Jay2391 Posted December 14, 2006 Share Posted December 14, 2006 I have a DB call " users " and i have table call "userinfo" and "email" is the primary key password is MD5 encryptionbefore i copy the code my issue is that it dosen't authenticate i get a t_Variable error in line 10and i enter my password and email in a hTML page that send the info to this page ... I tested that pasrt and it echos the right info...can you see what an i doing wrong...<?php session_start(); include("loginfo.php"); $table = 'userinfo'; $email = $_POST['email']; $password = md5($_POST['password']); $wtd = "relogin"; if($wtd == "relogin"){ mysql_pconnect ($host, $user, $pass); mysql_select_db ($database); $query = "SELECT password FROM $table WHERE email='$email' "; $result = mysql_query($query); $row = mysql_fetch_array($result); if($password == $row['password']){ echo "You sre loged In"; }else{ echo "Not loged in"; } }?> Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted December 14, 2006 Share Posted December 14, 2006 Why are you using mysql_pconnect? 99.99% of the time you should use mysql_connect. Additionally, you are not assigning the connection to a variable...[code]$connection = mysql_connect($hostname, $username, $password) or die(mysql_error());[/code] Quote Link to comment Share on other sites More sharing options...
Jay2391 Posted December 14, 2006 Author Share Posted December 14, 2006 Not working !!!! that is juat a variable....I read that pconnect is a constant connection !!! Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted December 14, 2006 Share Posted December 14, 2006 Under certain conditions it is, if you are running php as cgi, then it's not.from http://www.php.net/mysql_pconnect:[quote]Note, that these kind of links only work if you are using a module version of PHP[/quote]Read this page for more details:http://us3.php.net/manual/en/features.persistent-connections.phpDid you even try the code that I gave you? Assuming that your code is exactly as you posted it, then you are getting the error on that line (the mysql_pconnect that is not assigned to a variable). If you haven't tried it, do so. If you have, are you still getting an error? Quote Link to comment Share on other sites More sharing options...
Jay2391 Posted December 14, 2006 Author Share Posted December 14, 2006 no all i get is not logged in ...???here is what i have<?php session_start(); include("loginfo.php"); $table = 'userinfo'; $email = $_POST['email']; $password = md5($_POST['password']); $wtd = "relogin"; if($wtd == "relogin"){ $tc = mysql_connect ($host, $user, $pass); $db = mysql_select_db ($database, $tc); $query = "SELECT password FROM $table WHERE email='$email' "; $result = mysql_query($query); $row = mysql_fetch_array($result); if($password == $row['password']){ echo "You sre loged In"; }else{ echo "Not loged in"; } }?> Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted December 14, 2006 Share Posted December 14, 2006 Add in error checking and an echo to see what the value of $row['password'] is...[code]<?phpsession_start();include("loginfo.php");$table = 'userinfo';$email = $_POST['email'];$password = md5($_POST['password']);$wtd = "relogin";if ($wtd == "relogin") { $tc = mysql_connect($host, $user, $pass) or die(mysql_error()); $db = mysql_select_db($database, $tc) or die(mysql_error()); $query = "SELECT password FROM $table WHERE email='$email'"; $result = mysql_query($query) or die(mysql_error()); $password_check = mysql_result($result, 0); if ($password == $password_check) { echo "You are logged in"; } else { echo "Not logged in: <br />submitted password md5: $password<br />stored password md5: $password_check"; }}?>[/code] Quote Link to comment Share on other sites More sharing options...
Jay2391 Posted December 14, 2006 Author Share Posted December 14, 2006 I got what i was doing wrong i typed pasword on the html authentication page 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.