Ok, here is how you create a user_no for the database
$dk_time=strftime("%y%m%d%H%M%S");Lets explain that:
list($usec1, $sec1) = explode(" ",microtime()); $dk_user_no=$dk_time.substr($usec1,2,2);
echo $dk_user_no;
strftime = "%y%m%d%H%M%S" = Year - Month - Day - Hour - Minutes - Seconds
NOTE: Year is only displayed with the last 2 digits!
NOTE: If we want the full year like 2011 we use a capital Y
That creates a time like: 110101
Ok then, if 20 uses register on that day, we need to add something more to it
so all users have a special code
for that we use microtime()
that gives us: 0.14240300 1293893126
we create a list so we need to delete some crap that microtime is saying
we need to cut the 2 number is 2 parts
list($usec1, $sec1) = explode(" ",microtime());$usec1 = 0.14240300
$sec1 = 1293893126
and we explode the space between the numbers, cuz we dont need that
we are gonna use the 1st line called $usec1
then we subtract the last and first 2 digits, we dont need that :)
then add it all together
$dk_time.substr($usec1,2,2);then we can give it a variable called $dk_user_no
It will result in:
11010115483761
Again:
11 => Year
01 => Month
01 => Day
15483761 => Special code created from the time
janvier1985
Ragezone