You really don't want to use JavaScript for this. Why? JavaScript is unsecure because it is client-side scripting and it can be turned off or manipulated and not work in older browsers.
So if JavaScript was turned off or the browser was too old to support it you would get no value and a bunch of messed up JavaScript on the page (unless you use HTML <!-- right after the JavaScript declaration).
Plus the time JavaScript returns is the users system clock time. So in other words I could change my system clocks date and time to July 90th 9190 at 40:20 PM. Not good at all. Someone could attack your script and you wouldn't know it was them because the date wouldn't show as the time when you got attacked so it would be a hard thing to prove.
Now you need to control the data. Your server will control it not the users by using PHP.
Here's a script that can do this -
PHP Code:
<?php $date_time = date('YmdHis'); $date = date('Ymd\/M\/h\:s'); print "<input type=\"hidden\" name=\"trans_id\" value=\"$date_time\"> <input type=\"hidden\" name=\"repeat\" value=\"$date\">"; ?>
An example HTML output of this PHP script would be something alone the lines of -
Code:
<input type="hidden" name="trans_id" value="20070712083833">
<input type="hidden" name="repeat" value="20070712/Jul/8:39">
You can format it however you like by editing the PHP variables '$date_time' and '$date' and replacing them with the values in this page - http://us.php.net/manual/en/function.date.php. If you need it reformatted and can't figure it out let me know and I'll do it for you.
That should do it. Hope this helps.
__________________
PHP Code:
$talkupation++;
Please login or register to view this content. Registration is FREE - Free IPB forum hosting (releasing today!!!), no ads, free modifications
Last edited by Mattmaul1992; 07-12-2007 at 10:43 AM..
|