當前位置: 首頁>>代碼示例>>PHP>>正文


PHP check類代碼示例

本文整理匯總了PHP中check的典型用法代碼示例。如果您正苦於以下問題:PHP check類的具體用法?PHP check怎麽用?PHP check使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了check類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: content

 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     if ($_POST) {
         check::empty_fields();
         if (!main::errors()) {
             $user = $dbh->staff($_SESSION['user']);
             if (!$user['password']) {
                 main::errors("Wrong username!?");
             } else {
                 if (crypto::passhash($postvar['old'], $user['salt']) == $user['password']) {
                     if ($postvar['new'] != $postvar['confirm']) {
                         main::errors("Your passwords don't match!");
                     } else {
                         $salt = crypto::salt();
                         $newpass = crypto::passhash($postvar['new'], $salt);
                         $update_staff = array("password" => $newpass, "salt" => $salt);
                         $dbh->update("staff", $update_staff, array("id", "=", $_SESSION['user']));
                         main::errors("Password changed!");
                     }
                 } else {
                     main::errors("Your old password was wrong!");
                 }
             }
         }
     }
     echo style::replaceVar("tpl/admin/change-admin-password.tpl");
 }
開發者ID:cozylife,項目名稱:tht-reworked,代碼行數:28,代碼來源:pass.php

示例2: saveInfo

 function saveInfo($arrData, $intModify = 0, $isAlert = true, $isLastID = false)
 {
     global $arrGWeb;
     $arr = array();
     $arr = check::SqlInjection($this->saveTableFieldG($arrData));
     if ($intModify == 0) {
         if ($this->insertInfo($arr)) {
             if ($isAlert) {
                 check::Alert("恭喜你,訂閱成功!係統將返回到首頁", $arrGWeb['WEB_ROOT_pre'] . '/index.php');
             } else {
                 return true;
             }
         } else {
             if ($isAlert) {
                 check::Alert("訂閱失敗", -1);
             } else {
                 return false;
             }
         }
     } else {
         if ($this->updateInfo($arr)) {
             if ($isAlert) {
                 check::Alert("退訂成功!係統將返回到首頁", $arrGWeb['WEB_ROOT_pre'] . '/index.php');
             } else {
                 return true;
             }
         } else {
             if ($isAlert) {
                 check::Alert("退訂失敗", $arrGWeb['WEB_ROOT_pre'] . '/index.php');
             } else {
                 return false;
             }
         }
     }
 }
開發者ID:TiMoChao,項目名稱:xingfu,代碼行數:35,代碼來源:phonelist.class.php

示例3: smarty_modifier_api

/**
 * Smarty truncate modifier plugin
 *
 * Type:     modifier<br>
 * Name:     truncate<br>
 * Purpose:  Truncate a string to a certain length if necessary,
 *           optionally splitting in the middle of a word, and
 *           appending the $etc string or inserting $etc into the middle.
 * @link http://smarty.php.net/manual/en/language.modifier.truncate.php
 *          truncate (Smarty online manual)
 * @author   Monte Ohrt <monte at ohrt dot com>
 * @param string
 * @param integer
 * @param string
 * @param boolean
 * @param boolean
 * @return string
 */
function smarty_modifier_api($array, $class, $fun, $args = '', $debug = false)
{
    if (empty($class) || empty($fun)) {
        return $array;
    }
    $result = check::getAPI($class, $fun, $args, $debug);
    return $result;
}
開發者ID:TiMoChao,項目名稱:xingfu,代碼行數:26,代碼來源:modifier.api.php

示例4: smarty_modifier_imgurl

/**
 * Smarty truncate modifier plugin
 *
 * Type:     modifier<br>
 * Name:     truncate<br>
 * Purpose:  Truncate a string to a certain length if necessary,
 *           optionally splitting in the middle of a word, and
 *           appending the $etc string or inserting $etc into the middle.
 * @link http://smarty.php.net/manual/en/language.modifier.truncate.php
 *          truncate (Smarty online manual)
 * @author   Monte Ohrt <monte at ohrt dot com>
 * @param string
 * @param integer
 * @param string
 * @param boolean
 * @param boolean
 * @return string
 */
function smarty_modifier_imgurl($string, $module = '')
{
    global $arrGWeb;
    if (empty($module)) {
        $module = $arrGWeb['module_id'];
    }
    return check::getImgUrl($module);
}
開發者ID:TiMoChao,項目名稱:xingfu,代碼行數:26,代碼來源:modifier.imgurl.php

示例5: smarty_modifier_age

/**
 * Smarty truncate modifier plugin
 *
 * Type:     modifier<br>
 * Name:     truncate<br>
 * Purpose:  Truncate a string to a certain length if necessary,
 *           optionally splitting in the middle of a word, and
 *           appending the $etc string or inserting $etc into the middle.
 * @link http://smarty.php.net/manual/en/language.modifier.truncate.php
 *          truncate (Smarty online manual)
 * @author   Monte Ohrt <monte at ohrt dot com>
 * @param string
 * @param integer
 * @param string
 * @param boolean
 * @param boolean
 * @return string
 */
function smarty_modifier_age($date, $blday = true)
{
    if ($date == '0000-00-00') {
        return '0';
    } else {
        return check::birthday2age($date, $blday);
    }
}
開發者ID:TiMoChao,項目名稱:xingfu,代碼行數:26,代碼來源:modifier.age.php

示例6: long_long_equal

function long_long_equal($a, $b, $message)
{
    if (!($a === $b)) {
        if (!((double) $a === $b)) {
            return check::fail($message . ": '{$a}'!=='{$b}'");
        }
    }
    return TRUE;
}
開發者ID:daxiazh,項目名稱:swig,代碼行數:9,代碼來源:primitive_ref_runme.php

示例7: __tostring

 function __tostring()
 {
     $input1 = "";
     if ($this->number == 0) {
         $input1 .= "<script>alert('查不到');history.back();</script>";
     } else {
         foreach ($this->info as $value) {
             $sql = "select * from t_wz";
             $f = new check($sql);
             $input1 .= "<div class='post' id='post-001'>";
             $input1 .= "<h1>" . $value['title'] . "</h1>";
             $input1 .= "<small>" . $value['sj'] . "|</small> <a>分類:" . $value['kind'] . "</a>";
             $input1 .= "<div id='rensheng'><img src='../img/" . $value['id'] . ".jpg'></div>";
             $input1 .= "<div id='comments'><a href='blog_main.php?action=article2&id=" . $value['id'] . "'>readermore</a> <a>|</a><a>comments(" . $f->check1($value['id']) . ")</a></div>";
             $input1 .= " </div>";
         }
     }
     return $input1;
 }
開發者ID:JiaJia01,項目名稱:homework_09,代碼行數:19,代碼來源:checkone.class.php

示例8: smarty_modifier_ip_replace

/**
 * Smarty truncate modifier plugin
 *
 * Type:     modifier<br>
 * Name:     truncate<br>
 * Purpose:  Truncate a string to a certain length if necessary,
 *           optionally splitting in the middle of a word, and
 *           appending the $etc string or inserting $etc into the middle.
 * @link http://smarty.php.net/manual/en/language.modifier.truncate.php
 *          truncate (Smarty online manual)
 * @author   Monte Ohrt <monte at ohrt dot com>
 * @param string
 * @param integer
 * @param string
 * @param boolean
 * @param boolean
 * @return string
 */
function smarty_modifier_ip_replace($ip, $start = 4, $ellipsis = '*')
{
    if (check::FormatIP($ip)) {
        $start = $start - 1;
        $arrIP = explode('.', $ip);
        foreach ($arrIP as $k => $v) {
            if ($k >= $start) {
                $arrIP[$k] = $ellipsis;
            }
        }
        $ip = implode('.', $arrIP);
        return $ip;
    }
}
開發者ID:TiMoChao,項目名稱:xingfu,代碼行數:32,代碼來源:modifier.ip_replace.php

