• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP file_get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _receiveJob

 function _receiveJob()
 {
     $result = '';
     $dir_jobs_queued = $this->_options['DirJobsQueued'];
     if (!$dir_jobs_queued) {
         throw new UnexpectedValueException('Configuration option DirJobsQueued required');
     }
     $path = end_with_slash($dir_jobs_queued);
     $job_id = '';
     if (file_exists($path) && is_dir($path)) {
         if ($dh = opendir($path)) {
             while (($file = readdir($dh)) !== false) {
                 if (substr($file, 0, 1) != '.') {
                     $xml = file_get($path . $file);
                     $this->_jobID = substr($file, 0, strpos($file, '.'));
                     $xml = @simplexml_load_string($xml);
                     if (!$xml) {
                         throw new RuntimeException('Could not parse job XML');
                     }
                     $this->_jobXML = $xml;
                     break;
                     // just do one
                 }
             }
             closedir($dh);
         }
     }
 }
开发者ID:ronniebrito,项目名称:moodle_moviemasher,代码行数:28,代码来源:Local.php


示例2: water

 /**
  * 为图片添加水印
  * @static public
  * @param string $source 原文件名
  * @param string $water  水印图片
  * @param string $$savename  添加水印后的图片名
  * @param string $alpha  水印的透明度
  * @return void
  */
 public static function water($source, $water, $savename = null, $alpha = 80, $get_source = true)
 {
     //[cluster]
     if ($get_source) {
         $source_tmp_name = tempnam(sys_get_temp_dir(), 'tp_');
         file_put_contents($source_tmp_name, file_get($source));
         $origin_savename = is_null($savename) ? $source : $savename;
         $source = $source_tmp_name;
     }
     //检查文件是否存在
     if (!file_exists($source) || !file_exists($water)) {
         return false;
     }
     //图片信息
     $sInfo = self::getImageInfo($source);
     $wInfo = self::getImageInfo($water);
     //如果图片小于水印图片,不生成图片
     if ($sInfo["width"] < $wInfo["width"] || $sInfo['height'] < $wInfo['height']) {
         return false;
     }
     //建立图像
     $sCreateFun = "imagecreatefrom" . $sInfo['type'];
     $sImage = $sCreateFun($source);
     $wCreateFun = "imagecreatefrom" . $wInfo['type'];
     $wImage = $wCreateFun($water);
     //设定图像的混色模式
     imagealphablending($wImage, true);
     //图像位置,默认为右下角右对齐
     $posY = $sInfo["height"] - $wInfo["height"];
     $posX = $sInfo["width"] - $wInfo["width"];
     //生成混合图像
     imagecopymerge($sImage, $wImage, $posX, $posY, 0, 0, $wInfo['width'], $wInfo['height'], $alpha);
     //输出图像
     $ImageFun = 'Image' . $sInfo['type'];
     //如果没有给出保存文件名,默认为原图像名
     if (!$savename) {
         $savename = $source;
         @unlink($source);
     } elseif ($get_source) {
         //[cluster] 临时保存文件
         $savename = tempnam(sys_get_temp_dir(), 'tp_');
         @unlink($source);
     }
     //保存图像
     $ImageFun($sImage, $savename);
     imagedestroy($sImage);
     //[cluster] 上传文件
     if ($get_source) {
         file_upload($savename, $origin_savename);
         @unlink($savename);
     }
 }
开发者ID:ysking,项目名称:commlib,代码行数:61,代码来源:Image.class.php


示例3: parse_dict

function parse_dict($table)
{
    $names = array();
    if (is_file(DT_ROOT . '/file/setting/' . $table . '.csv')) {
        $tmp = file_get(DT_ROOT . '/file/setting/' . $table . '.csv');
        $arr = explode("\n", $tmp);
        foreach ($arr as $v) {
            $t = explode(',', $v);
            $names[$t[0]] = $t[1];
        }
    }
    return $names;
}
开发者ID:hcd2008,项目名称:destoon,代码行数:13,代码来源:data.inc.php


