Reputation: 441
i was create a script to active user registration but there's a problem with my isset logic. and here's my code:
if (!isset($_GET['x']) || !isset($_GET['y'])) {
echo "Check your email for activation code";
}else{
//collect values from the url
$memberID = trim($_GET['x']);
$active = trim($_GET['y']);
if(is_numeric($memberID) && !empty($active)){
$stmt = $pdo->prepare("UPDATE users SET active = 'Yes'
WHERE id = :memberID AND active = :active");
$stmt->execute(array(
':memberID' => $memberID,
':active' => $active
));
//if the row was updated redirect the user
if($stmt->rowCount() == 1){
//redirect to login page
header('Location: login.php?action=active');
exit;
} else {
echo "Your account could not be activated.";
}
}
}
but if i give code like this in url active.php?x=&y=9b4f0 or active.php?x=777&y= it show nothing. how can i handle this situation?
Upvotes: 0
Views: 138