示例9: uploadInfoImage

 /**
  * 上傳文件
  * @author	肖飛
  * @param array	 	$arrFile			圖片文件信息數組$_FILES
  * @param int 		$PR					自動壓縮的比例
  * @param int		$intID				內容ID,標示新增還是修改
  * @return unknown
  */
 function uploadInfoImage($arrFile, $PR = 0, $intID = 0)
 {
     if ($arrFile['name']) {
         if (!in_array(strtolower($arrFile['type']), array('image/jpg', 'image/jpeg', 'image/gif', 'image/pjpeg', 'image/png', 'image/x-png', 'application/x-shockwave-flash'))) {
             check::AlertExit('文件類型不符合要求(' . $arrFile['type'] . ')', -1);
         }
     }
     if ($intID == 0) {
         $intID = $this->getMaxID();
     }
     $strDir = ceil($intID / 1000);
     $strMakeDir = $this->arrGPic['FileSavePath'] . $strDir;
     if (!is_dir($this->arrGPic['FileSavePath'])) {
         @mkdir($this->arrGPic['FileSavePath']);
         @chmod($this->arrGPic['FileSavePath'], 0777);
     }
     if (!is_dir($strMakeDir)) {
         @mkdir($strMakeDir);
         @chmod($strMakeDir, 0777);
     }
     $FileExt = strrchr($arrFile['name'], ".");
     //取得上傳文件擴展名
     $strPhoto = $strDir . "/" . $intID . "_" . time() . $FileExt;
     //存入數據庫的圖片訪問路徑
     $strPicName = $strMakeDir . "/" . $intID . "_" . time() . $FileExt;
     //新圖片路徑及名稱
     if ($arrFile['type'] != 'application/x-shockwave-flash' && $arrFile['size'] > $this->arrGPic['FileMaxSize']) {
         if ($PR != 0) {
             move_uploaded_file($arrFile['tmp_name'], $strPicName);
             $objGDImage = new GDImage();
             if ($objGDImage->makePRThumb($strPicName, $PR)) {
                 return $strPhoto;
             } else {
                 check::AlertExit($strPicName . "文件上傳錯誤!", -1);
             }
         } else {
             check::AlertExit("文件大小不符合要求!", -1);
         }
     } else {
         if (move_uploaded_file($arrFile['tmp_name'], $strPicName)) {
             return $strPhoto;
         } else {
             check::AlertExit($strPicName . "文件上傳錯誤!", -1);
         }
     }
 }
開發者ID:TiMoChao,項目名稱:lc_ad_first,代碼行數:54,代碼來源:links.class.php

示例10: import

 public function import()
 {
     global $dbh, $postvar, $getvar, $instance;
     if (!$_POST) {
         $servers_query = $dbh->select("servers", array("type", "=", "zpanel"), 0, 0, 1);
         while ($servers_data = $dbh->fetch_array($servers_query)) {
             $values[] = array($servers_data['name'], $servers_data['id']);
         }
         $zpanel_array['DROPDOWN'] = main::dropdown("server", $values);
         echo style::replaceVar("tpl/admin/import/zpanel.tpl", $zpanel_array);
     } elseif ($_POST) {
         $postvar['server'] = $postvar['server'];
         //Hack to make sure we post the 'server' field as it doesn't post if it's empty.
         check::empty_fields();
         if (main::errors()) {
             echo "<ERRORS>";
         } else {
             $n = 0;
             include INC . "/servers/zpanel.php";
             $zpanel = new zpanel($postvar['server']);
             $zpanel_accounts = $zpanel->listaccs($postvar['server']);
             foreach ($zpanel_accounts as $zpanel_data) {
                 $packages_data = $dbh->select("packages", array("backend", "=", $zpanel_data['package']));
                 $users_data = $dbh->select("users", array("user", "=", $zpanel_data['user']));
                 if (!$packages_data['id']) {
                     $packages_insert = array("name" => $zpanel_data['package'], "backend" => $zpanel_data['package'], "description" => "Imported from ZPanel: " . $zpanel_data['package'], "type" => "free", "server" => $postvar['server'], "admin" => "1");
                     $dbh->insert("packages", $packages_insert);
                 }
                 $new_packages_data = $dbh->select("packages", array("backend", "=", $zpanel_data['package']));
                 if (!$users_data['id']) {
                     $salt = crypto::salt();
                     $newpass = crypto::passhash(rand(), $salt);
                     $users_insert = array("user" => $zpanel_data['user'], "zpanel_uid" => $zpanel_data['user'], "email" => $zpanel_data['user'], "password" => $zpanel_data['user'], "salt" => $zpanel_data['user'], "signup" => $zpanel_data['user'], "status" => $zpanel_data['user'], "domain" => $zpanel_data['user'], "pid" => $zpanel_data['user']);
                     $dbh->insert("users", $users_insert);
                     $dbh->insert("users_bak", $users_insert);
                     $n++;
                 }
             }
             echo $n . " Accounts have been imported";
         }
     }
 }
