PHP Autologin function to login script

前端 未结 4 2278
野趣味
野趣味 2020-12-30 15:40

How would I implent an autologin feature to this script?

session_start();
$result = mysql_query(\"SELECT id FROM users 
                       WHERE username         


        
4条回答
  •  时光说笑
    2020-12-30 16:36

    We can create auto login using cookies in php , this feature is required in case you want to create web view of your website , as mobile user don’t want to login every time they open your android app (web view of your web site. You can use the code below tom implement the auto-login on your php based website

     0 && $row[‘auto_login’]==1)
    {
    
    $_SESSION[‘uname’] = $email;
    $_SESSION[‘uid’]=$row[‘id’];
    setcookie (“username”,$email,time()+ 3600);
    setcookie (“password”,$pwd,time()+ 3600);
    header(‘Location:myhome.php’);
    }
    }
    ?>
    
    
    
    My Expense-Login
    
    
    
    
    
    
    
    
    
    

    User Login

    ”>
    ” >

提交回复
热议问题