Since I'm quite the newbie at PHP I used a Login script that seemed rather good, I kept on finding it on multiple sites and it seemed to be used alot, here's the url where I found it :
http://www.free2code.net/tutorials/programming/php/4/phplogin.php
I tried finding the answer and coded this in many ways but they all seem to fail once I start fetching information from my query and into my array. It just removes my active $SESSION. I'll get the table displayed once and then it would just remove my $SESSION entirely. I'm don't see any unsetting or anything and cannot tweak my php.ini since I'm not the host.
Here is the code:
<html>
<body bgcolor="#FFFFFF" text="#000000">
<?php
require 'db_connect.php';
echo '<pre>';
print_r($_SESSION);
echo '</pre>';
if($logged_in == 1 and $_SESSION[harpers_member] > 1) {
$memberrank = $_SESSION['harpers_member'];
// QUERY
$sql = "SELECT username, show_email, email, location, harpers_member, handle, charname, status FROM lsusers WHERE harpers_member < '$memberrank';";
$req = mysql_query($sql);
if (!$req) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
// Setup the table
echo "\t<form name=\"form1\" method=\"post\" action=\"\">\n";
echo "<table width=200 border=0>\n";
echo "\t<tr bgcolor=#999999>\n";
echo "\t<td width=5>username</td>\n";
echo "\t<td width=7>email</td>\n";
echo "\t<td width=10>location</td>\n";
echo "\t<td width=5>Member</td>\n";
echo "\t<td width=7>handle</td>\n";
echo "\t<td width=7>charname</td>\n";
echo "\t<td width=35>status</td>\n";
echo "\t</tr>\n";
for($usercount=0; $usercount<mysql_num_rows($req); $usercount++)
{
$data = mysql_fetch_assoc($req);
//The problem starts here!!! XD
$username = $data['username'];
if($data['show_email'] == '1'){
$email = $data['email'];
}
else {
$email = '-private-';
}
$location = $data['location'];
$harpers_member = $data['harpers_member'];
$handle = $data['handle'];
$charname = $data['charname'];
$status = $data['status'];
}
echo "\t</table>\n";
echo "\t\t<input type=\"submit\" name=\"Submit\" value=\"Update\">\n";
echo "\t</form>\n";
// Close the connection
mysql_free_result($req);
mysql_close();
}
else{
echo "\t Log in \n";
}
?>
</body>
</html>
Thanks to anyone who can fix this problem 😃