開發者ID:cozylife,項目名稱:tht-reworked,代碼行數:42,代碼來源:zpanelimport.php

示例11: saveInfo

 /**
  * 保存信息內容
  * @author	肖飛
  * @param	int $arrData    信息信息數組
  * @return  void
  */
 function saveInfo($arrData, $intModify = 0, $isAlert = true)
 {
     $arr = array();
     $arr = check::SqlInjection($this->saveTableFieldG($arrData));
     if ($intModify == 0) {
         if (!empty($_SESSION['user_id'])) {
             $arr['user_id'] = intval($_SESSION['user_id']);
         }
         if ($this->insertInfo($arr)) {
             if ($isAlert) {
                 check::Alert("預約成功,我們會盡快通知您,祝您生活愉快", -1);
             }
             check::AlertExit("", $arrGWeb['WEB_ROOT_pre'] . "/xingfu_apply/");
         } else {
             check::Alert("發布失敗", -1);
         }
     } else {
         if ($this->updateInfo($arr)) {
             check::Alert("修改成功!");
         } else {
             check::Alert("修改失敗");
         }
     }
 }
開發者ID:TiMoChao,項目名稱:xingfu,代碼行數:30,代碼來源:xingfu_apply.class.php

示例12: doInfoAction

 /**
  * 執行信息操作
  * @author	肖飛
  * @param	string	$strAction		執行命令
  * @param	array		$arrData		選中的操作數據id數組
  * @param	array		$arrFile			需要刪除的文件
  * @return	boolen
  */
 public function doInfoAction($strAction = null, $arrData = null, $arrFile = array('photo'))
 {
     switch ($strAction) {
         case 'del':
             foreach ($arrData as $key => $val) {
                 if (!$this->checkPopedomG($_SESSION['user_id'], 'd')) {
                     check::AlertExit('對不起,您沒有刪除權限', -1);
                 }
                 $this->deleteInfo($val, $arrFile);
             }
             break;
         case 'delpic':
             foreach ($arrData as $key => $val) {
                 if (!$this->checkPopedomG($_SESSION['user_id'], 'd')) {
                     check::AlertExit('對不起,您沒有刪除權限', -1);
                 }
                 $this->deleteInfoPic($val, $arrFile);
             }
             break;
         case 'moveup':
             foreach ($arrData as $key => $val) {
                 if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
                     check::AlertExit('對不起,您沒有執行權限', -1);
                 }
                 $this->moveupInfo($val);
             }
             break;
         case 'check':
             foreach ($arrData as $key => $val) {
                 if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
                     check::AlertExit('對不起,您沒有執行權限', -1);
                 }
                 $this->passInfo($val, 1);
             }
             break;
         case 'uncheck':
             foreach ($arrData as $key => $val) {
                 if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
                     check::AlertExit('對不起,您沒有執行權限', -1);
                 }
                 $this->passInfo($val, 0);
             }
             break;
         case 'settop':
             foreach ($arrData as $key => $val) {
                 if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
                     check::AlertExit('對不起,您沒有執行權限', -1);
                 }
                 $this->topInfo($val, 1);
             }
             break;
         case 'unsettop':
             foreach ($arrData as $key => $val) {
                 if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
                     check::AlertExit('對不起,您沒有執行權限', -1);
                 }
                 $this->topInfo($val, 0);
             }
             break;
         case 'setrecommend':
             foreach ($arrData as $key => $val) {
                 if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
                     check::AlertExit('對不起,您沒有執行權限', -1);
                 }
                 $this->recommendInfo($val, 1);
             }
             break;
         case 'unsetrecommend':
             foreach ($arrData as $key => $val) {
                 if (!$this->checkPopedomG($_SESSION['user_id'], 'x')) {
                     check::AlertExit('對不起,您沒有執行權限', -1);
                 }
                 $this->recommendInfo($val, 0);
             }
             break;
     }
     return true;
 }
