view user/unsubscribe.php @ 15:385ddd7c4b55 testing

use test_db.php to get mysqld_test instance
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Sun, 19 Feb 2017 16:17:53 +0000
parents 077b0a0a3e6d
children
line wrap: on
line source

<?PHP

$email = strval($_GET['email']);

include "../../../private/db_test.php";  

$query = "update userpref set ReceiveEmail = 0 where UserID in (select UserID from user where Email = '$email') ";
$results = mysqli_query($link, $query);

if ( $results )
{
	$redirectURL = "unsubscribe.html";
	header("Location:$redirectURL");
}
else{
	echo "<p>Error updating preferences. Please email <a href=\"mailto:feedback@yournextread.com?subject=Unsubscribe Problem\">feedback</a></p>";
}

mysqli_close($link);

?>