PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
if (isset($_POST['submit']))
{
$message = null;
//username
if (empty($_POST['username']))
{
$un = false;
$message .= "please type your username";
}
else
{
$un = $_POST['username'];
}
//password
if ($_POST['password'])
{
$pw = false;
$message = 'plese type your password';
}
else
{
$pw = $_POST['password'];
}
//process to username and password to db
if ($un && $pw)
{
$query = "select user_id, username, password from users where username='$un' and password='$pw'";
$result = @mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result, MYSQL_NUM);
if ($row)
{
// Start the session, register the values & redirect.
session_start();
$_SESSION['firstname'] = $row[1];
$_SESSION['user_id'] = $row[0];
header ("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php");
exit();
}
else
{
$message .= "username and password do not match";
}
mysql_close();
}
$message = "please try again";
}
if (isset($message))
{
echo "<font color=red>" . $message . "</font>";
}
i know using $smarty->assign() will assign some values from index2.php to index2.tpl, but i really don't know how to make this code work...please help...thanks in advance...
note: have deleted some smarty syntax for a fresh start
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
04/26/06 15:03:55
Apache/2.2.0 (Win32) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_autoindex_color PHP/5.1.1
1. tell me dev env info - php version, apache etc. etc.
2. smarty version.
3. make simple simple script/template to make use of smarty.
4. set template_dir $smarty->template_dir = 'path/to/dir/where/templates/files/are'
5. turn off cacheing $smarty->caching = false;
6. turn smarty debugging on. $smarty->debugging = true;
7. try doing stuff one by one (regardin calls to smarty) -> figure out on which call does it crash?