phool4fool
203.***.***.***
How to Generate a Unique ID for Order Tracking Numbers
This is a quick little way to generate a unique id for stuff like tracking numbers and order id's using the unix time stamp and the users ip address.
PHP Example:
<?php
$stamp = strtotime("now");
$orderid = $stamp-$REMOTE_ADDR;
$orderid = str_replace(".", "", $orderid);
echo($orderid);
?>
phool4fool;304:
This is a quick little way to generate a unique id for stuff like tracking numbers and order id's using the unix time stamp and the users ip address.
PHP Example:
<?php
$stamp = strtotime("now");
$orderid = "$stamp-$REMOTE_ADDR";
$orderid = str_replace(".", "", $orderid);
echo($orderid);
?>
what is unix time stamp in this code ?
i know about timestamps but is this some unix specified ?
penguinmama
12.***.***.***
It's just a basic "current date and time" thing, Bradd. The script generates the current date & time combined with the customer's IP to make a unique id. I wouldn't've thought of that, but it sure makes sense to do it that way!
Brilliant idea to blend the IP and the time stamp together, rarely if ever will two orders have the same. So I'm guessing strtotime is built into the PHP/UNIX syntax?