Code: Select all
<a href="sidor/Infanteries.php?saved_id=<?php echo $row[saved_id]; ?>" target="main">Infanteries</a><br> <!-- link to go to page Infanteries -->
Moderator: General Moderators
Code: Select all
<a href="sidor/Infanteries.php?saved_id=<?php echo $row[saved_id]; ?>" target="main">Infanteries</a><br> <!-- link to go to page Infanteries -->
nope. on the page where you output the URL you need to append the saved_id. your bit of code shows that you're adding $row['saved_id'], so it looks as though $row['saved_id'] hasn't been set.Goofan wrote:ok, now i get:
NO saved_id!
so i guess it still aint passing the saved id...
Code: Select all
$id =(isset($_GET['saved_id'])) ? (int)$_GET['saved_id'] : false;
if($id !== false)
{
$sql="SELECT * FROM konto WHERE saved_id=$id"; //selecting all from DB "Konto" where saved_id is the same as in the array $id
echo "<p>$sql</p>";
}
else
{
echo "NO saved_id!";
}
exit();
Code: Select all
<a href="sidor/Infanteries.php?saved_id=" target="main">Infanteries</a><br> <!-- link to go to page Infanteries -->
Code: Select all
<?php
include "login/database.php"; //page to where the database setting is, including this file into the php script of wichh is below it
$id =(isset($_GET['saved_id'])) ? $_GET['saved_id'] : false; //putting the information within saved_id of witch i got from the previous page and putted it into $id
$sql="SELECT * FROM konto WHERE saved_id=$id"; //selecting all from DB "Konto" where saved_id is the same as in the array $id
echo "<p>$sql</p>";
$result = mysql_query($sql) or die(mysql_error()); //choose all from table //fetch all info in the table
while($row = mysql_fetch_array( $result )) //fetching info from file and putting it in $row
{
$user=$row['user']; //fetching the "user" information in the tabledata
}
?>
Code: Select all
<html> <!--creating html scripting below-->
<title>Menu</title> <!--selecting the title of the page-->
<head> <!--starting head "all typed here will not be able to show for the public"-->
<center><img src="sidor/pictures/medieval_flag1.jpg" width="150" height="110"><br><br> <!-- choosing a picture to show the public and desiding it´s width and height-->
<style type="text/css"> <!--selecting the style type-->
<!--
a:link {text-decoration: none; color: blue}
a:visited {text-decoration: none; color: blue}
a:active {text-decoration: none; color: blue}
a:visited {text-decoration: none; color: blue}
-->
</style> <!--ending the style type-->
</head> <!--ending the head-->
<BODY bgcolor="#A4A8B0" leftMargin="0" topMargin="0" marginwidth="0" marginheight="0"> <!--Selecting the background colour for the body-->
<table align="left" valign="top" cellspacing=0 cellpadding=0 width="100%"> <!--telling the table that all its content will be aligned left (be as far from left as possible) and that the text should be valign top (starting at the top of the tabledata)-->
<tr> <!-- New Table row created -->
<td> <!-- New Table Data created -->
<font color="#0000CC"><b>Username: <font color="black">[ <?php echo $user; ?> ]</b><br>
</td> <!-- Table Data ended -->
</tr> <!-- Table Row ended-->
<tr> <!-- New Table row created -->
<td> <!-- New Table Data created -->
<font color="black"><b>MENU</b> <!-- Telling the "user" what the links below will contain /more or less/-->
</td> <!-- Table Data ended -->
</tr> <!-- Table Row ended-->
<tr> <!-- New Table Row created -->
<td> <!-- New Table Data created -->
<a href="sidor/overview.php?saved_id=<?php echo $row[saved_id]; ?>" target="main">Overview</a><br> <!-- link to go to page overview -->
<a href="sidor/scoreboard.php?saved_id=<?php echo $row[saved_id]; ?>" target="main">Scoreboard</a> <!-- link to go to page Scoreboard -->
</td> <!-- Table Data ended -->
</tr> <!-- Table Row ended-->
<tr> <!-- New Table Row created -->
<td> <!-- New Table Data created -->
<font color="black"><b>BUILDINGS</b> <!-- Telling the "user" what the links below will contain /more or less/-->
</td> <!-- Table Data ended -->
</tr> <!-- Table Row ended-->
<tr> <!-- New Table Row created -->
<td> <!-- New Table Data created -->
<a href="sidor/Civilian Houses.php?saved_id=<?php echo $row[saved_id]; ?>" target="main"><u>Civilian Houses</u></a><br> <!-- link to go to page Civilian Houses -->
<a href="sidor/Military Houses.php?saved_id=<?php echo $row[saved_id]; ?>" target="main">Military houses</a><br> <!-- link to go to page Military houses -->
<a href="sidor/Research.php?saved_id=<?php echo $row[saved_id]; ?>" target="main">Research</a> <!-- link to go to page Research -->
</td> <!-- Table Data ended -->
</tr> <!-- Table Row ended-->
<tr> <!-- New Table Row created -->
<td> <!-- New Table Data created -->
<font color="black"><b>UNITS</b> <!-- Telling the "user" what the links below will contain /more or less/-->
</td> <!-- Table Data ended -->
</tr> <!-- Table Row ended-->
<tr> <!-- New Table Row created -->
<td> <!-- New Table Data created -->
<a href="sidor/Infanteries.php?saved_id=<?php echo $row['saved_id']; ?>" target="main">Infanteries</a><br> <!-- link to go to page Infanteries -->
<a href="sidor/Military Vehicles.php?saved_id=<?php echo $row[saved_id]; ?>" target="main">Cavalry</a><br> <!-- link to go to page Vehicles -->
<a href="sidor/Military Boats.php?saved_id=<?php echo $row[saved_id]; ?>" target="main">Navy</a> <!-- link to go to page Military Boats -->
</td> <!-- Table Data ended -->
</tr> <!-- Table Row ended-->
<tr> <!-- New Table Row created -->
<td> <!-- New Table Data created -->
<font color="black"><b>FOR YOU</b> <!-- Telling the "user" what the links below will contain /more or less/-->
</td> <!-- Table Data ended -->
</tr> <!-- Table Row ended-->
<tr> <!-- New Table Row created -->
<td> <!-- New Table Data created -->
<a href="sidor/News.php?saved_id=<?php echo $row[saved_id]; ?>" target="main">News</a><br> <!-- link to go to page News -->
<a href="sidor/Mission.php?saved_id=<?php echo $row[saved_id]; ?>" target="main">Missions</a><br> <!-- link to go to page Missions -->
<a href="sidor/Mission.php?saved_id=<?php echo $row[saved_id]; ?>" target="main">Contact Us</a><br> <!-- link to go to page Contact Us -->
<a href="logout/logout_member.php" target="menu">logout</a><br> <!-- link to go to page logout -->
</td> <!-- Table Data ended -->
</tr> <!-- New Table Row created -->
</body> <!--body ending-->
</html> <!--html scripting ending-->
iankent wrote:In your menu file your also getting saved_id from the URL, and you're putting it in $id, so when you output the <a> links at the end you need to use <?=$id?> or <?php echo $id ?> to output the saved_id, not $row['saved_id'] as you currently are.
it also means when you first access the page you'll need to manually add ?saved_id=1 or whatever to set it
Code: Select all
<a href="sidor/Infanteries.php?$id=<?php echo $row['saved_id']; ?>" target="main">Infanteries</a><br> <!-- link to go to page Infanteries -->
Code: Select all
<a href="sidor/Infanteries.php?saved_id=<?php echo $id; ?>" target="main">Infanteries</a><br> <!-- link to go to page Infanteries -->
it shouldn't. if you just use a normal session it will end when the browser window closes (note window, not tab in most browsers). if you use ctrl+alt+del or restart the computer or shut down the browser the session should end. if it doesn't thats a browser fault and not a PHP session fault. as far as I know this works perfectly in almost all browsers (certainly does in IE5/6/7/8, Opera, Safari, Chrome and Firefox).Goofan wrote:well i have learned by "speaking to co-workers" that $_session got alot of faults...
for exampel if i remember correct:
If u close by (go by Vtrl + Alt + Delete) and close the webbpage it will keep u loged in and u might never get back into ure login...