Page 1 of 1

Re-send activation email!

Posted: Wed Mar 28, 2012 5:55 am
by mattollie
Hey guys,

Im new to PHP and was wondering if anyone knew a way to resend the activation email. Firstly, i dont know how to make it check to see if the username and email entered match one in the database. Secondly i dont know how to, once matched up, get the activation_code from the database.

I do however know how to get it in an email and send it haha... just need the main part :(

Could anyone help me with this?

Regards,

Matt

Re: Re-send activation email!

Posted: Wed Mar 28, 2012 6:40 am
by bowersbros
If they request it, check in your database the email that they requested it for.
If that email exists, then send them the activation code again (to the email requested) and then you can just treat it as normal.

Re: Re-send activation email!

Posted: Wed Mar 28, 2012 7:53 am
by mattollie
bowersbros wrote:If they request it, check in your database the email that they requested it for.
If that email exists, then send them the activation code again (to the email requested) and then you can just treat it as normal.
Yeah but I'm more after a page that users can visit to get it automatically sent to their email..

Re: Re-send activation email!

Posted: Wed Mar 28, 2012 5:10 pm
by bowersbros
just have a page which has an input form (their email address) and check that against the database.

Re: Re-send activation email!

Posted: Thu Mar 29, 2012 2:40 am
by mattollie
bowersbros wrote:just have a page which has an input form (their email address) and check that against the database.
OK, so far i can echo the activation_code from sql with this code...
//resend activation email
function resend_email($email){
	$email = mysql_real_escape_string($email);
	
	$total = "SELECT * FROM user_activations";
	$total2 = mysql_query($total);
		$total3 = mysql_fetch_assoc($total2);
		
		$total3['activation_code'];
		
		echo $total3['activation_code'];
}
this code here displays the activation_code, now i need to know how to get that instead of echo'ing it, into a $activationcode string that i can add to the end of activate.php?aid=$activationcode and email it. Also help with checking the email matches the one in the database and grabs the correct activation code.

Thanks,

Re: Re-send activation email!

Posted: Thu Mar 29, 2012 7:15 am
by bowersbros
try something like this:
$activation_code = "http://blah.com/index.php?acode=" . $total3['activation_code'];
Then look into the mail() function for ideas on how to send emails

Re: Re-send activation email!

Posted: Fri Mar 30, 2012 2:45 am
by mattollie
bowersbros wrote:try something like this:
$activation_code = "http://blah.com/index.php?acode=" . $total3['activation_code'];
Then look into the mail() function for ideas on how to send emails
Hey,

Thanks heaps.. that did the trick got it working so now if they didnt recieve their activation email there is a link that directs them to resend_activation_email that allows them to enter their email and if the email matches one in the database it will send it to that email.

Thanks you have been a good help :)