Hey i have a session problem which is meant to store the data of a username and userid. It works fine on my test server, but as soon as i upload it to the actual server. heres my script.
Login
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<title>(Type a title for your page here)</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<form action='loginck.php' method=post>
<table border='0' cellspacing='0' cellpadding='0' align=center>
<tr id='cat'>
<tr> <td bgcolor='#f1f1f1' ><font face='verdana, arial, helvetica' size='2' align='center'> Login ID
</font></td> <td bgcolor='#f1f1f1' align='center'><font face='verdana, arial, helvetica' size='2' >
<input type ='text' class='bginput' name='userid' ></font></td></tr>
<tr> <td bgcolor='#ffffff' ><font face='verdana, arial, helvetica' size='2' align='center'> Password
</font></td> <td bgcolor='#ffffff' align='center'><font face='verdana, arial, helvetica' size='2' >
<input type ='text' class='bginput' name='password' ></font></td></tr>
<tr> <td bgcolor='#f1f1f1' colspan='2' align='center'><font face='verdana, arial, helvetica' size='2' align='center'>
<input type='submit' value='Submit'> <input type='reset' value='Reset'>
</font></td> </tr>
<tr> <td bgcolor='#ffffff' ><font face='verdana, arial, helvetica' size='2' align='center'> <a href='signup.php'>New Member Sign UP</a></font></td> <td bgcolor='#ffffff' align='center'><font face='verdana, arial, helvetica' size='2' >
Forgot Password ?</font></td></tr>
<tr> <td bgcolor='#f1f1f1' colspan='2' align='center'><font face='verdana, arial, helvetica' size='2' align='center'>
</font></td> </tr>
</table></center></form>
</body>
</html>
Login Check
<?
include "session.php";
include "Connect.php";
?>
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<title>(Type a title for your page here)</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<?
$userid=mysql_real_escape_string($userid);
$password=mysql_real_escape_string($password);
if($rec=mysql_fetch_array(mysql_query("SELECT * FROM plus_signup WHERE userid='$userid' AND password = '$password'"))){
if(($rec['userid']==$userid)&&($rec['password']==$password)){
$_SESSION[userid]=$userid;
$_SESSION[password]=$password;
echo "<p class=data> <center>Successfully, $_SESSION[userid] Logged in<br><br><a href='logout.php'> Log OUT </a><br><br><a href=welcome.php>Click here if your browser is not redirecting automatically or you don't want to wait.</a><br></center>
<table width=200 border=1>
<tr>
<th scope=col>Money</th>
<th scope=col> </th>
<th scope=col> </th>
<th scope=col> </th>
</tr>
<tr>
<th scope=row> </th>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<th scope=row> </th>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<th scope=row> </th>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<th scope=row> </th>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>";
}
}
else {
session_unset();
echo "<font face='Verdana' size='2' color=red>Wrong Login. Use your correct Userid and Password and Try <br><center><input type='button' value='Retry' onClick='history.go(-1)'></center>";
}
?>
<center>
</body>
</html>
Main Page
<?php include "session.php";?>
<title>WOTA-Main Room</title>
<?php include "Connect.php";?>
<link href="My First CSS.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
background-color: #000000;
}
-->
</style></head>
<body>
<div id="header">
<?php include ("menu.php")?></div>
<div id="SideBar">
<?php include ("Links.php")?>
</div>
<div id="Body">
<?
$userid=mysql_real_escape_string($userid);
$password=mysql_real_escape_string($password);
$_SESSION[userid]=$userid;
$_SESSION[password]=$password;
if($rec=mysql_fetch_array(mysql_query("SELECT * FROM wota WHERE userid='$userid' AND password = '$password'"))){
if(($rec['userid']==$userid)&&($rec['password']==$password)){
$_SESSION[userid]=$userid;
$_SESSION[password]=$password;
$updatetotalpop="UPDATE wota SET totalpop=lowerclasspop+middleclasspop+upperclasspop WHERE userid='$_SESSION[userid]'";
mysql_query($updatetotalpop) or die("error displaying total population. Please report to Admin");
$updatetotalemployment="UPDATE wota SET totalunemployment=lowerclassunemployment+middleclassunemployent+upperclassunemployment WHERE userid='$_SESSION[userid]'";
mysql_query($updatetotalemployment) or die("error displaying total unemployment. Please report to Admin");
mysql_connect($servername,$dbusername,$dbpassword);
@mysql_select_db("$dbname");
$userstats="SELECT * FROM $table WHERE userid='$_SESSION[userid]'";
$userstats2=mysql_query($userstats);
$userstats3=mysql_fetch_array($userstats2);
echo "<p class=data> <center>Welcome Commander $_SESSION[userid]!
<br>Resources";
print "<table width='700' border='0'>
<th width=120 bgcolor=#999999><FONT SIZE=1>Gold</FONT></th>
<th width=120 bgcolor=#999999>
<FONT SIZE=1 >$userstats3[gold]</FONT>
<th width=300 bgcolor=#999999></th>
<th width=120 bgcolor=#999999><FONT SIZE=1>Wood</FONT></th>
<th width=120 bgcolor=#999999><FONT SIZE=1>$userstats3[wood]</FONT></th>
</tr>
<tr>
<th width=120 bgcolor=#333333><FONT SIZE=1>Food</FONT></th>
<th width=120 bgcolor=#333333><FONT SIZE=1>$userstats3[food]</FONT></th>
<th width=260 bgcolor=#333333></th>
<th width=120 bgcolor=#333333><FONT SIZE=1>Stone</FONT></th>
<th width=120 bgcolor=#333333><FONT SIZE=1>$userstats3[stone]</th>
</tr>
</table>
<table width=700>
<th width=700 bgcolor=#999999> Population </th>
</tr>
</table>
<table width=700>
<th width=100 bgcolor=#3333333><FONT SIZE=1>Total Population</FONT></th>
<th width=120 bgcolor=#333333>
<FONT SIZE=1 bgcolor=#333333>$userstats3[totalpop]</FONT>
<th width=260 bgcolor=#333333></th></th>
<th width=120 bgcolor=#333333><FONT SIZE=1>Lowerclass Population</FONT></th>
<th width=120 bgcolor=#33333><FONT SIZE=1>$userstats3[lowerclasspop]</FONT></th>
</tr>
<tr>
<th width=120 bgcolor=#999999><FONT SIZE=1>Middleclass Population</FONT></th>
<th width=120 bgcolor=#999999><FONT SIZE=1>$userstats3[middleclasspop]</FONT></th>
<th width=260 bgcolor=#999999></th>
<th width=120 bgcolor=#999999><FONT SIZE=1>Upperclass Population</FONT></th>
<th width=120 bgcolor=#999999><FONT SIZE=1>$userstats3[upperclasspop]</th>
</tr>
</table>
<table width=700>
<tr>
<th width=700 bgcolor=#999999> Employment </th>
</tr>
</table>
<table width=700>
<tr>
<th width=100 bgcolor=#3333333><FONT SIZE=1> Total Unemployment</FONT></th>
<th width=120 bgcolor=#333333>
<FONT SIZE=1 bgcolor=#333333>$userstats3[totalunemployment]</FONT>
<th width=260 bgcolor=#333333></th></th>
<th width=120 bgcolor=#333333><FONT SIZE=1>Lowerclass Unemployment</FONT></th>
<th width=120 bgcolor=#33333><FONT SIZE=1>$userstats3[lowerclassunemployment]</FONT></th>
</tr>
<tr>
<th width=120 bgcolor=#999999><FONT SIZE=1>Middleclass Unemployment</FONT></th>
<th width=120 bgcolor=#999999><FONT SIZE=1>$userstats3[middleclassunemployent]</FONT></th>
<th width=260 bgcolor=#999999></th>
<th width=120 bgcolor=#999999><FONT SIZE=1>Upperclass Unemployment</FONT></th>
<th width=120 bgcolor=#999999><FONT SIZE=1>$userstats3[upperclassunemployment]</th>
</tr>
";
}
}
else {
session_unset();
echo "<font face='Verdana' size='2' color=red>Wrong Login. Use your correct Userid and Password and Try <br><center><input type='button' value='Retry' onClick='history.go(-1)'></center>";
}
?>
</div>
</body>
</html>