something like this

function randString($length=16){
 mt_srand((double)microtime()*1000000);
 $newstring="";

 if($length>0){
  while(strlen($newstring)<$length){
   switch(mt_rand(1,3)){
    case 1: $newstring.=chr(mt_rand(48,57)); break;  // 0-9
    case 2: $newstring.=chr(mt_rand(65,90)); break;  // A-Z
    case 3: $newstring.=chr(mt_rand(97,122)); break; // a-z
   }
  }
 }
 return $newstring;
}

$contact_person_pass = randString();

$msg = "Your Name:\t$contact_person_name\n";
$msg .= "Please use the following details to login in future\n\n";
$msg .= "Your E-Mail:\t$contact_person_mail\n";
$msg .= "Your Password:\t$contact_person_pass\n\n";
$msg .= "You change your password later when you click on 'Firm
Profile'\n\n";

$recipient = "$contact_person_mail";

$subject = "Login Details";

$mailheaders = "From: LesGay <whatever@whatever> \n";

mail($recipient, $subject, $msg, $mailheaders);



> Hello friends,
>
> I have a form for registering by the users. This runs on php/mysql.
>
> Can someone tell me how I could include auto password generation and
> emailing of this password to users?
>
> Thanks
> denis
>
>
>
> --
> 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

Reply via email to