vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   while statements, eval, and only one result showing :( (https://vborg.vbsupport.ru/showthread.php?t=52981)

dv6cougar 05-15-2003 12:50 PM

while statements, eval, and only one result showing :(
 
hey guys, i'm using the Template Hack, mucho props to whomever made that, it's a great hack!

however, i'm trying to make a raffle like hack with this, so far i'm not doign to bad :)

this would be my first attempt at a hack.

i have this in my code
PHP Code:

//check to see that $id is not set
if(!isset($id)) {
    
$raffle $DB_site->query("SELECT * FROM raffle_list WHERE status='current'");
        while(
$raffleql $DB_site->fetch_array($raffle)) {
        
        
$raftitle $raffleql['title'];
        
$rafid $raffleql['id'];
         eval(
"\$ticketid = \"".logiciangettemplate('ticketid')."\";");
        }
//end while
}//end $id is not set 

and then i have my template set to use $ticketid, which works great :)

but then the ticketid tempalte looks like this

PHP Code:

<a href="show.php?pg=raffle&id=$rafid">$raftitle</a

the $rafid and $raftitle work like a charm, however, if i have 2 raffles i want to show up it only shows one :(

how do you make the while statement work correctly? i know you can do it, since teh forumhome and forumdisplay does it :)

thanks alot ;)

colicab-d 05-15-2003 01:14 PM

yeah ive had this prob before, with a simple shout box i made, when i eval`d i could only get 1 result showing

JulianD 05-15-2003 01:20 PM

After a quick look to your code, try to replace this:

PHP Code:

eval("\$ticketid = \"".logiciangettemplate('ticketid')."\";"); 

for this:

PHP Code:

eval("\$ticketid .= \"".logiciangettemplate('ticketid')."\";"); 


dv6cougar 05-15-2003 01:21 PM

hmm ok i even tried it within my original raffle template and not using $ticketid and what not as seperate templates....


any help would be great here :) usually there will only be one raffle but there may be more then 1 sometimes :) thanks for your input

dv6cougar 05-15-2003 01:27 PM

Quote:

Today at 03:20 PM JulianD said this in Post #3
After a quick look to your code, try to replace this:

PHP Code:

eval("\$ticketid = \"".logiciangettemplate('ticketid')."\";"); 

for this:

PHP Code:

eval("\$ticketid .= \"".logiciangettemplate('ticketid')."\";"); 



actually that would make sense .= so it takes more as needed :)

thanks!

JulianD 05-15-2003 01:28 PM

No problem :)

filburt1 05-15-2003 02:00 PM

Be uber-certain to either unset() or set to "" $ticketid first to avoid HTML injection.

Boofo 05-15-2003 02:16 PM

Would this be the same thing then?

$pollrun = "";
unset($pollrun);

even though the variable hasn't been declared yet?

filburt1 05-15-2003 02:24 PM

Either:
PHP Code:

unset($pollrun); // i like because it happens to free memory too 

or
PHP Code:

$pollrun ""

works. Remember with vB2, register_globals is explicitly turned on which is the biggest security hole known to mankind.

Boofo 05-15-2003 02:26 PM

Which one would you have to use with register_globals turned off?


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.01042 seconds
  • Memory Usage 1,746KB
  • 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
  • (8)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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