1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Temporary Password Creator

Discussion in 'PHP' started by pradeep, Apr 12, 2005.

  1. pradeep

    pradeep Team Leader

    Many sites send you a temporary password after u sign up with them. Here is is how you too can do that

    PHP:
    function TempPassword($tp_len)
    {
       
    $pstring "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWXxYyZz0123456789";
       
    $plen strlen($pstring);
          for (
    $i 1$i <= $tp_len$i++)
          {
              
    $start rand(0,$plen);
              
    $temp_password.= substr($pstring$start1);
          }

        return 
    $temp_password;
    }

    Example:
    PHP:
    $tp=TempPassword("9");
    Result:
    Code:
    $tp= Ab72Pz3Rs
     
  2. shabbir

    shabbir Administrator Staff Member

Share This Page