·设为首页收藏本站📧邮箱修改🎁免费下载专区📒收藏夹👽聊天室
返回列表 发布新帖

这个登录代码里面,怎么跳过验证码,只需要输入用户名和密码登录

155 1
发表于 2023-10-24 07:36:16 | 查看全部 阅读模式

马上注册,免费下载更多dz插件网资源。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
  1. <?php@header('Content-Type: text/html; charset=UTF-8');ob_start();error_reporting(0);require_once  ("../function/Mcrypt.class.php");require_once  ("../Model.php");include "../function.base.php";include "../function/geetestlib.php";$login = new Model("tools_user");$user_token = $login->find(array('id'=>'1'),"","*");// 加密$mw_token = Mcrypt::encode($user_token['user'],$user_token['user_token'],'86400');if(isset($_COOKIE['cookie_user'])&&$_COOKIE['cookie_user']!=''){  $cookie_user = $_COOKIE['cookie_user'] ? $_COOKIE['cookie_user'] : '1';}if(isset($_COOKIE['user_token'])&&$_COOKIE['user_token']!=''){  $user_token = $_COOKIE['user_token'] ? $_COOKIE['user_token'] : '1';}// 解密$miw_token = Mcrypt::decode($_COOKIE['cookie_user'],$_COOKIE['user_token']);if($miw_token){  exit("<script language='javascript'>window.location.href='index.php';</script>");}if (getParam('user')&&getParam('password')) {  if(isset($_POST['geetest_challenge']) && isset($_POST['geetest_validate']) && isset($_POST['geetest_seccode'])){    $geetest = new GeetestLib();    $geetest->set_privatekey("2d5be5ba4207f11d33f7ae5e14a1c33e");    $result = $geetest->validate($_POST['geetest_challenge'], $_POST['geetest_validate'], $_POST['geetest_seccode']);    if ($result == TRUE) {    } else if ($result == FALSE) {     exit("<script language='javascript'>alert('登陆失败,请拖动滑块完成验证!');window.location.href='login.php';</script>");   } else {    exit("<script language='javascript'>alert('登陆失败,请拖动滑块完成验证!');window.location.href='login.php';</script>");  }}else{  exit("<script language='javascript'>alert('登陆失败,请拖动滑块完成验证!');window.location.href='login.php';</script>");}$user= getParam('user');$pass= md5(md5(getParam('password')).md5($user_token['user_token']));$row = $login->find(array('user'=>$user,'password'=>$pass),"","user,password");if($row){  setcookie('cookie_user', $mw_token,time()+3600*24);  $inc_token = $login->update(array('id'=>'1'),array('token'=>$mw_token));  if($inc_token){    exit("<script language='javascript'>window.location.href='index.php';</script>");  }else{    exit("<script language='javascript'>alert('未知错误,请重新登录');window.location.href='login.php';</script>");  }}else{  exit("<script language='javascript'>alert('用户名或密码不正确');window.location.href='login.php';</script>");}}?><html><head>  <meta charset="utf-8">  <meta http-equiv="X-UA-Compatible" content="IE=edge">  <meta name="viewport" content="width=device-width, initial-scale=1">  <title>用户登录</title>  <!-- Bootstrap 核心 CSS 文件 -->  <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">  <style>  body{background:url('//api.yum6.cn/360img');background-size: 100%;background-repeat:no-repeat;background-attachment:fixed;}  /*web background*/  .container{    display:table;    height:100%;  }  .row{    display: table-cell;    vertical-align: middle;  }  /* centered columns styles */  .row-centered {    text-align:center;  }  .col-centered {    display:inline-block;    float:none;    margin-right:-4px;  }  .row-centered{    z-index: 0;/* 为不影响内容显示必须为最高层 */    position: relative;    overflow: hidden;  }  .row-centered:after {    content: "";/* 必须包括 */    position: absolute;/* 固定模糊层位置 */    left: -100%;/* 回调模糊层位置 */    top: -100%;/* 回调模糊层位置 */    filter: blur(20px);/* 值越大越模糊 */    z-index: -2;/* 模糊层在最下面 */  }  .well{    background-color: rgba(0, 0, 0, 0.2);/* 为文字更好显示,将背景颜色加深 */  }  .well {    position: relative;    margin: 0 auto;    padding: 1em;    max-width: 30em;    border-radius: .3em;    box-shadow: 0 0 0 1px hsla(0,0%,100%,.3) inset,    0 .5em 1em rgba(0, 0, 0, 0.6);    text-shadow: 0 1px 1px hsla(0,0%,100%,.3);    background: hsla(0,0%,100%,.3);    overflow: hidden;      /*    -webkit-filter: blur(3px);      filter: blur(3px);*/    }    .well::before {      content: '';      position: absolute;      top: 0; right: 0; bottom: 0; left: 0;      z-index: -1;      -webkit-filter: blur(20px);      filter: blur(20px);      margin: -30px;      /*background: rgba(255,0,0,.5);*/    }    #sizing-addon1{background:rgba(255, 0, 0, 0);}    input{background:rgba(255, 0, 0, 0) !important;}  </style></head><body>  <div class="container">    <div class="row row-centered">      <div class="well col-md-6 col-centered">        <h2>欢迎登录</h2>        <form action="login.php" method="post" role="form" >          <div class="input-group input-group-md">            <span class="input-group-addon" id="sizing-addon1"><i class="glyphicon glyphicon-user" aria-hidden="true"></i></span>            <input type="text" class="form-control" id="user" name="user" placeholder="请输入用户ID"/>          </div>          <div class="input-group input-group-md">            <span class="input-group-addon" id="sizing-addon1"><i class="glyphicon glyphicon-lock"></i></span>            <input type="password" class="form-control" id="password" name="password" placeholder="请输入密码"/>          </div>          <div class="input-group input-group-md">            <?php            echo "<div class="box">";            $geetest = new GeetestLib();            $geetest->set_captchaid("a757a567a6c660610521e79a429d7e4c");            if ($geetest->register()) {              echo $geetest->get_widget("embed");            }            echo "</div>";            ?>          </div>          <br/>          <button type="submit" class="btn btn-success btn-block">登录</button>        </form>      </div>    </div>  </div>  <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->  <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>  <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->  <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script></body></html>
