How would one go about coding this...

salukigirl

New Member
Messages
78
Reaction score
0
Points
0
Does anyone know how I can make a register script that send the user an activation code to the email vefore they can log into an account?
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
I am in the process of creating something very similar to this with php. Though mine is for my own site management system I am attempting to make.
 

mattura

Member
Messages
570
Reaction score
2
Points
18
Yes, I made one a while back.
You'll need at least php level 2,
make a page register.php, which has a form for name, email etc. When the user clicks post, your php creates a database entry, with a random sequence (substr of uniq is good)for a password, then you use mail() to send the password to the users email address. They then log in using the random password, and you redirect them to change their password.
PM me if you want more details

in the end it looks like this:
http://www.pepperandsalt.co.uk/matt/register.php
try it out if you want (but the game barely works!)
 
Messages
341
Reaction score
0
Points
0
Oh I'll Help. I Almost Have This Here Is Part Of It

Genorate Password Code:
PHP:
<?
srand(time());
$1 = (rand()%2);
$2 = (rand()%7);
$3 = (rand()%9);
$4 = (rand()%1);
$5 = (rand()%5);
$6 = (rand()%3);
$7 = (rand()%9);
?>

Sendmail Code:
PHP:
<?php 
$from='you@yourdomain.com'; 
$to="$email"; 
$headers="From: $from\n"; 
$headers.="Reply-to: $from\n"; 
mail($to,'Your Password',"Your Password Is: $1$2$3$4$5$6$7",$headers); 
?>

Then Create A Folder Called "pwd" And Make A .htaccess File With The Data:

Code:
<Limit GET HEAD POST>
order deny,allow
deny from all
</LIMIT>

Then Create A File Called "pwds.txt"

Use The Code To Add To The pwds.txt File

PHP:
<?php 
$fn = "pwd/pwds.txt"; 
$file = fopen($fn, "a+"); 
$size = filesize($fn); 

if($_POST['addition']) fwrite($file, $_POST['addition']); 
if($_POST['enter']) fwrite($file, $_POST['enter']); 
$text = fread($file, $size); 
fclose($file); 
?> 
<form action="<?=$PHP_SELF?>" method="post" name="nameform">
  <p>
    <input name="addition" type="text" size="60"/>
    <input name="enter" type="hidden" id="enter" value="&lt;br&gt;"/>
    <input name="Say This" type="submit" id="Add" value="Say This"/>
  </p>
</form>

NOTE: I Just Gave You Just About All Of The Parts Of The Script. I Have Little Idea Of How To Put Them Together. Seince I Wrote Them, I Could Explan What They Do, But I Can Not Build This For You.
 

DefecTalisman

Community Advocate
Community Support
Messages
4,148
Reaction score
5
Points
38
Not that speed on that script should be an issue, but maybe
PHP:
 mt_rand()
would be a little faster and efficient.
 
Top