RE: How to confirm subscriptions by e-mail on a PHP site ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What I do is generate a random key, save it in the database, send them an
email with a link that they must click to validate their email:

http://www.mysite.com/validate.php?email=you@xxxxxxxxxxxx&key=ayunj83J#@8h3j
9j(*(hn3983n*(j

Its not foolproof, I know, but it is simple and effective, as you say.

Heres a quick and dirty function to generate the key:

function KeyGen($length){  // Generates random, mixed case, alphanumeric
string of $length characters.
 
for($len=$length,$r='';strlen($r)<$len;$r.=chr(!mt_rand(0,2)?mt_rand(48,57):
(!mt_rand(0,1)?mt_rand(65,90):mt_rand(97,122))));
  return $r;
}

JM


> -----Original Message-----
> From: Mário Gamito [mailto:lists@xxxxxxxxxxx]
> Sent: Friday, May 20, 2005 5:13 AM
> To: php-general@xxxxxxxxxxxxx
> Subject:  How to confirm subscriptions by e-mail on a PHP site ?
> 
> 
> Hi,
> 
> I'm making this middle-range site (i. e., not so little, bit 
> not so big,
> either), and i want users that subscribe to my site to have their
> confirmation made by email.
> 
> Does anyone sugests a simple, yet effective way to do this ?
> 
> Please, don't misunderstand me.
> The PHP part i know.
> The sugestions i'm asking for are about the mechanism.
> 
> Thanking you in advance.
> 
> Warm Regards,
> Mário Gamito
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux