Jump to content

[SOLVED] How do I stop this?


Klance

Recommended Posts

I have a tree here: http://24.177.36.183/test/tree/index.php

But after I click Guitar Hero, if i click PS2 more than one, it will add that onto the url over and over, same with the difficulties, how do I stop it so that if you click it more than once, nothing will happen?

 

Here is index.php:

<a href="?game=GH">Guitar Hero</a><br />
<?php

if (!empty($_GET['game']) && file_exists("./$_GET[game].php")) {
include("./$_GET[game].php");
}
?>

 

Here is GH.php:

<a href="<?php echo $_SERVER['REQUEST_URI'] ?>&console=PS2">PS2</a><br />
<?php
if (!empty($_GET['console'])) {
include("./$_GET[console].php");
}
?>

 

Here is PS2.php:

<a href="<?php echo $_SERVER['REQUEST_URI'] ?>&diff=Easy">Easy</a> |
<a href="<?php echo $_SERVER['REQUEST_URI'] ?>&diff=Medium">Medium</a> |
<a href="<?php echo $_SERVER['REQUEST_URI'] ?>&diff=hard">Hard</a> |
<a href="<?php echo $_SERVER['REQUEST_URI'] ?>&diff=Expert">Expert</a> |
<br />
<?php
if (!empty($_GET['diff'])) {
include("scores.php");
}
?>

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/99394-solved-how-do-i-stop-this/
Share on other sites

Change all of your link references to look like these:

 

To Select Game:
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?game=GH">Guitar Heo</a> 

To Select Console:
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?game=<?php ehco $_GET['game']; ?>&console=PS2">PS2</a> 

To Select Difficulty:
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?game=<?php ehco $_GET['game']; ?>&console=<?php ehco $_GET['console']; ?>&diff=Easy">Easy</a> 
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?game=<?php ehco $_GET['game']; ?>&console=<?php ehco $_GET['console']; ?>&diff=Medium">Medium</a> 
[etc...]

 

Best, Nathan

Change all of your link references to look like these:

 

To Select Game:
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?game=GH">Guitar Heo</a> 

To Select Console:
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?game=<?php ehco $_GET['game']; ?>&console=PS2">PS2</a> 

To Select Difficulty:
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?game=<?php ehco $_GET['game']; ?>&console=<?php ehco $_GET['console']; ?>&diff=Easy">Easy</a> 
<a href="<?php echo $_SERVER['PHP_SELF'] ?>?game=<?php ehco $_GET['game']; ?>&console=<?php ehco $_GET['console']; ?>&diff=Medium">Medium</a> 
[etc...]

 

Best, Nathan

Thank you

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.