PDA

View Full Version : [HELP!] Quick PHP question... please take a look someone


007
05-22-2003, 07:38 AM
I am trying to make an if/else statement that deals with the last reply time of threads. I had this working a few hours ago but I've since had to restart by PC when it froze and now I can't figure out what I did to begin with :(

Here's my basic idea of what I am trying to do:


if ((time()-$thread['lastpost']) >= 86400 and !$bbuserinfo['userid'])
{$variable=1;}
else if ($bbuserid != 0)
{$variable=2;}

if ((time()-$thread['lastpost']) >= 86400)
{
$variable=1;
}
elseif (!$bbuserinfo['userid'])
{
$variable=2;
}
elseif ($bbuserinfo['userid'] != 0)
{
$variable=3;
}
else
{$variable=4;
}


Is there something I don't understand about if/else statements??? This is basically what I am trying to do but i haven't been able to get this to work.

Is there a good place that shows the do's and don'ts of if/else statements???? Or can someone show me what I am doing wrong?

Thanks! :)

007
05-22-2003, 05:19 PM
The main problem I'm having is that the first line, with the time in it isn't coded right apparently, because it's not recognising that I only want threads that have been replied to within the last 24 hours.

Even the simple:

if (time()-($thread[lastpost]) >= 86400) {
$variable=X;
}

..does not work..

Any ideas????? :(

Sebastian
05-22-2003, 09:57 PM
if you explain what you're really trying to do then maybe i can help.

007
05-22-2003, 11:19 PM
Well I messed up the code up there a little but I have it all coded now.

I am trying to make it so guests can only view threads that have received replies within the last 24 hours.

The code I had above was just my guess at what I should do but I then tried that and it didn't work...

Do you know how I could do this?

Here's what I have for the time checker:


$show=".gettemplate('postbit_guests').";

if ((time() - $thread[lastpost] >= 86400)) {
eval("\$show = \"".gettemplate('postbit_show')."\";");
}


$show is part of another hack that replaces the massage in the postbit with different things if the user is a guest.

https://vborg.vbsupport.ru/showthread.php?s=&threadid=51980

That's the hack I am trying to make this work with if that helps.

Thanks for any help. :)

007
05-23-2003, 04:21 PM
Do you know how to do this??

007
05-25-2003, 10:50 PM
:( ANyone??