当前位置: 首页>>代码示例>>PHP>>正文


PHP check_error函数代码示例

本文整理汇总了PHP中check_error函数的典型用法代码示例。如果您正苦于以下问题:PHP check_error函数的具体用法?PHP check_error怎么用?PHP check_error使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了check_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: login

 /**
  * 登陆,如果失败,返回失败原因(用户名或者密码不正确),如果成功,返回用户信息,
  * 附带返回系统服务器时间戳
  */
 public function login()
 {
     //查user表
     $User = M('User');
     check_error($User);
     $user = $User->field(array('id' => 'userId', 'username' => 'userName', 'name', 'role_id' => 'roleId', 'role'))->where(array('username' => safe_post_param('username'), '_string' => "`password`=MD5('" . safe_post_param('password') . "')"))->find();
     if (!empty($user)) {
         //根据权限查菜单
         $Menu = M('Menu');
         check_error($Menu);
         $menu = $Menu->join('`role_privilege` on `menu`.`id`=`role_privilege`.`menu_id`')->join('`user` on `user`.`role_id`=`role_privilege`.`role_id`')->field(array('`menu`.`id`', 'level', 'label', 'icon', 'widget', 'show', 'big_icon'))->where("`user`.`id`='" . $user['userId'] . "'")->order('`level` ASC')->select();
         check_error($Menu);
         //保存session
         session('logined', true);
         session('user', $user);
         session('menu', $menu);
         //设置返回数据
         $data = array();
         $data['serverTime'] = time();
         $data['user'] = $user;
         $data['menu'] = $menu;
         //保存日志
         R('Log/adduserlog', array('登录', '登录成功', '成功'));
         //返回结果:用户数据+服务器时间
         return_value_json(true, 'data', $data);
     } else {
         //保存日志
         R('Log/adduserlog', array('登录', '登录失败:用户名或者密码不正确', '失败:权限不够', '用户名:' . safe_post_param('username')));
         return_value_json(false, 'msg', '用户名或者密码不正确');
     }
 }
开发者ID:jumboluo,项目名称:tracking,代码行数:35,代码来源:AuthenticateAction.class.php

示例2: dao_open

function dao_open()
{
    global $db, $all_ops_stmt, $operation_stmt, $operation_id_stmt, $code_ref_stmt, $io_stmt, $object_stmt, $io_for_object_stmt, $io_for_parent_io_stmt, $operation_by_name_stmt, $io_for_object_parent_name_stmt;
    $db = new PDO("sqlite:test.sq3");
    # Get all ops
    $all_ops_stmt = $db->prepare("SELECT operation_id as id, name, parent_id, code_start_id, code_end_id, terminated_time FROM operation ORDER BY operation_id");
    # Get operation for a given id
    $operation_stmt = $db->prepare("SELECT operation_id as id, name, parent_id, code_start_id, code_end_id, terminated_time FROM operation WHERE operation_id = :id");
    # Operation id for parent operation
    $operation_id_stmt = $db->prepare('SELECT operation_id as id FROM operation WHERE parent_id = :id');
    # get a reference to code by reference id
    $code_ref_stmt = $db->prepare("SELECT code_id as id, file, line FROM code WHERE code_id = :id");
    # Get list of IOs for given operation (only the top-level ones)
    $io_stmt = $db->prepare('SELECT io_id as id, io_time, object_id, operation_id, name, value, readwrite, note, code_id FROM io WHERE operation_id = :id AND parent_id = -1 ORDER BY io_time ASC');
    # Get object of given id
    $object_stmt = $db->prepare('SELECT object_id as id, type, deallocated_time FROM object where object_id = :id');
    # All parent IOs for object
    $io_for_object_stmt = $db->prepare('SELECT io_id as id, io_time, object_id, operation_id, name, value, readwrite, note, code_id FROM io where object_id = :id ORDER BY io_time ASC');
    # All IOs for parent io
    $io_for_parent_io_stmt = $db->prepare('SELECT io_id as id, io_time, object_id, operation_id, name, value, readwrite, note, code_id, parent_id FROM io WHERE parent_id = :id ORDER BY io_id ASC');
    # Operation of a given name for parent operation
    $operation_by_name_stmt = $db->prepare('SELECT operation_id as id, name, parent_id, code_start_id, code_end_id, terminated_time FROM operation WHERE name = :name AND parent_id = :parent ORDER BY operation_id');
    # All IOs for given object, parent IO and name
    $io_for_object_parent_name_stmt = $db->prepare('SELECT io_id as id, io_time, object_id, operation_id, name, value, readwrite, note, code_id FROM io where operation_id = :operation_id AND parent_id = :parent_io AND name = :name AND note=:note ORDER BY io_time ASC');
    check_error();
}
开发者ID:pombredanne,项目名称:myrimatch,代码行数:26,代码来源:dao.php

示例3: add

 /**
  * add操作根据POST数据插入一个分组信息到数据库里,并返回操作结果
  */
 public function add()
 {
     if (!$this->isPost()) {
         return_value_json(false, 'msg', '非法的调用');
     }
     $Department = M('Department');
     //数据检查
     $name = trim($this->_post('name'));
     if (empty($name)) {
         return_value_json(false, 'msg', '分组名称为空');
     }
     $seq = $this->_post('sequence') + 0;
     if (empty($seq)) {
         return_value_json(false, 'msg', '系统出错:提交的序号为0或者为空');
     }
     //先更新次序在插入者之后的分组的次序
     $condition['sequence'] = array('egt', $seq);
     $Department->where($condition)->setInc('sequence', 1);
     check_error($Department);
     //插入
     $Department->create();
     check_error($Department);
     $Department->id = null;
     if (false === $Department->add()) {
         //保存日志
         R('Log/adduserlog', array('添加分组', '添加分组失败:' . get_error($Department), '失败:系统错误', '分组名称:' . $name));
         return_value_json(false, 'msg', get_error($Department));
     } else {
         //保存日志
         R('Log/adduserlog', array('添加分组', '添加分组成功', '成功', '分组名称:' . $name));
         return_value_json(true);
     }
 }
开发者ID:jumboluo,项目名称:tracking,代码行数:36,代码来源:DepartmentAction.class.php

示例4: getmanage

 public function getmanage()
 {
     $type = $_REQUEST['type'];
     $departmentId = $_REQUEST['departmentId'] + 0;
     if (!in_array($type, array('车辆', '人员', '集装箱', '班列', '设备'))) {
         return_json(true, null, 'targets', array());
     }
     $condition = '1';
     $condition .= empty($departmentId) ? '' : " AND `department_id`='{$departmentId}'";
     $DB = M();
     check_error($DB);
     if ($type == '车辆') {
         $targets = $DB->query("SELECT `id` AS `target_id`, '车辆' AS `target_type`, `number` AS `target_name`, " . "CONCAT('车辆^', `id`, '^', `number`) AS `type_id_name` FROM `vehicle` WHERE " . $condition . " ORDER BY `sequence` ASC");
     } else {
         if ($type == '人员') {
             $targets = $DB->query("SELECT `id` AS `target_id`, '人员' AS `target_type`, `name` AS `target_name`, " . "CONCAT('人员^', `id`, '^', `name`) AS `type_id_name` FROM `employee` WHERE " . $condition . " ORDER BY `sequence` ASC");
         } else {
             if ($type == '集装箱') {
                 $targets = $DB->query("SELECT `id` AS `target_id`, '集装箱' AS `target_type`, `number` AS `target_name`, " . "CONCAT('集装箱^', `id`, '^', `number`) AS `type_id_name` FROM `container` WHERE " . $condition . " ORDER BY `id` ASC");
             } else {
                 if ($type == '班列') {
                     $targets = $DB->query("SELECT `id` AS `target_id`, '班列' AS `target_type`, `number` AS `target_name`, " . "CONCAT('班列^', `id`, '^', `number`) AS `type_id_name` FROM `train` WHERE " . $condition . " ORDER BY `id` ASC");
                 } else {
                     if ($type == '设备') {
                         $targets = $DB->query("SELECT `id` AS `target_id`, '设备' AS `target_type`, `label` AS `target_name`, " . "CONCAT('设备^', `id`, '^', `label`) AS `type_id_name` FROM `device` WHERE " . $condition . " ORDER BY `id` ASC");
                     }
                 }
             }
         }
     }
     check_error($DB);
     //		Log::write("\n".M()->getLastSql(), Log::SQL);
     return_json(true, null, 'targets', $targets);
 }
开发者ID:jumboluo,项目名称:tracking,代码行数:34,代码来源:TargetAction.class.php

示例5: log

 public function log($data)
 {
     $Sms = M('Sms');
     check_error($Sms);
     $Sms->create($data);
     check_error($Sms);
     if (false === $Sms->add()) {
         return_value_json(false, 'msg', get_error($Sms));
     }
 }
开发者ID:jumboluo,项目名称:tracking,代码行数:10,代码来源:SmsAction.class.php

示例6: get_kartukeluarga_id

function get_kartukeluarga_id($nik)
{
    $sql = "select keluarga_id from penduduk where nik = '{$nik}'";
    $connection = MysqlManager::get_connection();
    $result = $connection->query($sql);
    check_error($connection);
    $row = $result->fetch_object();
    MysqlManager::close_connection($connection);
    return $row->keluarga_id;
}
开发者ID:aldrymaulana,项目名称:simduks,代码行数:10,代码来源:kelahiran.php

示例7: generate_key_pair

function generate_key_pair()
{
    $key_length = '64';
    $key_pair = new Crypt_RSA_KeyPair($key_length);
    check_error($key_pair);
    $public_key = $key_pair->getPublicKey();
    $private_key = $key_pair->getPrivateKey();
    $keys = array('public' => $public_key->toString(), 'private' => $private_key->toString());
    return $keys;
}
开发者ID:helenadeus,项目名称:s3db.map,代码行数:10,代码来源:createKeyPair.php

示例8: check_orangtua

 public function check_orangtua($nik_ayah, $nik_ibu)
 {
     $connection = MysqlManager::get_connection();
     $id_ayah = $this->get_penduduk_id($nik_ayah);
     $id_ibu = $this->get_penduduk_id($nik_ibu);
     $sql = "select count(*) as count from orang_tua where bapak_id = {$id_ayah} and ibu_id = {$id_ibu}";
     $result = $connection->query($sql);
     check_error($connection);
     $row = $result->fetch_object();
     MysqlManager::close_connection($connection);
     return $row->count;
 }
开发者ID:aldrymaulana,项目名称:simduks,代码行数:12,代码来源:orangtua_controller.php

示例9: cell

 /**
  * cell操作返回指定边界之内的基站
  */
 public function cell()
 {
     $nlat = $_GET['nelat'] + 0;
     $elng = $_GET['nelng'] + 0;
     $slat = $_GET['swlat'] + 0;
     $wlng = $_GET['swlng'] + 0;
     if (empty($nlat) || empty($elng) || empty($slat) || empty($wlng)) {
         return_value_json(false, msg, '边界坐标经度或(和)纬度为空');
     }
     $Cell = M('Cell');
     check_error($Cell);
     $cells = $Cell->field(array('id', 'mcc', 'mnc', 'lac', 'cellid', 'gps_lng', 'gps_lat', 'range', 'offset_lng', 'offset_lat', 'address', 'update_time'))->where("`gps_lng`<{$elng} AND `gps_lng`>{$wlng} AND `gps_lat`<{$nlat} AND `gps_lat`>{$slat}")->limit('250')->select();
     check_error($Cell);
     //		Log::write("\n".M()->getLastSql(), Log::SQL);
     return_json(true, null, 'cells', $cells);
 }
开发者ID:jumboluo,项目名称:tracking,代码行数:19,代码来源:TestAction.class.php

示例10: decrypt

function decrypt($encriptedMessage, $privateKey)
{
    ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . S3DB_SERVER_ROOT);
    require_once 'pearlib/RSACrypt/RSA.php';
    $enc_text = $encriptedMessage;
    $private_key = $privateKey;
    $key = Crypt_RSA_Key::fromString($private_key);
    check_error($key);
    $rsa_obj = new Crypt_RSA();
    check_error($rsa_obj);
    $rsa_obj->setParams(array('dec_key' => $key));
    check_error($rsa_obj);
    $plain_text = $rsa_obj->decrypt($enc_text);
    check_error($rsa_obj);
    return $plain_text;
}
开发者ID:helenadeus,项目名称:s3db.map,代码行数:16,代码来源:encryption.php

示例11: pdo_mysql_errorinfo

function pdo_mysql_errorinfo($db, $offset)
{
    try {
        /*
        If you create a PDOStatement object through PDO->prepare()
        or PDO->query() and invoke an error on the statement handle,
        PDO->errorCode() will not reflect that error. You must call
        PDOStatement->errorCode() to return the error code for an
        operation performed on a particular statement handle.
        */
        $code = $db->errorCode();
        check_error($offset + 2, $db);
        $stmt = $db->query('SELECT id, label FROM test');
        $stmt2 =& $stmt;
        check_error($offset + 3, $db);
        check_error($offset + 4, $stmt);
        $db->exec('DROP TABLE IF EXISTS test');
        @$stmt->execute();
        check_error($offset + 5, $db);
        check_error($offset + 6, $stmt, '42S02');
        check_error($offset + 7, $stmt2, '42S02');
        @($stmt = $db->query('SELECT id, label FROM unknown'));
        check_error($offset + 8, $db, '42S02');
        MySQLPDOTest::createTestTable($db);
        $stmt = $db->query('SELECT id, label FROM test');
        check_error($offset + 9, $db);
        check_error($offset + 10, $stmt);
        $db2 =& $db;
        $db->exec('DROP TABLE IF EXISTS unknown');
        @$db->query('SELECT id, label FROM unknown');
        check_error($offset + 11, $db, '42S02');
        check_error($offset + 12, $db2, '42S02');
        check_error($offset + 13, $stmt);
        check_error($offset + 14, $stmt2);
        // lets hope this is an invalid attribute code
        $invalid_attr = -1 * PHP_INT_MAX + 3;
        $tmp = @$db->getAttribute($invalid_attr);
        check_error($offset + 15, $db, 'IM001');
        check_error($offset + 16, $db2, 'IM001');
        check_error($offset + 17, $stmt);
        check_error($offset + 18, $stmt2);
    } catch (PDOException $e) {
        printf("[%03d] %s [%s] %s\n", $offset + 19, $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
    }
}
开发者ID:badlamer,项目名称:hhvm,代码行数:45,代码来源:pdo_mysql_errorinfo.php

示例12: retrieve_data

 public function retrieve_data()
 {
     $conn = MysqlManager::get_connection();
     $sql = "select n.no_pernikahan as nomor_pernikahan, n.tanggal as tanggal,\n        n.wali as wali, p.nama as pria, p.wni as wni_pria, a.agama as agama_pria,\n        pp.nama as wanita, pp.wni as wni_wanita, aa.agama as agama_wanita from pernikahan n,\n        penduduk p, penduduk pp, agama a, agama aa where n.id = {$this->id} and\n        n.pria = p.id and n.wanita = pp.id and p.agama_id = a.id and pp.agama_id = aa.id";
     $result = $conn->query($sql);
     check_error($conn);
     $row = $result->fetch_object();
     $this->pria = $row->pria;
     $this->no_pernikahan = $row->nomor_pernikahan;
     $this->tanggal_menikah = $row->tanggal;
     $this->wali = $row->wali;
     $this->pria_agama = $row->agama_pria;
     $this->pria_wni = $row->wni_pria;
     $this->wanita = $row->wanita;
     $this->wanita_agama = $row->agama_wanita;
     $this->wanita_wni = $row->wni_wanita;
     MysqlManager::close_connection($conn);
 }
开发者ID:aldrymaulana,项目名称:simduks,代码行数:18,代码来源:lap4.php

示例13: retrieve_data

 public function retrieve_data()
 {
     $conn = MysqlManager::get_connection();
     $sql = "select p.nik as nik, p.nama as nama, p.tmp_lahir as tempat_lahir, p.tgl_lahir as tgl_lahir, \r\n        p.jenis_kelamin as jenis_kelamin, p.wni as wni, \r\n        a.no_akta as no_akta, a.created_at as tanggal_pembuatan, pp.nama as ayah, ppp.nama as ibu \r\n        from penduduk p, penduduk pp, penduduk ppp, akta_kelahiran a, orang_tua o where p.id = " . $this->id . " and p.id = a.penduduk_id and p.orangtua_id = o.id and o.bapak_id = pp.id and o.ibu_id = ppp.id";
     $result = $conn->query($sql);
     check_error($conn);
     $row = $result->fetch_object();
     $this->nik = $row->nik;
     $this->nama = $row->nama;
     $this->tempat_lahir = $row->tempat_lahir;
     $this->tanggal_lahir = $row->tgl_lahir;
     $this->jenis_kelamin = $row->jenis_kelamin;
     $this->wni = $row->wni;
     $this->no_akta = $row->no_akta;
     $this->tanggal_pembuatan = $row->tanggal_pembuatan;
     $this->ayah = $row->ayah;
     $this->ibu = $row->ibu;
     MysqlManager::close_connection($conn);
 }
开发者ID:aldrymaulana,项目名称:simduks,代码行数:19,代码来源:lap1.php

示例14: generate_key_pair

function generate_key_pair()
{
    set_include_path(get_include_path() . PATH_SEPARATOR . S3DB_SERVER_ROOT . '/pearlib/phpseclib');
    if (is_file(S3DB_SERVER_ROOT . '/pearlib/phpseclib/Crypt/RSA.php')) {
        include S3DB_SERVER_ROOT . '/pearlib/phpseclib/Crypt/RSA.php';
        define('CRYPT_RSA_SMALLEST_PRIME', 1000);
        $rsa = new Crypt_RSA();
        $createKey = $rsa->createKey(10 * 64);
        $keys = array('public' => base64_encode($createKey['publickey']), 'private' => $createKey['privatekey']);
    } else {
        require_once S3DB_SERVER_ROOT . '/pearlib/RSACrypt/RSA.php';
        $key_length = '64';
        $key_pair = new Crypt_RSA_KeyPair($key_length);
        check_error($key_pair);
        $public_key = $key_pair->getPublicKey();
        $private_key = $key_pair->getPrivateKey();
        $keys = array('public' => $public_key->toString(), 'private' => $private_key->toString());
    }
    return $keys;
}
开发者ID:helenadeus,项目名称:s3db.map,代码行数:20,代码来源:generate_key_pair.php

示例15: add

 /**
  * add操作根据POST数据插入一个分组信息到数据库里,并返回操作结果
  */
 public function add()
 {
     if (!$this->isPost()) {
         return_value_json(false, 'msg', '非法的调用');
     }
     $Driver = M('Driver');
     //数据检查
     $name = trim($this->_post('name'));
     if (empty($name)) {
         return_value_json(false, 'msg', '司机姓名为空');
     }
     $dpm_id = $this->_post('department_id') + 0;
     //先更新次序在插入者之后的同一分组的司机的次序
     $seq = $this->_post('sequence') + 0;
     if (!empty($seq)) {
         $condition['department_id'] = array('eq', $dpm_id);
         $condition['sequence'] = array('egt', $seq);
         $Driver->where($condition)->setInc('sequence', 1);
         check_error($Driver);
     } else {
         $condition['department_id'] = array('eq', $dpm_id);
         $seqs = $Driver->where($condition)->order('`sequence` DESC')->limit('1')->field('sequence')->select();
         $seq = empty($seqs) ? 1 : $seqs[0]['sequence'] + 1;
     }
     //插入
     $Driver->create();
     check_error($Driver);
     $Driver->sequence = $seq;
     $Driver->id = null;
     if (false === $Driver->add()) {
         //保存日志
         R('Log/adduserlog', array('添加司机资料', '添加司机资料:' . get_error($Driver), '失败:系统错误', '司机名称:' . $Driver->name . ',失败原因:' . get_error($Driver)));
         return_value_json(false, 'msg', get_error($Driver));
     }
     //保存日志
     R('Log/adduserlog', array('添加司机资料', '添加司机资料成功', '成功', '车牌号码:' . $Driver->name));
     return_value_json(true);
 }
开发者ID:jumboluo,项目名称:tracking,代码行数:41,代码来源:DriverAction.class.php


注:本文中的check_error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。