Username: Save?
Password:
Home Forum Links Search Login Register*
    News: Keep The TechnoWorldInc.com Community Clean: Read Guidelines Here.
Recent Updates
[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[February 14, 2024, 02:00:39 PM]
Subscriptions
Get Latest Tech Updates For Free!
Resources
   Travelikers
   Funistan
   PrettyGalz
   Techlap
   FreeThemes
   Videsta
   Glamistan
   BachatMela
   GlamGalz
   Techzug
   Vidsage
   Funzug
   WorldHostInc
   Funfani
   FilmyMama
   Uploaded.Tech
   MegaPixelShop
   Netens
   Funotic
   FreeJobsInc
   FilesPark
Participate in the fastest growing Technical Encyclopedia! This website is 100% Free. Please register or login using the login box above if you have already registered. You will need to be logged in to reply, make new topics and to access all the areas. Registration is free! Click Here To Register.
+ Techno World Inc - The Best Technical Encyclopedia Online! » Forum » THE TECHNO CLUB [ TECHNOWORLDINC.COM ] » Programming Zone » PHP
 PHP: Generate random passwords and send email to user
Pages: [1]   Go Down
  Print  
Author Topic: PHP: Generate random passwords and send email to user  (Read 956 times)
Hellraiser
TWI Trailblazer
*******



Karma: 3
Offline Offline

Posts: 2476


View Profile
PHP: Generate random passwords and send email to user
« Posted: August 29, 2007, 10:42:01 AM »


Generate random passwords and send email to user

You can use this feature in the forgotPassword scenarios

I have used random passwords in a scenario where a user forgets his password and receives a temporary new password.

Generate random password -rand()

Code:
 $random=rand(1234,2343);
$password="mypass".$random;

Send email to user - mail()

Code:
$headers ="From: [email protected]\n"; //from address
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \n";
$subject ="Password Recovery - Do Not Reply Back To This Email";

$body="<div align=center><br><br>----------------------------- Password Recovery--------------------------------<br><br><br><br>Your Temporary Password is: $password<br><br>Remember your password this time!</div>";

if(mail($pemail,$subject,$body,$headers))
    {
        echo "<font class=tblackb>Your password has been send to $pemail</font>";
    }
else
    {
        echo "<font class=tblackb>Password Not Send.<br><Br>Please Try Again Later!...</font>";
    }


Save as sendpassword.php

Upload on the web and test it

Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Copyright © 2006-2023 TechnoWorldInc.com. All Rights Reserved. Privacy Policy | Disclaimer
Page created in 0.097 seconds with 24 queries.