PDA

View Full Version : Please help [been bugging me for ages!]


N9ne
02-11-2003, 04:32 PM
$changeuser = '';
if ($bbuserinfo['posts'] >= $postuserchange) {
$oldnames = $DB_site->query_first("SELECT * FROM namelogs WHERE userid='$bbuserinfo[userid]' ORDER BY time DESC");
$diff = time() - $oldnames['time'];
$limit = (86400 * $dayuserchange);
if ($diff > $limit or $bbuserinfo['usergroupid'] == 6) {
eval("\$changeuser = \"".gettemplate("changeuser")."\";");
} elseif ($diff < $limit or !$bbuserinfo['usergroupid'] == 6) {
eval("\$changeuser = \"".gettemplate("nochangeuser")."\";");
}
}



Ok there we have some code, heh. What I want to do, is have a variable which will say how long (in days) until the user can next change his username. I messed around with making new variables and such, but nothing is working for me! What variable do I need to set here so I can put it into the "nochangeuser" template, so it will display the number of days left until the user can change his/her username? Or is it more complicated?

Xenon
02-11-2003, 04:42 PM
before eval("\$changeuser = \"".gettemplate("nochangeuser")."\";");

add this:
$daysleft=intval(($limit-$diff)/86400);

Dean C
02-11-2003, 05:05 PM
btw i'm sure i read somewhere that it's best to use vbtime() function or something similar than the time() function..

- miSt

N9ne
02-11-2003, 05:11 PM
Thanks, works perfectly!