PDA

View Full Version : parameters


Link14716
08-27-2002, 12:23 AM
I wanna know how to set parameters and get them to work! :) Here is part of the file I am using.....
if ($action == "play") {
if (!$game) {
$game = tetris;
}

// Variable copying
$username = $bbuserinfo[username];
$userid = $bbuserinfo[userid];

// If someone tries to input a security code via any method, the no permission page will show
if ($_REQUEST['sec_no']) {
show_nopermission();
}

// Random security code generation
$lower = 100000000;
$higher = 999999999;
$sec_no = rand($lower, $higher);

// Date var
$date = mktime();

// New record inserted into the database, with new security code
$input_code = $DB_site->query("INSERT INTO arcade (userid, sec_no, game, comment, date) VALUES ('$userid', '$sec_no', '$game', '', '$date')");

// Fetches the high score for use in the game
$scoring = $DB_site->query("SELECT * FROM arcade WHERE game='$game' ORDER BY score DESC LIMIT 1");
$scoring_array=$DB_site->fetch_array($scoring);
$cur_high = $scoring_array['score'];

// Gets the "$game" template
eval("dooutput(\"".gettemplate('$game')."\");");

It doesn't get the template, so I am guessing that doesn't work ;)

g-force2k2
08-27-2002, 02:15 PM
did you make sure that you did the {filename here}.php?s=&action=play in the browser?

regards...

g-force2k2

Link14716
08-27-2002, 09:08 PM
it was. it was simply not calling the templates.

Scott MacVicar
08-27-2002, 09:29 PM
you have singlequotes around $game this will stop the variable from being changed and it will actually attempt to load the template $game

change them to doublequotes around game so its

"$game" and not '$game'

Link14716
08-27-2002, 09:34 PM
ahh, see, I'm learning ;)

that is the whole point of making, modding, and installing hacks for me, PHP is cool. Thanks PPN.

g-force2k2
08-27-2002, 09:48 PM
yeah thanks PPN... see i leanred someting new too ;) i didn't know the reason why in some files double quotes were used for eval() templates and for other ones single quotes ;) but i think you just helped me in the long run... :) a question though is there anything wrong with having all the templates incased in double quotes? regards...

g-force2k2

Scott MacVicar
08-27-2002, 10:21 PM
Its less efficent, php tries to replace all variables in double quotes among other things.

Thats why in vB3 everything uses single quotes where possible in all the coding. You also dont have to escape double quotes within singlequotes.

$test = '<a href="http://www.vbulletin.com/">vBulletin</a>';