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

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.