PDA

View Full Version : My Guessing Game Hack...


Chris M
07-03-2002, 06:48 PM
Ok...

Version 1.2 is working, as far as the php goes...

http://www.thelyceum.org/forum/guessword.php

There is the problem...

I cannot get the input form to appear...

I am using the variable $guess to call up the gg_guessword_guess template, which contains :

<form method="POST">
Type your guess here: <br>
<input type="text" name="guess" value="$yourguess">
<input type="hidden" name="num_triesgw" value="$num_triesgw">
<input type="submit" value="Submit">
</form>

I tried, as you can see, to add another variable, $yourguess, to the mix, which calls the template gg_guessword_guessbit. That contains :

$guess

The other variables are working as far as I can tell, but how do I make the input form appear on the template?

Satan

Velocd
07-03-2002, 07:31 PM
Since you are trying to finish, I think you would find more help (not to mention it's appropriate for the category) here:

https://vborg.vbsupport.ru/forumdisplay.php?s=&forumid=9

g-force2k2
07-03-2002, 07:33 PM
hellsatan i don't believe that you can call a template from a variable that you're trying to call yet another variable ;p

g-force2k2

g-force2k2
07-03-2002, 07:45 PM
The Coding of the Hack should be kinda like this then you just build on ;p

-------------------
guess_guessword template
-------------------

<form method="POST">
Type your guess here: <br>
<input type="text" name="guess" value="$yourguess">
<input type="hidden" name="num_triesgw" value="$num_triesgw">
<input type="submit" value="Submit">
</form>

thats something like the template you want to call ;)

now you want to make another template called:

----------------
guess template <--- this template should include the variable you want to call the other template
----------------

<html>
<head>
<title>[ Title here ]</title>
</head>
<body>

$header
<!-- the variable below -- hellsatan being the variable that calls the template -->
$guess

$footer

</body>
</html>

php file should look like this:

-----------------
guess.php file
-----------------

<?php

require('./global.php');

error_reporting(7);

$templatesused="guess,guess_guessword";

if($action="start_guess") {
eval("\$guess = \"".gettemplate('guess_guessword')."\";");
}

// Then You include what you want Here as well.

eval("eval("dooutput(\"".gettemplate('guess')."\");");

?>


g-force2k2

Chris M
07-03-2002, 08:28 PM
Thats what I had...

It calls a blank screen:confused:

Satan

g-force2k2
07-03-2002, 09:28 PM
did you call the main template at the end? if its possible let me see your coding...

g-force2k2

Chris M
07-04-2002, 10:28 AM
Here is the coding :

<?php
error_reporting(7);
register_globals;

$templatesused='gg_guessword,gg_guessword_intro,gg _guessword_message,gg_guessword_guess,gg_guessword _guessbit,gg_guessword_tries';

require('./global.php');

if($action="start_guessword") {
eval("\$guess = \"".gettemplate('gg_guessword_guess')."\";");
}

// Variables (start)
eval("$gwtries(\"".gettemplate('gg_guessword_tries')."\");");

//Start Guessword
$num = array( "blagh", "whoo", "whee", "hello", "testing" );
$num_nums = rand(1,count($num)) - 1;
$nums = $num[$num_nums];
$guessword == $nums;
$message = "";
$num_triesgw= ( isset( $num_triesgw ) ) ? ++$num_triesgw : 0;
if ( ! isset( $guess ) )
eval("$gwintro(\"".gettemplate('gg_guessword_intro')."\");");
elseif ( $guess != $nums )
eval("$message(\"".gettemplate('gg_guessword_message')."\");");
else { //must be equal to
header( "Location: hooray.php" );
exit;
}
$guess = (int)$guess;

eval("dooutput(\"".gettemplate('gg_guessword')."\");");

?>

gg_guessword is the main template, and gg_guessword_guess is the Guess Template...

Satan

g-force2k2
07-04-2002, 10:36 AM
hellsatan which template do you ahve the $guess variable in?

g-force2k2

Chris M
07-04-2002, 11:35 AM
gg_guessword...

Satan

g-force2k2
07-04-2002, 11:47 AM
duh :p *smacks myself... okay i figured it out hellsatan :D

Just take this coding:

eval("\$guess = \"".gettemplate('gg_guessword_guess')."\";");


and replace it with:

eval("\$fguess = \"".gettemplate('gg_guessword_guess')."\";");

then in your gg_guessword template replace:

$guess

with:

$fguess

that should do the trick :D

can't call the same variable if its manipulated as in this code:

$guess = (int)$guess;



thats all though :D

g-force2k2

Chris M
07-04-2002, 12:25 PM
ah...

Thanks - I'll try it:)

Great! It works:)

Thanks...

Satan

Chris M
07-04-2002, 01:20 PM
Ok ive released it!

I gave you thanks for helping me:)

Satan