silver32 Posted July 20, 2006 Share Posted July 20, 2006 Maybe this is most likely related to mysql than php, if mods think so please move it.Ok, I gave much effort to develop this browser based game, I Developed it and tested in my PC server running PHP & mysql with windows but after uploading the files to a linux/unix server I got a serious problem.The code below is for a login form, in my windows pc server everything worked fine when I entered a valid login name and password that actually existed in the mysql database. When I decided to launch the game I uploaded the script in various server but I always have the same problem, I dont know if it is the configuration of the server or the OS or something. I always get a login ID doesnt exist error, but it DOES. As I mentioned no such error on my server with the same script. Can someone carefully check the code and detect any problems with it? If you believe the answer is not here please reply with request for more information.[code]include("Config.php");include("System/Included/md5.php");$do = stripslashes($_REQUEST['do']);if ($do == Login){$name = $_POST["name"];$pass = $_POST["pass"];include_once('sql_check.php');check_inject();if ((eregi("[^a-zA-Z0-9_-]", $name)) || (eregi("[^a-zA-Z0-9_-]", $pass)) ){die("SQL Injection Detected. Make sure to ONLY use letters (a-Z) and numbers (0-9)!");}$sql_username_check = mysql_query("SELECT Login FROM Account WHERE Login='$name'");$username_check = mysql_fetch_row($sql_username_check);$sql_pass = mysql_query("SELECT Password from `Account` Where Login='$name'");$enc_pass = mysql_fetch_row($sql_pass);$dec_pass = md5_decrypt( $enc_pass[0], "*****" );$cookie_pass = md5_encrypt( $pass, "*****" );if (empty($name) || empty($pass) ) {echo "Some fields were left blank.<br>"; }if ($username_check[0] == NULL){ die("The Login ID you entered doesn't exist.<br>"); }if ($extcode != $extcode1) {die("The code you entered doesn't match with the original."); }if ($pass == $dec_pass){ setcookie("name", $name);setcookie("pass", $cookie_pass);echo '<meta http-equiv="refresh" content="0; url=SelectChar.php">';}[/code]Thanks in advance. Quote Link to comment Share on other sites More sharing options...
ChaosXero Posted July 20, 2006 Share Posted July 20, 2006 add an or die(mysql_error()) to your mysql lines and see if it's reaching the database or not. Make sure your database info is all the same including server name/ip etc... and that the tables are exactly the same too. Quote Link to comment Share on other sites More sharing options...
silver32 Posted July 20, 2006 Author Share Posted July 20, 2006 Thanks, havent thought to check the table names :P thanks a lot Quote Link to comment Share on other sites More sharing options...
nesargha Posted September 8, 2006 Share Posted September 8, 2006 hi, i wanted to know how to use the "md5_encrypt and md5_decrypt" which u are using in login form code. is there any class or include file by including which we can use the above function. sorry if am barging into the topic. i just wanted to know how can i encrypt and decrypt a string.nesargha Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 8, 2006 Share Posted September 8, 2006 md5 is a one way street and can not be decoded and used for passwords mainly but also can be used for other things ok.example[code]<?php$password="redarrow21345675432";$encoded=md5($password);echo $encoded;?>[/code]echoed result[code]c26afe4c5e3e01fcd6929bc71e406e56[/code] Quote Link to comment Share on other sites More sharing options...
Jenk Posted September 8, 2006 Share Posted September 8, 2006 [code=php:0]if ($do == Login)[/code]should be:[code=php:0]if ($do == 'Login')[/code]and [code=php:0]$do = stripslashes($_REQUEST['do']);[/code] should be:[code=php:0]function magic_strip($value){ if (get_magic_quotes_gpc()) { $value = stripslashes($value); { return $value;}$do = magic_strip($value);[/code] 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.