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


PHP Error函数代码示例

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


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

示例1: __construct

 private function __construct()
 {
     $this->m_state = json_decode(file_get_contents(__DIR__ . ServiceState::StateFile), true);
     if ($this->m_state === null) {
         Error('Unable to decode the service state file (' . ServiceState::StateFile . ').');
     }
 }
开发者ID:marco-c,项目名称:peter.sh,代码行数:7,代码来源:ServiceState.php

示例2: edit_user

function edit_user()
{
    if (!is_logged_in() || !is_post_parameter_complete(array('salutation', 'gender', 'firstname', 'lastname', 'birthyear', 'birthmonth', 'birthday', 'password', 'aboutme'))) {
        Redirect('../edit_user.php');
    }
    $userDetails['salutation'] = $_POST['salutation'];
    $userDetails['firstname'] = $_POST['firstname'];
    $userDetails['lastname'] = $_POST['lastname'];
    $userDetails['gender'] = $_POST['gender'];
    $userDetails['birthdate'] = "{$_POST['birthyear']}-{$_POST['birthmonth']}-{$_POST['birthday']}";
    $userDetails['username'] = $_SESSION['user']['username'];
    $userDetails['password'] = $_POST['password'];
    $userDetails['aboutme'] = $_POST['aboutme'];
    if (is_admin()) {
        if (is_post_parameter_complete(array('accesslevel'))) {
            $userDetails['accesslevel'] = $_POST['accesslevel'];
        } else {
            Redirect('../edit_user.php');
        }
    } else {
        $userDetails['accesslevel'] = 'User';
    }
    if (EditUser($userDetails)) {
        if ($_SESSION['user']['accesslevel'] == $userDetails['accesslevel']) {
            $_SESSION['user'] = SelectUser($userDetails['username']);
            Redirect('../index.php');
        } else {
            Redirect('../landing.php/logout');
        }
    } else {
        Error('Edit Failed');
    }
}
开发者ID:kayecandy,项目名称:secudev,代码行数:33,代码来源:edit_user.php

示例3: register_user

function register_user()
{
    if (!is_post_parameter_complete(array('salutation', 'gender', 'firstname', 'lastname', 'birthyear', 'birthmonth', 'birthday', 'username', 'password', 'aboutme'))) {
        Redirect('../register.php');
    }
    $userDetails['salutation'] = $_POST['salutation'];
    $userDetails['firstname'] = $_POST['firstname'];
    $userDetails['lastname'] = $_POST['lastname'];
    $userDetails['gender'] = $_POST['gender'];
    $userDetails['birthdate'] = "{$_POST['birthyear']}-{$_POST['birthmonth']}-{$_POST['birthday']}";
    $userDetails['username'] = $_POST['username'];
    $userDetails['password'] = $_POST['password'];
    $userDetails['aboutme'] = $_POST['aboutme'];
    if (is_admin()) {
        if (is_post_parameter_complete(array('accesslevel'))) {
            $userDetails['accesslevel'] = $_POST['accesslevel'];
        } else {
            Redirect('../register.php');
        }
    } else {
        $userDetails['accesslevel'] = 'User';
    }
    if (AddUser($userDetails)) {
        Redirect('../index.php');
    } else {
        Error('Registration Failed');
    }
}
开发者ID:kayecandy,项目名称:secudev,代码行数:28,代码来源:register.php

示例4: initialize_store

function initialize_store()
{
    if (!is_logged_in()) {
        Error('Invalid Access');
    }
    $GLOBALS['items'] = GetItems();
}
开发者ID:kayecandy,项目名称:secudev,代码行数:7,代码来源:store.php

示例5: save

 public function save()
 {
     $aid = $this->admin['aid'];
     $password = ForceStringFrom('password');
     $passwordconfirm = ForceStringFrom('passwordconfirm');
     $email = ForceStringFrom('email');
     $fullname = ForceStringFrom('fullname');
     $fullname_en = ForceStringFrom('fullname_en');
     if (strlen($password) or strlen($passwordconfirm)) {
         if (strcmp($password, $passwordconfirm)) {
             $errors[] = '两次输入的密码不相同!';
         }
     }
     if (!$email) {
         $errors[] = '请输入Email地址!';
     } elseif (!IsEmail($email)) {
         $errors[] = 'Email地址不规范!';
     } elseif (APP::$DB->getOne("SELECT aid FROM " . TABLE_PREFIX . "admin WHERE email = '{$email}' AND aid != '{$aid}'")) {
         $errors[] = 'Email地址已占用!';
     }
     if (!$fullname) {
         $errors[] = '请输入中文昵称!';
     }
     if (!$fullname_en) {
         $errors[] = '请输入英文昵称!';
     }
     if (isset($errors)) {
         Error($errors, '编辑我的信息错误');
     } else {
         APP::$DB->exe("UPDATE " . TABLE_PREFIX . "admin SET \r\n\t\t\t" . Iif($password, "password = '" . md5($password) . "',") . "\r\n\t\t\temail       = '{$email}',\r\n\t\t\tfullname       = '{$fullname}',\r\n\t\t\tfullname_en       = '{$fullname_en}'\r\n\t\t\tWHERE aid      = '{$aid}'");
         Success('myprofile');
     }
 }
开发者ID:noikiy,项目名称:meilala,代码行数:33,代码来源:myprofile.php

示例6: validateLogin

 /**
  * validateLogin, verify that the login credentials are correct.
  *
  * @param string $login the login field
  * @param string $password the password
  *
  * @return array
  *    index 0 -> false if login failed, index of the administrator if successful
  *    index 1 -> error message when login fails
  *
  * eg
  *    return array(5,'OK'); // -> login successful for admin 5
  *    return array(0,'Incorrect login details'); // login failed
  */
 public function validateLogin($login, $password)
 {
     $query = sprintf('select password, disabled, id from %s where loginname = "%s"', $GLOBALS['tables']['admin'], sql_escape($login));
     $req = Sql_Query($query);
     $admindata = Sql_Fetch_Assoc($req);
     $encryptedPass = hash(ENCRYPTION_ALGO, $password);
     $passwordDB = $admindata['password'];
     #Password encryption verification.
     if (strlen($passwordDB) < $GLOBALS['hash_length']) {
         // Passwords are encrypted but the actual is not.
         #Encrypt the actual DB password before performing the validation below.
         $encryptedPassDB = hash(ENCRYPTION_ALGO, $passwordDB);
         $query = sprintf('update %s set password = "%s" where loginname = "%s"', $GLOBALS['tables']['admin'], $encryptedPassDB, sql_escape($login));
         $passwordDB = $encryptedPassDB;
         $req = Sql_Query($query);
     }
     if ($admindata['disabled']) {
         return array(0, s('your account has been disabled'));
     } elseif (!empty($passwordDB) && $encryptedPass == $passwordDB) {
         return array($admindata['id'], 'OK');
     } else {
         if (!empty($GLOBALS['admin_auth_module'])) {
             Error(s('Admin authentication has changed, please update your admin module'), 'https://resources.phplist.com/documentation/errors/adminauthchange');
             return;
         }
         return array(0, s('incorrect password'));
     }
     if (!empty($GLOBALS['admin_auth_module'])) {
         Error(s('Admin authentication has changed, please update your admin module'), 'https://resources.phplist.com/documentation/errors/adminauthchange');
         return;
     }
     return array(0, s('Login failed'));
 }
开发者ID:gillima,项目名称:phplist3,代码行数:47,代码来源:phpListAdminAuthentication.php

示例7: save

 public function save()
 {
     $aids = $_POST['aids'];
     $nums = count($aids);
     $msg = ForceStringFrom('msg');
     $msg_en = ForceStringFrom('msg_en');
     if ($nums < 1) {
         $errors[] = '请选择所属客服人员!';
     }
     if (!$msg) {
         $errors[] = '请填写常用短语中文内容!';
     }
     if (!$msg_en) {
         $errors[] = '请填写常用短语英文内容!';
     }
     if (isset($errors)) {
         Error($errors, '添加常用短语');
     }
     for ($i = 0; $i < $nums; $i++) {
         $aid = ForceInt($aids[$i]);
         APP::$DB->exe("INSERT INTO " . TABLE_PREFIX . "phrase (aid, activated, msg, msg_en) VALUES ('{$aid}', 1, '{$msg}', '{$msg_en}')");
         $lastid = APP::$DB->insert_id;
         APP::$DB->exe("UPDATE " . TABLE_PREFIX . "phrase SET sort = '{$lastid}' WHERE pid = '{$lastid}'");
     }
     Success('phrases');
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:26,代码来源:phrases.php

示例8: __construct

 public function __construct($IdOrRow)
 {
     $row = NULL;
     if ($IdOrRow) {
         if (is_integer($IdOrRow) or is_numeric($IdOrRow)) {
             $row = dbFetchOne('SELECT * FROM Frames WHERE Id=?', NULL, array($IdOrRow));
             if (!$row) {
                 Error("Unable to load Frame record for Id=" . $IdOrRow);
             }
         } elseif (is_array($IdOrRow)) {
             $row = $IdOrRow;
         } else {
             Error("Unknown argument passed to Frame Constructor ({$IdOrRow})");
             return;
         }
     }
     # end if isset($IdOrRow)
     if ($row) {
         foreach ($row as $k => $v) {
             $this->{$k} = $v;
         }
     } else {
         Error("No row for Frame " . $IdOrRow);
     }
 }
开发者ID:schrorg,项目名称:ZoneMinder,代码行数:25,代码来源:Frame.php

示例9: __construct

 public function __construct($IdOrRow)
 {
     $row = NULL;
     if ($IdOrRow) {
         if (is_integer($IdOrRow) or is_numeric($IdOrRow)) {
             $row = dbFetchOne('SELECT * FROM Monitors WHERE Id=?', NULL, array($IdOrRow));
             if (!$row) {
                 Error("Unable to load Server record for Id=" . $IdOrRow);
             }
         } elseif (is_array($IdOrRow)) {
             $row = $IdOrRow;
         } else {
             Error("Unknown argument passed to Monitor Constructor ({$IdOrRow})");
             return;
         }
     }
     # end if isset($IdOrRow)
     if ($row) {
         foreach ($row as $k => $v) {
             $this->{$k} = $v;
         }
         if ($this->{'Controllable'}) {
             $s = dbFetchOne('SELECT * FROM Controls WHERE Id=?', NULL, array($this->{'ControlId'}));
             foreach ($s as $k => $v) {
                 if ($k == 'Id') {
                     continue;
                 }
                 $this->{$k} = $v;
             }
         }
     } else {
         Error("No row for Monitor " . $IdOrRow);
     }
 }
开发者ID:schrorg,项目名称:ZoneMinder,代码行数:34,代码来源:Monitor.php

示例10: LinkPath

 public function LinkPath()
 {
     if (ZM_USE_DEEP_STORAGE) {
         return $this->{'MonitorId'} . '/' . strftime("%y/%m/%d/.", $this->Time()) . $this->{'Id'};
     }
     Error("Calling Link_Path when not using deep storage");
     return '';
 }
开发者ID:schrorg,项目名称:ZoneMinder,代码行数:8,代码来源:Event.php

示例11: chk_id

function chk_id($id, $url = "", $msg = "操作非法")
{
    $id = intval($id);
    if (!$id || $id == 0) {
        Error($msg, $url);
    }
    return true;
}
开发者ID:BGCX067,项目名称:f1project-svn-to-git,代码行数:8,代码来源:admin.func.php

示例12: Fatal_error

function Fatal_error($msg)
{
    global $config;
    # logError($msg);
    $emailmsg = ' Fatal Error ' . $config["websiteurl"] . "\n\n" . $PHP_SELF . " " . $page . ", {$msg}";
    sendError($emailmsg);
    Error($msg);
    exit;
}
开发者ID:dehvCurtis,项目名称:phplist,代码行数:9,代码来源:errorlib.php

示例13: check_user

function check_user($user_id)
{
    $sql = mysql_query("SELECT COUNT(*) FROM " . TABLE_ORDER . " WHERE user_id='{$user_id}'") or Error(1, __FILE__, __LINE__);
    $arr = @mysql_fetch_array($sql);
    if (@$arr[0]) {
        return 1;
    }
    return 0;
}
开发者ID:nikuha,项目名称:rs,代码行数:9,代码来源:user.php

示例14: check_event

function check_event($event_id)
{
    $sql = mysql_query("SELECT user_id FROM " . TABLE_EVENT . " WHERE event_id={$event_id}") or Error(1, __FILE__, __LINE__);
    $info = @mysql_fetch_array($sql);
    if ($info['user_id'] != $_SESSION['admin_id']) {
        return '-';
    }
    return 0;
}
开发者ID:nikuha,项目名称:rs,代码行数:9,代码来源:event.php

示例15: fclose

        fclose($handle);
    }
    /**
	 * Add a new mail content by Admin
	 * @param array 0 => title, 1 => content
	 */
    public static function addNewMail($newmail)
    {
        assert(count($newmail) == 2);
        xassert(trim($newmail['title']) != '' && $newmail['content'] != '', Error('nullContent'));
开发者ID:sysuzjz,项目名称:soya,代码行数:10,代码来源:Mail.class.php


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