sessions of doom
Posted: Sat Jan 29, 2005 9:34 pm
ok i set sessions on the 1st page everything works yes. now i move over from index.php (were i set the sessions) and im trying to cary those sessions over to profile.php. well if u toss in session_start()l in profile the sessions work but other things in the file just dont work at all but if i take out the session stuff the file works perfectly fine. here is what i got
Code: Select all
<? ob_start(); include('config.php'); session_start();
$username2 = mysql_real_escape_string($user);
trim($username2);
$query = mysql_query("SELECT * FROM users WHERE username='$username2'", $connect);
while ($info = mysql_fetch_assoc($query)){
$username2 = $infoї'username'];
$joindate = $infoї'joindate'];
$title = $infoї'title'];
$validate = $infoї'validate'];
$access_level = $infoї'access_level'];
echo '
<tr><th>Name:</th><td>'.$username2.'</td></tr>
<tr><th>Joined:</th><td>'.$joindate.'</td></tr>
<tr><th>Title:</th><td>'.$title.'</td></tr>
<tr><th>Status:</th><td>';
if ($validate == "0"){
echo 'awaiting validation';
}elseif ($access_level == "0"){
echo 'banned';
}elseif ($access_level == "1"){
echo 'member';
}elseif ($access_level == "2"){
echo 'admin';
}
echo '</td></tr>
';
}
echo '</table></div><br>';
if (($_SESSIONї'level'] == "1")) {
echo '
<form action="profile.php?u='.$username2.'" method="post">
Admin Actions for User
<br>
Set status to: <br>
<input type="radio" name="access" value="0">Banned<br>
<input type="radio" name="access" value="1">Regular user<br>
<input type="radio" name="access" value="2">Admin<br>
<br><br><br>
Change user''s title to:
<input type="text" name="title" value=""><br><br>
<input type="submit" name="submit" value="submit">
</form>';
}
if (isset($u) && $_SESSIONї'level'] == "1"){
if (isset($_POSTї'type'])){
$query = mysql_query("UPDATE users SET access_level='$access' WHERE username='$u'", $connect);
}
if ($title != ''){
$query2 = mysql_query("UPDATE users SET title='$title' WHERE username='$u'", $connect);
}
header("location: profile.php?user=$u");
}
?>