Esempio n. 1
0
function validate_request($request)
{
    global $response;
    if (empty($request['api_key'])) {
        $response['message'] = "The request must include a valid api key";
        return false;
    }
    $verify = new verify();
    if (!$verify->verify_Token($request['api_key'])) {
        $response['message'] = "Invalid api key provided";
        return false;
    }
    if (empty($request['description'])) {
        $response['message'] = "The request must include a description";
        return false;
    } elseif (strlen($request['description']) >= 120) {
        $response['message'] = "The description must be at most 120 characters";
        return false;
    }
    if (empty($request['amount'])) {
        $response['message'] = "The request must include an amount";
        return false;
    } elseif ($request['amount'] < 1) {
        $response['message'] = "The amount must be larger than one";
        return false;
    } elseif ($request['amount'] > 10000) {
        $response['message'] = "The maximum amount is 10000";
        return false;
    }
    return true;
}
Esempio n. 2
0
 function validate_user($un, $pwd)
 {
     $mysql = new verify();
     $ensure_credentials = $mysql->verify_Username_and_Pass($un, $pwd);
     if ($ensure_credentials && $_SESSION['payment']) {
         $_SESSION['status'] = 'authorized';
         header("location: banklink/Banklink.php");
     } elseif ($ensure_credentials) {
         $_SESSION['status'] = 'authorized';
         header("location: index.php");
     } else {
         return "Please enter correct username and password!";
     }
 }
Esempio n. 3
0
function m__edit_my_pass()
{
    global $dbm;
    $_POST = helper::sqlxss($_POST);
    $sql = "select apass from " . TB_PREFIX . "admin_list where admin_id='{$_SESSION['admin']['admin_id']}' limit 1";
    $rs = $dbm->query($sql);
    if (count($rs['list']) == 0) {
        die('{"code":"1","msg":"登录状态可能已失效,请重新登录"}');
    }
    $_POST['upassnew'] = isset($_POST['upassnew']) ? $_POST['upassnew'] : '';
    $_POST['new_upass'] = isset($_POST['new_upass']) ? $_POST['new_upass'] : '';
    $_POST['re_upass'] = isset($_POST['re_upass']) ? $_POST['re_upass'] : '';
    $verify = verify::verify_upass($_POST['new_upass']);
    if ($rs['list'][0]['apass'] != helper::password_encrypt($_POST['upassnew'])) {
        die('{"code":"1","msg":"原密码输入不正确","id":"upassnew"}');
    }
    if ($verify != '') {
        die('{"code":"1","msg":"' . $verify . '","id":"new_upass"}');
    }
    if ($_POST['new_upass'] != $_POST['re_upass']) {
        die('{"code":"1","msg":"新密码输入不一致","id":"new_upass"}');
    }
    $fields['apass'] = helper::password_encrypt($_POST['new_upass']);
    $dbm->single_update(TB_PREFIX . "admin_list", $fields, "admin_id='{$_SESSION['admin']['admin_id']}'");
    die('{"code":"0","msg":"密码修改成功"}');
}
Esempio n. 4
0
 function transfer_Money($account_from, $account_to, $amount)
 {
     $verify = new verify();
     // We check if the paying account exists
     if (!$verify->verify_Account($account_from)) {
         echo "The paying account is not in our database";
         return false;
     }
     // We check for funds
     if (!$verify->check_Funds($account_from, $amount)) {
         echo "Insufficient funds";
         return false;
     }
     // We check if the receiving account exists
     if (!$verify->verify_Account($account_to)) {
         echo "The receiving account is not in our database";
         return false;
     }
     $this->make_Payment($account_from, $account_to, $amount);
     echo "Your payment was executed";
 }
Esempio n. 5
0
function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $settings, $loggedIn;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        header("Location: " . $CONF['url'] . "/index.php?a=feed");
    } else {
        if (isset($_POST['verify'])) {
            // Verification usage
            $ver = new verify();
            $ver->db = $db;
            $ver->url = $CONF['url'];
            $ver->enrollno = $_POST['enrollno'];
            $ver->name = $_POST['name'];
            $ver->fname = $_POST['fname'];
            $ver->course = $_POST['course'];
            $ver->branch = $_POST['branch'];
            $ver->join = $_POST['jyear'] . '-' . $_POST['tyear'];
            $ver->born = $_POST['day'] . '/' . $_POST['month'] . '/' . $_POST['year'];
            //$ver->dob = $settings['captcha'];
            $TMPL['verificationMsg'] = $ver->process();
            if ($TMPL['verificationMsg'] == 1) {
                header("Location: " . $CONF['url'] . "/index.php?a=verify");
            }
        }
        if (isset($_SESSION['enrollno']) || isset($_SESSION['born']) || isset($_SESSION['join']) || isset($_SESSION['course']) || isset($_SESSION['branch']) || isset($_SESSION['name'])) {
            header("Location: " . $CONF['url'] . "/index.php?a=register");
        }
    }
    $TMPL['years'] = generateDateForm(0, $date[0]);
    $TMPL['months'] = generateDateForm(1, $date[1]);
    $TMPL['days'] = generateDateForm(2, $date[2]);
    $TMPL['jyear'] = generateDateForm(0, $join[0]);
    $TMPL['tyear'] = generateDateForm(0, $join[1]);
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['Verify'] . ' - ' . $settings['title'];
    $TMPL['ad'] = $settings['ad1'];
    $skin = new skin('register/verify');
    return $skin->make();
}
Esempio n. 6
0
function addSubscribe()
{
    $objResponse = new xajaxResponse();
    if (!get_uid(false)) {
        return $objResponse;
    }
    if (!verify::isSubscribeUser()) {
        verify::addSubscribeUser();
        $count = verify::getCountSubscribe();
        $objResponse->assign('count_subscribe', 'innerHTML', verify::converNumbersTemplate($count));
        $objResponse->assign('count_subscribe_text', 'innerHTML', ending($count, 'пользователь', 'пользователя', 'пользователей'));
        $objResponse->script("\$('button_send').dispose(); \$('send_success').removeClass('b-fon_hide');");
    } else {
        return $objResponse;
    }
    return $objResponse;
}
Esempio n. 7
0
function m__login()
{
    global $dbm;
    $_POST = helper::sqlxss($_POST);
    $_POST['uname'] = isset($_POST['uname']) ? $_POST['uname'] : '';
    $verify = verify::verify_length($_POST['uname'], 1, 20);
    if ($verify != '') {
        die('{"code":"1","msg":"账号' . $verify . '","id":"uname"}');
    }
    $_POST['upass'] = isset($_POST['upass']) ? $_POST['upass'] : '';
    $verify = verify::verify_upass($_POST['upass']);
    if ($verify != '') {
        die('{"code":"1","msg":"' . $verify . '","id":"uname","id":"upass"}');
    }
    $_POST['code'] = isset($_POST['code']) ? $_POST['code'] : '';
    $_POST['safecode'] = isset($_POST['safecode']) ? $_POST['safecode'] : '';
    if ($_POST['safecode'] != SAFE_CODE) {
        die('{"code":"1","msg":"安全码错误","id":"safecode"}');
    }
    if ($_SESSION['login'] != md5(strtoupper($_POST['code']))) {
        die('{"code":"1","msg":"验证码错误","id":"code"}');
    }
    $sql = "select a.*,b.g_urank,b.g_name from " . TB_PREFIX . "admin_list a left join " . TB_PREFIX . "admin_group b on a.group_id=b.group_id where aname='" . $_POST['uname'] . "' limit 1";
    $rs = $dbm->query($sql);
    //print_r($rs);
    if (count($rs['list']) == 0) {
        die('{"code":"1","msg":"账号不存在","id":"uname"}');
    }
    if ($rs['list'][0]['apass'] != helper::password_encrypt($_POST['upass'])) {
        die('{"code":"1","msg":"密码错误","id":"upass"}');
    }
    if ($rs['list'][0]['astate'] != 0) {
        die('{"code":"1","msg":"账号异常","id":"uname"}');
    }
    // 登陆成功
    $_SESSION['admin']["admin_id"] = $rs['list'][0]['admin_id'];
    $_SESSION['admin']["aname"] = $rs['list'][0]['aname'];
    $_SESSION['admin']["aname_true"] = $rs['list'][0]['aname_true'];
    $_SESSION['admin']["group_id"] = $rs['list'][0]['group_id'];
    $_SESSION['admin']['group_level'] = $rs['list'][0]['g_urank'];
    $_SESSION['admin']['gname'] = $rs['list'][0]['g_name'];
    $_SESSION['admin']["alevel"] = $_SESSION['admin']['group_level'] . ',|,' . $rs['list'][0]['alevel'];
    logs($_SESSION['admin']["aname"] . "登陆成功");
    die('{"code":"0","msg":"登录成功"}');
}
Esempio n. 8
0
 public function postComments()
 {
     if ($this->user) {
         $user_id = $this->user['id'];
         $goods_id = $_POST['goods_id'];
         $the_date = $_POST['the_date'];
         $starts = $_POST['starts'];
         $comments = $_POST['comments'];
         if (!verify::vIsNNUll($comments)) {
             core::outPut(-1, "评论内容输入不能为空");
         }
         if (!verify::vIsNumber($starts)) {
             core::outPut(-1, "评论星级选择不能为空");
         }
         if (!verify::vIsNumber($goods_id)) {
             core::outPut(-1, "商品ID不能为空");
         }
         //先判断该用户是否有购买过该商品
         $this->CT_Api->api = "en.order.checkComments";
         $this->CT_Api->user_id = $user_id;
         $this->CT_Api->goods_id = $goods_id;
         $result = $this->CT_Api->get();
         if ($result != 1) {
             core::outPut(-1, "必须购买了该产品才能评论");
         }
         $this->CT_Api->api = "en.comments.save";
         $this->CT_Api->setParams(array('line_id' => $result['response']['id'], 'user_id' => $user_id, 'goods_id' => $goods_id, 'the_date' => $the_date, 'starts' => $starts, 'content' => $comments));
         $result = $this->CT_Api->post();
         if ($result['code'] == 1) {
             core::outPut(1, "评论发表成功");
         } else {
             core::outPut(-1);
         }
     } else {
         core::outPut(1001, "Please login");
     }
 }
Esempio n. 9
0
File: demo.php Progetto: lyb411/util
useImgBg	是否使用背景图片 默认为false
fontSize	验证码字体大小(像素) 默认为25
useCurve	是否使用混淆曲线 默认为true
useNoise	是否添加杂点 默认为true
imageW	验证码宽度 设置为0为自动计算
imageH	验证码高度 设置为0为自动计算
length	验证码位数
fontttf	指定验证码字体 默认为随机获取
useZh	是否使用中文验证码
bg	验证码背景颜色 rgb数组设置,例如 array(243, 251, 254)
seKey	验证码的加密密钥
codeSet	验证码字符集合 3.2.1 新增
zhSet	验证码字符集合(中文) 3.2.1 新增
*/
//001==实例============
$Verify = new verify();
$Verify->length = 4;
$Verify->entry(1);
//002==实例============
//如果你需要在一个页面中生成多个验证码的话,entry方法需要传入可标识的信息,例如: 验证码1:
//$Verify = new Verify();
//$Verify->entry(1);
//$Verify->entry(2);
//003==实例============
/* $config=array(
	'imageW'	=>'130',
	'imageH'	=>'35',
	'fontSize'	=>'18',
	'length'	=>4,
    'useCurve'    =>    false,    //是否使用混淆曲线
    'useNoise'    =>    false,    //是否使用杂点 
Esempio n. 10
0
 public function verifyAction()
 {
     session_start();
     verify::buildImageVerify(6, 1, 'png', 70, 30);
 }
Esempio n. 11
0
 public function orderTrace()
 {
     if ($_POST) {
         $order_code = $_POST['order_code'];
         $billing_email = $_POST['billing_email'];
         if (!verify::vIsNNUll($order_code)) {
             $errmsg = "订单号码输入不能为空";
             $this->assign('email', $billing_email);
             $this->assign('order_code', $order_code);
             $this->assign('errmsg', $errmsg);
             $this->display("tracking");
         }
         if (!verify::vIsNNUll($billing_email)) {
             $errmsg = "账单邮箱输入不能为空";
             $this->assign('email', $billing_email);
             $this->assign('order_code', $order_code);
             $this->assign('errmsg', $errmsg);
             $this->display("tracking");
         }
         if (!verify::vEmail($billing_email)) {
             $errmsg = "账单邮箱格式输入错误";
             $this->assign('email', $billing_email);
             $this->assign('order_code', $order_code);
             $this->assign('errmsg', $errmsg);
             $this->display("tracking");
         }
         if (!preg_match("/^d\\d{10,15}\$/is", $order_code)) {
             $errmsg = "订单号码格式输入错误";
             $this->assign('email', $billing_email);
             $this->assign('order_code', $order_code);
             $this->assign('errmsg', $errmsg);
             $this->display("tracking");
         } else {
             $this->CT_Api->api = "en.order.getByCode";
             $this->CT_Api->code = $order_code;
             $dataResponse = $this->CT_Api->get();
             $data = $dataResponse['response'];
         }
         if (!$data) {
             $errmsg = "Sorry, we could not find that order id in our database.";
         }
         //渲染视图
         $this->assign('errmsg', $errmsg);
         $this->assign('email', $billing_email);
         $this->assign('order_code', $order_code);
         $this->assign('data', $data);
         $this->display("tracking");
     } else {
         $this->display("tracking");
     }
 }
Esempio n. 12
0
    <link href="../css/main.css" rel="stylesheet" media="screen">
    <meta charset="UTF-8">
    <title>Verify User</title>
  </head>
  <body>
<?php 
require 'scripts/class.loginscript.php';
include 'config.php';
// Pulls variables from url. Can pass 1 (verified) or 0 (unverified/blocked) into url
$uid = $_GET['uid'];
$verify = $_GET['v'];
$e = new selectEmail();
$eresult = $e->emailPull($uid);
$email = $eresult['email'];
$username = $eresult['username'];
$v = new verify();
if (isset($uid) && !empty(str_replace(' ', '', $uid)) && isset($verify) && !empty(str_replace(' ', '', $verify))) {
    //Updates the verify column on user
    $vresponse = $v->verifyUser($uid, $verify);
    //Success
    if ($vresponse == 'true') {
        echo $activemsg;
        //Send verification email
        $m = new mailSender();
        $m->sendMail($email, $username, $uid, 'Active');
    } else {
        //Echoes error from MySQL
        echo $vresponse;
    }
} else {
    //Validation error from empty form variables
Esempio n. 13
0
 function verify_action() {
     echo verify::show();
 }
Esempio n. 14
0
function m__edit()
{
    global $dbm;
    check_level("B0202");
    $params = array();
    foreach ($_POST as $k => $v) {
        if (strpos($k, 'pass') > 0) {
        } else {
            $_POST[$k] = helper::sqlxss($v);
        }
    }
    $fields['aname'] = isset($_POST['aname']) ? $_POST['aname'] : '';
    $verify = verify::verify_uname($fields['aname']);
    if ($verify != '') {
        die('{"code":"1","msg":"' . $verify . '","id":"aname"}');
    }
    $_POST['apass'] = isset($_POST['apass']) ? $_POST['apass'] : '';
    $_POST['re_pass'] = isset($_POST['re_pass']) ? $_POST['re_pass'] : '';
    $fields['aname_true'] = isset($_POST['aname_true']) ? $_POST['aname_true'] : '';
    $fields['aemail'] = isset($_POST['aemail']) ? $_POST['aemail'] : '';
    $fields['aphone'] = isset($_POST['aphone']) ? $_POST['aphone'] : '';
    $fields['group_id'] = isset($_POST['group_id']) ? intval($_POST['group_id']) : 0;
    $_POST['admin_id'] = isset($_POST['admin_id']) ? intval($_POST['admin_id']) : 0;
    if ($fields['group_id'] == 0) {
        die('{"code":"1","msg":"请选择管理组","id":"group_id"}');
    }
    if ($_POST['admin_id'] > 0) {
        if ($_POST['apass'] != '') {
            $verify = verify::verify_upass($_POST['apass']);
            if ($verify != '') {
                die('{"code":"1","msg":"' . $verify . '","id":"apass"}');
            }
            if ($_POST['apass'] != $_POST['re_pass']) {
                die('{"code":"1","msg":"两次密码输入不一致","id":"apass"}');
            }
            $fields['apass'] = helper::password_encrypt($_POST['apass']);
        }
        $where = " admin_id ='" . $_POST['admin_id'] . "'";
        $rs = $dbm->single_update(TB_PREFIX . "admin_list", $fields, $where);
        if ($rs['error'] == '') {
            logs("编辑CMS账号资料成功:{$_POST['aname']}");
            die('{"code":"0","msg":"编辑账号成功"}');
        }
        die('{"code":"1","msg":"编辑账号失败,请核实后再编辑"}');
    } else {
        // 添加账号
        $verify = verify::verify_upass($_POST['apass']);
        if ($verify != '') {
            die('{"code":"1","msg":"' . $verify . '","id":"apass"}');
        }
        if ($_POST['apass'] != $_POST['re_pass']) {
            die('{"code":"1","msg":"两次密码输入不一致","id":"apass"}');
        }
        $fields['apass'] = helper::password_encrypt($_POST['apass']);
        $where = " aname='" . $_POST['aname'] . "'";
        $a = $dbm->single_query(array('where' => $where, 'table_name' => TB_PREFIX . "admin_list"));
        if (count($a['list']) > 0) {
            die('{"code":"1","msg":"账号名不能重复","id":"aname"}');
        }
        $fields['reg_date'] = time();
        $fields['astate'] = 0;
        $rs = $dbm->single_insert(TB_PREFIX . "admin_list", $fields);
        if ($rs['error'] == '') {
            logs("添加账号成功:{$_POST['aname']}");
            die('{"code":"0","msg":"添加账号成功"}');
        }
        die('{"code":"1","msg":"添加账号失败,请核实后再添加"}');
    }
}
Esempio n. 15
0
 public static function verify_idcard($idcard)
 {
     $City = array(11 => "北京", 12 => "天津", 13 => "河北", 14 => "山西", 15 => "内蒙古", 21 => "辽宁", 22 => "吉林", 23 => "黑龙江", 31 => "上海", 32 => "江苏", 33 => "浙江", 34 => "安徽", 35 => "福建", 36 => "江西", 37 => "山东", 41 => "河南", 42 => "湖北", 43 => "湖南", 44 => "广东", 45 => "广西", 46 => "海南", 50 => "重庆", 51 => "四川", 52 => "贵州", 53 => "云南", 54 => "西藏", 61 => "陕西", 62 => "甘肃", 63 => "青海", 64 => "宁夏", 65 => "新疆", 71 => "台湾", 81 => "香港", 82 => "澳门", 91 => "国外");
     $iSum = 0;
     $idCardLength = strlen($idcard);
     // 长度验证
     if (!preg_match('/^\\d{17}(\\d|x)$/i', $idcard) and !preg_match('/^\\d{15}$/i', $idcard)) {
         return false;
     }
     // 地区验证
     if (!array_key_exists(intval(substr($idcard, 0, 2)), $City)) {
         return false;
     }
     // 15位身份证验证生日,转换为18位
     if ($idCardLength == 15) {
         $sBirthday = '19' . substr($idcard, 6, 2) . '-' . substr($idcard, 8, 2) . '-' . substr($idcard, 10, 2);
         $d = new DateTime($sBirthday);
         $dd = $d->format('Y-m-d');
         if ($sBirthday != $dd) {
             return false;
         }
         $idcard = substr($idcard, 0, 6) . "19" . substr($idcard, 6, 9);
         //15to18
         $Bit18 = verify::get_verify_bit($idcard);
         //算出第18位校验码
         $idcard = $idcard . $Bit18;
     }
     // 判断是否大于2078年,小于1900年
     $year = substr($idcard, 6, 4);
     if ($year < 1900 || $year > 2078) {
         return false;
     }
     // 18位身份证处理
     $sBirthday = substr($idcard, 6, 4) . '-' . substr($idcard, 10, 2) . '-' . substr($idcard, 12, 2);
     $d = new DateTime($sBirthday);
     $dd = $d->format('Y-m-d');
     if ($sBirthday != $dd) {
         return false;
     }
     // 身份证编码规范验证
     $idcard_base = substr($idcard, 0, 17);
     if (strtoupper(substr($idcard, 17, 1)) != verify::get_verify_bit($idcard_base)) {
         return false;
     }
     return $idcard;
 }
Esempio n. 16
0
 static function show() {
     $verify=new verify();
     $verify->main();
 }
Esempio n. 17
0
<?php 
class verify
{
    public function _construct()
    {
        if (isset($_GET['username'])) {
            $this->make_verified($_GET['username']);
        } else {
            header("Location:index.php");
        }
    }
    private function make_verified($username)
    {
        echo "<center><p id='response'>Your account(" . htmlentities($username) . ") has been verified:<a href='../'>Signin</a> </p></center>";
    }
}
$verify = new verify();
$verify->_construct();
?>

</center>
<footer>
	<a href='../about.php' class='a'>About</a>
	<a href='../blog.php' class='a'>Blog</a>
	<a href='../team.php' class='a'>Team</a>
	<a href='../privacy.php' class='a'>Privacy</a>
	<a href='..'>&copy Yilo 2015</a>
</footer>
</body>
</html>
Esempio n. 18
0
        }
        foreach ($strArray as $k => $v) {
            $strValue[] = $tempArray[$v];
        }
        $str = implode($this->dilimter, $strValue);
        $this->str = $str;
        return $str;
    }
    /**
     * write the text
     * 写入文字
     */
    function text($img, $str, $color = false)
    {
        $color = $color ? $color : imagecolorallocate($img, 211, 0, 95);
        imagestring($img, 4, 7, 3, strtoupper($str), $color);
        return $img;
    }
    /**
     * display the image
     * 显示图片
     */
    function display()
    {
        session_start();
        $_SESSION['verify'] = str_replace($this->dilimter, "", $this->str);
        imagegif($this->img);
    }
}
$verify = new verify(5, 2, false, 85, 20);
$verify->display();