Jump to content

[SOLVED] activation email not always activating.


dolcezza

Recommended Posts

I have a register script that sends an email after registering to activate membership. It turns the field "activated" from 0 to 1. It is working sometimes and not others. It is showing the message that says "Success...", but no success email is being sent and "activate" is remaining at 0. Any ideas?

ID is coming from the link...http://.......activate.php?id=8cc1651440deadca1111e1dc2400654cfb836f23, and it is showing up in the address bar.

<?php
require_once("db_connect.php");

$id = $_GET['id'];

$query = mysql_query("SELECT * FROM mem WHERE Actkey = '$id'") or die(mysql_error());
$row = mysql_fetch_array($query);

if(mysql_num_rows($query) > 0){

$user = $row['user_id'];

$do = mysql_query("UPDATE mem SET activated = 1 WHERE user_id = '$user'") or die(mysql_error());
$send = mail($row['user_email'] , "Activation Confirmation" , "Thank you for activating your account, you are now fully registered and able to use our services.\n\nTo login, click the link below:\nhttp://www.caregivingsocal.com/signin.php" , "FROM: auto@mailer.com");

?>
//other html here

<?php

if(($do)&&($send))
{

echo '
<div id="success">
<p>Activation successful! A confirmation email has been dispatched. You can now login!</p>
<p><a href="https://www.caregivingsocal.com/signin.php">Click here</a> to goto the login page.</p>
</div>';

} else {

echo '
<div id="error">
<p>We are sorry, there appears to be an error processing your activation. Please try again later.</p>
</div>';

}

} else {

echo '
<div id="error">
<p>Sorry, your activation code was incorrect. Please try again.</p>
</div>';

}

?>

Link to comment
Share on other sites

because you could have a duplicate key

Email activations should send two or three parts of data for verification

 

1) The UserID or Username to be activated

2) The random Code used that forces the email activation

3) a second random code or phrase for redundancy to prevent a person from breaking it easily.

 

Having only a single item (#2) can allow duplicate codes to activate the wrong users

 

also try and run the query in phpmyadmin and see what it says

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.