My registration confirmation code is not sending out emails.
Please help. -
<?php
-
-
if (isset($_POST['Submit'])) {
-
//$Bday = date("dd-mm-yyyy");
-
include "dbCon.php";
-
-
$EmailAd = $_POST['EmailAd'];
-
$Password = $_POST['Password'];
-
$Name = $_POST['Name'];
-
$Gender = $_POST['Gender'];
-
$Bday = $_POST['Bday'];
-
$Phone = $_POST['Phone'];
-
$College = $_POST['College'];
-
$Course = $_POST['Course'];
-
$Yr = $_POST['Yr'];
-
$UserType = $_POST['UserType'];
-
-
-
/* Let's strip some slashes in case the user entered
-
any escaped characters. */
-
$EmailAd = stripslashes($EmailAd);
-
$Password = stripslashes($Password);
-
$Name = stripslashes($Name);
-
$Gender = stripslashes($Gender);
-
$Bday = stripslashes($Bday);
-
$Phone = stripslashes($Phone);
-
$College = stripslashes($College);
-
$Course = stripslashes($Course);
-
$Yr = stripslashes($Yr);
-
$UserType = stripslashes($UserType);
-
-
-
-
/* Let's do some checking and ensure that the user's email address or username
-
does not exist in the database */
-
-
$sql_email_check = mysql_query("SELECT emailad FROM user WHERE EmailAd='$EmailAd'");
-
// $sql_username_check = mysql_query("SELECT username FROM users WHERE username='$username'");
-
-
$email_check = mysql_num_rows($sql_email_check);
-
// $username_check = mysql_num_rows($sql_username_check);
-
-
if(($email_check > 0)){
-
echo "Please fix the following errors: <br />";
-
if($email_check > 0){
-
echo "<strong>Your email address has already been used. Please use a different Email address!<br />";
-
unset($email_address);
-
-
include 'index.php'; // Show the form again!
-
exit(); // exit the script so that we do not create this account!
-
}}
-
-
-
-
// table name
-
-
// Random confirmation code
-
$confirm_code=md5(uniqid(rand()));
-
-
-
$query = mysql_query("INSERT into temp_user (confirm_code, EmailAd, Password, Name, Gender, Bday, Phone, College, Course, Yr, UserType)
-
VALUES('$confirm_code', '$EmailAd', '$Password', '$Name', '$Gender', '$Bday', '$Phone', '$College', '$Course', '$Yr', '$UserType')");
-
-
// $sql= "INSERT INTO user SET Regdate='$now', expire='$exp'";
-
-
if($result){
-
// ---------------- SEND MAIL FORM ----------------
-
-
// send e-mail to ...
-
$to=$emailad;
-
-
// Your subject
-
$subject="Your confirmation link here";
-
-
// From
-
//$header="from: mysite <alart@mysite.org>";
-
-
// Your message
-
mysql_query($query);
-
$to = $emailad;
-
$subject = 'Imostars e-mail address confirmation';
-
$message = "
-
<p>Hey! Thanks for being part of our alumni portal. Click below to confirm your e-mail address.</p>
-
<p><a href='http://mysite.org/confirm.php?emailad=$emailad'>below</a></p>";
-
$headers = "ImoStars Alumni <alart@mysite.org>" . "\r\n" .
-
'Content-type: text/html; charset=iso-8859-1' . "\r\n";
-
mail($to,$subject,$message,$headers);
-
?>
-
<span style='color:green'>Congratulations, you've registered successfully! A confirmation e-mail has been sent to the address you entered.</span>
-
-
-
}
-
?>
-
5 3509
Have you done any debugging on this whatsoever?
Are there any errors?
Okay, have you tried debugging this at all?
Your error is where you insert the code into the database and then check to see if the insert has been successful. This is causing the code to send an email to not execute.
You assign the query to variable to ($query) - $query = mysql_query("INSERT into temp_user (confirm_code, EmailAd, Password, Name, Gender, Bday, Phone, College, Course, Yr, UserType)
-
VALUES('$confirm_code', '$EmailAd', '$Password', '$Name', '$Gender', '$Bday', '$Phone', '$College', '$Course', '$Yr', '$UserType')");
But when you check to see if the query has been executed, you check for ($result) if($result){
Change $result to $query or vice a versa
Good Luck.
@tutusaint
Error is at the end of page.
mail($to,$subject,$message,$headers);
}
}
?>
end your program here.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Les Juby |
last post by:
I've used a simple javascript for some time (no entries required up in
the <head> tag) that asks for a confirmation before deleting.
ie.
<a href="/delete.asp?which=345 %>"...
|
by: Kenneth Farmer |
last post by:
Several of my websites are getting hosed by automated scripts that insert
all kinds of jiberish into the forms and newsletter sign-up fields.
Sometimes I get a hundred an hour.
I noticed the...
|
by: Prince of Code |
last post by:
Hey There,
I have been to this group for a couple of days. I am really
impressed by the way people respond. I get answers for all my doubts
and that too more info. So I am putting across a doubt...
|
by: Tatyana |
last post by:
Hello,
I'm having problems to Style Order Confirmation Email Body. I'm sending it
out as HTML.
Everything looks fine in Outlook, but hotmail accounts (checked it on yahoo
and hotmail) seem to...
|
by: .Net Sports |
last post by:
I'm using CDO mail in my asp scripts, and I need to find a script that
whereas a user signs up for your website and when he hits submit, an
email goes to his email box with a confirmation link for...
|
by: pbd22 |
last post by:
Hi.
I have got the email part working.
I have it set up so there is a temp_table of the registration.
There is a confirm_code column with an encrypted ID.
My question is this - it seems...
|
by: DavidPr |
last post by:
I'm using the User Registration from the book by Larry Ullman "PHP and MYSQL for dynamc websites - second edition, and it is suppose to send an email to the person who just registered so thay can...
|
by: newbie55 |
last post by:
I’m currently using Async sockets with .BeginReceive called to collect any message from clients.
I would like to know if the receiving socket received and processed the data sent and throw an...
|
by: xyrhou |
last post by:
When i uploaded my site i got these error at registration. When a user register he/she will receive a confirmation email with the link to activate his/her account.
But i got this error when i click...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |