Пример #1
0
 public function fix_avatars()
 {
     connect();
     $array = mysql_array("SELECT distinct md5(email), email from jq_comments");
     foreach ($array as $row) {
         $email = $row[1];
         $data = file_get_contents('http://www.gravatar.com/avatar/' . $row[0] . '.png?d=404&s=48');
         if ($data) {
             $avatar = "avatars/" . $row[0] . ".png";
             $file = fopen($avatar, "w");
             if (!$file) {
                 throw new Exception("IO Error: Can't open file {$avatar}");
             }
             fwrite($avatar, $data);
             fclose($file);
         } else {
             $avatar = "avatars/default.png";
         }
         $avatars[] = array($avatar, str_len($data));
         if (!mysql_query("UPDATE jq_comments set avatar = '{$avatar}' where email = '{$email}'")) {
             throw new Exception("Can't update {$row[1]}");
         }
     }
     return $avatars;
 }
Пример #2
0
 /**
  * @author: 肖红阳
  * check created_on column
  * @param $attribute
  */
 public function checkCreatedOn($attribute, $params)
 {
     p($this->{$attribute});
     if (empty($this->{$attribute}) || str_len($this->{$attribute}) < 4 || is_null($this->{$attribute}) || !$this->{$attribute} > 0) {
         $this->addError($attribute, "created_on 错误!");
     } else {
         $this->setAttribute($attribute, $this->{$attribute});
     }
 }
Пример #3
0
function get_ip()
{
    $ip = "UNBEKANNT";
    if (isset($_SERVER['HTTP_CLIENT_IP']) && str_len($_SERVER['HTTP_CLIENT_IP'])) {
        $ip = $_SERVER["HTTP_CLIENT_IP"];
    } else {
        if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && str_len($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
        } else {
            if ($_SERVER["REMOTE_ADDR"]) {
                $ip = $_SERVER["REMOTE_ADDR"];
            }
        }
    }
    return $ip;
}
Пример #4
0
function get_order_info()
{
    $datetime = $_GET['datetime'];
    $order_sn = trim($_GET['order_sn']);
    $print_sn = trim($_GET['print_sn']);
    $where = "where i.country " . $GLOBALS['city_code'];
    if ($datetime) {
        $where .= " and l.bdate='" . $datetime . "'";
    }
    if ($print_sn) {
        $where .= " and l.print_sn='" . $print_sn . "'";
    }
    if ($order_sn) {
        if (str_len($order_sn) == 5) {
            $where .= " and i.order_sn like '%{$order_sn}'";
        } else {
            $where = "where i.country " . $GLOBALS['city_code'] . " and i.order_sn='" . $order_sn . "'";
        }
    }
    $sql = "SELECT i.order_sn,i.inv_payee,i.inv_content,i.postscript,i.money_address,i.scts,i.wsts,i.card_message,i.order_id, i.order_status, i.pay_status, i.orderman, i.consignee, i.add_time as time1, i.pay_name, i.best_time, i.province, i.address, g.remark, dis.status as sta1, dis.route_id, dis.turn, dis.add_time as time2, l.ptime, l.stime, l.print_sn,l.bdate, del.status as sta2, rou.route_code, s.station_name\r\n\tFROM ecs_order_info AS i\r\n\tLEFT JOIN order_genid AS g ON g.order_id = i.order_id\r\n\tLEFT JOIN order_dispatch AS dis ON dis.order_id = i.order_id\r\n\tLEFT JOIN print_log_x AS l ON l.order_id = dis.order_id \r\n\tLEFT JOIN order_delivery AS del ON del.order_id = i.order_id\r\n\tLEFT JOIN ship_route AS rou ON rou.route_id = dis.route_id\r\n\tLEFT JOIN ship_station AS s ON rou.station_id = s.station_id " . $where . " limit 1";
    $arr = $GLOBALS['db_read']->getRow($sql);
    if ($arr['order_id']) {
        $sql = "select goods_name,goods_attr,goods_number from ecs_order_goods as goo where order_id='" . $arr['order_id'] . "' and goods_attr!=''";
        $arr2 = $GLOBALS['db_read']->getAll($sql);
    } else {
        $arr2 = array();
    }
    foreach ($arr2 as $k => $v) {
        $arr2[$k]['goods_name'] = $v['goods_name'] . "--" . $v['goods_attr'] . "--" . $v['goods_number'];
        if ($k != 0) {
            $arr2[0]['goods_name'] .= " | " . $arr2[$k]['goods_name'];
        }
    }
    $sql = "select sum(goods_number) as c_num from ecs_order_goods as goo where order_id='" . $arr['order_id'] . "' and goods_id='60'";
    $c_arr = $GLOBALS['db_read']->getOne($sql);
    $sql = "select sum(goods_number) as l_num from ecs_order_goods as goo where order_id='" . $arr['order_id'] . "' and goods_id='61'";
    $l_arr = $GLOBALS['db_read']->getOne($sql);
    return array("order_info" => $arr, "goods_info" => $arr2, "cj" => $c_arr, "lz" => $l_arr);
}
Пример #5
0
function get_order_info()
{
    $datetime = empty($_GET['datetime']) ? date("Y-m-d") : $_GET['datetime'];
    $order_sn = empty($_GET['order_sn']) ? "" : trim($_GET['order_sn']);
    $print_sn = empty($_GET['print_sn']) ? "" : trim($_GET['print_sn']);
    $where = "where i.country " . $GLOBALS['city_code'];
    if ($datetime) {
        $where .= " and l.bdate='" . $datetime . "'";
    }
    if ($print_sn) {
        $where .= " and l.print_sn='" . $print_sn . "' ";
    }
    if ($order_sn) {
        if (str_len($order_sn) == 5) {
            $where .= " and i.order_sn like '%{$order_sn}' ";
        } else {
            $where = "where i.order_sn='" . $order_sn . "'";
        }
    }
    $sql = "SELECT i.order_sn,i.order_id, i.best_time, l.ptime, l.stime, l.print_sn,bdate  \r\n\tFROM ecs_order_info AS i\r\n\tLEFT JOIN order_genid AS g ON g.order_id = i.order_id\r\n\tLEFT JOIN order_dispatch AS dis ON dis.order_id = i.order_id\r\n\tLEFT JOIN print_log_x AS l ON l.order_id = dis.order_id \r\n\tLEFT JOIN order_delivery AS del ON del.order_id = i.order_id\r\n\tLEFT JOIN ship_route AS rou ON rou.route_id = dis.route_id\r\n\tLEFT JOIN ship_station AS s ON rou.station_id = s.station_id " . $where . " limit 1";
    $arr = $GLOBALS['db_read']->getRow($sql);
    return $arr;
}
Пример #6
0
     exit;
 case 'register':
     //更新数据库数据
     $sms_server_id = empty($_POST["sms_server_id"]) ? 0 : intval($_POST["sms_server_id"]);
     $user = trim($_POST["user"]);
     $pass = trim($_POST["pass"]);
     $server = trim($_POST["server"]);
     $port = trim($_POST["port"]);
     $total = empty($_POST["total"]) ? 0 : intval($_POST["total"]);
     $is_active = empty($_POST["is_active"]) ? 0 : intval($_POST["is_active"]);
     $phone = trim($_POST["phone"]);
     $sql = "update " . $ecs->table("sms_server") . " set user='******',pass='******',server='{$server}',port='{$port}',is_active='{$is_active}',total='{$total}' where sms_server_id=" . $sms_server_id;
     $db->query($sql);
     $msg = "服务器设置成功!";
     //短信测试
     if ($is_active && str_len($phone) > 3) {
         $sms = new sms();
         $res = $sms->send($phone, "您好,您已开通您的短信服务,感谢您的使用!【磐盛科技】", "", "", $_SESSION["admin_name"]);
         if ($res['error'] == 1) {
             $msg .= $res['msg'];
         } else {
             $msg .= "请查收短信";
         }
     }
     sys_msg($msg, 0, array(), false);
     exit;
 case 'sense':
     $smarty->assign('ur_here', "敏感词汇");
     $sms = new sms();
     $smarty->assign('sense', implode("|", $sms->sense));
     assign_query_info();
Пример #7
0
    public function create_menu($db)
    {
        $this->access_token($db);
        $ret = $db->getRow("SELECT `access_token` FROM `wxch_config`");
        $access_token = $ret['access_token'];
        if (strlen($access_token) == 150) {
            $url = 'https://api.weixin.qq.com/cgi-bin/menu/create?access_token=' . $access_token;
            $menu = '{
     "button":[
     {	
          "type":"click",
          "name":"新款推荐",
          "key":"XKTJ"
      },
      {
           "type":"click",
           "name":"绑定会员",
           "key":"BDHY"
      },
      {
           "name":"帮助",
           "sub_button":[
           {	
               "type":"click",
               "name":"订单查询",
               "key":"DDCX",
            },
            {
              "type":"click",
               "name":"快递查询",
               "key":"KDCX",
            },
            {
               "type":"click",
               "name":"帮助",
               "key":"HELP"
            }]
       }]
 }';
            $ret = $this->curl_grab_page($url, $menu);
            $errmsg = $ret->errmsg;
            if ($errmsg == 'ok') {
                echo '创建菜单成功';
            } else {
                $i = 1;
                $max = 100;
                for ($i; $i <= $max; $i++) {
                    sleep(1);
                    $ret_json = $this->curl_grab_page($url, $menu);
                    $ret = json_decode($ret_json);
                    if ($ret->errcode == 0) {
                        echo '尝试第' . $i . '时成功创建';
                        break;
                    }
                }
                if ($ret->errcode == -1) {
                    echo '尝试创建' . $i . '次菜单失败,请稍后再试';
                }
            }
            print_r($ret);
        } else {
            echo 'access_token:' . str_len($access_token);
        }
    }
Пример #8
0
function linktipp_display($linktipp, $addclass = '')
{
    global $options;
    if (!isset($linktipp)) {
        return;
    }
    $post_id = isset($linktipp->ID) ? $linktipp->ID : 0;
    $title = get_the_title($linktipp);
    $linktipp_url = get_post_meta($post_id, 'linktipp_url', true);
    $linktipp_imgid = get_post_meta($post_id, 'linktipp_imgid', true);
    $linktipp_image = get_post_meta($post_id, 'linktipp_image', true);
    $linktipp_untertitel = get_post_meta($post_id, 'linktipp_untertitel', true);
    $linktipp_text = get_post_meta($post_id, 'linktipp_text', true);
    if (isset($linktipp_untertitel) && !isset($title)) {
        $title = $linktipp_untertitel;
        $linktipp_untertitel = '';
    }
    $out = '';
    $out .= '<section class="p3-column linktipps ' . $addclass . '" id="post-' . $post_id . '" >';
    $out .= "\n";
    if ($options['linktipps-titlepos'] != 1) {
        $out .= '<header class="post-title p3-cbox">';
        if (mb_strlen(trim($linktipp_untertitel)) > 1) {
            $out .= '<div class="hgroup">';
        }
        if ($options['linktipps-subtitlepos'] == 0 && mb_strlen(trim($linktipp_untertitel)) > 1) {
            $out .= '<h3 class="subtitle">' . $linktipp_untertitel . '</h3>';
        }
        $out .= '<h2>';
        if ($options['linktipps-linkpos'] == 0 || $options['linktipps-linkpos'] == 3) {
            $out .= '<a href="' . $linktipp_url . '" rel="bookmark">';
        }
        $out .= $title;
        if ($options['linktipps-linkpos'] == 0 || $options['linktipps-linkpos'] == 3) {
            $out .= '</a>';
        }
        $out .= '</h2>';
        if ($options['linktipps-subtitlepos'] == 1 && mb_strlen(trim($linktipp_untertitel)) > 1) {
            $out .= '<h3 class="subtitle">' . $linktipp_untertitel . '</h3>';
        }
        if (mb_strlen(trim($linktipp_untertitel)) > 1) {
            $out .= '</div>';
        }
        $out .= '</header>';
        $out .= "\n";
    }
    $out .= '<div class="p3-column">';
    $out .= "\n";
    $out .= '<article class="post-entry p3-cbox">';
    $out .= "\n";
    if ($options['linktipps-linkpos'] == 1) {
        $out .= '<a href="' . $linktipp_url . '">';
    }
    if (isset($linktipp_imgid) && $linktipp_imgid > 0) {
        $image_attributes = wp_get_attachment_image_src($linktipp_imgid, 'linktipp-thumb');
        if (is_array($image_attributes)) {
            $out .= '<img src="' . $image_attributes[0] . '" width="' . $image_attributes[1] . '" height="' . $image_attributes[2] . '" alt="' . trim(strip_tags($linktipp_text)) . '">';
        }
    } elseif (isset($linktipp_image)) {
        $out .= '<img src="' . $linktipp_image . '" alt="">';
    }
    if ($options['linktipps-linkpos'] == 1) {
        $out .= '</a>';
    }
    if (isset($linktipp_text)) {
        $out .= piratenkleider_make_nice_links($linktipp_text);
    }
    $out .= "</article>\n";
    if ($options['linktipps-titlepos'] == 1) {
        $out .= '<header class="post-title p3-cbox">';
        if (str_len(trim($linktipp_untertitel)) > 1) {
            $out .= '<div class="hgroup">';
        }
        if ($options['linktipps-subtitlepos'] == 0 && str_len(trim($linktipp_untertitel)) > 1) {
            $out .= '<h3 class="subtitle">' . $linktipp_untertitel . '</h3>';
        }
        $out .= '<h2>';
        if ($options['linktipps-linkpos'] == 0 || $options['linktipps-linkpos'] == 3) {
            $out .= '<a href="' . $linktipp_url . '" rel="bookmark">';
        }
        $out .= $title;
        if ($options['linktipps-linkpos'] == 0 || $options['linktipps-linkpos'] == 3) {
            $out .= '</a>';
        }
        $out .= '</h2>';
        if ($options['linktipps-subtitlepos'] == 1 && str_len(trim($linktipp_untertitel)) > 1) {
            $out .= '<h3 class="subtitle">' . $linktipp_untertitel . '</h3>';
        }
        if (str_len(trim($linktipp_untertitel)) > 1) {
            $out .= '</div>';
        }
        $out .= '</header>';
        $out .= "\n";
    }
    if ($options['linktipps-linkpos'] == 2 || $options['linktipps-linkpos'] == 3) {
        $out .= '<footer class="linktipp-url"><a class="extern" href="' . $linktipp_url . '">' . $linktipp_url . '</a></footer>';
    }
    $out .= "</div>\n";
    $out .= "</section>\n";
    return $out;
}
Пример #9
0
function search_smart_truncate($text, $len, $needles)
{
    if (is_array($needles) && count($needles)) {
        return truncatePreserveWords($text, $needles);
    } else {
        if (str_len($txt) > $len) {
            return word_limiter($text, $len);
        }
    }
}
Пример #10
0
<?php

$firstName = 'Andy';
$nameLength = str_len($firstName);
$myVar = 'Hi, my name is ' . $nameLength . ' letters long.';
echo $myVar;
Пример #11
0
    public function create_menu($db)
    {
        $this->access_token($db);
        $ret = $db->getRow("SELECT `access_token` FROM `wxch_config`");
        $access_token = $ret['access_token'];
        if (strlen($access_token) == 150) {
            $url = 'https://api.weixin.qq.com/cgi-bin/menu/create?access_token=' . $access_token;
            //            $arr = array(
            //                'button' => array(
            //                    array('type'=>'click','name'=>'新款推荐','key'=>'XKTJ'),
            //                    array('type'=>'click','name'=>'绑定会员','key'=>'BDHY'),
            //                    array('name'=>'更多','sub_button'=>array(
            //                            array('type'=>'click','name'=>'订单查询','key'=>'DDCX'),
            //                            array('type'=>'click','name'=>'快递查询','key'=>'KDCX'),
            //                            array('type'=>'click','name'=>'帮助','key'=>'HELP')
            //                            )
            //                        )
            //                    )
            //            );
            //            $arr = mb_convert_encoding($arr, "GBK", "UTF-8");
            //            print_r($arr);exit;
            //            $menu = json_encode($arr);
            //            print_r($menu);exit;
            //
            $menu = '{
     "button":[
     {	
          "type":"click",
          "name":"新款推荐",
          "key":"XKTJ"
      },
      {
           "type":"click",
           "name":"绑定会员",
           "key":"BDHY"
      },
      {
           "name":"帮助",
           "sub_button":[
           {	
               "type":"click",
               "name":"订单查询",
               "key":"DDCX",
            },
            {
              "type":"click",
               "name":"快递查询",
               "key":"KDCX",
            },
            {
               "type":"click",
               "name":"帮助",
               "key":"HELP"
            }]
       }]
 }';
            //     print_r($menu);exit;
            //            $menu = mb_convert_encoding($menu, "UTF-8", "GBK");
            //            $menu_arr = json_decode($menu,TRUE);
            $ret = $this->curl_grab_page($url, $menu);
            $errmsg = $ret->errmsg;
            if ($errmsg == 'ok') {
                echo '创建菜单成功';
            } else {
                $i = 1;
                $max = 100;
                for ($i; $i <= $max; $i++) {
                    sleep(1);
                    $ret_json = $this->curl_grab_page($url, $menu);
                    $ret = json_decode($ret_json);
                    if ($ret->errcode == 0) {
                        echo '尝试第' . $i . '时成功创建';
                        break;
                    }
                }
                if ($ret->errcode == -1) {
                    echo '尝试创建' . $i . '次菜单失败,请稍后再试';
                }
            }
            print_r($ret);
        } else {
            echo 'access_token:' . str_len($access_token);
        }
    }
Пример #12
0
function order_list()
{
    $filter['sdate'] = empty($_REQUEST['sdate']) ? '' : trim($_REQUEST['sdate']);
    $filter['order_sn'] = empty($_REQUEST['order_sn']) ? '' : trim($_REQUEST['order_sn']);
    $filter['turn'] = empty($_REQUEST['turn']) ? 0 : intval($_REQUEST['turn']);
    $filter['station'] = empty($_REQUEST['station']) ? '' : intval($_REQUEST['station']);
    $filter['employee'] = empty($_REQUEST['employee']) ? '' : intval($_REQUEST['employee']);
    $filter['pack_no'] = empty($_REQUEST['pack_no']) ? '' : trim($_REQUEST['pack_no']);
    $filter['print_sn'] = empty($_REQUEST['print_sn']) ? '' : trim($_REQUEST['print_sn']);
    $filter['status'] = empty($_REQUEST['status']) ? '' : intval($_REQUEST['status']);
    $filter['orderstatus'] = empty($_REQUEST['orderstatus']) ? '' : intval($_REQUEST['orderstatus']);
    $filter['page'] = empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0 ? 1 : intval($_REQUEST['page']);
    $where = " where o.country " . $GLOBALS['city_code'] . " ";
    if ($filter['sdate']) {
        $where .= " and best_time > '" . $filter['sdate'] . "' and best_time < '" . $filter['sdate'] . " 23:30:00'";
    }
    if ($filter['turn']) {
        $where .= " and c.turn = '" . $filter['turn'] . "' ";
    }
    if ($filter['employee']) {
        $where .= " and employee_id = '" . $filter['employee'] . "' ";
    }
    if ($filter['pack_no']) {
        $where .= " and d.route_name = '" . $filter['pack_no'] . "' ";
    }
    if ($filter['status']) {
        $where .= " and a.status = '" . $filter['status'] . "' ";
    }
    if ($filter['orderstatus'] == 0) {
        $where .= " and order_status =0 ";
    }
    if ($filter['orderstatus'] == 1) {
        $where .= " and order_status =1 ";
    }
    if ($filter['orderstatus'] == 2) {
        $where .= " and order_status =2 ";
    }
    if ($filter['orderstatus'] == 3) {
        $where .= " and order_status =3 ";
    }
    if ($filter['orderstatus'] == 4) {
        $where .= " and order_status =4 ";
    }
    if ($filter['order_sn']) {
        if (str_len($filter['order_sn']) == 5) {
            $where .= " and order_sn like '%" . $filter['order_sn'] . "' ";
        } else {
            $where = " where order_sn = '" . $filter['order_sn'] . "' ";
        }
    }
    if ($filter['station'] && $filter['station'] != 100) {
        $where .= " and d.station_id = '" . $filter['station'] . "' ";
    }
    if ($filter['print_sn']) {
        $where .= "and p.print_sn = '" . $filter['print_sn'] . "' ";
    }
    if ($filter['station'] == 100) {
        $where .= " and shipping_station_name is null ";
    }
    if ($filter['sort_by'] == 'shipping_station_name') {
        $orderby = "shipping_pack_no,best_time ";
    } elseif ($filter['sort_by'] == 'shipping_pack_no') {
        $orderby = "shipping_station_name, best_time ";
    } else {
        $orderby = "shipping_station_name, shipping_pack_no ";
    }
    if ($_SESSION['station'] > 0) {
        $where .= " and d.station_id = '" . $_SESSION['station'] . "' ";
    }
    $size = 30;
    $sql = "select count(1) " . "from order_delivery as a " . "left join ecs_order_info as o on a.order_id=o.order_id " . "left join order_dispatch as c on a.order_id=c.order_id " . "left join print_log_x as p on a.order_id=p.order_id " . "left join hr_employees as h on a.employee_id=h.id " . "left join ship_route as d on c.route_id=d.route_id " . "left join ship_station as s on d.station_id=s.station_id " . $where;
    $record_count = $GLOBALS['db_read']->getOne($sql);
    $page_count = $record_count > 0 ? ceil($record_count / $size) : 1;
    $sql = "select a.order_id,p.print_sn,o.order_sn,o.city,o.address,o.best_time,c.*,d.*,s.station_name,s.station_code,a.status,h.name as employee_name " . "from order_delivery as a " . "left join ecs_order_info as o on a.order_id=o.order_id " . "left join order_dispatch as c on a.order_id=c.order_id " . "left join print_log_x as p on a.order_id=p.order_id " . "left join hr_employees as h on a.employee_id=h.id " . "left join ship_route as d on c.route_id=d.route_id " . "left join ship_station as s on d.station_id=s.station_id " . $where . "order by d.route_name,c.turn,best_time " . "LIMIT " . ($filter['page'] - 1) * $size . ",{$size}";
    $res = $GLOBALS['db_read']->GetAll($sql);
    $sql = "SELECT a.sender,b.name FROM delivery_plan as a,hr_employees as b WHERE a.sender=b.id and bdate = '" . $filter['sdate'] . "' \r\n\t\t\tand a.station_id = '" . $filter['station'] . "'";
    $res2 = $GLOBALS['db_read']->GetAll($sql);
    foreach ($res as $key => $val) {
        $res[$key]['i'] = $key + 1;
        $res[$key]['address'] = region_name($val['city']) . ' ' . $val['address'];
    }
    $arr = array('orders' => $res, 'filter' => $filter, 'page_count' => $page_count, 'record_count' => $record_count, 'senders' => $res2);
    return $arr;
}
Пример #13
0
function createLicense($max_id, $sum)
{
    $yard = yard();
    $license = array();
    for ($i = 0; $i < $sum; $i++) {
        $time = time() + ++$max_id;
        //时间戳加上当前最大的id号表示唯一
        $li = dechex($time);
        //将唯一编号转换为十六进制
        $total = 0;
        for ($j = 0; $j < str_len($li); $j++) {
            $res = ord($li[$j]);
            //计算这些十六进制asic码总和
            $total += $res;
        }
        $total = $total % 36;
        //将total模上36,获取最后一位校验码
        $y = $yard[$total];
        $li = $li . "" . $y;
        $license[] = $li;
        // 		echo $li.'<br><br>';
    }
    return $license;
}
Пример #14
0
function convert_back_cbs($cb_val)
{
    $cb_str = (string) $cb_val;
    $len = str_len($cb_arr);
    while ($len <= 5) {
        $cb_str .= '0';
        $len++;
    }
    return str_split($cb_str);
}
Пример #15
0
 /**
  * Max Length
  *
  * @access	public
  * @param	string
  * @param	value
  * @return	bool
  */
 public function max_length($str, $val)
 {
     if (preg_match("/[^0-9]/", $val)) {
         return FALSE;
     }
     //if (function_exists('mb_strlen'))
     //{
     //	return (mb_strlen($str) > $val) ? FALSE : TRUE;
     //}
     return str_len($str) > $val ? FALSE : TRUE;
 }
Пример #16
0
function hasData($fieldName)
{
    return str_len(trim($_POST[$fieldName])) !== 0;
}
Пример #17
0
 /**
  * 封装短信发送接口
  * url最长不能超过2083
  */
 function send($phones, $msg, $school_code, $class_code, $creator, $suf = '')
 {
     $result = array('error' => 0, 'msg' => '');
     //检查手机号码是否正确,手机号总长度不超过1024
     if (empty($phones) || str_len($phones) == 0) {
         return array('error' => 1, 'msg' => '手机号码不能为空');
     }
     if (str_len($phones) > 1024) {
         return array('error' => 1, 'msg' => '手机号码过长,最多可同时发送给100个客户');
     }
     $phones_tmp = explode(",", $phones);
     $error_phones = array();
     foreach ($phones_tmp as $k => $p) {
         if (!is_moblie($p)) {
             $error_phones[] = $p;
         }
     }
     if (count($error_phones) > 0) {
         $erro = implode(",", $error_phones);
         return array('error' => 1, 'msg' => '您发送的号码中有错误号码:' . $erro . '');
     }
     //对号码进行去重
     $phones = removeRepeat($phones_tmp);
     //检查短信内容是否包含有敏感字符,短信内容不能超过512个字符
     if (empty($msg) || str_len($msg) == 0) {
         return array('error' => 1, 'msg' => '短信内容不能为空');
     }
     if (str_len($msg) > 512) {
         return array('error' => 1, 'msg' => '短信内容不能超过512个字符');
     }
     //检查是否带了签名
     if (stripos($msg, "【") <= -1 || stripos($msg, "】") <= -1) {
         if ($suf) {
             $this->suf = suf;
         }
         $msg .= $this->suf;
     }
     $error_words = array();
     foreach ($this->sense as $k => $v) {
         if (stripos($msg, $v) > -1) {
             $error_words[] = $v;
         }
     }
     if (count($error_words) > 0) {
         $erro = implode("|", $error_words);
         return array('error' => 1, 'msg' => '您发送的短信内容中存在敏感词汇:' . $erro . '');
     }
     /**
      * 1、将短信插入到短信队列
      * 2、发送短信
      * 3、更新短信队列中的状态
      * 4、更新短信服务器的总条数记录
      */
     $school_code = $school_code != "super" ? $school_code : 'hteacher';
     $database = $school_code ? $school_code : 'hteacher';
     if ($database != "hteacher" && !strpos($database, "_school")) {
         $database = $database . '_school';
     }
     $sql = "insert into " . $database . ".ht_sms (content,phones, status, class_code, creator, created ) \n\t\t\tvalues ('" . $msg . "','" . $phones . "',0,'" . $class_code . "','" . $creator . "',now())";
     $this->db->query($sql);
     $sms_id = $this->db->insert_id();
     $info = $this->sendSMS($phones, $msg);
     if (empty($info[0]) || $info[0] == 0) {
         $sql = "update " . $database . ".ht_sms set status=2 where sms_id=" . $sms_id;
         $this->db->query($sql);
         return array('error' => 1, 'msg' => '短信发送失败:' . $info[1] . '');
     }
     $sql = "update " . $database . ".ht_sms set status=1, num='" . $info[1] . "',sended=now() where sms_id=" . $sms_id;
     $this->db->query($sql);
     $sql = "update hteacher.ht_sms_server set used=used+" . $info[1] . " where sms_server_id=" . $this->sms_server_id;
     $this->db->query($sql);
     return $result;
 }
Пример #18
0
         $error_user_list = $cls_user->test_conflict($test_user_list);
         //检查
         if ($error_user_list) {
             $domain_len = 0 - str_len($domain);
             $count = count($error_user_list);
             for ($i = 0; $i < $count; $i++) {
                 $error_user_list[$i] = substr($error_user_list[$i], 0, $domain_len);
             }
             /* 将用户标记为改名失败 */
             $sql = "UPDATE " . $GLOBALS['ecs']->table('users') . " SET flag = '1' WHERE " . db_create_in($error_user_list, 'user_name');
         }
         /* 检查改名后用户是否与商城用户重名 */
         $sql = "SELECT user_name FROM " . $GLOBALS['ecs']->table('users') . " WHERE " . db_create_in($test_user_list, 'user_name');
         $error_user_list = $GLOBALS['db']->getCol($sql);
         if ($error_user_list) {
             $domain_len = 0 - str_len($domain);
             $count = count($error_user_list);
             for ($i = 0; $i < $count; $i++) {
                 $error_user_list[$i] = substr($error_user_list[$i], 0, $domain_len);
             }
             /* 将用户标记为改名失败 */
             $sql = "UPDATE " . $GLOBALS['ecs']->table('users') . " SET flag = '1' WHERE " . db_create_in($error_user_list, 'user_name');
         }
     }
 }
 if ($start + $size < $total) {
     $result['start'] = $start + $size;
     $result['content'] = sprintf($_LANG['notice'], $result['start'], $total);
 } else {
     $start = $total;
     $result['content'] = $_LANG['check_complete'];
Пример #19
0
require ROOT_PATH . '/includes/cls_sms.php';
$action = isset($_REQUEST['act']) ? $_REQUEST['act'] : 'def';
switch ($action) {
    case 'def':
        $sql = "select * from " . $ecs->table("student") . " where is_active=1 ";
        //and license!=''
        $students = $db->getAll($sql);
        $smarty->assign("students", $students);
        $smarty->display('sms_def.htm');
        exit;
    case 'send':
        $phones = trim($_POST["phones"]);
        $content = trim($_POST["content"]);
        $copy = trim($_POST["copy"]);
        $result = array("error" => 1, "msg" => "您选择的家长的电话号码全部为空");
        if (str_len($phones) > 4) {
            if ($copy) {
                $admin = get_admin_by_id($_SESSION["admin_id"]);
                if (is_moblie($admin["cellphone"])) {
                    $phones .= "," . $admin["cellphone"];
                }
            }
            $sms = new sms();
            $result = $sms->send($phones, $content, $school_code, $class_code, $_SESSION["admin_name"]);
        }
        make_json($result);
        exit;
    case 'record':
        $smarty->display('sms_list.htm');
        exit;
    case 'ajax_list':
Пример #20
0
 function strlen()
 {
     $str = "我是一个php程序员";
     $count = str_len($str);
     echo $count;
 }
Пример #21
0
function get_userfolder($userid)
{
    $key = "get_userfolder_" . $userid;
    $userfolder = getSqlCacheData($key);
    if (!$userfolder) {
        global $adb, $mailstore_directory;
        //global $log;
        $userfolder = "";
        $current_username = getUserName($userid);
        if ($current_username == "") {
            return $mailstore_directory;
        }
        require_once "include/utils/ChineseSpellUtils.php";
        $spell = new ChineseSpell();
        $length = str_len($current_username);
        $current_username = iconv_ec("UTF-8", "GBK", $current_username);
        $current_username = $spell->getFullSpell($current_username, "");
        $current_username = strtolower($current_username);
        $userfolder = $mailstore_directory . $current_username . "/";
        setSqlCacheData($key, $userfolder);
    }
    return $userfolder;
}
Пример #22
0
 /**
  * Writes SyncMail to MAPI (actually flags only)
  *
  * @param mixed             $mapimessage
  * @param SyncMail          $message
  */
 private function setEmail($mapimessage, $message)
 {
     $flagmapping = MAPIMapping::GetMailFlagsMapping();
     $flagprops = MAPIMapping::GetMailFlagsProperties();
     $flagprops = array_merge($this->getPropIdsFromStrings($flagmapping), $this->getPropIdsFromStrings($flagprops));
     // flag specific properties to be set
     $props = $delprops = array();
     // unset message flags if:
     // flag is not set
     if (empty($message->flag) || !isset($message->flag->flagstatus) || isset($message->flag->flagstatus) && ($message->flag->flagstatus == 0 || $message->flag->flagstatus == "")) {
         // if message flag is empty, some properties need to be deleted
         // and some set to 0 or false
         $props[$flagprops["todoitemsflags"]] = 0;
         $props[$flagprops["status"]] = 0;
         $props[$flagprops["completion"]] = 0.0;
         $props[$flagprops["flagtype"]] = "";
         $props[$flagprops["ordinaldate"]] = 0x7fffffff;
         // ordinal date is 12am 1.1.4501, set it to max possible value
         $props[$flagprops["subordinaldate"]] = "";
         $props[$flagprops["replyrequested"]] = false;
         $props[$flagprops["responserequested"]] = false;
         $props[$flagprops["reminderset"]] = false;
         $props[$flagprops["complete"]] = false;
         $delprops[] = $flagprops["todotitle"];
         $delprops[] = $flagprops["duedate"];
         $delprops[] = $flagprops["startdate"];
         $delprops[] = $flagprops["datecompleted"];
         $delprops[] = $flagprops["utcstartdate"];
         $delprops[] = $flagprops["utcduedate"];
         $delprops[] = $flagprops["completetime"];
         $delprops[] = $flagprops["flagstatus"];
         $delprops[] = $flagprops["flagicon"];
     } else {
         $this->setPropsInMAPI($mapimessage, $message->flag, $flagmapping);
         $props[$flagprops["todoitemsflags"]] = 1;
         if (isset($message->subject) && str_len($message->subject) > 0) {
             $props[$flagprops["todotitle"]] = $message->subject;
         }
         // ordinal date is utc current time
         if (!isset($message->flag->ordinaldate) || empty($message->flag->ordinaldate)) {
             $props[$flagprops["ordinaldate"]] = time();
         }
         // the default value
         if (!isset($message->flag->subordinaldate) || empty($message->flag->subordinaldate)) {
             $props[$flagprops["subordinaldate"]] = "5555555";
         }
         $props[$flagprops["flagicon"]] = 6;
         //red flag icon
         $props[$flagprops["replyrequested"]] = true;
         $props[$flagprops["responserequested"]] = true;
         if ($message->flag->flagstatus == SYNC_FLAGSTATUS_COMPLETE) {
             $props[$flagprops["status"]] = olTaskComplete;
             $props[$flagprops["completion"]] = 1.0;
             $props[$flagprops["complete"]] = true;
             $props[$flagprops["replyrequested"]] = false;
             $props[$flagprops["responserequested"]] = false;
             unset($props[$flagprops["flagicon"]]);
             $delprops[] = $flagprops["flagicon"];
         }
     }
     if (!empty($props)) {
         mapi_setprops($mapimessage, $props);
     }
     if (!empty($delprops)) {
         mapi_deleteprops($mapimessage, $delprops);
     }
 }
Пример #23
0
    // print $u[$i]['img'];
    print ' &nbsp&nbsp&nbsp&nbsp<figure>
	
	<div style="overflow: hidden;">
		<div style="width: 100%;">
			<div style="float: left; width: 180px; height: 180px;">';
    print $u[$i]['img'] . '
			</div>&nbsp&nbsp 
				<div style="float: left; width: 350px; height: 100%; overflow: hidden; padding-top:15px;"><font size="5" color="black" face="Arial" >';
    print $u[$i]['title'] . '</font><br />
					<font size="1" color="red" face="Arial">' . $u[$i]['date'] . '</font>	
				</div>
		</div>
	</div>	<br />
				<div class="text" style="padding:5px; word-break: break-all;">';
    str_len($u[$i]['text'], $u[$i]['id']);
    print '</div>
							</figure>	<br/><br/>';
}
?>



</div>
<div style="float: left; width: 25%; height: 100%;">

<div id="auto"><font size="5" color="white" face="Arial" >Авторизація</font></div>
<div id="right">
<br/>