Jump to content

Having a problem


Xyphon

Recommended Posts

Okay, I finally got map to wok a bit, but then it made my code show both caught and catch on the same page because I didnt exit.

 

So I exit and now the only page it'll ever display is the Nothing found page..

 

Heres the code:

 

<?PHP
session_start();
include('Connect.php');
include('top.php');
$ID= $_COOKIE['UserID'];

//If User Is Not Logged In
if(!isset($ID))
{
//Display Message
echo "Sorry, you are not logged in.<br /><br /><a href='login.php'>Login</a>";

//Include Bottom File
include("bottom.php");

//Exit Page
exit;
}
$Action= $_GET['action'];
$Submit= $_POST['Submit'];
$Result1= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID'");
$Rows1= mysql_fetch_array($Result1);

//If User Has No Pokémon
if(empty($Rows1))
{
//Display Message
echo "Sorry, you must obtain your starter first.<br /><br /><a href='obtainstarter.php'>Obtain Starter</a>";

//Include Bottom File
include("bottom.php");

//Exit Page
exit;
}
//Find Position Results
$AP_PResult1= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='1'");
$AP_PResult2= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='2'");
$AP_PResult3= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='3'");
$AP_PResult4= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='4'");
$AP_PResult5= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='5'");
$AP_PResult6= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='6'");

//Find Position Rows
$AP_PRows1= mysql_fetch_array($AP_PResult1);
$AP_PRows2= mysql_fetch_array($AP_PResult2);
$AP_PRows3= mysql_fetch_array($AP_PResult3);
$AP_PRows4= mysql_fetch_array($AP_PResult4);
$AP_PRows5= mysql_fetch_array($AP_PResult5);
$AP_PRows6= mysql_fetch_array($AP_PResult6);

//Set Position Variable
$AP_MainPosition="No";

//Find Position One
if(empty($AP_PRows1))
{
//If Main Position Is No
if($AP_MainPosition=="No")
{
//Define Variables
$AP_Slot= 1;
$AP_MainPosition="Yes";
}
}

//Find Position Two
elseif(empty($AP_PRows2))
{
//If Main Position Is No
if($AP_MainPosition=="No")
{
//Define Variables
$AP_Slot= 2;
$AP_MainPosition="Yes";
}
}

//Find Position Three
elseif(empty($AP_PRows3))
{
//If Main Position Is No
if($AP_MainPosition=="No")
{
//Define Variables
$AP_Slot= 3;
$AP_MainPosition="Yes";
}
}

//Find Position Four
elseif(empty($AP_PRows4))
{
//If Main Position Is No
if($AP_MainPosition=="No")
{
//Define Variables
$AP_Slot= 4;
$AP_MainPosition="Yes";
}
}

//Find Position Five
elseif(empty($AP_PRows5))
{
//If Main Position Is No
if($AP_MainPosition=="No")
{
//Define Variables
$AP_Slot= 5;
$AP_MainPosition="Yes";
}
}

//Find Position Six
elseif(empty($AP_PRows6))
{
//If Main Position Is No
if($AP_MainPosition=="No");
{
//Define Variables
$AP_Slot= 6;
$AP_MainPosition="Yes";
}
}

