alexander007 Posted October 2, 2007 Share Posted October 2, 2007 Could someone tell me why this work with my hosting but when I try to test it on Godaddy it doesnt work... Of course I changed the info on config.php for use with new host etc.... <?php include"config.php"; $tbl_name="login"; // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from signup form $username=$_POST['username']; $encrypted_password=md5($password); $password=$_POST['password']; $sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$encrypted_password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $username, $password and redirect to file "menu.php" session_register("username"); session_register("password"); header("location:menu.php"); } else { echo "Wrong Username or Password"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/71464-solved-phpmysql-login-problem-with-godaddy/ Share on other sites More sharing options...
cooldude832 Posted October 2, 2007 Share Posted October 2, 2007 your very in descriptive in saying it doesn't work. Elaborate. Quote Link to comment https://forums.phpfreaks.com/topic/71464-solved-phpmysql-login-problem-with-godaddy/#findComment-359752 Share on other sites More sharing options...
alexander007 Posted October 2, 2007 Author Share Posted October 2, 2007 Sorry...It just tell that the username/password is wrong...BUt I dont know why..the exact code work on the other hosting.. Quote Link to comment https://forums.phpfreaks.com/topic/71464-solved-phpmysql-login-problem-with-godaddy/#findComment-359755 Share on other sites More sharing options...
cooldude832 Posted October 2, 2007 Share Posted October 2, 2007 paste the error Quote Link to comment https://forums.phpfreaks.com/topic/71464-solved-phpmysql-login-problem-with-godaddy/#findComment-359757 Share on other sites More sharing options...
alexander007 Posted October 2, 2007 Author Share Posted October 2, 2007 never mind...the error was here <?php // username and password sent from signup form $username=$_POST['username']; $encrypted_password=md5($password); $password=$_POST['password']; ?> It should be <?php // username and password sent from signup form $username=$_POST['username']; $password=$_POST['password']; $encrypted_password=md5($password); ?> But why in one hosting work one way and the other no? Quote Link to comment https://forums.phpfreaks.com/topic/71464-solved-phpmysql-login-problem-with-godaddy/#findComment-359759 Share on other sites More sharing options...
cooldude832 Posted October 2, 2007 Share Posted October 2, 2007 it shouldn't as the variable $password isn't delcared at that line Quote Link to comment https://forums.phpfreaks.com/topic/71464-solved-phpmysql-login-problem-with-godaddy/#findComment-359768 Share on other sites More sharing options...
sKunKbad Posted October 2, 2007 Share Posted October 2, 2007 I have some godaddy sites, and yes they do have a unique type of database login. Don't ask why, it's just the way it is. Quote Link to comment https://forums.phpfreaks.com/topic/71464-solved-phpmysql-login-problem-with-godaddy/#findComment-359782 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.