Jump to content

Verfying email address problem


mikebyrne

Recommended Posts

I've setup as per the tutorial on (http://www.phpeasystep.com/phptu/24.html) but when my browser brings up the signup_ac.php file I get the following on screen

 

"; // Your message $message="Your Comfirmation link \r\n"; $message.="Click on this link to activate your account \r\n"; $message.="http://localhost/confirmation.php?passkey=$confirm_code"; // send email $sentmail = mail($to,$subject,$message,$header); } // if not found else { echo "Not found your email in our database"; } // 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"; } ?>

 

My php code looks like this:

 

<?
include('config.php');

// table name
$tbl_name=temp_members_db;

// Random confirmation code
$confirm_code=md5(uniqid(rand()));

// values sent from form
$name=$_POST['name'];
$email=$_POST['email'];
$country=$_POST['country'];

// Insert data into database
$sql="INSERT INTO $tbl_name(confirm_code, name, email, password, country)VALUES('$confirm_code', '$name', '$email', '$password', '$country')";
$result=mysql_query($sql);

// if suceesfully inserted data into database, send confirmation link to email
if($result){

// ---------------- SEND MAIL FORM ----------------

// send e-mail to ...
$to=$email;

// Your subject
$subject="Your confirmation link here";

// From
$header="from: Mike Byrne <Mikebyrne000@hotmail.com>";

// Your message
$message="Your Comfirmation link \r\n";
$message.="Click on this link to activate your account \r\n";
$message.="http://localhost/confirmation.php?passkey=$confirm_code";

// send email
$sentmail = mail($to,$subject,$message,$header);

}

// if not found
else {
echo "Not found your email in our database";
}

// 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";
}

?> 

 

I've WAMP5 running and I've a test.php page that displays fine so I'm presuming I've made a mistake in the code??

Link to comment
Share on other sites

Changed it to >?php like suggested it seems to have worked but now getting an error:

 

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\signup_ac.php on line 17

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\signup_ac.php on line 17
Not found your email in our databaseCannot send Confirmation link to your e-mail address

Link to comment
Share on other sites

Think i know whats up!

 

Here's config.php

 

<?

$host="localhost"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name


//Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect to server");
mysql_select_db("$db_name")or die("cannot select DB");

?>

 

Would I be right in asuming I've to fill out username, password,db_name??

 

Would you recommend I use <?php like before??

Link to comment
Share on other sites

Sorry config was pointing to table not Database. Fixed that error. Now getting:

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\signup_ac.php on line 39

Cannot send Confirmation link to your e-mail address

Link to comment
Share on other sites

Now you are having a real problem with the mail server... Either you don't have a mail-server installed, or you do but you haven't made the correct settings in your php.ini.

If this is running on your local machine, install a mail server on your machine. If you are with some kind of host, contact your host and ask them what the problem is.

 

Orio.

Link to comment
Share on other sites

I've got it up and running but do I have to alter my php.ini file because im still getting the error

 

Warning: mail() [function.mail]: SMTP server response: 551 User not local. We don't relay in C:\wamp\www\signup_ac.php on line 39

Cannot send Confirmation link to your e-mail address

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.