開發者ID:TiMoChao,項目名稱:xingfu,代碼行數:86,代碼來源:php_common.php

示例13: array_values

    }
    if (is_array($_POST['photo'])) {
        $_POST['thumbnail'] = $_POST['photo'][0]['photo'];
    } else {
        $_POST['thumbnail'] = $_POST['photo'];
    }
    $_POST['photo'] = array_values($_POST['photo']);
    $_POST['video'] = array_values($_POST['video']);
    #自動拆字生成tag
    if (empty($_POST['tag'])) {
        $objSP = new SplitWord();
        $_POST['tag'] = $objSP->SplitRMM($_POST['title'], false);
    }
    $_POST = array_merge($arrInfo, $_POST);
    $objWebInit->saveInfo($_POST, 1);
    $objWebInit->updateCache($_POST['id'], $_POST['type_id'], $arrMOutput);
    check::WindowLocation('index.php', 'page=' . $_GET['page']);
}
if (!is_array($arrMType) || empty($arrMType)) {
    $arrMType = $objWebInit->getTypeList();
    $arrMType = $objWebInit->formatTypeList(0, $arrMType);
}
// 輸出到模板
$arrMOutput["template_file"] = "admin.html";
$arrMOutput["smarty_assign"]['FileCallPath'] = $objWebInit->arrGPic['FileCallPath'];
$arrMOutput["smarty_assign"]['FileListPicSize'] = $objWebInit->arrGPic['FileListPicSize'];
$arrMOutput["smarty_assign"]['arrData'] = $arrInfo;
$arrMOutput["smarty_assign"]['arrMType'] = $arrMType;
$arrMOutput["smarty_assign"]['action_type'] = "save";
$arrMOutput["smarty_assign"]['MAIN'] = $arrGSmarty['admin_main_dir'] . 'submit.htm';
$objWebInit->output($arrMOutput);
開發者ID:TiMoChao,項目名稱:lc_ad_first,代碼行數:31,代碼來源:modifyinfo.php

示例14: A

require "tests.php";
require "exception_order.php";
check::functions(array(a_foo, a_bar, a_foobar, a_barfoo));
check::classes(array(A, E1, E2, E3, exception_order, ET_i, ET_d));
check::globals(array(efoovar, foovar, cfoovar, a_sfoovar, a_foovar, a_efoovar));
$a = new A();
try {
    $a->foo();
} catch (Exception $e) {
    check::equal($e->getMessage(), 'C++ E1 exception thrown', '');
}
try {
    $a->bar();
} catch (Exception $e) {
    check::equal($e->getMessage(), 'C++ E2 exception thrown', '');
}
try {
    $a->foobar();
} catch (Exception $e) {
    check::equal($e->getMessage(), 'postcatch unknown', '');
}
try {
    $a->barfoo(1);
} catch (Exception $e) {
    check::equal($e->getMessage(), 'C++ E1 exception thrown', '');
}
try {
    $a->barfoo(2);
} catch (Exception $e) {
    check::equal($e->getMessage(), 'C++ E2 * exception thrown', '');
}
開發者ID:hj3938,項目名稱:crossbridge,代碼行數:31,代碼來源:exception_order_runme.php

示例15: smarty_modifier_age

/**
 * Smarty truncate modifier plugin
 *
 * Type:     modifier<br>
 * Name:     truncate<br>
 * Purpose:  Truncate a string to a certain length if necessary,
 *           optionally splitting in the middle of a word, and
 *           appending the $etc string or inserting $etc into the middle.
 * @link http://smarty.php.net/manual/en/language.modifier.truncate.php
 *          truncate (Smarty online manual)
 * @author   Monte Ohrt <monte at ohrt dot com>
 * @param string
 * @param integer
 * @param string
 * @param boolean
 * @param boolean
 * @return string
 */
function smarty_modifier_age($date, $blday = false)
{
    return check::birthday2age($date, $blday);
}
開發者ID:TiMoChao,項目名稱:lc_ad_first,代碼行數:22,代碼來源:modifier.age.php


注:本文中的check類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。