? Php (); session_start (); CC {private $ REFURL = http://www.cncms.com.cn; // after successful login, convert the page private $ LoginFLAG = false; // Login success sign private?loginfile=loginmsg.txt;
# # Ob_start ();
# Session_start ();
# Class CC {
# Private $ REFURL = "http://www.php100.com"; // The conversion page after successful login
# Private $ LoginFLAG = false; // logon success flag
# Private $ loginFILE = "loginmsg.txt"; // Information File
# Function setFlag ($ flag ){
# $ This-> loginFLAG = $ flag;
#}
# Function check (){
# Global $ _ POST;
# If (file_exists ($ this-> loginFILE) & (time ()-filemtime ($ this-> loginFILE) <60) {// The user login exists and is valid
# $ Info = file ($ this-> loginFILE );
# $ Username = trim ($ info [0]); // online login username
# $ Password = trim ($ info [1]); // online password (optional)
# $ Ip = trim ($ info [2]); // An online IP address
# $ Sid = trim ($ info [3]); // online PORT
# If (strcmp ($ _ SESSION [LoginUser], $ username) = 0 ){
# If (strcmp ($ _ SESSION ['loginpw '], $ password) = 0 ){
# If (strcmp ($ _ SERVER [REMOTE_ADDR], $ ip) = 0 ){
# If (strcmp (session_id (), $ sid) = 0 ){
# $ This-> setFlag (true );
# Echo "your account is unique! ";
# $ Cf = fopen ($ this-> loginFILE, "a + ");
# Fputs ($ cf, "\ r \ na ");
# Fclose ($ cf );
# Echo" ";
# // Echo "";
#} Else {
# Echo "you are not allowed to log on to your account online at the same time...". $ _ SERVER [REMOTE_PORT];
# $ This-> LoginFLAG = false;
#}
#} Else {
# Echo "the account cannot be used to log on simultaneously ..
";
# $ This-> LoginFLAG = false;
#}
#} Else {
# Echo "incorrect password ..
";
# $ This-> LoginFLAG = false;
#}
#} Else {
# // If the authentication is correct
# Echo "an error occurred when logging on to the account! Incorrect user name
";
#}
#} Else {
# If (isset ($ _ POST [LoginUser]) {
# $ _ SESSION [LoginUser] =_ _ POST [LoginUser];
# $ _ SESSION [LoginPw] =_ _ POST [LoginPw];
# $ Fp = fopen ($ this-> loginFILE, "w ");
# $ Msg = $ _ POST ['loginuser']. "\ r \ n ". $ _ POST ['loginpw ']. "\ r \ n ". $ _ SERVER [REMOTE_ADDR]. "\ r \ n ". session_id ();;
# Fputs ($ fp, $ msg );
# Fclose ($ fp );
#} Else {
# $ Outtime = time ()-filemtime ($ this-> loginFILE)-60;
# Echo "the login does not exist or you have timed out (". $ outtime. "seconds )...";
#}
#}
#}
# Function Wfrom (){
# Global $ _ POST;
# If (! File_exists ($ this-> loginFILE) | (time ()-filemtime ($ this-> loginFILE)> 60) {// login failed
# Echo <
#
# LOGINFORM;
#} Else {
# Echo "existing user login ";
#}
#}
#}
# $ D = new CC;
# $ D-> check ();
# $ D-> Wfrom ();
##>