php problem!!!

NielsJanssen

New Member
Messages
148
Reaction score
0
Points
0
i have made a usermanagement system but when i go to the memberslist en then go to another page of my site the session variables seem to have cleared. could someone help me?

this is my members.php page:
PHP:
<? session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Dj G-licious :: Leden</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400,left = 212,top = 184');");
}
-->
</script>
<link href="http://nielsj.x10hosting.com/djg/new/css/style.css" rel="stylesheet" type="text/css" />
</head>
<body onload="MM_preloadImages('http://nielsj.x10hosting.com/djg/new/images/djg_r2_c5_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c6_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c7_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c9_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c10_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c11_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c12_f2.jpg','http://nielsj.x10hosting.com/djg/new/images/djg_r2_c14_f2.jpg')" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0">
<? include('includes/overall_header.php'); ?><table width="100%" vspace="0" cellpadding="0" cellspacing="0"><tr>
  <td width="50%"><span class="titel">ledenlijst</span></td>
  <td align="right"><? include('log_strip.php'); ?></td></tr></table> 
	  
		<hr size="1" color="#000000" noshade />
		
<? 
include 'library/config.php';
include 'library/opendb.php';

$query  = "SELECT userid, first_name, last_name, email_address, username, signup_date FROM users";
$result = mysql_query($query) or die(mysql_error());
 if(mysql_num_rows($result) == 0)
{
echo "De database is leeg.";
} else {
?>
	<p><table width="100%" border="0" id="fontsize10" cellpadding="0" cellspacing="0">
  <tr bgcolor="#FF9933">
	<td colspan="5" bgcolor="#ffffff" id="fontsize10"><table border="0" cellpadding="0" cellspacing="0" width="100%" style="background-image:url(downloadheader.png); background-repeat:repeat; ">
<!-- fwtable fwsrc="downloadheader.png" fwbase="downloadheader.gif" fwstyle="Dreamweaver" fwdocid = "1045783444" fwnested="1" -->
  <tr>
	<td width="4%" align="center"><strong>#</strong></td>
	<td width="24%" align="center"><strong>Gebruikersnaam</strong></td>
	<td width="24%" align="center"><strong>Echte naam</strong></td>
	<td width="24%" align="center"><strong>Email</strong></td>
	<td width="24%" align="center"><strong>Geregistreerd op</strong></td>
  </tr>
</table></td>
  </tr><? while(list($id, $first_name, $last_name, $email, $username, $signup_date) = mysql_fetch_array($result))
	{ ?>
 
  <tr onMouseOver="this.bgColor='#B8C3CE';" onMouseOut="this.bgColor='#FFFFFF';">
	<td width="4%" id="fontsize10" align="center"><?=$id;?></td>
	<td width="24%" id="fontsize10" align="center"><?=$username;?></td>
	<td width="24%" id="fontsize10" align="center"><? echo $first_name . " " . $last_name; ?></td>
	<td width="24%" id="fontsize10" align="center"><?=$email;?></td>
	<td width="24%" align="center" id="fontsize10"><?=$signup_date;?></td>
  </tr>
  <? }
	   } ?>
<tr><td colspan="5"><table border="0" cellpadding="0" cellspacing="0" width="100%" background="downloadheaderupsidedown.png">
<!-- fwtable fwsrc="downloadheaderupsidedown.png" fwbase="downloadheaderupsidedown.gif" fwstyle="Dreamweaver" fwdocid = "1045783444" fwnested="1" -->
  <tr>
   <td style="height:20px; "></td>
  </tr>
</table></td></tr>
  </table>
	</p>
		
		<?
include 'library/closedb.php';
include('includes/overall_footer.htm');
?>
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
The problem you have is that you have whitespace before the session_start() function.

Change:
Code:
<? session_start(); ?>

To:
Code:
<?php
session_start();
?>

Also make sure you have the session_start() on EVERY page that you will want to use the set variables in the session on.
 

NielsJanssen

New Member
Messages
148
Reaction score
0
Points
0
@ Auvee: yes i've got the session start at every page
@ NedreN: i tried your suggestion but it didn't work
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
Ok, umm... That is the ONLY and ACTUAL script you have on that page? Nothing else?

Also, how are you setting the session variables?
 
Top