Session Applets in php

Source: Internet
Author: User

// Login page (login. php3)
// This script is used to enter a password for the user and determine whether the password is correct.
// If it is correct, 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, $ REMOTE_ADDR, $ 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 ";
?>


 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.