<?php
$abc = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o','p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O','P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
for ($i=0; $i < 6; $i++)
{
$pass = array_rand($abc);
echo $abc[$pass];
}
?>
I need to send email with generated pass but i must generated pass get to some variable but i dont now how.
I just use this: $newpass = substr(md5(uniqid()),0,8);
It's not particularly secure, but it does the job and users are required to change their passwords as soon as they log in with a reset password. The point is it's more efficient than loops and character accesses.