I need help in new user email confirmation script for my site.
My script is populating my table but the email is not sending.
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!
-
}}
-
-
-
//$expiry = date ("Y-m-d", mktime (0,0,0,date("m")+12,(date("d")-1),date("Y")));
-
// 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'";
-
-
$jude="SELECT emailad FROM temp_user WHERE emailad='$emailad'";
-
$result=mysql_query($jude);
-
-
// if found this e-mail address, row must be 1 row
-
// keep value in variable name "$count"
-
$count=mysql_num_rows($result);
-
}
-
// compare if $count =1 row
-
if($count==1){
-
-
$rows=mysql_fetch_array($result);
-
// send e-mail to ...
-
$to=$emailad;
-
-
// Your subject
-
$subject="Your confirmation link here";
-
-
// From
-
$header="from: mysite <alart@mysite.org>";
-
-
// Your message
-
$message="Your Comfirmation link \r\n";
-
$message.="Click on this link to activate your account \r\n";
-
$message.="http://www.mysite.org/confirm.php?passkey=$confirm_code";
-
-
// send email
-
$sentmail = mail($to,$subject,$header,$message);
-
-
}
-
-
// if not found
-
else {
-
echo "Please enter a valid email address.";
-
}
-
-
// if your email succesfully sent
-
if($sentmail){
-
echo "Your Confirmation link Has Been Sent To Your Email Address.";
-
}
-
else {
-
echo "Cannot send Confirmation link to your e-mail address";
-
}
-
-
-
-
?>
-
-
1 1427
I haven't used MAIL() in forever but i remember offhand that $message was always the third item sent to that procedure.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Matthew |
last post by:
I am have written a medium sized program and everything works fine
except for one piece. At a certain point in the program I want to do a
simple user confirmation, eg Are you sure ? y/n. The...
|
by: Leo Breebaart |
last post by:
I am writing a utility in Python and I'd like to add a
command-line option "--mailto <address>" that will cause an
e-mail summary to be sent to <address> when the utility finishes
running.
My...
|
by: ColinWard |
last post by:
Hi. I have the following code in a module which sends email via Outlook.
Option Compare Database
Option Explicit
' Declare module level variables
Dim mOutlookApp As Outlook.Application
Dim...
|
by: mostafa atalla |
last post by:
how to send email by MS outlook express using C# code
|
by: HoustonComputerGuy |
last post by:
I am working on getting my web applications moved to .Net 2.0 and am
having some problems with System.Net.Mail. I get the following error
when sending the mail:
System.Net.Mail.SmtpException was...
|
by: Danny |
last post by:
Hi all,
Trying to send mail with System.Net.SmtpClient, using very simple code
just for testing:
SmtpClient smtp = new SmtpClient("mail.server.com", 25);
smtp.Credentials = new...
|
by: JoeP |
last post by:
Hi All,
How can I find the reason for such an error: Failure sending mail.
Some Code...
oMailMessage.IsBodyHtml = False
oMailMessage.Body = cEmailBody
Dim oSMTP As New SmtpClient...
|
by: raj200809 |
last post by:
when i m sending mail i received error from symantec Antivirus" Your email message was unable to be sent because your mail server rejected the message
550-5.7.1 the ip you’re using to send mail is...
|
by: undbund |
last post by:
Hi I am creating a newsletter system. The software should run from
desktop computer (localhost) but be able to send email to anyone on
the internet. Can you guys give me some ideas on how to...
|
by: jagdeep gupta |
last post by:
10.2 How to send emails by using System.Net.Mail
CODE-BEHIND:
MailMessage message = new MailMessage();
message.From = new MailAddress("fromusername@DomainName");
message.To.Add(new...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |