kellz Posted November 10, 2007 Share Posted November 10, 2007 I just don't know where the error is, I tried for AGES and deleted lines until i found the error but I still couldn't find it.. ??? <?php if (isset($_POST['Submit'])) login(); function login() { $logged=false; if (isset($_POST['user']) && isset($_POST['pass'])) { $con = mysql_connect("localhost","root",""); if (!$con) die('Could not connect: ' . mysql_error()); mysql_select_db("people", $con); $sql = "SELECT loginName FROM Member WHERE loginName='$_POST[user]' AND password=('$_POST[pass]')"; $result = mysql_query($sql) or die("Couldn't execute query 2."); $num = mysql_num_rows($result); if ($num > 0) { $logged=true; } if ($logged != false) $_SESSION['auth'] = "yes"; } echo $_SESSION['auth']; ?> there's an error on line 42 (ofcourse it isnt on line 42) so there must be an error above that somewhere... edit: OK never mind i fixed it, i forgot a "}" lol but now i get "unknown index auth" ??? edit2: ok i fixed that aswell lol... I should open my eyes! Quote Link to comment Share on other sites More sharing options...
kellz Posted November 10, 2007 Author Share Posted November 10, 2007 errrr NOW there is an error i cant fix! and i guess it's the sql (something I'm useless at) even when I enter the correct username and password it doesn't say "logged in" I don't know why... Quote Link to comment Share on other sites More sharing options...
kopytko Posted November 10, 2007 Share Posted November 10, 2007 If your passwords are md5 encoded, try this: <?php $sql = "SELECT loginName FROM Member WHERE loginName='".$_POST['user']."' AND password='".md5($_POST['pass'])."'"; ?> If not, just remove md5 function. Quote Link to comment Share on other sites More sharing options...
Barand Posted November 11, 2007 Share Posted November 11, 2007 Have you called "session_start()" anywhere on that page? Quote Link to comment Share on other sites More sharing options...
kellz Posted November 11, 2007 Author Share Posted November 11, 2007 It's ok, i fixed it ages ago^^ i cant remember what the problem was but thanks anyway Quote Link to comment Share on other sites More sharing options...
Barand Posted November 11, 2007 Share Posted November 11, 2007 No, it's not OK! See the TOPIC SOLVED button? Use it. 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.