php login and pass to session
checkpassword.php
<?php
session_start();
if (empty($_SESSION[pagecheck]))
{
if (empty($_POST[logname]) or empty($_POST[logpass])) {
echo 'You did not input the login name or password.';
exit;
}elseif ($_POST[logname]=='admin' and $_POST[logpass]=='adminpass') {
$_SESSION [pageecheck]==time();
} else {
echo 'The login name or password is incorrect <p> <a href="login.php">Tray Again</a></p>';
exit;
}
}
?>
session_start();
if (empty($_SESSION[pagecheck]))
{
if (empty($_POST[logname]) or empty($_POST[logpass])) {
echo 'You did not input the login name or password.';
exit;
}elseif ($_POST[logname]=='admin' and $_POST[logpass]=='adminpass') {
$_SESSION [pageecheck]==time();
} else {
echo 'The login name or password is incorrect <p> <a href="login.php">Tray Again</a></p>';
exit;
}
}
?>
- _SESSION 是用大草
- Program while on filename.php 第一行
- Anything relation with session shoud write session_start()
- *Refer : php.ini output buffering 4096.
- <? php ob_start(); ?> i.e. add before session for add the buffer
沒有留言:
張貼留言