Jump to content

[SOLVED] Help! Please.


Shiny_Charizard

Recommended Posts

<?PHP
SESSION_START();
include('connect.php');
$Member1 = mysql_query("SELECT * FROM members WHERE username='$username'");
$Member = mysql_fetch_array($Member1);
//Variables
$username = $_SESSION[username];
$Dir = $_GET["Dir"];
$Value_X = $Member[map_pos_X]; //Right or Left
$Value_Y = $Member[map_pos_Y]; //Up or Down


if($Dir == "Down") //If user chose to go Down
{
$Value_Y = $Value_Y--;
    mysql_query("UPDATE members SET map_pos_Y='$Value_Y' WHERE username='$username'");
}
elseif($Dir == "Up") //If user chose to go Up
{
$Value_Y = $Value_Y++;
mysql_query("UPDATE members SET map_pos_Y='$Value_Y' WHERE username='$username'");
}
elseif($Dir == "Right") //If user chose to go Right
{	
$Value_X = $Value_X--;
mysql_query("UPDATE members SET map_pos_X='$Value_X' WHERE username='$username'");
}
elseif($Dir == "Left") //If user chose to go Left
{
$Value_X = $Value_X++;
mysql_query("UPDATE members SET map_pos_X='$Value_X' WHERE username='$username'");
}

header("Location: http://tpfrpg.ghostblade.us/bmap.php"); // This is to prevent refreshing

?>

How can I make the page redirect the user to http://tpfrpg.ghostblade.us/bmap.php after it has done the if statements? Any help will be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/88978-solved-help-please/
Share on other sites

You should just use a <meta> tag - If that's what i think you mean.

 

Example:

<?php
echo '<meta http-equiv="refresh" content="5;directory/file.php">';
echo 'You will now be re-directed in 5 seconds. <br />';
echo 'If you are not re-directed, please <a href="directory/file.php">Click Here</a>.';
?>

Link to comment
https://forums.phpfreaks.com/topic/88978-solved-help-please/#findComment-455682
Share on other sites

Change

$username = $_SESSION[username];

 

to

 

$username = $_SESSION['username'];

 

 

What sets "Dir" here, a URL or a Form?

 

$Dir = $_GET["Dir"];

 

echo $Dir after you set it and see what it contains.

 

A url sets "Dir".

Link to comment
https://forums.phpfreaks.com/topic/88978-solved-help-please/#findComment-455710
Share on other sites

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.