vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   a bit of code in need of fixing (https://vborg.vbsupport.ru/showthread.php?t=36882)

E 04-02-2002 04:19 AM

a bit of code in need of fixing
 
part of a hack im making:

PHP Code:

 //Drakks Warning Hack
$warnifield="field10" //make x the field for ur warning level
$warnlevel $DB_site->query_first("SELECT $warnifield FROM userfield WHERE $userid=$bbuserinfo");
        if (
$warnlevel >= "10") {
                
$warnphraze="NEEDS BANNING";    //u may set the warn phraze for each one
        
} elseif ($warnlevel >= "7") {
                
$warnphraze="Very Bad";
        } elseif (
$warnlevel >= "4") {
                
$warnphraze="Thats Rough";
        } elseif (
$warnlevel >= "1") {
                
$warnphraze="Evil's Apprentice";
        } else {
                
$warnphraze"Goody Goody";
        }
        if (
$warnfield >= "10") {
                
$warning='<img src="{imagefolder}/warn1.jpg"> $warnphraze';
        } elseif (
$warnlevel >= "7") {
                
$warning='<img src="{imagefolder}/warn2.jpg"> $warnphraze';
        } elseif (
$warnlevel >= "4") {
                
$warning='<img src="{imagefolder}/warn3.gif"> $warnphraze';
        } elseif (
$warnlevel >= "1") {
                
$warning='<img src="{imagefolder}/warn4.gif"> $warnphraze';
        } else {
                
$warning='<img src="{imagefolder}/warn5.gif"> $warnphraze';
        }
//End Warning hack 

Theres also an error with the query,,, but... how can i get $warning too =<img src="{imagefolder}/warn5.gif"> and so on?

i know that Wont work.. how can i change it too make it work

TECK 04-02-2002 05:22 AM

did you tried:
PHP Code:

$warning='<img src="{imagefolder}/warn1.jpg"> $warnphraze' 

?

E 04-02-2002 05:25 AM

hmm...

E 04-02-2002 05:41 AM

theres still the error with this line :
PHP Code:

$warnlevel $DB_site->query_first("SELECT $warnfield FROM userfield WHERE userid='$bbuserinfo'"); 

i also tried changing it too:
PHP Code:

$warnlevel $DB_site->query_first("SELECT $warnfield FROM userfield WHERE userid=$userid"); 


Logician 04-02-2002 07:26 AM

insert:
echo "warnfield=$warnfield <br>";
echo "bbuserinfo=$bbuserinfo<br>";
before
$warnlevel = $DB_site->query_first("SELECT $warnfield FROM userfield WHERE userid='$bbuserinfo'");

and see what your variables have before entering the query.

BTW isnt it the variable "$bbuserinfo[userid]" you should use in your query if I got what you're trying to do right?

if yes try this:
$new_var_323= $bbuserinfo[userid];
$warnlevel = $DB_site->query_first("SELECT $warnfield FROM userfield WHERE userid='$new_var_323'");

Hope this helps..

Regards,
Logician

E 04-02-2002 07:33 AM

it seems no matter what i do i get this error:

Parse error: parse error in /home/fiendwor/public_html/admin/functions.php on line 214

Fatal error: Call to undefined function: getuserinfo() in /home/fiendwor/public_html/admin/sessions.php on line 323

E 04-02-2002 07:36 AM

it doesnt like this code:
echo "warnfield=$warnfield <br>";

if thats not there it doesnt like this code:
$new_var_323= $bbuserinfo[userid];

if thats not there it doesnt like the query

Logician 04-02-2002 07:48 AM

what editor program do you use? Cant you see which line produced the error? I strongly suggest you using an editor that can show you line numbers and then you can easily point which line is causing you trouble. It would be a real headache to trace and fix the problem without even knowing which line causes the problem!

E 04-02-2002 07:52 AM

PHP Code:

//Drakks Warning Hack
$warnfield="field10" //make x the field for ur warning level
echo "warnfield=$warnfield <br>";
echo 
"bbuserinfo=$bbuserinfo<br>";

$warnlevel $DB_site->query_first("SELECT $warnfield FROM userfield WHERE userid='$new_var_323'");
$warnlevel=$warnlevel[$warnfield]; 

in that case this is the line:
PHP Code:

echo "warnfield=$warnfield <br>"

if u get rid of that and the bit after it and this is in there this is the line:
PHP Code:

$new_var_323$bbuserinfo[userid]; 

but.. if that aint there this is the line:
PHP Code:

$warnlevel $DB_site->query_first("SELECT $warnfield FROM userfield WHERE $bbuserinfo[userid]"); 

and so on

E 04-02-2002 08:00 AM

o and the first line of this bit of code is the reference too the sessions.php
PHP Code:

  // get pertinient user info
  
if (!isset($bbuserinfo) or $bbuserinfo['userid']!=$session['userid']) {
    
$bbuserinfo=getuserinfo($session['userid']);
    
$bbuserinfo['realstyleid'] = $bbuserinfo['styleid'];
  } 



All times are GMT. The time now is 11:55 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.02164 seconds
  • Memory Usage 1,759KB
  • 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
  • (9)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete