0

I have created a registration system with email verification and when I signed up everything was ok. But when I clicked on link in email it said error. Can you help me please?

<?php session_start();
 include_once 'dbconnect.php';

 if (isset($_GET['email'])){
 $email = $_GET['email'];
}
if (isset($_GET['status']) && (strlen($_GET['status']) == 32)) {
 $status = $_GET['status'];
}

if (isset($email) && isset($status)) {

 $query_activate_account = "UPDATE users SET status='Active' WHERE(email ='$email' AND status='$status')";
 $result_activate_account = mysqli_query($query_activate_account);

 echo '<div>Your account is now active. You may now <a href="signin.php">Log in</a></div>';

 } else {
 echo '<div>Oops !Your account could not be activated. Please recheck the link or contact the system administrator.</div>';

 }
?>
Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
JDaveth
  • 37
  • 4

1 Answers1

0

The url you are sending to user is wrong

It does not contain email and status

To use code like this,

if (isset($_GET['email'])){
   $email = $_GET['email'];
}
if (isset($_GET['status']) && (strlen($_GET['status']) == 32)) {
 $status = $_GET['status'];
}

your email should be like this,

$email = "email here";
$message =  "http://chat-web.net/activate.php?status=$status&email=$email";
Niranjan N Raju
  • 12,047
  • 4
  • 22
  • 41
  • It said: Warning: mysqli_query() expects at least 2 parameters, 1 given in /data/web/virtuals/115709/virtual/www/activate.php on line 14 Your account is now active. You may now Log in – JDaveth Nov 24 '15 at 18:17
  • Pass connection object as first parameter to mysqli_query() – Niranjan N Raju Nov 24 '15 at 18:19
  • It said: Warning: mysqli_query() expects parameter 1 to be mysqli, string given in /data/web/virtuals/115709/virtual/www/activate.php on line 14 – JDaveth Nov 24 '15 at 18:40