Jump to content

Where should I look?


BradD

Recommended Posts

Hey Guys:

 

I have been getting a massive amount of help with this script and now I am stuck again...

 

The confirmation email is being sent BUT there is no link attached to it.

 

So when it arrives in the inbox, it looks something like this.

 

Dear bob,

Thank you for registering at my website. To confirm your registration, please visit the link provided and enter the following confirmation code,

0d64f18da8955b90260d1c1349cd57b1

 

As you can see the URL is missing and I can't seem to find the appropriate information to hook the URL and $conf_code ?

 

Any Suggestions?

<?php ob_start(); ?>
<?php


require_once('connectDB.php'); 

$password = md5($_POST['password']); // hash the password before the array_map()

array_map('mysql_real_escape_string', $_POST); // Since only one element won't need to be sanitized, run the entire $_POST array through mysql_real_escape_string.

$conf_code = md5(uniqid(rand(), true)); // generates confirmation code to use wth the confirmation email that gets sent //

$query = "INSERT INTO `members` (
`firstname`, `lastname`, `username`, `password`, `accounttype`, `country`, `state`, `city`, `phone`, `mobile`, `business`, `email`, `website`, `signupdate`, `emailactivated`, `confirmed`
) VALUES (
'" . $_POST['firstname'] . "', '" . $_POST['lastname'] . "', '" . $_POST['username'] . "', '" . $password . "', '" . $_POST['accounttype'] . "', '" . $_POST['country'] . "', '" . $_POST['state'] . "', '" . $_POST['city'] . "', '" . $_POST['phone'] . "', '" . $_POST['mobile'] . "', '" . $_POST['business'] . "', '" . $_POST['email'] . "',  '" . $_POST['website'] . "', now(), '" . $conf_code . "', 0
)";
mysql_query($query) or die("There has been a system problem. Failed to add record to database.");

if( mysql_affected_rows() == 1 )  {
$id = mysql_insert_id();
$new_record = "SELECT `firstname`, `username`, `email`, `emailactivated` FROM `members` WHERE `id` = $id";
$result = mysql_query($new_record);
$array = mysql_fetch_assoc($result);

$email = $array['email'];
$subject = "Your confirmation code from the website";
$message = "Dear " . $array['firstname'] . ",\r\n";
$message .= "Thank you for registering at my website. To confirm your registration, please visit the link provided and enter the following confirmation code,\r\n";
$message .= $array['emailactivated'];
$from = "From: [email protected]\n";

if( mail($email, $subject, $message, $from) ) {
header( 'Location: success.php' ); // redirects to a "landing page" if mail was sent successfully.
exit; // stops further script execution after redirect.
}
}
?>
<? ob_flush(); ?>

 

Help is greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/206619-where-should-i-look/
Share on other sites

You can give them both a link and an alternate way, incase their mail client handles links poorly. Delete - $message .= $array['emailactivated']; and add the following - Then see how that works.

 

$message .= '<a href="http://www.my_website.com/confirm_page_script_name.php?uname=' . $_POST['username'] . '&code=' . $conf_code . '">Confirm registration!</a>\n';
$message .= 'If the link isn't clickable in your email client, you can visit http://www.my_website.com/confirm.php and copy this confirmation code into the form:\n';
$message .= $conf_code . '\n';

Link to comment
https://forums.phpfreaks.com/topic/206619-where-should-i-look/#findComment-1080704
Share on other sites

Hey Pikachu:  :D 

How goes it man: I thought you might be having the weekend off?

 

Thanks man, your an absolute legend....

 

You can give them both a link and an alternate way, incase their mail client handles links poorly. Delete - $message .= $array['emailactivated']; and add the following - Then see how that works.

 

$message .= '<a href="http://www.my_website.com/confirm_page_script_name.php?uname=' . $_POST['username'] . '&code=' . $conf_code . '">Confirm registration!</a>\n';
$message .= 'If the link isn't clickable in your email client, you can visit http://www.my_website.com/confirm.php and copy this confirmation code into the form:\n';
$message .= $conf_code . '\n';

Link to comment
https://forums.phpfreaks.com/topic/206619-where-should-i-look/#findComment-1080876
Share on other sites

Don't ask me why ??? But I thought there was more to it than that...  :shrug:

 

Hey Pikachu:  :D 

How goes it man: I thought you might be having the weekend off?

 

Thanks man, your an absolute legend....

 

You can give them both a link and an alternate way, incase their mail client handles links poorly. Delete - $message .= $array['emailactivated']; and add the following - Then see how that works.

 

$message .= '<a href="http://www.my_website.com/confirm_page_script_name.php?uname=' . $_POST['username'] . '&code=' . $conf_code . '">Confirm registration!</a>\n';
$message .= 'If the link isn't clickable in your email client, you can visit http://www.my_website.com/confirm.php and copy this confirmation code into the form:\n';
$message .= $conf_code . '\n';

Link to comment
https://forums.phpfreaks.com/topic/206619-where-should-i-look/#findComment-1080877
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.