MySQL Error: " . mysqli_error($dbc)); $q = "SELECT id FROM emails WHERE emailenc=AES_ENCRYPT('$e', @salte)"; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n
MySQL Error: " . mysqli_error($dbc)); if ( (mysqli_num_rows($r) == 0) ) { // Available. // Create the unsubscribe code: $a = md5(uniqid(rand(), true)); // Add the email address to the database: $q = "INSERT INTO emails (emailenc, unsub, date1) VALUES ( AES_ENCRYPT('$e',@salte), '$a', NOW() ) "; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n
MySQL Error: " . mysqli_error($dbc)); if (mysqli_affected_rows($dbc) == 1) { // If it ran OK. // Send email with unsubscribe link $body = "Thank you for subscribing to Harkness Day Spa & rejuvenation center's FREE Newsletter. If you did not signup for this list, then you can unsubscribe by clicking on the following link:\n\n"; $body .= BASE_URL . 'unsub.php?x=' . urlencode($e) . "&y=$a"; $subj = "Registration Confirmation"; $header = 'From: admin '."\r\n"; $retval = mail($trimmed['email'], $subj, $body, $header); # /usr/sbin/sendmail; echo "Success! Thank you for subscribing to Harkness Day Spa & rejuvenation center's FREE Newsletter. You should be receiving an email confirmation of your subscription shortly."; include ('includes/footer.html'); // Include the HTML footer. exit(); // Stop the page. } else { // If it did not run OK. echo 'We\'re sorry. You could not be registered due to a system error. We apologize for any inconvenience.'; include ('includes/footerforregister.html'); // Include the HTML footer. exit(); // Stop the page. } } elseif (mysqli_num_rows($r) != 0) { // The email address has already been registered. echo 'Our records show your email address has already been added to our list. Thank you.'; include ('includes/footer.html'); // Include the HTML footer. exit(); // Stop the page. } } } // display the errors if (!empty($errors)) { // If one of the data tests failed. foreach ($errors as $err) { echo '

'.$err.'

'; } } include('includes/footer.html'); ?>