Jump to content

[SOLVED] PHP/MYSQL Login problem with GoDaddy


alexander007

Recommended Posts

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";
}
?>

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.