Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 27th, 2005, 01:51 AM
Registered User
 
Join Date: Dec 2005
Location: New Delhi, New Delhi, India.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to spbharti
Default how to send activation link with e mail

When a user registers with my site, I want an email to be sent to the user with an activation code or a custom link in order to verify that the email submitted is valid before their account becomes active. I would imagine there are others out there who have the same requirement. Any assistance would be appreciated. Thanks
Reply With Quote
  #2 (permalink)  
Old December 27th, 2005, 06:01 AM
Friend of Wrox
 
Join Date: Mar 2004
Location: Bhopal, MP, India.
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul
Default

It is very easy. You're storing the 'verification code' in db. And use PHP mail() to send a link to PHP script in your Web site that checks/tallies that 'verification code'. Easy!

`~@#\^%&*/\.<.\/-|+|_!:;..=?>
Students' finances
Reply With Quote
  #3 (permalink)  
Old December 28th, 2005, 09:17 AM
Friend of Wrox
 
Join Date: Dec 2004
Location: London, London, United Kingdom.
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Activation Code:
<?php
$chain="";
$arra_codesASCII=array();
for($i=ord(0);$i<=ord(9);$i++) $arra_codesASCII[]=chr($i);
for($i=ord("a");$i<=ord("z");$i++) $arra_codesASCII[]=chr($i);
for($i=ord("A");$i<=ord("Z");$i++) $arra_codesASCII[]=chr($i);
for($i=0;$i!=128;$i++) $chain.=$arra_codesASCII[array_rand($arra_codesASCII)];
?>
Store the code in the database with there username obviously ;) then send them an email:
<?php
$headers = 'From: webmaster@companyname.com' . "\r\n";
$headers.= "MIME-version: 1.0\n";
$headers.= "Content-type: text/html; charset= iso-8859-1\n";

$message = "Thank you to register with (company name)<br>\n (2nd line) <br>\n In order to activate your account please click here:<br>\n
<center><a href=\"http://websiteaddress/reguser.php?verify=".$chain."&mail=".$useremail)." &web=0\">Activation</a></center> <br>\n
Thank you for taking the time to register to the (company name) Website. <br><br>\n\n Please do not reply to this email has the mailbox isn't monitored.<br><br><br>\n\n\n<center> - The Webmaster (company name) - </center><br>\n";

mail($useremail,'title', $message, $headers);
?>

create a page:
http://websiteaddress/reguser.php
the data are in 'verify'

:)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
send mail chavakoti BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 1 September 4th, 2007 05:03 AM
Cannot send mail rajanikrishna JSP Basics 3 March 17th, 2006 01:39 AM
e-mail a link p2ptolu Classic ASP Databases 1 June 17th, 2005 06:58 PM
Not able to send a mail hums .NET Framework 2.0 5 November 16th, 2004 03:56 AM



All times are GMT -4. The time now is 02:31 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.