I am currently working on a project where I need to get a user to sign up and then an email is sent to the website administrator's email with an approval link (containing the php page below, user email and sha512). When the approval link is clicked, it's meant to Update the table with the corresponding email and change isApproved to 1, but it does nothing other than printing the echos.
I tried changing the SQL commands, adding the ` around the names, looking it up on w3schools, stackoverflow and other forums and found nothing.
<?php
$hash = $_GET['h'];
$email = $_GET['e'];
if($hash == hash('sha512', 'ACCEPT')){
$host = "redacted";
$dbUsername = "redacted";
$dbPassword = "redacted";
$dbname = "redacted";
//create connection
$conn = mysqli_connect($host, $dbUsername, $dbPassword, $dbname);
if (mysqli_connect_error())
{
die('Connect Error('. mysqli_connect_errno().')'.mysqli_connect_error());
}
else
{
$sql = "UPDATE `User` SET `isApproved`='1' WHERE `User`.`email`=$email";
echo("approved");
}
?>
All I see when opening the website is "approved", which is what i expected, but the records in the database remain unchanged.