vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   [HELP!] Quick PHP question... please take a look someone (https://vborg.vbsupport.ru/showthread.php?t=53220)

007 05-22-2003 07:38 AM

[HELP!] Quick PHP question... please take a look someone
 
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:

PHP Code:

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:

PHP Code:

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:

PHP Code:

$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/showthrea...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??


All times are GMT. The time now is 10:43 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01084 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete