新闻中心
Phpcms实现首页可以直接登陆方法
作者 / 无忧主机 时间 2014-12-01 15:24:22
为了给用户体验到最好最简单最容易操作而又不复杂的环境,无忧主机php空间的开发同事们已经绞尽脑汁。站长们也都一样,为了网站的体验想尽一切办法,而今天无忧小编也是其中之一。为了让用户能用最简单最快的方法进入自己帐户,无忧小编查阅了很多资料终于实现了phpcms在首页实现直接登陆方法。下面截图是无忧小编以前登陆画面看上去比较麻烦,第一先点击登陆第二输入帐户点击登陆非常的麻烦:
以上的方法看上去非常的麻烦。下面无忧主机总结了一套代码只需要把以前的代码覆盖掉即可,进入public_html/phpcms/templates/default/member/找到mini.html用FTP工具下载到本地用代码编辑器打开,把整段的代码全部删除修改为如下代码:
<?php defined('IN_PHPCMS') or exit('No permission resources.'); ?><style> body,html{background:none; padding:0; margin:0} .log{line-height:24px;*line-height:27px; height:24px;float:right; font-size:12px} .log span{color:#ced9e7} .log a{color:#049;text-decoration: none;} .log a:hover{text-decoration: underline;} .log .snda{ position:relative; bottom:-3px} </style> <body style="background-color:transparent"> <div class="log"><?php if($_username) { ?><?php echo L('hellow');?> <?php echo get_nickname();?>, <a href="<?php echo APP_PATH;?>index.php?m=member&siteid=<?php echo $siteid;?>" target="_blank"><?php echo L('member_center');?></a> <a href="<?php echo APP_PATH;?>index.php?m=member&c=index&a=logout&forward=<?php echo urlencode($_GET['forward']);?>&siteid=<?php echo $siteid;?>" target="_top"><?php echo L('logout');?></a><?php } else { ?> {php if(!HTTP_REFERER || strpos(HTTP_REFERER,'&a=login')) @header("Location: ".$_GET['forward']);//这行放到文件顶部吧 } <form method="post" action="{APP_PATH}index.php?m=member&c=index&a=login" id="myform" name="myform" target="_top"> <input type="hidden" name="forward" id="forward" value="{if $_GET['forward']}{$_GET['forward']}{else}{HTTP_REFERER}{/if}"> 账号:<input type="text" id="username" name="username" style="width:70px;height:19px; size="10" class="input-text"> 密码:<input type="password" id="password" name="password" style="width:70px;height:19px; size="10" class="input-text"> 验证码:<input type="text" id="code" name="code" size="5" style="width:30px;height:19px; class="input-text" > {form::checkcode('code_img', '2', '14', 50, 18)} <input type="submit" name="dosubmit" id="dosubmit" value="{L('登录')}"> | <a href="{APP_PATH}index.php?m=member&c=index&a=register&siteid={$siteid}" target="_blank">{L('注册')}</a> </form> <?php } ?></div> </body>进入之后利用FTP工具上传到public_html/phpcms/templates/default/member/覆盖mini.html目录。完成后就可在首页实现直接登陆了,截图如下:

本文地址:https://www.51php.com/phpcms/17751.html






