HI, I cant sign in using my code and I don't know what is the problem here.
Someone who can give hint?
here is the code:`<?php // formtest2.php
require_once 'login.php';
$connection = new mysqli($hn, $un, $pw, $db);
if ($connection->connect_error) die($connection->connect_error);
if (isset($SERVER['PHP_AUTH_USER']) && isset($SERVER['PHP_AUTH_PW']))
{
$un_temp = mysql_entities_fix_string($connection, $SERVER['PHP_AUTH_USER']);
$pw_temp = mysql_entities_fix_string($connection, $SERVER['PHP_AUTH_PW']);
$query = "SELECT * FROM users9 WHERE username='$un_temp'";
$result = $connection->query($query);
if (!$result) die($connection->error);
elseif ($result->num_rows) {
$row = $result->fetch_array(MYSQLI_NUM);
$result->close();
$token = ("$pw_temp$");
if ($token == $row[3]) echo "$row[0] $row[1] :
Hi $row[0], you are now logged in as '$row[2]'";
else die("Invalid username/password combination"); }
else die("Invalid username/password combination"); }
else { header('WWW-Authenticate: Basic realm="Restricted Section"');
header('HTTP/1.0 401 Unauthorized');
die ("Please enter your username and password"); }
$connection->close();
function mysql_entities_fix_string($connection, $string) {
return htmlentities(mysql_fix_string($connection, $string)); }
function mysql_fix_string($connection, $string) {
if (get_magic_quotes_gpc()) $string = stripslashes($string);
return $connection->real_escape_string($string);
}
?>`