Sure, sorry, no problem.
login.php
<?php
require_once('c:\php\smarty\Smarty.class.php');
if ($_SESSION['loggedin'] == 1)
{
header("Location: index.php");
}
else
{
$smarty = new Smarty;
$user_name_form = "<input type='text' name='username'>";
$password_form = "<input type='password' name='password'>";
$user_name_label = "User Name";
$password_label = "Password";
$smarty->assign('username', $user_name_label);
$smarty->assign('usernameform', $user_name_form);
$smarty->assign('password', $password_label);
$smarty->assign('passwordform', $password_form);
$smarty->display('login.tpl');
}
?>
login.tpl
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="do_login.php" method="post" name="login" id="login">
<table align="CENTER" width="30%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="38%">{$username}</td>
<td width="62%">{$password}</td>
</tr>
<tr>
<td>{$usernameform}</td>
<td>{$passwordform}</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</form>
</body>
</html>
do_login.php
<?php
session_start();
require_once('Connections/Anykey.php');
require_once('c:\php\smarty\Smarty.class.php');
$smarty = new Smarty;
$user = $_POST['username'];
$password = $_POST['password'];
mysql_select_db($database_Anykey, $Anykey);
$query = mysql_query("SELECT * FROM user_table WHERE username = '$user'");
$data = mysql_fetch_object($query);
$stored_pass = $data->password;
$authorized = $data->authorized;
if ($stored_pass == $password)
{
if ($authorized == $data->authorized)
{
$_SESSION['loggedin'] = 1;
header("Location: index.php");
#include('index.php');
#echo "<meta http-equiv='refresh' content='3;URL=index.php'>";
}
else
{
}
}
else
{
include('login.php');
}
?>
index.php
<html>
<head>
<title>Anykey</title>
</head>
<body>
<?php
if ($_SESSION['loggedin'] == 1)
{
echo "Welcome to Anykey";
}
else
{
include('login.php');
}
?>
</body>
</html>
That should do it. Thanks a bunch for any help.