1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
if ($Choice=='Add')
{
// Verification if the new user is already recorded
$request1="SELECT Name, Profile fROM User
WHERE Name='$NewName'";
$result1=mysql_query($request1);
$find1=mysql_fetch_row($result1);
if ($find1==null)
{
?>
<script language="JavaScript">
alert("This user doesn't exist");
</script>
<?php
header("Location: AdministratorManagement.php");
}
else
{
$profile=$find1[1];
// Request
$request2="UPDATE user SET Admin='1' WHERE Name='$NewName' AND Profile='$profile'";
$result2=mysql_query($request2);
?>
<script language="JavaScript">
alert("You have recorded a new administrator under the name of <?php echo"$NewName"; ?> with the <?php echo"$profile"; ?> profile");
</script>
<?php
header("Location: TreatAdmin_access.php");
}
}
else
{
// Verification if the new user is recorded
$request1="SELECT Name, Profile fROM User
WHERE Name='$NewName'";
$result1=mysql_query($request1);
$find1=mysql_fetch_row($result1);
if ($find1==null)
{
?>
<script language="JavaScript">
alert("This user doesn't exist");
</script>
<?php
header("Location: AdministratorManagement.php");
}
else
{
$profile=$find1[1];
// Request
$request2=" UPDATE user SET Admin='0' WHERE Name='$NewName' AND Profile='$profile'";
$result2=mysql_query($request2);
?>
<script language="JavaScript">
alert("You have deleted an administrator under the name of <?php echo"$NewName"; ?> with the <?php echo"$profile"; ?> profile");
</script>
<?php
header("Location: AdministratorManagement.php");
}
} |
Partager