PHP instance program: use PHP to create a logon page program // This script is used to input a password to the user and determine whether the password is accurate. // If accurate, go to the welcome page.
// This script is used to input a password to the user and determine whether the password is correct.
// If accurate, go to the welcome page.
If ($ login ){
Include ('../include/config. inc. php3 ');
Session_start ();
$ Right_enter = '0 ';
$ Query = 'select * from user_define where user_login = '$ user_login' and user_pass = password ('$ user_pass ')';
$ Result = @ mysql_query ($ query, $ dbconnect );
If ($ user_array = @ mysql_fetch_array ($ result )){
$ User_id = $ user_array [user_id];
$ User_name = $ user_array [user_info];
Session_register ('User _ id ');
Session_register ('User _ name ');
Session_register ('User _ array ');
If ($ user_array [ticket_day]) and ($ user_array [ticket_num]) {
$ Right_enter = '1 ';
}
Else {
$ Error_message = 'Sorry, you do not have permission to book tickets! ';
}
}
Else {
$ Error_message = 'error! The user name or password is incorrect. Enter again. ';
}
$ Log_time = date ('Y-m-d H: I: s ');
$ Query = 'Insert into log_record (log_time, user_login, remote_addr, right_enter, enter_function) values ('$ log_time', '$ user_login', '$ login',' $ right_enter ', '1 ')';
@ Mysql_query ($ query, $ dbconnect );
If ($ right_enter ){
Header ('Location: welcome_reserve.php3 ');
Exit;
}
}
If ($ logout ){
Session_start ();
Session_unregister ('User _ id ');
Session_unregister ('User _ name ');
Session_unregister ('User _ array ');
}
?>
User logon
If ($ error_message) echo'
$ Error_message ';
?>