The user receives their key in an email btw. My problem is that when I put in the key it doesn't match it to a user thus not updating the 'activated' field nor displaying their name in the echo.PHP Code:<?php
include("global.php");
if($_GET['action'] == "activate"){
$key = $_POST['key'];
$kr = mysql_query("SELECT activationkey FROM users");
$keyrow = mysql_fetch_array($kr);
$nr = mysql_query("SELECT fname FROM users WHERE activationkey = '$key'");
if($keyrow = $key){
$update = mysql_query("UPDATE users SET activated = yes WHERE activationkey = '$key'");
echo "Congratulations '$nr' - your account is now activated.";
} else {
echo "This account has already been activated.";
}
} else {?>
<form action="?action=activate" method="POST">
<input type="text" name="key"></input>
<input type="submit" value="activate">
</form>
<?php
}
?>





Reply With Quote