|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-07-18 14:30 UTC] sniper@php.net
[2002-07-20 04:02 UTC] georg@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 05:00:01 2025 UTC |
Hi, I tried it on many PHP forums but with no answers I am making a login page, but as soon as I login I receive an error message saying: "Error in query: select username, md5(password) from tblusers where tblusers.username = 'ADMINISTRATOR' and md5(tblusers.password) = '6c84cbd30cf9350a990bad2bcc1bec5f' No Database Selected" The problem is the database table exsists (of courses I figured that one myself), and when I query the same query in mysql I dont recieve an error. This problem happens at random; sometimes I can log in, which makes the problem more frustrating (sometimes I also receive the following popup error:APACHE caused an invalid page fault in module PHP4TS.DLL at 015f:100ddfc1. Registers: ....) Here is the scource code below: ------------------------------------------------------------------- <?php require_once('scripts/sessions.php'); ?> <?php require_once('Connections/OfficeBox.php'); ?> <? if($_POST['signal']!="") { $logusername = $_POST['username']; $logpassword = $_POST['encrypt']; $query = "select username, md5(password) from tblusers where tblusers.username = '$logusername' and md5(tblusers.password) = '$logpassword'"; $result = mysql_query($query) or die ("Error in query: $query " . mysql_error() ); $numrows = mysql_num_rows($result); if($numrows == 0) { header("Location: logoninvalid.php"); exit; } else { $_SESSION['sessusername'] = $logusername; header("Location: logonok.php"); exit; } mysql_close($connection); } else{ ?> <?php <html> <head> <title>logon</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <SCRIPT language=JavaScript src="scripts/md5.js"></SCRIPT> <SCRIPT LANGUAGE=JavaScript> <!-- var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1; function myFlash_DoFSCommand(command, args) { var argv = String(args).split(","); var argc = argv.length; var gebruiker = argv[0]; var wachtwoord = argv[1]; //alert ("You entered: " + strInput); document.form1.username.value = gebruiker; document.form1.password.value = wachtwoord; document.form1.encrypt.value = calcMD5(wachtwoord); var myFlashObj = InternetExplorer ? myFlash : document.myFlash; //alert ("You entered: " + args); } if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) { document.write('<SCRIPT LANGUAGE=VBScript\> \n'); document.write('on error resume next \n'); document.write('Sub myFlash_FSCommand(ByVal command, ByVal args)\n'); document.write(' call myFlash_DoFSCommand(command, args)\n'); document.write('end sub\n'); document.write('</SCRIPT\> \n'); } //--> </SCRIPT> <body bgcolor="#cccccc" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <div align="center"> <table width="100%" height="100%" border="0" align="center"> <tr> <td><div align="center"> <p> <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="600" height="400" name="myFlash" id="myFlash"> <param name="movie" value="logon.swf"> <param name="quality" value="high"> <param name=bgcolor value=#FFFFFF> <embed src="logon.swf" quality="high" bgcolor=#FFFFFF pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="600" height="400" name="myFlash" swliveconnect=true> </embed></object> </p> <form name="form1" method="post" action="<? echo $PHP_SELF; ?>"> <input name="username" type="hidden" id="username"> <input name="password" type="hidden" id="password"> <input name="signal" type="hidden" id="signal" value="signal"> <input name="encrypt" type="hidden" id="encrypt"> </form> <p> </p> </div></td> </tr> </table> </div> </body> </html> <?php } ?> --------------------------------------------------------------------------- My connection file looks like: ------------------------------------------------------------------------- <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_OfficeBox = "localhost"; $database_OfficeBox = "Systemapp"; $username_OfficeBox = "root"; $password_OfficeBox = ""; $OfficeBox = mysql_pconnect($hostname_OfficeBox, $username_OfficeBox, $password_OfficeBox) or die(mysql_error()); ?> --------------------------------------------------------------------- MD5 in the query is not the problem. Mysql excepts the query (I ran the query from within mysql for testpurposes) Furthermore most of the time it does except my password. Something about the script itself:this script encrypts(using md5) the form passwordfield through javascript. When it is encrypted it checks it with the encrypted value from the database. (so in the mysql database the password is just common and readable) I installed apache_1.3.26-win32-x86-no_src.exe and php-4.3.0-dev-zend2-win32-alpha2.zip I am using windows98 kind regards Patrick