Below is my login script.
When it tries to redirect to index.php, THIS happens to it.
Any solutions?
PHP:
<?php
$username = $_POST['username'];
$password = $_POST['password'];
//connect to the database here
if($_GET['action'] == "login")
{
$dbhost = 'localhost';
$dbname = 'taigah_members';
$dbuser = 'taigah_th100';
$dbpass = 'taigaisb';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname, $conn);
}
//sanitize username
$username = mysql_real_escape_string($username);
$query = "INSERT INTO users ( username, password, salt )
VALUES ( '$username' , '$hash' , '$salt' );";
mysql_query($query);
$username = mysql_real_escape_string($username);
$query = "SELECT password, salt
FROM users
WHERE username = '$username';";
$result = mysql_query($query);
if(mysql_num_rows($result) < 1) //no such user exists
{
header('Location: login_form.php?login=failed&cause='.urlencode('Invalid User/Password'));
die();
}
$userData = mysql_fetch_array($result, MYSQL_ASSOC);
$hash = sha1( $userData['salt'] . sha1($password) );
if($hash != $userData['password']) //incorrect password
{
header('Location: login_form.php?login=failed&cause='.urlencode('Invalid User/Password'));
die();
}
//Login successful; redirect to another page or display "login success" message
session_register("$username");
session_register("$password");
header('Location: index.php');
mysql_close();
?>
When it tries to redirect to index.php, THIS happens to it.
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'taigah'@'10.33.248.75' (using password: NO) in /home/taigah/public_html/members/login.php on line 28
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/taigah/public_html/members/login.php on line 28
Warning: mysql_query() [function.mysql-query]: Access denied for user 'taigah'@'10.33.248.75' (using password: NO) in /home/taigah/public_html/members/login.php on line 32
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/taigah/public_html/members/login.php on line 32
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'taigah'@'10.33.248.75' (using password: NO) in /home/taigah/public_html/members/login.php on line 34
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/taigah/public_html/members/login.php on line 34
Warning: mysql_query() [function.mysql-query]: Access denied for user 'taigah'@'10.33.248.75' (using password: NO) in /home/taigah/public_html/members/login.php on line 39
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/taigah/public_html/members/login.php on line 39
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/taigah/public_html/members/login.php on line 41
Warning: Cannot modify header information - headers already sent by (output started at /home/taigah/public_html/members/login.php:28) in /home/taigah/public_html/members/login.php on line 43
Any solutions?