示例4: setUp

 public function setUp()
 {
     $this->isProject = getenv('IS_PROJECT');
     parent::setUp();
     // setup manifest
     $codexArr = json_decode(file_get($this->fixturesPath('codex.json')), true);
     $codexArr = Util::recursiveArrayStringReplace($codexArr, ['{vendor_dir}' => $this->basePath('vendor')]);
     file_put(storage_path('codex.json'), json_encode($codexArr));
     // setup misc
     file_touch(storage_path('codex.log'));
     $this->registerServiceProvider();
     $a = 'a';
 }
开发者ID:codexproject,项目名称:core,代码行数:13,代码来源:TestCase.php


示例5: get

 function get($key)
 {
     is_md5($key) or $key = md5($this->pre . $key);
     $php = DT_CACHE . '/php/' . substr($key, 0, 2) . '/' . $key . '.php';
     if (is_file($php)) {
         $str = file_get($php);
         $ttl = substr($str, 13, 10);
         if ($ttl < $this->time) {
             return '';
         }
         return substr($str, 23, 1) == '@' ? substr($str, 24) : unserialize(substr($str, 23));
     } else {
         return '';
     }
 }
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:15,代码来源:cache_file.class.php


示例6: private_signature

function private_signature($key_path, $data)
{
    $result = FALSE;
    if (function_exists('openssl_get_privatekey') && function_exists('openssl_sign') && function_exists('openssl_free_key')) {
        $key = file_get($key_path);
        if ($key) {
            $pkeyid = openssl_get_privatekey($key);
            if ($pkeyid) {
                if (openssl_sign($data, $result, $pkeyid)) {
                    $result = base64_encode($result);
                }
                openssl_free_key($pkeyid);
            }
        }
    }
    return $result;
}
开发者ID:ronniebrito,项目名称:moodle_moviemasher,代码行数:17,代码来源:cryptutils.php


示例7: _get

 function _get($type, $job_id)
 {
     $dir_cache = $this->getOption('DirCache');
     if (!$dir_cache) {
         throw new UnexpectedValueException('Configuration option DirCache required');
     }
     $path = end_with_slash($dir_cache) . $job_id . '/media.xml';
     $raw_xml = file_get($path);
     $result = '';
     //$progress = -1;
     $status = 'Progress or PercentDone tags not found in response';
     $progress = 10;
     // now if there is any problem we set the percent back to one and retry later
     if (!$raw_xml) {
         $status = 'Queued';
     } else {
         $raw_xml = '<moviemasher>' . $raw_xml . '</moviemasher>';
         $xml = $this->_parseResponse($raw_xml);
         if (!empty($xml->Progress) && is_object($xml->Progress)) {
             $data = $xml->Progress[sizeof($xml->Progress) - 1];
             if (!empty($data->PercentDone)) {
                 $progress = (string) $data->PercentDone;
                 if (!empty($data->Status)) {
                     $status = (string) $data->Status;
                 } else {
                     $progress = 10;
                     $status = 'Status tag empty';
                 }
             } else {
                 $status = 'PercentDone tag empty';
             }
         } else {
             $status = 'Progress tag empty';
         }
     }
     if (strpos($status, 'empty') !== FALSE) {
         $this->log($status . ' in response: ' . $raw_xml);
     }
     $result = array('percent' => $progress, 'status' => $status);
     return $result;
 }
开发者ID:ronniebrito,项目名称:moodle_moviemasher,代码行数:41,代码来源:Client.php


