
October 17th, 2004, 11:05 PM
|
|
Registered User
|
|
Join Date: Oct 2004
Posts: 24
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
no problem.i used this in a site i scripted.
excerpt lines from a script.....
PHP Code:
<?php /* some stuff */ $utds='m/d/Y H:i:s'; $gmtos='-5'; $access=$vis; # set default time display/gmt offset/access (guest settings) /* some stuff accessing the db and possibly resetting those based on cookies*/ /* other parts of the script */ function mkfrmlst($foruminf, $utds, $gmtos){ // make a forum into a table string for display $lauth=$foruminf['username']; $lpt=$foruminf['UNIX_TIMESTAMP(lpt)']; # who/when of lst pst if($lpt==0){ $lpt='No Posts'; $lauth='No Posts'; } # no posts ever else{ $lpt=gmdate($utds, ($lpt+($gmtos*60*60))); } # change to user's time format/zone $tblln=" <tr><td class=\"mfld\"><span class=\"frmttl\"><a href=\"{$_SERVER['PHP_SELF']}?fid={$foruminf['fid']}\">{$foruminf['title']} </a></span><br /><span class=\"frmblrb\">{$foruminf['blurb']}</span></td><td class=\"mfld\">{$foruminf['threads']}</td><td class=\"mfld\">$lau th</td><td class=\"mfld\">$lpt</td></tr>\n"; # add the row with the forum return $tblln; } function mkthrdlst($thrdinf, $utds, $gmtos){ # construct actual thread listing $lpt=gmdate($utds, ($thrdinf['UNIX_TIMESTAMP(thrd.lpt)']+($gmtos*60*60))); # set time $lock='<img alt="unlocked" src="sitepics/unlocked.png" title="unlocked">'; if($thrdinf['locked']){ $lock='<img alt="locked" src="sitepics/lo cked.png" title="locked thread" />'; } # set locked $goto=''; $posts=$thrdinf['amt_posts']; if($posts>20){ $goto="<br />Go To Page:<a href=\"{$_SERVER['PHP_SELF']}?tid={$thrdinf['tid']}&pa ge=1\">1</a>"; $pg=2; while(($posts=$posts-20)>20){ $goto.=", <a href=\"{$_SERVER['PHP_SELF']}?tid={$thrdinf['tid']}&page=$pg\">$pg</a>"; $pg++; } if($posts>0){ $goto.=", <a href=\"{$_SERVER['PHP_SELF']}?tid={$thrdinf['tid']}&page=$pg\">$pg</a>"; }} # set goto $thrd=" <tr><td class=\"right\">$lock</td><td class=\"tcs\"><a href=\"{$_SERVER['PHP_SELF']}?tid={$thrdinf['tid']}\">{$thrdinf['sub' ]}</a>$goto</td><td class=\"tpcs\">{$thrdinf['amt_posts']}</td><td class=\"tcs\">{$thrdinf['auth']}</td><td class=\"tcs\">{$thrdinf['lpa']}</t d><td class=\"ttcs\">$lpt</td></tr>\n"; return $thrd; } ?>
using the passed time display and gmt offset, the timestamp is made to be local to the user
|