trq Posted August 5, 2008 Share Posted August 5, 2008 I don't get a DB error anymore Likely because the error supressors are back in place. Remove them! Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-608243 Share on other sites More sharing options...
webguync Posted August 5, 2008 Author Share Posted August 5, 2008 I removed them, but still the same result :-( Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-608245 Share on other sites More sharing options...
trq Posted August 5, 2008 Share Posted August 5, 2008 Then the records do not exist. Are you sure all field names are correct? Try this... <?php error_reporting(E_ALL); ini_set('display_errors','1'); if (isset($_POST['Submit'])) { //connect to MySQL and select database to use //set up database and table names $db_name ="shadowdata"; $table_name ="RegistrationForm"; // connect to MySQL and select database to use $connection = mysql_connect("localhost","username","password") or die(mysql_error()); $db = mysql_select_db($db_name) or die(mysql_error()); $username = mysql_real_escape_string($_POST['loginemail']); $userpw = mysql_real_escape_string($_POST['loginpw']); $sql = "SELECT loginemail,loginpw FROM RegistrationForm WHERE loginemail = '$username' AND loginpw = '$userpw'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { session_start(); $_SESSION['logged'] = true; header("Location: console.php"); } else { header("Location: index.php?error=x"); } } else { echo "Query failed<br />" . mysql_error() . "<br />$sql"; } } ?> Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-608248 Share on other sites More sharing options...
revraz Posted August 5, 2008 Share Posted August 5, 2008 Are your PW's encrypted in the DB? Because you are not encrypting them when you check it. Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-608318 Share on other sites More sharing options...
webguync Posted August 5, 2008 Author Share Posted August 5, 2008 I will give it another try this evening. No the passwords are not encrypted in the DB. Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-608591 Share on other sites More sharing options...
webguync Posted August 6, 2008 Author Share Posted August 6, 2008 I don't get the Query failed error, but I do get the error page, even though the user name and password I am entering is in the database. Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-609183 Share on other sites More sharing options...
revraz Posted August 6, 2008 Share Posted August 6, 2008 echo them both out and see why they don't match Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-609298 Share on other sites More sharing options...
webguync Posted August 6, 2008 Author Share Posted August 6, 2008 can you provide a quick example of what you are referring to? Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-609648 Share on other sites More sharing options...
webguync Posted August 7, 2008 Author Share Posted August 7, 2008 for some reason I am still just getting a blank white page even though errors should be displaying. Not sure where the error is. Any help? <?php error_reporting(E_ALL); ini_set('display_errors','1'); if (isset($_POST['Submit'])) { //connect to MySQL and select database to use //set up database and table names $db_name ="shadowdata"; $table_name ="RegistrationForm"; // connect to MySQL and select database to use $connection = mysql_connect("localhost","username","PW") or die(mysql_error()); $db = mysql_select_db($db_name) or die(mysql_error()); $username = mysql_real_escape_string($_POST['loginemail']); $userpw = mysql_real_escape_string($_POST['loginpw']); $sql = "SELECT loginemail,loginpw FROM RegistrationForm WHERE loginemail = '$username' AND loginpw = '$userpw'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { session_start(); $_SESSION['logged'] = true; header("Location: console.php"); } else { header("Location: index.php?error=x"); } } else { echo "Query failed<br />" . mysql_error() . "<br />$sql"; } } ?> Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-610282 Share on other sites More sharing options...
webguync Posted August 7, 2008 Author Share Posted August 7, 2008 any ideas on this? Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-610706 Share on other sites More sharing options...
trq Posted August 7, 2008 Share Posted August 7, 2008 Were going to need to place some echo's in the script to debug. <?php error_reporting(E_ALL); ini_set('display_errors','1'); echo "script called<br />" if (isset($_POST['Submit'])) { echo "Within the if<br />"; //connect to MySQL and select database to use //set up database and table names $db_name ="shadowdata"; $table_name ="RegistrationForm"; // connect to MySQL and select database to use $connection = mysql_connect("localhost","username","PW") or die(mysql_error()); $db = mysql_select_db($db_name) or die(mysql_error()); $username = mysql_real_escape_string($_POST['loginemail']); $userpw = mysql_real_escape_string($_POST['loginpw']); $sql = "SELECT loginemail,loginpw FROM RegistrationForm WHERE loginemail = '$username' AND loginpw = '$userpw'"; if ($result = mysql_query($sql)) { echo "Query success<br />"; if (mysql_num_rows($result)) { echo "Match found<br />"; session_start(); $_SESSION['logged'] = true; //header("Location: console.php"); } else { echo "No match found<br />"; //header("Location: index.php?error=x"); } } else { echo "Query failed<br />" . mysql_error() . "<br />$sql"; } } ?> What does that produce? Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-610736 Share on other sites More sharing options...
webguync Posted August 8, 2008 Author Share Posted August 8, 2008 i'm not sure where the error is b/c i just get a blank white page still :-( Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-611234 Share on other sites More sharing options...
trq Posted August 8, 2008 Share Posted August 8, 2008 What is the name of this script? And can we see your form? Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-611251 Share on other sites More sharing options...
webguync Posted August 8, 2008 Author Share Posted August 8, 2008 login.php can be found here: http://www.shadowmarket.com/real-estate/x/login.php here is the form script <? include('x.php'); $error = $_REQUEST['error']; ?><br> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <? include('header_admin.php') ?> <body> <div align="center"> <table width="750" border="1" align="center" cellpadding="0" bordercolor="#000000" bgcolor="#FFFFFF"> <tr> <td bordercolor="#FFFFFF"><div align="center"> <table width="750" border="0" align="center" cellpadding="5" bordercolor="#FFFFFF" bgcolor="#FFFFFF"> <tr> <td colspan="2"><div align="center"><img src="../template_images/x_top.gif" width="750" height="75"></div></td> </tr> <tr> <td colspan="2" valign="top"><? include('menu.php'); ?></td> </tr> <? if($logout) { print"<tr bgcolor='#CCFF00'>"; } elseif($error) { print"<tr bgcolor='#FF0000'>"; } else { print"<tr>"; } ?> <td colspan="2" valign="top"><div align="center"> <table width="100%" border="1" align="center" cellpadding="0" bordercolor="#999999" bgcolor="#FFFFFF"> <tr> <td valign="top" bordercolor="#FFFFFF" bgcolor="#eeeeee"><div align="center" class="style1">System Administration <? include('xver.txt');?> Console</div></td> </tr> </table> <form action="login.php" method="post" name="xconsole" id="xconsole"> <table width="100%" border="1" align="center" cellpadding="0" bordercolor="#999999" bgcolor="#FFFFFF"> <tr> <td width="25%" bordercolor="#FFFFFF"><div align="right" class="style4"> <? if($logout == "x") { print"<b>Log Out X Console = Success !</b>"; } if($error) { print"<b>X Console Login = Error !</b>"; } if($logout == "y") { print"<b>Log Out X Console = Success ! Login Updated</b>"; } ?> </div></td> <td width="25%" bordercolor="#FFFFFF"><div align="right"><span class="style4">Email Address </span></div></td> <td width="50%" bordercolor="#FFFFFF"><div align="left" class="style4"> <input name="loginemail" type="text" id="q"> </div></td> </tr> <tr> <td colspan="2" bordercolor="#FFFFFF"><div align="right" class="style4">Password</div></td> <td valign="top" bordercolor="#FFFFFF"><div align="left" class="style4"> <input name="loginpw" type="password" id="t"> </div></td> </tr> </table> <br> <input type="submit" name="Submit" value="X Console Login"> <br> </form> </div></td> </tr> <tr> <td width="448"><div align="center" class="style9"> <div align="left"><a href="http://www.listingagent.ca" target="_blank"> <? print"$fc"; ?> : Installed Version # <? include('ver.txt'); include('xver.txt');?></a></div> </div></td> <td width="290"><div align="center" class="style9"> <div align="right"><a href="index.php"><? print"$x_console"; ?></a></div> </div></td> </tr> </table> </div></td> </tr> </table> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-611254 Share on other sites More sharing options...
webguync Posted August 8, 2008 Author Share Posted August 8, 2008 any ideas on what is wrong here? Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-611656 Share on other sites More sharing options...
webguync Posted August 8, 2008 Author Share Posted August 8, 2008 anyone? Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-611989 Share on other sites More sharing options...
webguync Posted August 9, 2008 Author Share Posted August 9, 2008 help! Link to comment https://forums.phpfreaks.com/topic/117982-need-assistance-with-authenticating-username-and-pw/page/2/#findComment-612170 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.