Hi everyone, as I described it in the title bar, I can't redirect my site during the login process.
I've read a lot of posts already, but none has been helpful so far. (I put header() as a function in the begining part of my file too).
I am at a loss, maybe it's an URL problem, please, help me with this!
here is my code (for index.php):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
session_start();
if(!isset($_SESSION['access']))$_SESSION['access']='DENIED';
function redirect()
{
$_SESSION['access']='GRANTED';
header('Location: http://tlib.x10.mx/tlib.php');
die();
exit;
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="unity.css" />
<title>Login screen</title>
</head>
<body>
<div id="login">
<?php
$connection=mysql_connect("localhost", "loginname_login", "psw");
if(!$connection)die('Could not connect: ' . mysql_error());
mysql_select_db("loginname_book_lib", $connection);
$data = mysql_query("SELECT * FROM Account");
while($temp = mysql_fetch_array($data)){
if(!empty($_POST) && $temp["Username"] == $_POST["uname"] && $temp["Password"] == $_POST["password"])
{
redirect();
mysql_close($connection);
}
}
?>
<form action="index.php" method="post">
Username: <input type="text" name="uname" /></br>
Password: <input type="password" name="password" /></br>
<input type="submit" value="submit" />
</form>
</div>
</body>
</html>
And in my file manager, I uploaded files as index.php and tlib.php
I've read a lot of posts already, but none has been helpful so far. (I put header() as a function in the begining part of my file too).
I am at a loss, maybe it's an URL problem, please, help me with this!
here is my code (for index.php):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
session_start();
if(!isset($_SESSION['access']))$_SESSION['access']='DENIED';
function redirect()
{
$_SESSION['access']='GRANTED';
header('Location: http://tlib.x10.mx/tlib.php');
die();
exit;
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="unity.css" />
<title>Login screen</title>
</head>
<body>
<div id="login">
<?php
$connection=mysql_connect("localhost", "loginname_login", "psw");
if(!$connection)die('Could not connect: ' . mysql_error());
mysql_select_db("loginname_book_lib", $connection);
$data = mysql_query("SELECT * FROM Account");
while($temp = mysql_fetch_array($data)){
if(!empty($_POST) && $temp["Username"] == $_POST["uname"] && $temp["Password"] == $_POST["password"])
{
redirect();
mysql_close($connection);
}
}
?>
<form action="index.php" method="post">
Username: <input type="text" name="uname" /></br>
Password: <input type="password" name="password" /></br>
<input type="submit" value="submit" />
</form>
</div>
</body>
</html>
And in my file manager, I uploaded files as index.php and tlib.php
Last edited: