PHP implements login background restriction to allow only one machine to be online_PHP tutorial

WBOY
Release: 2016-07-13 17:37:58
Original
855 people have browsed it

# # ob_start();
# session_start();
# class CC{
# Private $REFURL="http://www.BkJia.com"; //Convert page after successful login
#  private $LoginFLAG=false;     //Successful login sign
# 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){//User login exists and is valid
#   $info=file($this->loginFILE);
#   $username=trim($info[0]); //The online login username
#   $password=trim($info[1]); //Already online password (you don’t need to save it)
#   $ip  =trim($info[2]); //IP already online
#    $sid  =trim($info[3]); // PORT online
#   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 guaranteed to be unique!

";
#       $cf=fopen($this->loginFILE,"a+");
#      fputs($cf," a");
#       fclose($cf);
# echo "";
#        ///echo "";
#       }else{
#        echo "Accounts are not allowed to log in simultaneously on the bureau network.. ".$_SERVER[REMOTE_PORT];
#       $this->LoginFLAG=false;
#        }    
#      }else{
#      echo "Simultaneous logins using accounts are not allowed..
";
#       $this->LoginFLAG=false;
#     }
#     }else{
# echo "Wrong password..
";
#      $this->LoginFLAG=false;
#     }
#    }else{
#    //Verify the identity here if it is correct
#     echo "An error occurred while logging in to the account! Wrong username
";
#    }
#   }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 << #  

#   
#   

#   Username:


#   
Password:

#  {this.form.submit();}else{return false;}">
#   

#  

#LOGINFORM;
# }else{
# echo "A user has logged in";
# }
# }
# }
# $D=new CC;
# $D->check();
# $D->Wfrom();
# ?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486513.htmlTechArticle# ?php # ob_start(); # session_start(); # class CC{ # private $REFURL=http: //www.2cto.com; //Convert page after successful login# private $LoginFLAG=false; //Login successful sign# private...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!