< Buzzing or vibrating the login form using jquery Posted On May 15, 2012 : 0 comments << >> Simple div slideshow using jquery Posted On May 9, 2012 : 0 comments << >> Copy mysql column in varchar to type date Posted On May 3, 2012 : 0 comments << >> Enter only numbers inside a input field of a form using javascript Posted On May 1, 2012 : 0 comments << >> Slide in and out animate div vertically using jquery Posted On April 25, 2012 : 1 comment << >> Tag cloud using php, mysql and ajax with filter Posted On April 24, 2012 : 0 comments << >> Change webpage font color or background color from the user side using javascript Posted On April 19, 2012 : 0 comments << >> A single link that cycles through several webpage background color using javascript Posted On April 17, 2012 : 0 comments << >> Simple webpage redirection using perl script Posted On April 10, 2012 : 0 comments << >> Get ipaddress using perl script Posted On April 4, 2012 : 0 comments << >>

MD5 Function and Unique ID in php

This Tutorial Has Been Viewed 1,436 Times.
VN:F [1.9.17_1161]
Rating: 9.0/10 (1 vote cast)

uniqid () function, This function has two parameters we can set. The first is the prefix. This is what will be appended to the beginning of each ID. The second is more_entropy. If this is false or not specified it will return 13 characters, if it is true then 23 characters will be returned.Uniqid (prefix, more_entropy)Sample Code Very Simple To Use

<?php 

echo ‘creates a unique id with the about prefix<br>’;

$a = uniqid(about);

echo $a;

echo “<hr>”;

echo ‘creates a longer unique id with the about prefix<br>’;

$b = uniqid (about, true);

echo $b;

echo “<hr>”;

echo ‘creates a unique ID with a random number as a prefix – more secure than a static prefix<br>’;

$c = uniqid (rand (),true);

echo $c;

echo “<hr>”;

echo ‘this md5 encrypts the username from above, so its ready to be stored in your database<br>’;

$md5 = md5($c);

echo $md5;

?>

 If you want a unique id then use uniqidThe id’s generated are only unique they are not completely random.If you want completly random id’s then you will need to make your own function, as an md5 or sha1 will not help. As these will provide you with a fixed length string. You could chop an md5 string at a random position, but then you would need to check that this string is unique and not just random 

VN:F [1.9.17_1161]
Rating: 9.0/10 (1 vote cast)

MD5 Function and Unique ID in php, 9.0 out of 10 based on 1 rating

Incoming search terms:





You will also be interested in ,

Leave a Reply

Proudly designed by Mistonline.in.
Affordable Seo PackagesSeo BlogEdu Backlinks