Example #1
0
 /**
  * 亿美短信发送接口
  * @param unknown $mobile 手机号
  * @param unknown $content 短信内容
  */
 private function _sendEmay($mobile, $content)
 {
     set_time_limit(0);
     define('SCRIPT_ROOT', BASE_DATA_PATH . '/api/emay/');
     require_once SCRIPT_ROOT . 'include/Client.php';
     /**
      * 网关地址
      */
     $gwUrl = C('sms.gwUrl');
     /**
      * 序列号,请通过亿美销售人员获取
      */
     $serialNumber = C('sms.serialNumber');
     /**
      * 密码,请通过亿美销售人员获取
      */
     $password = C('sms.password');
     /**
      * 登录后所持有的SESSION KEY,即可通过login方法时创建
      */
     $sessionKey = C('sms.sessionKey');
     /**
      * 连接超时时间,单位为秒
      */
     $connectTimeOut = 2;
     /**
      * 远程信息读取超时时间,单位为秒
      */
     $readTimeOut = 10;
     /**
     $proxyhost		可选,代理服务器地址,默认为 false ,则不使用代理服务器
     $proxyport		可选,代理服务器端口,默认为 false
     $proxyusername	可选,代理服务器用户名,默认为 false
     $proxypassword	可选,代理服务器密码,默认为 false
     */
     $proxyhost = false;
     $proxyport = false;
     $proxyusername = false;
     $proxypassword = false;
     $client = new Client($gwUrl, $serialNumber, $password, $sessionKey, $proxyhost, $proxyport, $proxyusername, $proxypassword, $connectTimeOut, $readTimeOut);
     /**
      * 发送向服务端的编码,如果本页面的编码为GBK,请使用GBK
      */
     $client->setOutgoingEncoding("UTF-8");
     $statusCode = $client->login();
     if ($statusCode != null && $statusCode == "0") {
     } else {
         //登录失败处理
         //    echo "登录失败,返回:".$statusCode;exit;
     }
     $statusCode = $client->sendSMS(array($mobile), $content);
     if ($statusCode != null && $statusCode == "0") {
         return true;
     } else {
         return false;
         print_R($statusCode);
         echo "处理状态码:" . $statusCode;
     }
 }
Example #2
0
    Ticket View.
    TODO: Support different views based on auth_token - e.g for BCC'ed users vs. Ticket owner.

    Peter Rotich <*****@*****.**>
    Copyright (c)  2006-2010 osTicket
    http://www.osticket.com

    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.

    vim: expandtab sw=4 ts=4 sts=4:
    $Id: $
**********************************************************************/
require_once 'client.inc.php';
//If the user is NOT logged in - try auto-login (if params exists).
if (!$thisclient || !$thisclient->isValid()) {
    // * On login Client::login will redirect the user to tickets.php view.
    // * See TODO above for planned multi-view.
    $user = null;
    if ($_GET['t'] && $_GET['e'] && $_GET['a']) {
        $user = Client::login($_GET['t'], $_GET['e'], $_GET['a'], $errors);
    }
    //XXX: For now we're assuming the user is the ticket owner
    // (multi-view based on auth token will come later).
    if ($user && $user->getTicketID() == trim($_GET['t'])) {
        @header('Location: tickets.php?id=' . $user->getTicketID());
    }
}
//Simply redirecting to tickets.php until multiview is implemented.
require 'tickets.php';
Example #3
0
    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.

    vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
require_once 'client.inc.php';
if (!defined('INCLUDE_DIR')) {
    die('Fatal Error');
}
define('CLIENTINC_DIR', INCLUDE_DIR . 'client/');
define('OSTCLIENTINC', TRUE);
//make includes happy
require_once INCLUDE_DIR . 'class.client.php';
require_once INCLUDE_DIR . 'class.ticket.php';
if ($_POST) {
    if ($user = Client::login(trim($_POST['lticket']), trim($_POST['lemail']), null, $errors)) {
        //XXX: Ticket owner is assumed.
        @header('Location: tickets.php?id=' . $user->getTicketID());
        require_once 'tickets.php';
        //Just in case of 'header already sent' error.
        exit;
    } elseif (!$errors['err']) {
        $errors['err'] = 'Authentication error - try again!';
    }
}
$nav = new UserNav();
$nav->setActiveNav('status');
require CLIENTINC_DIR . 'header.inc.php';
require CLIENTINC_DIR . 'login.inc.php';
require CLIENTINC_DIR . 'footer.inc.php';
 private function sendSms($mobile, $content)
 {
     require_once APPPATH . 'libraries/sms/Client.php';
     //$sms_config = $this->tickets->select('configs',array('tc_type'=>'sms_config'));
     $sql = "select * from t_configs where 1=1 and tc_type='sms_config'";
     $sms_config = $this->db->query($sql)->row();
     if (!$sms_config) {
         return false;
     } else {
         $config = $sms_config;
     }
     /**
      * 网关地址
      */
     $gwUrl = 'http://sdk4report.eucp.b2m.cn:8080/sdk/SDKService';
     /**
      * 序列号,请通过亿美销售人员获取
      */
     $serialNumber = $config->tc_title;
     //'6SDK-EMY-6688-KGZSP';
     /**
      * 密码,请通过亿美销售人员获取
      */
     $password = $config->tc_content;
     //'845379';
     /**
      * 登录后所持有的SESSION KEY,即可通过login方法时创建
      */
     $sessionKey = '123456';
     /**
      * 连接超时时间,单位为秒
      */
     $connectTimeOut = 2;
     /**
      * 远程信息读取超时时间,单位为秒
      */
     $readTimeOut = 10;
     $proxyhost = false;
     $proxyport = false;
     $proxyusername = false;
     $proxypassword = false;
     $client = new Client($gwUrl, $serialNumber, $password, $sessionKey, $proxyhost, $proxyport, $proxyusername, $proxypassword, $connectTimeOut, $readTimeOut);
     /**
      * 发送向服务端的编码,如果本页面的编码为GBK,请使用GBK
      */
     $client->setOutgoingEncoding("utf8");
     $statusCode = $client->login();
     $statusCode = $client->sendSMS(array($mobile), $content);
     if ($statusCode == 0) {
         return true;
     } else {
         return false;
     }
 }
<?php

session_start();
require_once '../core/config.php';
if (isset($_POST['email']) && isset($_POST['password'])) {
    $client = new Client();
    try {
        $data = $client->login($_POST['email'], $_POST['password']);
    } catch (Exception $e) {
        header("Location:" . RESOURCE_PATH_DIY . "login?error=" . $e->getMessage());
        exit;
    }
    $_SESSION['client'] = $data;
    $access_token = Hash::get($_SESSION['client']['client_id'], Hash::salt(10) . time());
    Logger::logPlobizUser($data['client_id'], $access_token, 'N/A', uniqid(), 'WEB', 1);
    $_SESSION['client']['access_token'] = $access_token;
    if (isset($_POST['remember'])) {
        setcookie("remember", $_SESSION['client']['email'], time() + 3600 * 365, "/");
    } else {
        setcookie("remember", $_SESSION['client']['email'], time() - 1, "/");
    }
    // 	03-07-15 : redirect to pending redirectto url
    $redirectto = isset($_SESSION['redirectto']) && $_SESSION['redirectto'] != '' ? $_SESSION['redirectto'] : RESOURCE_PATH_DIY . "dashboard";
    $_SESSION['redirectto'] = '';
    header("Location:" . $redirectto);
} else {
    header("Location:" . RESOURCE_PATH_DIY . "login");
}