//Find Box Position
else
{
//Define Variables
$AP_Slot= 7;
$AP_MainPosition="Yes";
}
if(!isset($Action))
{
if(!isset($_SESSION['rand']) ) {
    $PokemonRand= rand(1, 99);
    $_SESSION['rand'] = $PokemonRand;
}

if($PokemonRand < 75 && $PokemonRand > 50)
{
$pokemonname="Magby";
$sorrymessage="<img border='0' src='http://i10.tinypic.com/8also6f.png'><br />Pokemon found! Want to catch?<form action='mapbeta.php?action=catch' method='POST'>
<input type='hidden' name='Submit' value='1'>
<input type='submit' value='Catch!'>
</form>";
$attack= rand(12,27);
$defence= rand(15,23);
$level= rand(1,15);
$EXP="0";
$NEXP= rand(27,52);
$attack1="Flamethrower";
$attack2="Hydro Pump";
$attack3="Razor Leaf";
$attack4="Thunder";
$pokemonicon="http://i9.tinypic.com/6owv9l0.png";
$pokemonimage="http://i10.tinypic.com/8also6f.png";
}
elseif($PokemonRand < 100 && $PokemonRand > 74 )
{
$pokemonname="Charmander";
$sorrymessage="<img border='0' src='http://i13.tinypic.com/6xvsvw7.png'><br />Pokemon found! Want to catch?<form action='mapbeta.php?action=catch' method='POST'>
<input type='hidden' name='Submit' value='1'>
<input type='submit' value='Catch!'>
</form>";
$attack= rand(15,23);
$defence= rand(12,27);
$level= rand(1,15);
$EXP="0";
$NEXP= rand(27,52);
$attack1="Flamethrower";
$attack2="Hydro Pump";
$attack3="Razor Leaf";
$attack4="Thunder";
$pokemonicon="http://i13.tinypic.com/6l2w8l2.png";
$pokemonimage="http://i13.tinypic.com/6xvsvw7.png";
}
elseif($PokemonRand < 51 && $PokemonRand > 49 )
{
$pokemonname="Entei";
$sorrymessage="<img border='0' src='http://i8.tinypic.com/7xxnyud.png'><br />Pokemon found! Want to catch?<form action='mapbeta.php?action=catch' method='POST'>
<input type='hidden' name='Submit' value='1'>
<input type='submit' value='Catch!'>
</form>";
$attack= rand(20,37);
$defence= rand(23,34);
$level= rand(1,15);
$EXP="0";
$NEXP= rand(27,52);
$attack1="Flamethrower";
$attack2="Hydro Pump";
$attack3="Razor Leaf";
$attack4="Thunder";
$pokemonimage="http://i8.tinypic.com/7xxnyud.png";
$pokemonicon="http://i2.tinypic.com/6wp5cmq.png";
}
else
{
$sorrymessage="Nothing found. Keep looking.";
}
$pokemonrand2= $_SESSION['rand2'];

//If Gender Is Male
if(!isset($_SESSION['rand2']) ) {
    $pokemonrand2= rand(1, 99);
    $_SESSION['rand2'] = $pokemonrand2;
}
if($pokemonrand2 < 50 && $pokemonrand2 > 0)
{
//Define Promo Variables
$pokemongender="Male";
}

//If Gender Is Female
elseif($pokemonrand2 < 99 && $pokemonrand2 > 50)
{
//Define Promo Variables
$pokemongender="Female";
}

//If Promo Is Ungendered
else
{
//Define Promo Variables
$pokemongender="Ungendered";
}
echo "$sorrymessage<br />";
echo "Click on the map to find pokemon!<br />";

echo "<a href='mapbeta.php'><img border='0' src='http://i13.tinypic.com/8104aqe.jpg'></a>";
}
include('bottom.php');
die();
if(isset($Action))
{
$PokemonRand = $_SESSION['rand'];
}

