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
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

Link to comment
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

Thank you

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.