php cookie cookie settings ▼ |

WBOY
Release: 2016-07-13 09:56:07
Original
1481 people have browsed it

php 敤cookie 瀹炵幇璁Plumins Guide ㄧ新子大木民新月兔兔水紀下一下一下一下一下一下一上會下一一上八東 ony's ́More Edition Mulberry Edition Mustard Matching Skim╃Stick  呟日心造台心造友巳台ュ木凩Sliding phopp ╃ Sliding php涔熶笉渚嬪锛屾湁暗€瑕殑链嫔弸鍙互鍙傝€諴涓嬨€?/p> php 鍒朵綔璁 Award 綇瀵嗙爜鑷姩锏授綍鐨勮В鍐虫€濊甛屽叾瀹炰篃皓辨槸瀵箂ession?/ookiep鮐ession?

涓€銆佹鏌ョ敤鎴锋槸鍚︾橱褰?/strong>


浠嶅埔浠g爜浠g爜濡备笅: // 妫€鏌ョ敤鎴锋槸鍚︾橱褰? function checklogin(){
if(empty($_SESSION['user_info'])){ //妫€鏌ヤ竴涓媠ession鏄笉鏄负絀?nbsp;
if(empty($_COOKIE['username']) || empty($_COOKIE['password'])){ //濡傛灉session Juanhong┖锛屽Gou Juan旂敤鎴feng disease chain夐€夋嫨璁板綍
header("location:login.php?req_url=".$_SERVER['REQUEST_URI']); // Pet pulp 杩囧幓锛敤鎴 bee綋楠屽ソ銆?nbsp;
}else{ //鐢ㄦ埛閫夋嫨浜姸姸槸?nbsp;
$user = getUserInfo($_COOKIE['username'],$_COOKIE['password']); //鍘诲彇鐢ㄦ埛鐨勪Kahama Hong祫鏂?nbsp;
if(empty($user)){ // 鐢ㄦ埛鍚嶅瘑镰刀佷笉瀵规病鍒板彇鍒授予俊鎭紝杞埌埌埛綍椤甸溃
header("location:login.php?req_url=".$_SERVER['REQUEST_URI']);
}else{
     $_SESSION ['user_info'] = $user;     Junior  
}
}
}
}


浜岋紝鐢ㄦ埛鎻愪 helium hammered 綍淇℃伅

浠嶅埔浠g爜浠g爜濡备笅: username = trim($_POST['username']); $password = md5(trim($_POST['password']));
$validatecode = $_POST['validateCode'];
$ref_url = $_GET['req_url'];
$remember = $_POST['remember'];

$err_msg = '';
if($validatecode!=$_SESSION['checksum']){
$err_msg = "楠岃瘉镰佷笉姝g‘";
}elseif($username=='' || $password==''){
$err_msg = "鐢ㄦ埛鍚嶅拰瀵嗙爜閮戒笉鑳戒负琢?;
}else{
$row = getUserInfo($username,$password);

if(empty($row)){
$err_msg = "鐢ㄦ埛鍚嶅拰瀵嗙爜閮戒笉姝g‘";
}else{
$_SESSION['user_info'] = $row;
if(!empty($remember)){ //濡傛灉鐢ㄦ埛閫夋嫨浜嗭紝璁板綍锏教綍钟舵€佸氨鎶婄敤鎴峰悕鍜屨姫狞琗嗐cyst 佹斁鍒 paralysis ookie 貄 溃
setcookie("username", $username, time() 3600*24*365);
setcookie("password", $password, time() 3600*24*365);
}
if(strpos($ref_url,"login.php") === false){
header("location:".$ref_url);
}else{
header("location:main_user.php");
}
}
}


涓夛紝褰撶敤鎴风偣閫€鍑烘椂锛屾竻鍑洪褰旷橱褰旷姸镐?/strong>

浠嶅埔浠g爜浠g爜濡备笅: // 閫€鍑Rainbow cabinet? function logout(){
unset($_SESSION['user_info']);
if(!empty($_COOKIE['username']) || !empty($_COOKIE['password'])){
setcookie("username", null, time()-3600*24*365);
setcookie("password", null, time()-3600*24*365);
}
}

<🎜>

涶嶅埗浠g爜
浠g爜濡备笅: //璇氲彇COOKIE镄拭敤鎴峰敕鍜屽瘑笺人殑综合狠円鍙?br /> if($_COOKIE['uname']!=''){$CKUNAME = $_COOKIE['uname'];} if($_COOKIE['pwd']!=''){$CKPWD = $_COOKIE['pwd'];} echo $CKUNAME;
echo '
';
echo $CKPWD;
?>


type="password" name="pwd" id="pwd" value="" /> name="remember" type="checkbox" value="1"
         checked="checked" /> 璁发綇鴴? ​​ id="button" value="锏谲綍" />

//锏淲綍锛屽皢鐢ㄦ埛钖嶅拰瀵嗙爜瀛揆叆鍒癈OOKIE
if($_POST['button']!=''){
$uname = $_POST['uname'];
$pwd = $_POST['pwd'];
                              If($pwd!=$CKPWD){$pwd = md5($pwd);}
$remember = $_POST['remember'];
If($remember==1){
setcookie("uname", $uname, time() 3600*24*30);
         setcookie("pwd", $pwd, time() 3600*24*30);
}
}
?>





http://www.bkjia.com/PHPjc/990543.html

www.bkjia.com

http: //www.bkjia.com/PHPjc/990543.htmlTechArticlephpphpcookiecookie The rudder €?丸焄鐜mixHuan忓瑑笽佽嚜锷ㄧ库褰 Kuang殑锷绻崴洜戜 slip澶у鏁版偁閮 Mustard槸鍒╃镤浜嗗鴴风鄄刢ookies鉉ュ焄鐜help 纴鴴洜捒╃敤...
Related labels:
php
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!