Nieuw lid |
|
Hallo iedereen,
Ik heb een probleem met mijn session dit is het script waarmee hij de sessie aanmaakt.
if(isset($_POST['submit'])) {
$U = $_POST['user'];
$P = md5($_POST['pass']);
//Account check
$sql1="SELECT * FROM seven_ORA.dbo.UserInfo WHERE Account='$U' AND MD5PassWord='$P' AND [Right] > 0";
$rs1=mssql_query($sql1);
$select = mssql_fetch_row($rs1);
if (!$rs1){exit("Error in SQL");}
$count = mssql_num_rows($rs1);
$acces = $select ['[Right]'];
if($count == 1)
{
$_SESSION['username'] = $U;
$_SESSION['accesslevel'] = $acces;
print("Logged in..... Click <a href=content/panel.php><strong>here</strong></a>");
}
else
{
die('Access Denied');
}
}
if(isset($_POST['submit'])) { $U = $_POST['user']; $P = md5($_POST['pass']); //Account check $sql1="SELECT * FROM seven_ORA.dbo.UserInfo WHERE Account='$U' AND MD5PassWord='$P' AND [Right] > 0"; $rs1=mssql_query($sql1); $select = mssql_fetch_row($rs1); if (!$rs1){exit("Error in SQL");} $count = mssql_num_rows($rs1); $acces = $select ['[Right]']; if($count == 1) { $_SESSION['username'] = $U; $_SESSION['accesslevel'] = $acces; print("Logged in..... Click <a href=content/panel.php><strong>here</strong></a>"); } else { } }
En met deze code haal ik het weer op.
session_start();
if (isset($_SESSION['username']))
//If we are already logged into an active session
$username = $_SESSION['username'];
$accesslevel = $_SESSION['accesslevel'];
echo"<span class='normal'>You are already logged in as $username! with $accesslevel</span>";
if (isset($_SESSION['username'])) //If we are already logged into an active session $username = $_SESSION['username']; $accesslevel = $_SESSION['accesslevel']; echo"<span class='normal'>You are already logged in as $username! with $accesslevel</span>";
Maar wat het probleem nou is dat hij de sessie acceslevel niet aanmaakt of niet goed terug leest.
Kunnen jullie een probleem vinden?
Alvast bedankt,
Smurf
|