if($PokemonRand < 75 && $PokemonRand > 50)
{
$pokemonname="Magby";
$sorrymessage="<img border='0' src='http://i10.tinypic.com/8also6f.png'><br />Pokemon found! Want to catch?<form action='mapbeta.php?action=catch' method='POST'>
<input type='hidden' name='Submit' value='1'>
<input type='submit' value='Catch!'>
</form>";
$attack= rand(12,27);
$defence= rand(15,23);
$level= rand(1,15);
$EXP="0";
$NEXP= rand(27,52);
$attack1="Flamethrower";
$attack2="Hydro Pump";
$attack3="Razor Leaf";
$attack4="Thunder";
$pokemonicon="http://i9.tinypic.com/6owv9l0.png";
$pokemonimage="http://i10.tinypic.com/8also6f.png";
}
elseif($PokemonRand < 100 && $PokemonRand > 74 )
{
$pokemonname="Charmander";
$sorrymessage="<img border='0' src='http://i13.tinypic.com/6xvsvw7.png'><br />Pokemon found! Want to catch?<form action='mapbeta.php?action=catch' method='POST'>
<input type='hidden' name='Submit' value='1'>
<input type='submit' value='Catch!'>
</form>";
$attack= rand(15,23);
$defence= rand(12,27);
$level= rand(1,15);
$EXP="0";
$NEXP= rand(27,52);
$attack1="Flamethrower";
$attack2="Hydro Pump";
$attack3="Razor Leaf";
$attack4="Thunder";
$pokemonicon="http://i13.tinypic.com/6l2w8l2.png";
$pokemonimage="http://i13.tinypic.com/6xvsvw7.png";
}
elseif($PokemonRand < 51 && $PokemonRand > 49 )
{
$pokemonname="Entei";
$sorrymessage="<img border='0' src='http://i8.tinypic.com/7xxnyud.png'><br />Pokemon found! Want to catch?<form action='mapbeta.php?action=catch' method='POST'>
<input type='hidden' name='Submit' value='1'>
<input type='submit' value='Catch!'>
</form>";
$attack= rand(20,37);
$defence= rand(23,34);
$level= rand(1,15);
$EXP="0";
$NEXP= rand(27,52);
$attack1="Flamethrower";
$attack2="Hydro Pump";
$attack3="Razor Leaf";
$attack4="Thunder";
$pokemonimage="http://i8.tinypic.com/7xxnyud.png";
$pokemonicon="http://i2.tinypic.com/6wp5cmq.png";
}
else
{
$sorrymessage="Nothing found. Keep looking.";
$pokemonrand2= $_SESSION['rand2'];

//If Gender Is Male
}
if($pokemonrand2 < 50 && $pokemonrand2 > 0)
{
//Define Promo Variables
$pokemongender="Male";
}

//If Gender Is Female
elseif($pokemonrand2 < 99 && $pokemonrand2 > 50)
{
//Define Promo Variables
$pokemongender="Female";
}

//If Promo Is Ungendered
else
{
//Define Promo Variables
$pokemongender="Ungendered";
}

echo "You caught the Pokemon!<br />";
echo "Click on the map to find pokemon!<br />";

echo "<a href='mapbeta.php'><img border='0' src='http://i13.tinypic.com/8104aqe.jpg'></a>";
mysql_query("INSERT INTO pokemon_info (user_id, pokemon_name, pokemon_attack, pokemon_defence, pokemon_image, pokemon_gender, pokemon_icon, pokemon_level, pokemon_exp, pokemon_nexp, attack1, attack2, attack3, attack4, pokemon_slot)
VALUES ('$ID', '$pokemonname', '$attack', '$defence', '$pokemonimage', '$pokemongender', '$pokemonicon', '$level', '$EXP', '$NEXP', '$attack1', '$attack2', '$attack3', '$attack4', '$AP_Slot')")or die(mysql_error());
unset($_SESSION['rand']);
unset($_SESSION['rand2']);
session_unset();
session_destroy(); 


include('bottom.php');
?>

 

Can you help me?

Link to comment
Share on other sites

Narrow your code down to the relevent parts. Also, you'll need to be alot clearer in the description of your problem, you talk about maps, but I have no idea what your refering too.

 

ps: Your code is terribly inificient. Look at this....

 

$AP_PResult1= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='1'");
$AP_PResult2= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='2'");
$AP_PResult3= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='3'");
$AP_PResult4= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='4'");
$AP_PResult5= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='5'");
$AP_PResult6= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='6'");

 

that sort of logic is rediculous.

Link to comment
Share on other sites

Narrow your code down to the relevent parts. Also, you'll need to be alot clearer in the description of your problem, you talk about maps, but I have no idea what your refering too.

 

ps: Your code is terribly inificient. Look at this....

 

$AP_PResult1= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='1'");
$AP_PResult2= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='2'");
$AP_PResult3= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='3'");
$AP_PResult4= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='4'");
$AP_PResult5= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='5'");
$AP_PResult6= mysql_query("SELECT * FROM pokemon_info WHERE user_id='$ID' AND pokemon_slot='6'");

 

that sort of logic is rediculous.

 

That my friend is checking the pokemon slots.

 

You know catching pokemon? Thats maps. The error is the exit, as in, I keep clicking the map and no matter what it wont display a pokemon thats found, it'll just keep saying ntohing found.

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.