tomfmason Posted July 5, 2006 Share Posted July 5, 2006 I have fumbling around with this for awhile..lol. I organily was trying to make this alot more complaicted then it needed to be see [url=http://www.phpfreaks.com/forums/index.php/topic,99502.0.html]http://www.phpfreaks.com/forums/index.php/topic,99502.0.html[/url] for more information about my past issues on this subject.I tried everything that I could think of to hide the login process and came up with nothing, untill now. I had a great idea, why not post to it's self. Well I thought that would work but no. I think I am real close to it working. Here is the script.[code]<?phpif (isset($_POST['login'])){ session_start(); header("Cache-control: private"); $user = $_POST['username']; $pass = $_POST['password']; include("db.php"); $sql_user_check = "SELECT id, access, username FROM users WHERE username='$user' AND password = '".md5($pass)."'"; $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 = "Wrong username/password"; } else { $text = mysql_fetch_array($result_name_check); $id = $text['id']; $access = $text['access']; $_SESSION['username'] = $text['username']; header('Location: http://www.owpt.biz/account.php?'.SID); echo '<html><head><title>Redirecting</title></head>'; echo '<body><a href="http://www.owpt.biz/account.php?'.SID.'">Continue</a></body></html>'; exit; }}$filename = "login.php";$title = "Login";$content= " <form action=\"test_login.php\" method=\"post\"> <label>   login</label> <p>    <input type=\"text\" name=\"username\" size=\"20\" maxlength=\"15\" value=\"username\"> </p> <p>    <input type=\"password\" name=\"password\" size=\"20\" maxlength=\"15\" value=\"password\"> </p> <p>    <input name=\"goButton1\" type=\"submit\" value=\"go\" alt=\"go\"> </p> </form>";include('includes/main.php'); ?>[/code]Any suggestions would be great. Quote Link to comment https://forums.phpfreaks.com/topic/13737-login-script-not-logining-in/ Share on other sites More sharing options...
micah1701 Posted July 5, 2006 Share Posted July 5, 2006 a suggestion, put session_start(); at the top of the page, regardless of whether or not the user is loggin in or not. The session has to be called before the rest of the script. Don't know if that will solve your problem, but its a start. Quote Link to comment https://forums.phpfreaks.com/topic/13737-login-script-not-logining-in/#findComment-53339 Share on other sites More sharing options...
tomfmason Posted July 5, 2006 Author Share Posted July 5, 2006 I tried that and nothing. I am ??? at this point. Quote Link to comment https://forums.phpfreaks.com/topic/13737-login-script-not-logining-in/#findComment-53347 Share on other sites More sharing options...
karthikeyan_coder Posted July 5, 2006 Share Posted July 5, 2006 [code] $sql_user_check = "SELECT id, access, username FROM users WHERE username='$user' AND password = '".md5($pass)."'";[/code]Try to echo this variable $sql_user_check ... and check it with your database manually...Thank you,Karthi Keyan. Quote Link to comment https://forums.phpfreaks.com/topic/13737-login-script-not-logining-in/#findComment-53427 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.