复制代码

这个登录文件login.php里面调用了geetest 这一家的api验证码,输入验证码才能登录


不需要这个,直接输入用户名和密码就能登录,  上面代码里面,应该删掉哪些代码呢?


上面调用的geetestlib.php里面代码是下面这个:
  1. <?phpdefine('GT_API_SERVER', 'http://api.geetest.com');define('GT_SSL_SERVER', 'https://api.geetest.com');define('GT_SDK_VERSION', 'php_2.15.4.2.2');class GeetestLib{        function __construct() {                $this->challenge = "";        }                function set_captchaid($captcha_id) {                $this->captcha_id = $captcha_id;        }        function set_privatekey($private_key) {                $this->private_key = $private_key;        }                function register() {                $this->challenge = $this->_send_request("/register.php", array("gt"=>$this->captcha_id));                if (strlen($this->challenge) != 32) {                        return 0;                }                return 1;        }                function get_widget($product, $popupbtnid="", $ssl=FALSE) {                $params = array(                        "gt" => $this->captcha_id,                        "challenge" => $this->challenge,                        "product" => $product,                );                if ($product == "popup") {                        $params["popupbtnid"] = $popupbtnid;                }                if(!isset($_SERVER['HTTPS'])){                        $server = GT_API_SERVER;                }                else{                        $server = GT_SSL_SERVER ;                }                return "<script type='text/javascript' src='".$server."/get.php?".http_build_query($params)."'></script>";        }        function validate($challenge, $validate, $seccode) {                        if ( ! $this->_check_validate($challenge, $validate)) {                        return FALSE;                }                $query = http_build_query(array("seccode"=>$seccode,"sdk"=>GT_SDK_VERSION));                $codevalidate = $this->_http_post('api.geetest.com', '/validate.php', $query);                if (strlen($codevalidate)>0 && $codevalidate==md5($seccode)) {                        return TRUE;                } else if ($codevalidate == "false"){                        return FALSE;                } else {                         return $codevalidate;                }        }                function _check_validate($challenge, $validate) {                if (strlen($validate) != 32) {                        return FALSE;                }                if (md5($this->private_key.'geetest'.$challenge) != $validate) {                        return FALSE;                }                 return TRUE;        }        function _send_request($path, $data, $method="GET") {                if ($method=="GET") {                        $opts = array(                            'http'=>array(                                    'method'=>"GET",                                    'timeout'=>2,                            )                    );                    $context = stream_context_create($opts);                        $response = file_get_contents(GT_API_SERVER.$path."?".http_build_query($data), false, $context);                }                return $response;        }        function _http_post($host,$path,$data,$port = 80){                $http_request = "POST $path HTTP/1.0\r\n";                $http_request .= "Host: $host\r\n";                $http_request .= "Content-Type: application/x-www-form-urlencoded\r\n";                $http_request .= "Content-Length: " . strlen($data) . "\r\n";                $http_request .= "\r\n";                $http_request .= $data;                $response = '';                if (($fs = @fsockopen($host, $port, $errno, $errstr, 10)) == false) {                        die ('Could not open socket! ' . $errstr);                }                                fwrite($fs, $http_request);                while (!feof($fs))                        $response .= fgets($fs, 1160);                fclose($fs);                                $response = explode("\r\n\r\n", $response, 2);                return $response[1];        }}?>
复制代码
我要说一句 收起回复

评论1

TyCodingLv.8 发表于 2023-10-24 07:36:27 | 查看全部
这个登录代码里面,怎么跳过验证码,只需要输入用户名和密码登录 用户名,验证码,登录,代码,密码
这部分删掉试试
我要说一句 收起回复

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

图文热点
关闭

站长推荐上一条 /1 下一条

投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图 知道创宇云防御

您的IP:18.222.127.152,GMT+8, 2025-2-22 14:01 , Processed in 0.231245 second(s), 73 queries , Gzip On, Redis On.

Powered by Discuz! X5.0 Licensed

© 2001-2025 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表