dubt2nv Posted November 27, 2006 Share Posted November 27, 2006 i basically have a log-in page where a user can log in to get into a maintenance area that isnt permitted to the public....when i log in it goes through a process login script php file;[code]<?phpsession_start();header("Cache-control: no-cache");//this includes the database connectioninclude("database.inc");//Get the user's input from the form $username = trim($_POST['user']);//Get the user's input from the form $password = trim($_POST['pass']);//check username and password are correct$users_query = "SELECT * FROM user where username = '$user' AND password = '$pass'";//echo $users_query;$mysql_result=mysql_query($users_query,$conn);$row=mysql_fetch_row($mysql_result);//if valid user doesnt exist set the error message and redirect to badlogin pageif ($row[0]==""){//echo "nooo";header("Location: http://kieren.classroomonline.info/Kieren%20Lollback/error.htm");}else{//if valid user exists set all the session variables//$row is the record, [3] is the 3rd element(field) in the array$_SESSION['Level']=$row[1];//redirect to the page you want to allow the user to access//echo "yesss";header("Location: http://kieren.classroomonline.info/Kieren%20Lollback/index.htm");}?>[/code]but then when i get to the page after log-in it seems as though the page isnt secured...even though i have a security.inc file;[code]<?phpsession_start();if ($Level == "Admin") { header("Location: http://kieren.classroomonline.info/Kieren%20Lollback/index.htm");}elseif ($Level == "Owner") { header("Location: http://kieren.classroomonline.info/Kieren%20Lollback/awareness2.htm");}?>[/code]WHERE AM I GOING WRONG..... and each page has the security include title at the start...[code]<?php include("security.inc");?>[/code] Link to comment https://forums.phpfreaks.com/topic/28623-sessions-problem/ Share on other sites More sharing options...
trq Posted November 27, 2006 Share Posted November 27, 2006 Where do you define $Level? should be...[code=php:0]if ($_SESSION['Level'] == "Admin") {[/code] Link to comment https://forums.phpfreaks.com/topic/28623-sessions-problem/#findComment-130934 Share on other sites More sharing options...
dubt2nv Posted November 28, 2006 Author Share Posted November 28, 2006 on which page and where?? Link to comment https://forums.phpfreaks.com/topic/28623-sessions-problem/#findComment-131572 Share on other sites More sharing options...
Cagecrawler Posted November 28, 2006 Share Posted November 28, 2006 [code]//$row is the record, [3] is the 3rd element(field) in the array$_SESSION['Level']=$row[1];[/code]Should the [1] be [3], or have you changed the code and not the comment?Thorpe is referring to your security.inc file, but I think the answer he is looking for is the bit of code in my post. Link to comment https://forums.phpfreaks.com/topic/28623-sessions-problem/#findComment-131583 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.