示例8: foreach

 foreach (glob(DT_ROOT . '/*.*') as $f) {
     $files[] = $f;
 }
 foreach ($filedir as $d) {
     $files = array_merge($files, get_file(DT_ROOT . '/' . $d, $fileext));
 }
 $lists = $mirror = array();
 if (is_file(DT_ROOT . '/file/md5/' . DT_VERSION . '.php')) {
     $content = substr(trim(file_get(DT_ROOT . '/file/md5/' . DT_VERSION . '.php')), 13);
     foreach (explode("\n", $content) as $v) {
         list($m, $f) = explode(' ', trim($v));
         $mirror[$m] = $f;
     }
 }
 foreach ($files as $f) {
     $content = file_get($f);
     if (preg_match_all('/(' . $code . ')/i', $content, $m)) {
         $r = $c = array();
         foreach ($m[1] as $v) {
             in_array($v, $c) or $c[] = $v;
         }
         $r['num'] = count($c);
         if ($r['num'] < $codenum && strpos($content, 'Zend') === false) {
             continue;
         }
         $r['file'] = str_replace(DT_ROOT . '/', '', $f);
         if ($mirror && in_array($r['file'], $mirror)) {
             if (md5_file($f) == array_search($r['file'], $mirror)) {
                 continue;
             }
         }
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:scan.inc.php


示例9: selectCountry

<html>
<head>
    <title>Land wählen</title>

    <script language="JavaScript" type="text/javascript" src="../global.js"></script>
    <script language="JavaScript" type="text/javascript" src="selcountry.js"></script>
    <script language="JavaScript" type="text/javascript">
        // @ by I.Runge 2004

        function selectCountry(name) {
//opener.xform.feld.value="name";
            opener.subnetgo(name);
            self.close();
        }

    </script>

</head>
<body style="font-family:arial;">

<?php 
define("IN_HTN", 1);
include "../gres.php";
echo str_replace("%path%", "../images/maps", file_get("../data/pubtxt/selcountry_body.txt"));
?>

</body>
</html>
开发者ID:dergriewatz,项目名称:htn-original,代码行数:28,代码来源:selcountry.php


示例10: action_submitcode

function action_submitcode()
{
    global $sessionid, $admin, $maxcodesize;
    if ($admin["mode"] != "Passive" && $admin["mode"] != "Active" && $_SESSION["status"] != "Admin") {
        $_SESSION["message"][] = "Code Submission Error : You are not allowed to submit solutions right now!";
        return;
    }
    if (!isset($_POST["code_pid"]) || empty($_POST["code_pid"]) || !isset($_POST["code_lang"]) || empty($_POST["code_lang"]) || !isset($_POST["code_name"]) || empty($_POST["code_name"])) {
        $_SESSION["message"][] = "Code Submission Error : Insufficient Data";
        return;
    }
    $data = mysql_query("SELECT status,languages,pgroup FROM problems WHERE pid='{$_POST['code_pid']}'");
    if (!is_resource($data) || mysql_num_rows($data) == 0) {
        $_SESSION["message"][] = "Code Submission Error : The specified problem does not exist.";
        return;
    }
    $data = mysql_fetch_array($data);
    if ($_SESSION["status"] != "Admin" && $data["status"] != "Active") {
        $_SESSION["message"][] = "Code Submission Error : The problem specified is not currently active.";
        return;
    }
    if ($_SESSION["status"] != "Admin" && eregi("^#[0-9]+ CQM\\-[0-9]+\$", $data["prgoup"]) && $admin["mode"] == "Passive") {
        $_SESSION["message"][] = "Code Submission Error : You can no longer submit solutions to this problem.";
        return;
    }
    if ($_SESSION["status"] != "Admin" && !in_array($_POST["code_lang"], explode(",", $data["languages"]))) {
        $_SESSION["message"][] = "Code Submission Error : The programming language specified is not allowed for this problem.";
        return;
    }
    // Lower Priority - Text
    if (strlen($_POST["code_text"]) > $maxcodesize) {
        $_SESSION["message"][] = "Code Submission Error : Submitted code exceeds size limits.";
        return;
    }
    $sourcecode = addslashes($_POST["code_text"]);
    // Higher Priority - File
    $ext = file_upload("code_file", "sys/temp/" . $sessionid . "_code", "text/plain,text/x-c,text/x-c++src,application/octet-stream,application/x-javascript,application/x-ruby", 100 * 1024);
    if ($ext != -1) {
        $sourcecode = addslashes(file_get("sys/temp/" . $sessionid . "_code.{$ext}"));
        unlink("sys/temp/" . $sessionid . "_code.{$ext}");
        $_POST["code_name"] = eregi_replace(".(b|c|cpp|java|pl|php|py|rb|txt)\$", "", basename($_FILES['code_file']['name']));
    }
    //echo "INSERT INTO runs (pid,tid,language,name,code,access,submittime) VALUES ('$_POST[code_pid]','$_SESSION[tid]','$_POST[code_lang]','$_POST[code_name]','$sourcecode','private',".time().")";
    if (!empty($sourcecode)) {
        mysql_query("INSERT INTO runs (pid,tid,language,name,code,access,submittime) VALUES ('{$_POST['code_pid']}','{$_SESSION['tid']}','{$_POST['code_lang']}','{$_POST['code_name']}','{$sourcecode}','private'," . time() . ")");
        $rid = mysql_insert_id();
        $_SESSION["message"][] = "Code Submission Successful.\nIf the code you submitted is not being evaluated immediately, please contact \"SourceCode\" on DC.";
        $_SESSION["redirect"] = "?display=code&rid={$rid}";
    } else {
        $_SESSION["message"][] = "Code Submission Error : Cannot submit empty code.";
    }
    return mysql_insert_id();
}
开发者ID:VaibhavAgarwalVA,项目名称:aurora-online-judge,代码行数:53,代码来源:system_code.php


示例11: file_get

    if ($backdays > 5) {
        ?>
 (<span class="f_red"><?php 
        echo $backdays;
        ?>
</span>天以前)<?php 
    }
    ?>
</a></td>
</tr>
</table>
<div class="tt">使用协议</div>
<table cellpadding="2" cellspacing="1" class="tb">
<tr>
<td style="padding:10px;"><textarea style="width:100%;height:100px;" onmouseover="this.style.height='600px';" onmouseout="this.style.height='100px';"><?php 
    echo file_get(DT_ROOT . '/license.txt');
    ?>
</textarea></td>
</tr>
</table>
<script type="text/javascript" src="<?php 
    echo $notice_url;
    ?>
"></script>
<script type="text/javascript">
var destoon_release = <?php 
    echo DT_RELEASE;
    ?>
;
var destoon_version = <?php 
    echo DT_VERSION;
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:main.tpl.php


示例12: dir_read

 if ($sql_dir) {
     $load_files = dir_read($sql_dir, null, array('.sql'), 'date_desc');
 }
 $load_assoc = array();
 if ($sql_dir) {
     foreach ($load_files as $file) {
         $file_path = $file;
         $file = basename($file);
         $load_assoc[$file] = '(' . substr(file_date($file_path), 0, 10) . ')' . ' ' . $file;
     }
 }
 if ($sql_dir && 'load' == $post['perform']) {
     $file = $sql_dir . '/' . $post['load_from'];
     if (array_key_exists($post['load_from'], $load_assoc) && file_exists($file)) {
         $msg .= sprintf('<div>Sql loaded: %s (%s)</div>', basename($file), timestamp(file_date($file)));
         $post['sql'] = file_get($file);
         $post['save_as'] = basename($file);
         $post['save_as'] = str_replace('.sql', '', $post['save_as']);
     } else {
         error('<div>File not found: %s</div>', $file);
     }
 }
 // after load - md5 may change
 $md5 = md5($post['sql']);
 if ($sql_dir && 'load' == $post['perform'] && !error()) {
     $md5_tmp = sprintf($sql_dir . '/zzz_%s.dat', $md5);
     file_put($md5_tmp, $post['sql']);
 }
 $is_sel = false;
 $queries = preg_split("#;(\\s*--[ \t\\S]*)?(\r\n|\n|\r)#U", $post['sql']);
 foreach ($queries as $k => $query) {
开发者ID:rubencamargogomez,项目名称:custom_properties,代码行数:31,代码来源:dbkiss.php


示例13: split_sell

function split_sell($part)
{
    global $db, $CFG, $MODULE;
    $sql = file_get(DT_ROOT . '/file/setting/split_sell.sql');
    $sql or dalert('请检查文件file/setting/split_sell.sql是否存在');
    $sql = str_replace('destoon_sell', $db->pre . 'sell_' . $part, $sql);
    if ($db->version() > '4.1' && $CFG['db_charset']) {
        $sql .= " ENGINE=MyISAM DEFAULT CHARSET=" . $CFG['db_charset'];
    } else {
        $sql .= " TYPE=MyISAM";
    }
    $sql .= " COMMENT='" . $MODULE[5]['name'] . "分表_" . $part . "';";
    $db->query($sql);
}
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:14,代码来源:global.func.php


示例14: msg

 if (isset($import)) {
     if (isset($filename) && $filename && file_ext($filename) == 'sql') {
         $dfile = $D . $filename;
         if (!is_file($dfile)) {
             msg('文件不存在,请检查');
         }
         $sql = file_get($dfile);
         sql_execute($sql);
         msg($filename . ' 导入成功', '?file=' . $file . '&action=import');
     } else {
         $fileid = isset($fileid) ? $fileid : 1;
         $tid = isset($tid) ? intval($tid) : 0;
         $filename = is_dir($D . $filepre) ? $filepre . '/' . $fileid : $filepre . $fileid;
         $filename = $D . $filename . '.sql';
         if (is_file($filename)) {
             $sql = file_get($filename);
             if (substr($sql, 0, 11) == '# Destoon V') {
                 $v = substr($sql, 11, 3);
                 if (DT_VERSION != $v) {
                     msg('由于数据结构存在差异,备份数据不可以跨版本导入<br/>备份版本:V' . $v . '<br/>当前系统:V' . DT_VERSION);
                 }
             }
             sql_execute($sql);
             $prog = $tid ? progress(1, $fileid, $tid) : '';
             msg('分卷 <strong>#' . $fileid++ . '</strong> 导入成功 程序将自动继续...' . $prog, '?file=' . $file . '&action=' . $action . '&filepre=' . $filepre . '&fileid=' . $fileid . '&tid=' . $tid . '&import=1');
         } else {
             msg('数据库恢复成功', '?file=' . $file . '&action=import');
         }
     }
 } else {
     $dbak = $dbaks = $dsql = $dsqls = $sql = $sqls = array();
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:database.inc.php


示例15: drawSimpleTop

function drawSimpleTop($title = false)
{
    //leave title empty for emails
    $return = url_header_utf8() . draw_doctype() . '
		<head>' . draw_meta_utf8() . draw_favicon(DIRECTORY_WRITE . '/favicon.png') . draw_css(file_get('/css/simple.css'));
    if ($title) {
        $return .= draw_container('title', $title);
        $return .= draw_javascript_src();
        $return .= draw_javascript_src('/javascript.js');
    }
    $return .= '</head>
		<body class="s">';
    return $return;
}
开发者ID:Rhenan,项目名称:intranet-1,代码行数:14,代码来源:include.php


示例16: tag

function tag($parameter, $expires = 0)
{
    global $DT, $CFG, $MODULE, $DT_TIME, $db;
    if ($expires > 0) {
        $tag_expires = $expires;
    } else {
        if ($expires == -2) {
            $tag_expires = $CFG['db_expires'];
        } else {
            if ($expires == -1) {
                $tag_expires = 0;
            } else {
                $tag_expires = $CFG['tag_expires'];
            }
        }
    }
    $tag_cache = false;
    $db_cache = $expires == -2 || defined('TOHTML') ? 'CACHE' : '';
    if ($tag_expires && $db_cache != 'CACHE' && strpos($parameter, '&page=') === false) {
        $tag_cache = true;
        $TCF = DT_CACHE . '/tag/' . md5($parameter) . '.htm';
        if (is_file($TCF) && $DT_TIME - filemtime($TCF) < $tag_expires) {
            echo substr(file_get($TCF), 17);
            return;
        }
    }
    $parameter = str_replace(array('&amp;', '%'), array('', '##'), $parameter);
    $parameter = strip_sql($parameter);
    parse_str($parameter, $par);
    if (!is_array($par)) {
        return '';
    }
    $par = dstripslashes($par);
    extract($par, EXTR_SKIP);
    isset($prefix) or $prefix = $db->pre;
    isset($moduleid) or $moduleid = 1;
    if (!isset($MODULE[$moduleid])) {
        return '';
    }
    isset($fields) or $fields = '*';
    isset($catid) or $catid = 0;
    isset($child) or $child = 1;
    isset($areaid) or $areaid = 0;
    isset($areachild) or $areachild = 1;
    isset($dir) && check_name($dir) or $dir = 'tag';
    isset($template) && check_name($template) or $template = 'list';
    isset($condition) or $condition = '1';
    isset($group) or $group = '';
    isset($page) or $page = 1;
    isset($offset) or $offset = 0;
    isset($pagesize) or $pagesize = 10;
    isset($order) or $order = '';
    isset($showpage) or $showpage = 0;
    isset($showcat) or $showcat = 0;
    isset($datetype) or $datetype = 0;
    isset($target) or $target = '';
    isset($class) or $class = '';
    isset($length) or $length = 0;
    isset($introduce) or $introduce = 0;
    isset($debug) or $debug = 0;
    isset($lazy) or $lazy = 0;
    isset($cols) && $cols or $cols = 1;
    if ($catid) {
        if ($moduleid > 4) {
            if (is_numeric($catid)) {
                $CAT = $db->get_one("SELECT child,arrchildid,moduleid FROM {$db->pre}category WHERE catid={$catid}");
                $condition .= $child && $CAT['child'] && $CAT['moduleid'] == $moduleid ? " AND catid IN (" . $CAT['arrchildid'] . ")" : " AND catid={$catid}";
            } else {
                if ($child) {
                    $catids = '';
                    $result = $db->query("SELECT arrchildid FROM {$db->pre}category WHERE catid IN ({$catid})");
                    while ($r = $db->fetch_array($result)) {
                        $catids .= ',' . $r['arrchildid'];
                    }
                    if ($catids) {
                        $catid = substr($catids, 1);
                    }
                }
                $condition .= " AND catid IN ({$catid})";
            }
        } else {
            if ($moduleid == 4) {
                $condition .= " AND catids LIKE '%,{$catid},%'";
            }
        }
    }
    if ($areaid) {
        if (is_numeric($areaid)) {
            $ARE = $db->get_one("SELECT child,arrchildid FROM {$db->pre}area WHERE areaid={$areaid}");
            $condition .= $areachild && $ARE['child'] ? " AND areaid IN (" . $ARE['arrchildid'] . ")" : " AND areaid={$areaid}";
        } else {
            if ($areachild) {
                $areaids = '';
                $result = $db->query("SELECT arrchildid FROM {$db->pre}area WHERE areaid IN ({$areaid})");
                while ($r = $db->fetch_array($result)) {
                    $areaids .= ',' . $r['arrchildid'];
                }
                if ($areaids) {
                    $areaid = substr($areaids, 1);
                }
//.........这里部分代码省略.........
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:101,代码来源:tag.func.php


示例17: load

function load($file)
{
    $ext = file_ext($file);
    if ($ext == 'css') {
        echo '<link rel="stylesheet" type="text/css" href="' . DT_SKIN . $file . '" />';
    } else {
        if ($ext == 'js') {
            echo '<script type="text/javascript" src="' . DT_STATIC . 'file/script/' . $file . '"></script>';
        } else {
            if ($ext == 'htm') {
                $file = str_replace('ad_m', 'ad_t6_m', $file);
                if (is_file(DT_CACHE . '/htm/' . $file)) {
                    $content = file_get(DT_CACHE . '/htm/' . $file);
                    if (substr($content, 0, 4) == '<!--') {
                        $content = substr($content, 17);
                    }
                    echo $content;
                } else {
                    echo '';
                }
            } else {
                if ($ext == 'lang') {
                    $file = str_replace('.lang', '.inc.php', $file);
                    return DT_ROOT . '/lang/' . DT_LANG . '/' . $file;
                } else {
                    if ($ext == 'inc' || $ext == 'func' || $ext == 'class') {
                        return DT_ROOT . '/include/' . $file . '.php';
                    }
                }
            }
        }
    }
}
开发者ID:oneoneplus,项目名称:webshell,代码行数:33,代码来源:global.func.php


示例18: action_updateproblem

function action_updateproblem()
{
    global $sessionid, $invalidchars, $maxfilesize;
    if (!isset($_POST["update_pid"]) || empty($_POST["update_pid"])) {
        $_SESSION["message"][] = "Problem Updation Error : Insufficient Data";
        return;
    }
    foreach ($_POST as $key => $value) {
        if (eregi("^update_", $key) && eregi($invalidchars, $value)) {
            $_SESSION["message"][] = "Problem Updation Error : Value of {$key} contains invalid characters.";
            return;
        }
    }
    foreach ($_POST as $key => $value) {
        if (eregi("^update_", $key) && $key != "update_languages" && strlen($value) > 30 && $key != "update_languages") {
            $_SESSION["message"][] = "Problem Updation Error : Value of {$key} too long.";
            return;
        }
    }
    $pid = $_POST["update_pid"];
    foreach ($_POST as $key => $value) {
        if (eregi("^update_", $key) && !eregi("^update_file_", $key) && $key != "update_pid" && $key != "update_delete") {
            mysql_query("UPDATE problems SET " . eregi_replace("^update_", "", $key) . "='" . addslashes(eregi_replace("\"", "\\'", $value)) . "' WHERE pid={$pid}");
        }
    }
    foreach (array("statement", "input", "output") as $item) {
        $ext = file_upload("update_file_{$item}", "sys/temp/" . $sessionid . "_{$item}", "text/plain", $maxfilesize);
        if ($ext == -1) {
            continue;
        }
        mysql_query("UPDATE problems SET {$item}='" . addslashes(eregi_replace("\r", "", file_get("sys/temp/" . $sessionid . "_{$item}.{$ext}"))) . "' WHERE pid={$pid}");
        unlink("sys/temp/" . $sessionid . "_{$item}.{$ext}");
    }
    $ext = file_upload("update_file_image", "sys/temp/image", "image/jpeg,image/gif,image/png", $maxfilesize);
    if ($ext != -1) {
        $f = fopen("sys/temp/image.{$ext}", "rb");
        $img = base64_encode(fread($f, filesize("sys/temp/image.{$ext}")));
        fclose($f);
        mysql_query("UPDATE problems SET image='{$img}', imgext='{$ext}' WHERE pid={$pid}");
    }
    if (0) {
        if (isset($_POST["update_status"]) && $_POST["update_status"] == "Delete") {
            mysql_query("DELETE FROM problems WHERE pid={$pid}");
        }
    }
    $_SESSION["message"][] = "Problem Updation Successful";
    return;
}
开发者ID:VaibhavAgarwalVA,项目名称:aurora-online-judge,代码行数:48,代码来源:system_problem.php


示例19: extract

    $user = $do->get_one();
    extract($user);
    $logintime = timetodate($logintime, 5);
    $regtime = timetodate($regtime, 5);
    $userurl = userurl($_username, '', $domain);
    $sys = array();
    $i = 0;
    $result = $db->query("SELECT itemid,title,addtime,groupids FROM {$DT_PRE}message WHERE groupids<>'' ORDER BY itemid DESC", 'CACHE');
    while ($r = $db->fetch_array($result)) {
        $groupids = explode(',', $r['groupids']);
        if (!in_array($_groupid, $groupids)) {
            continue;
        }
        if ($i > 2) {
            continue;
        }
        $i++;
        $sys[] = $r;
    }
    $note = DT_ROOT . '/file/user/' . dalloc($_userid) . '/' . $_userid . '/note.php';
    $note = file_get($note);
    if ($note) {
        $note = substr($note, 13);
    } else {
        $note = $MOD['usernote'];
    }
    $trade = $db->count("{$DT_PRE}mall_order", "seller='{$_username}' AND status=0");
    $expired = $totime && $totime < $DT_TIME ? true : false;
    $havedays = $expired ? 0 : ceil(($totime - $DT_TIME) / 86400);
    include template('index', $module);
}
开发者ID:hcd2008,项目名称:destoon,代码行数:31,代码来源:index.inc.php


示例20: cache_write

     $data['template'] = $template;
     $data['maillist'] = $maillist;
     $data['fields'] = $fields;
     cache_write($_username . '_sendmail.php', $data);
 }
 $_content = $content;
 $pernum = intval($pernum);
 if (!$pernum) {
     $pernum = 5;
 }
 $pertime = intval($pertime);
 if (!$pertime) {
     $pertime = 5;
 }
 $DT['mail_name'] = $name;
 $emails = file_get(DT_ROOT . '/file/email/' . $maillist);
 $emails = explode("\n", $emails);
 for ($i = 1; $i <= $pernum; $i++) {
     $email = trim($emails[$id++]);
     if (is_email($email)) {
         $content = $_content;
         if ($template) {
             $user = _userinfo($fields, $email);
             eval("\$title = \"{$title}\";");
             $content = ob_template($template, 'mail');
         }
         send_mail($email, $title, $content, $sender);
     }
 }
 if ($id < count($emails)) {
     msg('已发送 ' . $id . ' 封邮件,系统将自动继续,请稍候...', '?moduleid=' . $moduleid . '&file=' . $file . '&sendtype=3&id=' . $id . '&pernum=' . $pernum . '&pertime=' . $pertime . '&send=1', $pertime);
开发者ID:hcd2008,项目名称:destoon,代码行数:31,代码来源:sendmail.inc.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP file_get_contents函数代码示例发布时间:2022-05-15
下一篇:
PHP file_generate_unique_name函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap