脚本宝典收集整理的这篇文章主要介绍了php – 创建第二个自动登录用户的登录页面,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
<form action="?" method="post" id="frm-useracc-login" name="frm-useracc-LOGin" > <div id="login-username-wrap" > <div class="login-input-ITem left"> <div class="div-seArch-label left"> <div id="div-leftheader-wrap"> <p class="a-topheader-infotext left"><strong>Username: </strong></p> </div> </div> <div class="login-input-content left div-subrow-style ui-corner-all"> <input tyPE="text" tabindex="1" name="txt-username" id="txt-username" class="input-txt-med required addr-search-input txt-username left"> </div> </div> </div> <div id="login-password-wrap" > <div class="login-input-item left"> <div class="div-search-label left"> <div id="div-leftheader-wrap"> <p class="a-topheader-infotext left"><strong>Password: </strong></p> </div> </div> <div class="login-input-content left div-subrow-style ui-corner-all"> <input type="password" tabindex="1" name="txt-password" id="txt-password" class="input-txt-med required addr-search-input txt-password left"> </div> </div> </div> <div id="login-BTn-bottom" class="centre-div"> <div id="login-btn-right"> <button name="btn-login" id="btn-login" class="btn-med ui-button ui-state-default ui-button-text-only ui-corner-all btn-hover-anim btn-row-wrapper left">Login</button> <button name="btn-cancel" id="btn-cancel" class="btn-med ui-button ui-state-default ui-button-text-only ui-corner-all btn-hover-anim btn-row-wrapper left">Cancel</button><br /><br /> </div> </div> </form>
在这里我的session.controller.PHP文件:
基本上,我想要做的是创建第二个登录页面,自动将值传递给会话控制器并登录.例如,如果我转到login-guest.PHP,我会将用户名和密码的默认值和然后有一个jquery点击事件,使用$(“#btn-login”)自动记录它们.触发器(‘click’);
现在,如果您无法将会话超时增加到无限,则可能需要将登录类型存储在cookie中的其他位置,或者作为URL中的查询字符串.
在cookie的情况下,它将是这样的:
... $expire = 60 * 60 * 24 * 30 * 24 + time(); // 2 years setcookie('logintype','guest',$expire);
if(isset($_COOKIE['logintype']) && $_COOKIE['logintype']=='guest'){ header('Location: login-guest.PHP'); } else { header('Location: login.PHP'); }
我不认为饼干可以有无限的生命,所以我设定了两年的到期时间你可以改变.显然,如果用户删除cookie或使用其他浏览器,它将不会持久存在.
以上是脚本宝典为你收集整理的php – 创建第二个自动登录用户的登录页面全部内容,希望文章能够帮你解决php – 创建第二个自动登录用户的登录页面所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。