In PHP, only one machine can be online. #? Php # ob_start (); # session_start (); # classCC {# private $ REFURLwww.2cto.com; after successful login, convert the page # private $ LoginFLAGfalse; Login success sign # private # # Ob_start ();
# Session_start ();
# Class CC {
# Private $ REFURL = "http://www.BkJia.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, "");
# 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]. "". $ _ POST [LoginPw]. "". $ _ SERVER [REMOTE_ADDR]. "". 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 ();
##>Http://www.bkjia.com/PHPjc/486513.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/486513.htmlTechArticle? Php # ob_start (); # session_start (); # class CC {# private $ REFURL = http://www.2cto.com; // after successful login, the conversion page # private $ LoginFLAG = false; // Login success sign # private...