Может кто-нибудь посмотреть, что не так?
Я должен сделать простую форму входа в систему, но я не могу заставить ее показать свою страницу index1.php. Он застревает на моей странице login.function.php. Я знаю, что мне где-то нужно поместить код для check_login на мою страницу index1.php, но моя голова пуста. Я не знаю, где его поставить или как мне его кодировать. Кто-нибудь?
login.function.php
<?php
session_start();
function login($username, $password)
{
//rigt user and pw
$correct_user = "xx1";
$correct_pass = "xx2";
//Step 1
if ( !empty($username) && !empty($password) )
{
//Steg 2
if ( $username == $correct_user
&& $password == $correct_pass )
{
//Steg3
$_SESSION['user_login'] = TRUE;
header('Location: http://page.com/TEST/index1.php');
}
//if user and pw is wrong
else
{
return "blablabla...";
}
}
//if user and pw is empty
else
{
return "you have to.....";
}
}
/*********************************************
* Function to log out
*********************************************/
function logout()
{
$_SESSION['user_login'] = FALSE;
session_destroy();
}
function is_logon()
{
if ( isset($_SESSION['user_login'])
&& $_SESSION['user_login'] == TRUE )
{
return TRUE;
}
else
{
return FALSE;
}
}
$usr = $_POST["username"];
$pwd = $_POST["password"];
login($usr, $pwd);
?>
Мой index.php
<body>
<form action="login.function.php" method="post">
<table width="100%" border="0">
<tbody>
<tr>
<td><div align="center">
<p><img src="../site_images/logo.png" width="340" height="75"></p>
<p> </p>
</div></td>
</tr>
<tr>
<td><div align="center" class="style4">
<p>Welcome to... - Please log in </p>
<p> </p>
</div></td>
</tr>
<tr>
<td align="center">
<span class="style4">User name:</span><br>
<input type="text" name="username"><br>
<span class="style4">Password:</span><br>
<input type="password" name="password"><br>
<input type="hidden" name="login_form" value="1">
<input type="submit" value="Log in">
</td>
</tr>
<tr>
<td><div align="center"><img src="../site_images/wwww.jpg" width="710" height="444"></div></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
И некоторые из моих index1.php
<?php header("Content-Type: text/html; charset=UTF-8");
include_once("php_includes/db_conx.php");
?>
<!DOCTYPE html>
<html><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<META HTTP-EQUIV="Expires" CONTENT="Mon, 27 Jul 1997 00:00:00 GMT" />
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache" />
<title>Blablabla</title>
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="styles/style.css">
<script type="text/javascript">
<!--
function openClub(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
</script>
</head>
<body bgcolor="#000000">
<?php include_once("template_pageTop.php"); ?>
<div id="pageMiddle">
<table width="75%" border="0" cellspacing="10" align="center">
<tr>
<th width="50" align="left">One</th>
<th width="200" align="left">Two</th>
<th width="75" align="left">Three</th>
<th width="160" align="left">Fore</th>
<th width="100" align="left">five</th>
</tr>
<?php
mysqli_set_charset($db_conx, "iso-8859-1");
$query="SELECT * FROM ccc2 WHERE regional = 1 OR regional = 2 ORDER BY one, club ASC";
$result=mysqli_query($db_conx, $query);
$num=mysqli_num_rows($result);
while ($row = mysqli_fetch_array($result)) {
.............