Avatar of Wanda Marston
Wanda Marston
Flag for Canada

asked on 

I want to delete potential users from the database automatically if they have not activated their account.

At this point users register and then an email is sent to them. So their information is in the database. There is a link in the database that they click and then that changes their input in the "active" column to NULL. They then can log in to their account if the active column says Null. Many registrants do not active their account. I also feel that some of these registrants are FAKE users so it is possible that their email is phony. IF A CAPTCHA is the answer then I would prefer not to use the image style CAPTCHA. I personally do not like to use those when I am trying to get into a website.

The code I am now using.
     $q = "INSERT INTO users (username, email, pass, first_name, mid_initial, last_name, active, agree, date_expires) VALUES (?, ?, ?, ?, ?, ?, ?,  'Agree',  DATE_ADD(NOW(), INTERVAL 2 YEAR) )";      
                
// Prepare the statement:
$stmt = mysqli_prepare($db, $q);

// Bind the variables:
mysqli_stmt_bind_param($stmt, 'sssssss', $u, $e, $p, $fn, $mi, $ln, $a);

// Assign the values to variables:
$u  = $_POST['username'];
$e  = $_POST['email'];
$fn  = $_POST['first_name'];
$mi = $_POST['mid_initial'];
$ln  = $_POST['last_name'];
//$a  = $_POST['active']; 
            
// Execute the query:
 mysqli_stmt_execute($stmt); 
                       
// Send the email:
                $body = "Thank you for registering at Tired Of Being Ripped Off. To activate your account, please click on this link:\n\n";
                $body .= BASE_URL . 'ActivateLU.php?x=' . urlencode($e) . "&y=$a";
                mail($trimmed['email'], 'Registration Confirmation', $body, 'From: admin@tiredofbeingrippedoff.com');
// Finish the page:
               include('ThankYou.html'); // Include the Thank You For Registering
                exit(); // Stop the page.  

Open in new window

DatabasesMySQL Server

Avatar of undefined
Last Comment
Wanda Marston

8/22/2022 - Mon