Nav apraksta

makeManager.php 642B

1234567891011121314151617181920212223
  1. <?php
  2. require_once 'config.php';
  3. require_once 'dbh.inc.php';
  4. require_once 'checkLogin.php';
  5. // EXAMPLE INPUT...
  6. // array(1) { ["researcherID"]=> string(1) "3" }
  7. $researcherID = mysqli_real_escape_string($connection, trim($_POST['researcherID']));
  8. // Check if name is not an empty string
  9. if($researcherID === '') {
  10. http_response_code(400);
  11. echo json_encode(array("error" => "Must specify researcher ID."));
  12. exit();
  13. }
  14. // Insert user
  15. $queryManager = "UPDATE researcher SET admin = '1' WHERE id_researcher = '$researcherID';";
  16. mysqli_query($connection, $queryManager) or die("Error: " . mysqli_error($connection));