tomfmason Posted July 5, 2006 Share Posted July 5, 2006 This is a very simple script. I have had all sorts of trouble with createing a login script but so far nothin has worked. Here is the simple script in question. This is the script that I get the error with.[code]<?phpheader('Location: http://www.owpt.biz/account.php?'.SID');?>[/code]I use the following login script [code]<?phpsession_start();header("Cache-control: private");$user = $_POST['username'];$pass = $_POST['password'];include("db.php");$sql_user_check = "SELECT username FROM users WHERE username='$user'";$result_name_check = mysql_query($sql_user_check) or die(mysql_error());$usersfound = mysql_num_rows($result_name_check) or die(mysql_error());if($usersfound < 1){ $error = "User ".$user." was not found in the database."; $user = $_POST['username']; $pass = md5($_POST['password']); $sql = "select * from users where `username` = '$user'"; $result = mysql_query($sql); while ($text = mysql_fetch_array($result)) { $id = $text['id']; $password = $text['encrytpass']; $access = $text['access']; } if ($pass == $password) { $error = "Wrong Username / Password <a href=\"../index.php\">Back</a>"; }else{ $_SESSION['username'] = $user_info['username']; }}if(!$_SESSION['username']){ if($error){ echo $error; include("index.php"); }else{ include("header.php"); } }else{ echo "<html><head><title>Welcomce Back</title></head>Welcome back ". $_SESSION['username'] .".<a href=index.php>Click here</a> to proceed."; }?>[/code]I am wanting to pass the session id to account.php and at the same time hide the backend login process. I have tried several ways to acheive this.I was also thinking, for security reasons I should maybe through in another session_start() in the header.php. Any suggestions would be great. Quote Link to comment Share on other sites More sharing options...
shocker-z Posted July 5, 2006 Share Posted July 5, 2006 <?phpheader('Location: http://www.owpt.biz/account.php?'.SID');?>try<?phpheader('Location: http://www.owpt.biz/account.php?'.SID);?>you had a ' after SIDRegardsLiam Quote Link to comment Share on other sites More sharing options...
tomfmason Posted July 5, 2006 Author Share Posted July 5, 2006 Thanks but now I get the standard header error. I think I will try a javascript do I need to pass the SID when I do this javascript? Quote Link to comment Share on other sites More sharing options...
trq Posted July 5, 2006 Share Posted July 5, 2006 You don't really need to pass the SID when your using sessions unless your specifically targetting users who disable cookies.Also, there are better workarounds for header area's the resorting to javascript. read the sticky at the top of this forum. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.