Unique random key





4
Date Submitted Tue. Nov. 4th, 2008 8:32 AM
Revision 1 of 1
Beginner cicero
Tags identify | Key | PHP | Random | unique
Comments 3 comments
This php script provides a unique random key with 32 characters and can be used to avoid the system to pass some primary keys across the url, by example.

function get_cripta()
{
        $year = date('Y');
        $month = date('m');
        $day = date('d');
        $hour = date('H');
        $min = date('i');
        $sec = date('s');
        $coef = rand(1,99999);
        $quo1 = ($year*$month*$day);
        $quo2 = ($hour+$min+$sec);
        $result = ($quo1*$quo2)*$coef;
        $final = md5($result);
        return $final;
}
 

Cicero George Bezerra Monteiro

Comments

Comments Nice idea
Sat. Nov. 15th, 2008 9:09 PM    Scripter ColdKeyboard
Comments Really . . .
Tue. Aug. 11th, 2009 10:10 PM    Scripter sehrgut
Comments How to verify
Wed. Jun. 3rd, 2009 2:20 AM    Syntax Master sundaramkumar

Voting