Hi, please i need a little help in finding a error🙁
I've got two php files.
1) login.php
2) dbase.php
When u press the submit button on login.php and the pass is true then u must be redirected to dbase.php.
If you will try to access the dbase.php file without be authenticated well on login.php then u must be redirected to login.php.
=====login.php=======
<?php
error_reporting(0);
session_start();
if( $submit ){
session_register("user_id", "user_pass");
$HTTP_SESSION_VARS["user_id"] = $user_id;
$HTTP_SESSION_VARS["user_pass"] = $user_pass;
header("Location: dbase.php");
}else{
?>
...
...
...
<form name="login_form" method="post" action=<?php echo "\"$PHP_SELF\""?>>
...
...
...
<input type="text" name="txtUserName" maxlength="9" size="15">
<input type="hidden" name="user_id" value=<? echo "\"$txtUserName\"" ?>>
<input type="password" name="txtPassword" maxlength="15" size="15">
<input type="hidden" name="user_pass" value=<? echo "\"$txtPassword\"" ?>>
</form>
...
...
...
======end login.php=========
====dbase.php=========
<?php
session_start();
if( strcmp($HTTP_SESSION_VARS['user_pass'],"thepasshere")==0){
echo $HTTP_SESSION_VARS['user_id'];
}else{
session_unregister("user_id");
session_unregister("user_pass");
header("Location: index.php");
}
?>
THANKS
Mail: liviu.voicu@huji.ac.il