本文整理汇总了PHP中savefile函数的典型用法代码示例。如果您正苦于以下问题:PHP savefile函数的具体用法?PHP savefile怎么用?PHP savefile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了savefile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _T
////////////////////////////////////////////////////////////////////////////////////
// FORGOT YOUR PASSWORD - SEND LINK
if (isset($_POST['forgot'])) {
if (isset($_POST['email']) && cl($_POST['email']) == $settings['SET_CONTACT']) {
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
// More headers
$headers .= 'From: ' . $settings['SET_CONTACT'] . "\r\n";
$subject = $settings['SET_TITLE'] . ' - ' . _T("admin_log_forgot_password_email_subject");
$find = array('{reset_url}', '{user_name}');
$reset_id = md5(time() . $settings['SET_SALTING']);
$replace = array('reset_url' => '<a href="' . $settings['SET_SITEURL'] . 'admin.php?reset=' . $reset_id . '">' . $settings['SET_SITEURL'] . 'admin.php?reset=' . $reset_id . '</a>', 'user_name' => $settings['SET_USERNAME']);
$msg = str_replace($find, $replace, _T("admin_log_forgot_password_email_body"));
mail($settings['SET_CONTACT'], $subject, $msg, $headers);
if (savefile(array('id' => $reset_id, 'date' => time()), CFDATAPATH . 'rs.cf')) {
user_feedback('success', _T('admin_log_forgot_password_suc'), 'forgot_password');
$forgot_note = 1;
}
} else {
user_feedback('error', _T("admin_log_forgot_password_email_err"), 'admin_log_forgot_password_email');
$forgot_note = 1;
}
}
// FORGOT YOUR PASSWORD - RESET LINK CHECK
if (isset($_GET['reset'])) {
if (file_exists(CFDATAPATH . 'rs.cf')) {
$reset_db = loadfile(CFDATAPATH . 'rs.cf');
if ($reset_db['id'] == cl($_GET['reset']) && $reset_db['date'] + 3600 > time()) {
$reset_password = true;
$_SESSION['reset_password'] = cl($_GET['reset']);
示例2: updateContent
function updateContent($content_id, $arbre_id, $langue_id)
{
//recherche du contenu_id
$requete_select_contenu = "select contenu_id,shortlib from " . __racinebd__ . "contenu c inner join " . __racinebd__ . "langue l on c.langue_id=l.langue_id where arbre_id = " . $arbre_id . " and l.langue_id!=" . $langue_id;
$link_select_contenu = query($requete_select_contenu);
$requete_select_content = "select * from " . __racinebd__ . "content where content_id = " . $content_id;
$link_select_content = query($requete_select_content);
$ligne_select_content = fetch($link_select_content);
//print_r($_POST);
//$result = mysql_query("select * from table");
$listfile = array();
while ($ligne_select_contenu = fetch($link_select_contenu)) {
//$requete="insert into ".__racinebd__."content ";
$listchamps = array();
$listvalue = array();
$listext = array();
//$listchamps[]="contenu_id";
//$listvalue[]=$ligne_select_contenu["contenu_id"];
for ($i = 0; $i < mysql_num_fields($link_select_content); $i++) {
if (mysql_field_name($link_select_content, $i) != "content_id" && mysql_field_name($link_select_content, $i) != "contenu_id") {
$champs = mysql_field_name($link_select_content, $i);
if (strpos($champs, "ext") === false) {
if ($_POST[$champs . "___" . $ligne_select_contenu["shortlib"]] != "") {
$value = "'" . addslashes($_POST[$champs . "___" . $ligne_select_contenu["shortlib"]]) . "'";
} else {
$value = "'" . addslashes($ligne_select_content[$champs]) . "'";
}
$listchamps[] = $champs . "=" . $value;
} else {
//print $champs."___".$ligne_select_contenu["shortlib"]." : ".$_FILES[$champs."___".$ligne_select_contenu["shortlib"]];
//print_r($_FILES);
if (isset($_FILES[$champs . "___" . $ligne_select_contenu["shortlib"]])) {
//$numext=explode("___",$champs);
//sauvegarde du fichier
/*
if(strlen($numext[0])>3){
$numext=substr($numext[0],-1);
*/
//print "ici";
if (strlen($champs) > 3) {
$numext = substr($champs, -1);
//print $numext;
$listfile[] = array($champs . "___" . $ligne_select_contenu["shortlib"], __racinebd__ . "content" . $numext . "_");
} else {
$listfile[] = array($champs . "___" . $ligne_select_contenu["shortlib"], __racinebd__ . "content");
}
//$value=($_POST[$champs."___".$ligne_select_contenu["shortlib"]]=="")?"null":"'".$_POST[$champs."___".$ligne_select_contenu["shortlib"]]."'";
$value = $_FILES[$champs . "___" . $ligne_select_contenu["shortlib"]]["name"] != "" ? "'" . getext($_FILES[$champs . "___" . $ligne_select_contenu["shortlib"]]["name"]) . "'" : "null";
} else {
$value = $ligne_select_content[$champs] == "" ? "null" : "'" . $ligne_select_content[$champs] . "'";
$listext[] = $champs;
}
if ($_POST[$champs . "___" . $ligne_select_contenu["shortlib"] . "_chk"] == 1) {
$listchamps[] = $champs . "=null";
} else {
if ($value != "null") {
$listchamps[] = $champs . "=" . $value;
}
}
}
}
}
$requete_update_content = "update " . __racinebd__ . "content set " . implode(",", $listchamps) . " where contenu_id=" . $ligne_select_contenu["contenu_id"];
//print $requete_insert_content;
//echo $requete_insert_content;
$link = query($requete_update_content);
//verification que la mise ajour a été effectué sinon on crée un enregistrement
$sql = "select * from " . __racinebd__ . "content where contenu_id=" . $ligne_select_contenu["contenu_id"];
$link = query($sql);
if (num_rows($link) == 0) {
copyContent($content_id, $arbre_id, $langue_id, $ligne_select_contenu["langue_id"]);
} else {
$tbl = fetch($link);
/*
print_r($listfile);
print_r($listext);
*/
//sauvegarde des fichiers différents
for ($j = 0; $j < count($listfile); $j++) {
savefile($listfile[$j][0], $listfile[$j][1], $tbl["content_id"]);
}
$dernier_ajout_content = $tbl["content_id"];
//a faire pour l'update
//print_r($listext);
for ($listextindice = 0; $listextindice < count($listext); $listextindice++) {
$suffixe = strlen($listext[$listextindice]) > 3 ? substr($listext[$listextindice], -1) . "_" : "";
//$suffixe=($listextindice==0)?"":($listextindice+1)."_";
//print $_SERVER["DOCUMENT_ROOT"].__uploaddir__.__racinebd__.'content'.$suffixe.$ligne_select_content['content_id'].'.'.$ligne_select_content[$listext[$listextindice]]."<br>";
@copy($_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . __racinebd__ . 'content' . $suffixe . $ligne_select_content['content_id'] . '.' . $ligne_select_content[$listext[$listextindice]], $_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . __racinebd__ . 'content' . $suffixe . $dernier_ajout_content . '.' . $ligne_select_content[$listext[$listextindice]]);
@copy($_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . 'tbl_' . __racinebd__ . 'content' . $suffixe . $ligne_select_content['content_id'] . '.' . $ligne_select_content[$listext[$listextindice]], $_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . 'tbl_' . __racinebd__ . 'content' . $suffixe . $dernier_ajout_content . '.' . $ligne_select_content[$listext[$listextindice]]);
for ($i = 0; $i < 5; $i++) {
@copy($_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . 'tbl_' . $i . __racinebd__ . 'content' . $suffixe . $ligne_select_content['content_id'] . '.' . $ligne_select_content[$listext[$listextindice]], $_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . 'tbl_' . $i . __racinebd__ . 'content' . $suffixe . $dernier_ajout_content . '.' . $ligne_select_content[$listext[$listextindice]]);
}
}
$requete_select_fichier = "select * from " . __racinebd__ . "fichiers where content_id = " . $ligne_select_content['content_id'] . " and supprimer=0";
$link_select_fichier = query($requete_select_fichier);
while ($ligne_select_fichier = fetch($link_select_fichier)) {
$requete_insert_fichier = "insert into " . __racinebd__ . "fichiers (content_id,titre,abstract,ext,nom_fichier,supprimer,contenu) values (\r\n " . $dernier_ajout_content . ",\r\n '" . addslashes($ligne_select_fichier['titre']) . "',\r\n '" . addslashes($ligne_select_fichier['abstract']) . "',\r\n " . ($ligne_select_fichier['ext'] == "" ? "null" : "'" . $ligne_select_fichier['ext'] . "'") . ",\r\n '" . addslashes($ligne_select_fichier['nom_fichier']) . "',\r\n " . $ligne_select_fichier['supprimer'] . ",\r\n '" . addslashes($ligne_select_fichier['contenu']) . "'\r\n )";
$link_insert_fichier = query($requete_insert_fichier);
$dernier_ajout_fichier = insert_id();
//.........这里部分代码省略.........
示例3: edit_file
function edit_file($dir, $item)
{
// edit file
global $mainframe, $mosConfig_live_site;
if (($GLOBALS["permissions"] & 01) != 01) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
$fname = get_abs_item($dir, $item);
if (!get_is_file($fname)) {
show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
}
if (!get_show_item($dir, $item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
}
if (isset($GLOBALS['__POST']["dosave"]) && $GLOBALS['__POST']["dosave"] == "yes") {
// Save / Save As
$item = basename(stripslashes($GLOBALS['__POST']["fname"]));
$fname2 = get_abs_item($dir, $item);
if (!isset($item) || $item == "") {
show_error($GLOBALS["error_msg"]["miscnoname"]);
}
if ($fname != $fname2 && @$GLOBALS['jx_File']->file_exists($fname2)) {
show_error($item . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
}
savefile($fname2);
$fname = $fname2;
if (!empty($GLOBALS['__POST']['return_to'])) {
$return_to = urldecode($GLOBALS['__POST']['return_to']);
mosRedirect($return_to);
} elseif (!empty($GLOBALS['__POST']['return_to_dir'])) {
mosRedirect($_SERVER['PHP_SELF'] . '?option=com_joomlaxplorer&dir=' . $dir, 'The File ' . $item . ' was saved.');
}
}
// header
$s_item = get_rel_item($dir, $item);
if (strlen($s_item) > 50) {
$s_item = "..." . substr($s_item, -47);
}
show_header($GLOBALS["messages"]["actedit"] . ": /" . $s_item);
$s_info = pathinfo($s_item);
$s_extension = str_replace('.', '', $s_info['extension']);
switch (strtolower($s_extension)) {
case 'txt':
$cp_lang = 'text';
break;
case 'cs':
$cp_lang = 'csharp';
break;
case 'css':
$cp_lang = 'css';
break;
case 'html':
case 'htm':
case 'xml':
case 'xhtml':
$cp_lang = 'html';
break;
case 'java':
$cp_lang = 'java';
break;
case 'js':
$cp_lang = 'javascript';
break;
case 'pl':
$cp_lang = 'perl';
break;
case 'ruby':
$cp_lang = 'ruby';
break;
case 'sql':
$cp_lang = 'sql';
break;
case 'vb':
case 'vbs':
$cp_lang = 'vbscript';
break;
case 'php':
$cp_lang = 'php';
break;
default:
$cp_lang = 'generic';
}
// Form
echo '<script type="text/javascript" src="components/com_joomlaxplorer/scripts/codepress/codepress.js"></script>';
echo "<br/><form name=\"editfrm\" id=\"editfrm\" method=\"post\" action=\"" . make_link("edit", $dir, $item) . "\">\n";
if (!empty($GLOBALS['__GET']['return_to'])) {
$close_action = 'window.location=\'' . urldecode($GLOBALS['__GET']['return_to']) . '\';';
echo "<input type=\"hidden\" name=\"return_to\" value=\"" . $GLOBALS['__GET']['return_to'] . "\" />\n";
} else {
$close_action = 'window.location=\'' . make_link('list', $dir, NULL) . "'";
}
$submit_action = 'document.editfrm.code.value=codearea.getCode();document.editfrm.submit();';
echo "\r\n<table class=\"adminform\">\r\n\t<tr>\r\n\t\t<td style=\"text-align: center;\">\r\n\t\t\t<input type=\"button\" value=\"" . $GLOBALS["messages"]["btnsave"] . "\" onclick=\"{$submit_action}\" /> \r\n\t\t\t<input type=\"reset\" value=\"" . $GLOBALS["messages"]["btnreset"] . "\" /> \r\n\t\t\t<input type=\"button\" value=\"" . $GLOBALS["messages"]["btnclose"] . "\" onclick=\"javascript:{$close_action}\" />\r\n\t\t</td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td >\r\n\t\t\t<div id=\"positionIndicator\" style=\"width: 20%;float:left;\">" . $GLOBALS["messages"]["line"] . ": <input type=\"text\" name=\"txtLine\" class=\"inputbox\" size=\"6\" onchange=\"setCaretPosition(document.editfrm.code, this.value);return false;\" /> " . $GLOBALS["messages"]["column"] . ": <input type=\"text\" name=\"txtColumn\" class=\"inputbox\" size=\"6\" readonly=\"readonly\" />\r\n </div>\r\n\t\t\t<div style=\"width:70%;text-align: center;float:left;\">\r\n\t\t\t\t<input type=\"checkbox\" value=\"1\" name=\"return_to_dir\" id=\"return_to_dir\" />\r\n\t\t\t\t<label for=\"return_to_dir\">" . $GLOBALS["messages"]["returndir"] . "</label>\r\n\t\t\t</div>";
echo "\r\n\t\t</td>\r\n\t</tr>\r\n\t<tr><td>";
echo "<input type=\"hidden\" name=\"dosave\" value=\"yes\" />\n";
// Show File In TextArea
$content = $GLOBALS['jx_File']->file_get_contents($fname);
if (get_magic_quotes_runtime()) {
$content = stripslashes($content);
}
//.........这里部分代码省略.........
示例4: edit_file
function edit_file($dir, $item)
{
if (!permissions_grant($dir, $item, "change")) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
if (!get_is_file($dir, $item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
}
if (!get_show_item($dir, $item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
}
$fname = get_abs_item($dir, $item);
if (isset($GLOBALS['__POST']["dosave"]) && $GLOBALS['__POST']["dosave"] == "yes") {
// Save / Save As
$item = basename(stripslashes($GLOBALS['__POST']["fname"]));
$fname2 = get_abs_item($dir, $item);
if (!isset($item) || $item == "") {
show_error($GLOBALS["error_msg"]["miscnoname"]);
}
if ($fname != $fname2 && @file_exists($fname2)) {
show_error($item . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
}
savefile($fname2);
$fname = $fname2;
}
// open file
$fp = @fopen($fname, "r");
if ($fp === false) {
show_error($item . ": " . $GLOBALS["error_msg"]["openfile"]);
}
// header
$s_item = get_rel_item($dir, $item);
if (strlen($s_item) > 50) {
$s_item = "..." . substr($s_item, -47);
}
show_header($GLOBALS["messages"]["actedit"] . ": /" . $s_item);
// Wordwrap (works only in IE)
?>
<script language="JavaScript1.2" type="text/javascript">
<!--
function chwrap() {
if(document.editfrm.wrap.checked) {
document.editfrm.code.wrap="soft";
} else {
document.editfrm.code.wrap="off";
}
}
// -->
</script>
<script language="Javascript" type="text/javascript">
// initialisation
editAreaLoader.init({
id: "txtedit" // id of the textarea to transform
,start_highlight: true // if start with highlight
,allow_resize: "both"
//,min_width = 400
//,min_height = 100
//,allow_resize: "y"
,allow_toggle: true
,word_wrap: true
,language: "<?php
echo $GLOBALS["language"];
?>
"
,syntax: "<?php
echo get_mime_type($dir, $item, "ext");
?>
"
});
</script>
<?php
// Form
echo "<BR><FORM name=\"editfrm\" method=\"post\" action=\"" . make_link("edit", $dir, $item) . "\">\n";
echo "<input type=\"hidden\" name=\"dosave\" value=\"yes\">\n";
echo "<TEXTAREA NAME=\"code\" ID=\"txtedit\" rows=\"25\" cols=\"120\" wrap=\"off\">";
// Show File In TextArea
$buffer = "";
while (!feof($fp)) {
$buffer .= fgets($fp, 4096);
}
@fclose($fp);
//echo htmlspecialchars($buffer);
echo $buffer;
echo "</TEXTAREA><BR>\n<TABLE><TR><TD>Wordwrap: (IE only)</TD><TD><INPUT type=\"checkbox\" name=\"wrap\" ";
echo "onClick=\"javascript:chwrap();\" value=\"1\"></TD></TR></TABLE><BR>\n";
echo "<TABLE><TR><TD><INPUT type=\"text\" name=\"fname\" value=\"" . $item . "\"></TD>";
echo "<TD><input type=\"submit\" value=\"" . $GLOBALS["messages"]["btnsave"];
echo "\"></TD>\n<TD><input type=\"reset\" value=\"" . $GLOBALS["messages"]["btnreset"] . "\"></TD>\n<TD>";
echo "<input type=\"button\" value=\"" . $GLOBALS["messages"]["btnclose"] . "\" onClick=\"javascript:location='";
echo make_link("list", $dir, NULL) . "';\"></TD></TR></FORM></TABLE><BR>\n";
?>
<script language="JavaScript1.2" type="text/javascript">
<!--
if(document.editfrm) document.editfrm.code.focus();
// -->
</script><?php
}
示例5: set_time_limit
<?php
require "../../require/function.php";
require "../../require/back_include.php";
$_GET["nomobj"] = "listmontant[]";
set_time_limit(3600);
$sql = "select * from " . __racinebd__ . "newsletterline where newsletterline_id=" . ($_GET["id"] == "" ? $_POST["newsletterline_id"] : $_GET["id"]);
$link = query($sql);
$tbl_info = fetch($link);
if ($_POST["save"] == "yes") {
if ($_FILES["ext"]["tmp_name"] != "") {
$myext = savefile("ext", __racinebd__ . "newsletterline", $_POST["newsletterline_id"]);
$myext = ",ext='" . getext($_FILES["ext"]["name"]) . "'";
}
//sauvegarde en base
$sql = "update " . __racinebd__ . "newsletterline \r\n set titre='" . addquote($_POST["titre"]) . "',\r\n contenu='" . str_replace(",", ".", addquote($_POST["contenu"])) . "',\r\n lien='" . str_replace(",", ".", addquote($_POST["lien"])) . "'\r\n {$myext}\r\n where newsletterline_id=" . $_POST["newsletterline_id"];
$link = query($sql);
?>
<script>
alert("Modifications prises en compte");
if(top.listidmontantiframelist.contentWindow)
top.listidmontantiframelist.contentWindow.location.href=top.listidmontantiframelist.contentWindow.location.href.replace('mode=','');
else
top.listidmontantiframelist.location.href=top.listidmontantiframelist.location.href.replace('mode=','');
window.location="insertfile.php?nomobj=listontant[]&id=<?php
echo $tbl_info["newsletter_id"];
?>
";
</script>
示例6: exec
echo "res={ sabai: false, msg: 'OpenVPN file missing.' };";
break;
}
case "stop":
$line = exec("sh /www/bin/ovpn.sh {$act} 2>&1", $out);
$i = count($out) - 1;
while (substr($line, 0, 3) != "res" && $i >= 0) {
$line = $out[$i--];
}
file_put_contents("/etc/sabai/stat/php.ovpn.log", implode("\n", $out));
echo $line;
break;
case "clear":
exec("sh /www/bin/ovpn.sh clear 2>&1");
echo "res={ sabai: true, msg: 'OpenVPN file removed.', reload: true };";
break;
case "newfile":
newfile();
break;
case "save":
savefile();
break;
case "log":
exec("/www/bin/ovpn.sh log");
echo file_exists("/var/log/ovpn_web.log") ? str_replace(array("\"", "\r"), array("'", "\n"), file_get_contents("/var/log/ovpn_web.log")) : "No log.";
break;
case "check":
$line = exec("sh /www/bin/ovpn.sh {$act}");
echo $line;
break;
}
示例7: uploadfile
function uploadfile($field, $intro = "", $SaveDir = "", $SaveFileName = "", $type = "upload")
{
global $iCMS;
$UploadDir = $iCMS->config['uploadfiledir'] . "/";
$RelativePath = $iCMS->dir . $UploadDir;
//相对路径
$RootPath = iPATH . $UploadDir;
//绝对路径
if ($_FILES[$field]['name']) {
$tmp_name = $_FILES[$field]['tmp_name'];
!is_uploaded_file($tmp_name) && exit("What are you doing?");
if ($_FILES[$field]['error'] > 0) {
switch ((int) $_FILES[$field]['error']) {
case UPLOAD_ERR_NO_FILE:
@unlink($tmp_name);
alert('请选择上传文件!');
return false;
break;
case UPLOAD_ERR_FORM_SIZE:
@unlink($tmp_name);
alert('上传的文件超过大小!');
return false;
break;
}
return false;
}
$_FileSize = @filesize($tmp_name);
//文件类型
preg_match("/\\.([a-zA-Z0-9]{2,4})\$/", $_FILES[$field]['name'], $exts);
$FileExt = strtolower($exts[1]);
//ļʽ
CheckValidExt($FileExt);
//判断文件类型
//过滤文件;
strstr($FileExt, 'ph') && ($FileExt = "phpfile");
in_array($FileExt, array('cer', 'htr', 'cdx', 'asa', 'asp', 'jsp', 'aspx', 'cgi')) && ($FileExt .= "file");
$FileNameTmp = get_date('', "YmdHis") . rand(1, 999999);
empty($SaveFileName) && ($SaveFileName = $FileNameTmp . "." . $FileExt);
$oFileName = $_FILES[$field]['name'];
// 文件保存目录方式
$_CreateDir = "";
if (empty($SaveDir)) {
if ($iCMS->config['savedir']) {
$_CreateDir = str_replace(array('Y', 'y', 'm', 'n', 'd', 'j', 'EXT'), array(get_date('', 'Y'), get_date('', 'y'), get_date('', 'm'), get_date('', 'n'), get_date('', 'd'), get_date('', 'j'), $FileExt), $iCMS->config['savedir']) . "/";
}
} else {
$_CreateDir = $SaveDir . "/";
}
// $UploadDir = $UploadDir.$_CreateDir;
$RelativePath = $RelativePath . $_CreateDir;
$RootPath = $RootPath . $_CreateDir;
//创建目录
createdir($RootPath);
//文件名
// $sFileName = $UploadDir.$SaveFileName;
$RelativePath_FileName = $RelativePath . $SaveFileName;
$RootPath_FileName = $RootPath . $SaveFileName;
savefile($tmp_name, $RootPath_FileName);
if (in_array($FileExt, array('gif', 'jpg', 'jpeg', 'png'))) {
if ($iCMS->config['isthumb'] && ($iCMS->config['thumbwidth'] || $iCMS->config['thumbhight'])) {
$Thumb = MakeThumbnail($RootPath, $RootPath_FileName, $FileNameTmp);
!empty($Thumb['src']) && imageWaterMark($Thumb['src']);
}
imageWaterMark($RootPath . $SaveFileName);
}
$RelativePath_FileName = getfilepath($RelativePath_FileName, '', '-');
// 写入数据库
if ($type == "upload") {
$iCMS->db->query("INSERT INTO `#iCMS@__file` (`filename`,`ofilename`,`path`,`intro`,`ext`,`size`,`time`,`type`) VALUES ('{$SaveFileName}', '{$oFileName}', '{$RelativePath_FileName}','{$intro}', '{$FileExt}', '{$_FileSize}', '" . time() . "', 'upload') ");
}
$_File = array('fid' => $iCMS->db->insert_id, 'FilePath' => $RelativePath_FileName, 'OriginalFileName' => $oFileName, 'FileName' => $SaveFileName);
return $_File;
} else {
return;
}
}
示例8: dosomething
function dosomething($bestand, $host, $actie)
{
if (!empty($bestand) && !empty($host) && !empty($actie)) {
# this function should be called per item on a foreach loop.
switch ($actie) {
case 'shortstat':
savefile($host, $bestand);
$parsed_host = parse_url($host, PHP_URL_HOST);
shortstat($bestand, $parsed_host);
break;
case 'historystat':
echo "<table>";
savefile($host, $bestand);
$parsed_host = parse_url($host, PHP_URL_HOST);
historystat($bestand, $parsed_host);
echo "</table>";
break;
}
}
}
示例9: savefile
<?php
require "avssinit.php";
if (!$authstatus) {
echo "not logged in";
exit;
}
savefile($path, $file);
示例10: savefile
if ($_FILES["ext"]["tmp_name"] != "") {
$myext = savefile("ext", $table, $id);
tbl_img($table, $id, getext($_FILES["ext"]["name"]), 16, 10);
}
//mise a niveau de la table contenu, pour les traduction des noeuds
$sql = "select * from " . __racinebd__ . "contenu where langue_id=" . __defaultlangueid__;
$link = query($sql);
while ($tbl_result = fetch($link)) {
$sql = "insert into " . __racinebd__ . "contenu (arbre_id,langue_id,nom,translate) values (" . $tbl_result["arbre_id"] . "," . $id . ",'" . $tbl_result["nom"] . "',0)";
query($sql);
}
$szQuery = "";
break;
case "modif":
if ($_FILES["ext"]["tmp_name"] != "" && $_POST["ext_chk"] != 1) {
$myext = savefile("ext", $table);
tbl_img($table, $_GET["id"], getext($_FILES["ext"]["name"]), 16, 10);
} else {
if ($_POST["ext_chk"] == 1) {
$myext = ",ext=null ";
}
}
$txtmsg = "La langue a été modifiée";
$szQuery = "update {$table} set \r\n\t\t\t\t\tlibelle='" . addquote($_POST["libelle"]) . "',\r\n\t\t\t\t\tshortlib='" . addquote($_POST["shortlib"]) . "',\r\n\t\t\t\t\tactive='" . addquote($_POST["active"]) . "'\r\n\t\t\t\t\t{$myext}\r\n where {$tablekey}=" . $_GET["id"];
break;
}
require "../../include/template_save.php";
} else {
$szQuery = "SELECT * FROM {$table} where {$tablekey}=" . $_GET["id"];
//libelle=>nom du champ|type|obligatoire|taille (facultatif)
//les type sont les suivant
示例11: query
$link = query($sql);
$tbl = fetch($link);
if ($_FILES["ext"]["tmp_name"] != "") {
$myext = "'" . getext($_FILES["ext"]["name"]) . "'";
} else {
if ($_POST["ext"] != "") {
$myext = "'" . $_POST["ext"] . "'";
} else {
$myext = "null";
}
}
$sql = "insert into " . __racinebd__ . "newsletterline (newsletter_id,titre,contenu,ordre,ext,lien) \r\n value('" . addquote($_GET["id"]) . "','" . addquote($_POST["titre"]) . "','" . str_replace(",", ".", addquote($_POST["contenu"])) . "','" . ($tbl["maxordre"] + 1) . "',{$myext},'" . addquote($_POST["lien"]) . "')";
$link = query($sql);
$mmontant_id = insert_id();
if ($_FILES["ext"]["tmp_name"] != "") {
savefile("ext", __racinebd__ . "newsletterline", $mmontant_id);
}
?>
<script>
//rafraichissement de la liste
//alert(top.listidmontantiframelist.location)
if(top.listidmontantiframelist.contentWindow)
top.listidmontantiframelist.contentWindow.location.href=top.listidmontantiframelist.contentWindow.location.href.replace('mode=','');
else
top.listidmontantiframelist.location.href=top.listidmontantiframelist.location.href.replace('mode=','');
</script>
<?php
}
?>
<html>
示例12: COUNT
$sql_zcard = "SELECT COUNT(t1.mTransactionID) as qty,SUM(t1.cardvalue) as revenue_gross,SUM(t1.cardvalue) as revenue_net FROM {$table_zcard} t1 WHERE t1.verify = '1' AND t1.gameID = '{$gameID}' ";
$row_zcard = runSQL($sql_zcard);
$sql_mcard = "SELECT COUNT(t1.mTransactionID) as qty,SUM(t1.grossAmount) as revenue_gross,SUM(t1.netAmount) as revenue_net FROM {$table_mcard} t1 WHERE t1.groupResponseCode = '1' AND t1.gameID = '{$gameID}' ";
$row_mcard = runSQL($sql_mcard);
$sql_sms = "SELECT COUNT(t1.requestid) as qty,SUM(t1.money) as revenue_gross,SUM(t1.net_money) as revenue_net FROM {$table_sms} t1 \n ";
$row_sms = runSQL_sms($sql_sms, $database_name);
$list['atm'] = $row_atm;
$list['zcard'] = $row_zcard;
$list['mcard'] = $row_mcard;
$list['sms'] = $row_sms;
// $result = json_encode($list);
// savefile($result, $name_file_log);
return $list;
}
// $min = $argv[1];
$time = time() - 86400;
$name_file_log = date("Ymd", $time);
$date_to = date("Y-m-d", $time);
$game_id = array("FH", "SGMB", "FARM", "MPCOTUONG", "CARO", "MPPOKER", "MPTALA", "MPBINH", "MPTIENLEN", "MPXITO", "ZINZIN", "THOILOAN", "LM", "10HA7", "CANDYRUN", "VLMB", "ZB", "CUUTOC", "FARMWEB", "WC2014", "ICA");
$re = array();
foreach ($game_id as $value) {
$re[$value] = getRevenue($date_to, $value);
}
$re = json_encode($re);
savefile($re, $name_file_log);
die;
// for ($i = 1; $i <= 30; $i++) {
// $date_to = "2015-06-" . sprintf("%02d", $i);
// $name_file_log = "201506" . sprintf("%02d", $i); ;
// getRevenue($date_to,$name_file_log);
// }
示例13: preg_replace
//creation du repertoire tmp
//@mkdir ($_SERVER["DOCUMENT_ROOT"].__uploaddir__."u".$_SESSION['users_id'], 0775);
//deplacement du fichier
//move_uploaded_file($_FILES[ext]["tmp_name"],$_SERVER["DOCUMENT_ROOT"].__uploaddir__."u".$_SESSION['users_id']."/".$_FILES["ext"]["name"]);
//$filename=preg_replace('/[^a-z0-9_\-\.]/i', '_', $_FILES["ext"]["name"]);
$filename = preg_replace('/[^a-z0-9_\\-\\.]/i', '_', $_FILES["ext"]["name"]);
$filename = makename($_FILES["ext"]["name"]);
//if(move_uploaded_file($_FILES["ext"]["tmp_name"],$_SERVER["DOCUMENT_ROOT"].__uploaddir__."u".$_SESSION['users_id']."/".$filename)===false){
//sauvegarde en base
$ext = getext($_FILES["ext"]["name"]);
//$sql="insert into ".__racinebd__."fichiers (titre,abstract,ext,nom_fichier,contenu) value('".addquote($_POST["titre_fichier"])."','".addquote($_POST["description_fichier"])."','".$ext."','".$filename."','".$contenu."')";
$sql = "insert into " . __racinebd__ . "fichiers (titre,abstract,ext,nom_fichier) value('" . addquote($_POST["titre_fichier"]) . "','" . addquote($_POST["description_fichier"]) . "','" . $ext . "','" . addquote($filename) . "')";
//print $sql;
$link = query($sql);
$fichiers_id = insert_id();
savefile("ext", __racinebd__ . "fichiers", $fichiers_id);
//print $_SERVER["DOCUMENT_ROOT"].__uploaddir__.__racinebd__."fichiers".$fichiers_id.".".$ext;
if (PHANTOM_FULLTEXT == true) {
$contenu = addslashes(extract2tmpfile($ext, $_SERVER["DOCUMENT_ROOT"] . __uploaddir__ . __racinebd__ . "fichiers" . $fichiers_id . "." . $ext));
}
if ($contenu == '') {
$contenu = addquote($_POST["description_fichier"]);
}
$sql = "update " . __racinebd__ . "fichiers set contenu='" . $contenu . "' where fichiers_id=" . $fichiers_id;
query($sql);
?>
<script>
content='<table width="100%" style="border-bottom:1px solid black" id="table_fichier_<?php
echo $fichiers_id;
?>
">';
示例14: savefile
$myext2 = savefile("iconsecure", $table . "2_", $id);
tbl_img($table . "2_", $id, getext($_FILES["iconsecure"]["name"]), 18, 18);
}
$szQuery = "";
break;
case "modif":
if ($_FILES["iconnormal"]["tmp_name"] != "" && $_POST["iconnormal_chk"] != 1) {
$myext = savefile("iconnormal", $table);
tbl_img($table, $_GET["id"], getext($_FILES["iconnormal"]["name"]), 18, 18);
} else {
if ($_POST["iconnormal_chk"] == 1) {
$myext = ",iconnormal=null ";
}
}
if ($_FILES["iconsecure"]["tmp_name"] != "" && $_POST["iconsecure_chk"] != 1) {
$myext2 = savefile("iconsecure", $table . "2_");
tbl_img($table . "2_", $_GET["id"], getext($_FILES["iconsecure"]["name"]), 18, 18);
} else {
if ($_POST["iconsecure_chk"] == 1) {
$myext2 = ",iconsecure=null ";
}
}
$txtmsg = $trad["Le gabarit a été modifié"];
$szQuery = "update {$table} set \r\n\t\t\t\t\tlibelle='" . addquote($_POST["libelle"]) . "',\r\n\t\t\t\t\ttable_nom='" . addquote($_POST["table_nom"]) . "',\r\n\t\t\t\t\tnom_fichier='" . addquote($_POST["nom_fichier"]) . "',\r\n\t\t\t\t\tsitemap='" . addquote($_POST["sitemap"]) . "',\r\n\t\t\t\t\tsearch='" . addquote($_POST["search"]) . "',\r\n\t\t\t\t\trss='" . addquote($_POST["rss"]) . "'\r\n\t\t\t\t\t{$myext}\r\n\t\t\t\t\t{$myext2} \r\n where {$tablekey}=" . $_GET["id"];
break;
}
require "../../include/template_save.php";
} else {
$szQuery = "SELECT * FROM {$table} where {$tablekey}=" . $_GET["id"];
//libelle=>nom du champ|type|obligatoire|taille (facultatif)
//les type sont les suivant
示例15: autoDeleted
/**
* autoDeleted()
* Automatic remove images if they have not be viewed for some time
*/
function autoDeleted()
{
global $settings;
// check auto remove image is on
if (!check_set('SET_AUTO_DELETED')) {
return;
}
// make file name
$checkfor = CFDATAPATH . 'ad' . date($settings['SET_AUTO_DELETED_JUMP']);
// check to see if it's been run for this time period
if (is_file($checkfor)) {
return;
}
// get image index
$db_img = imageList(0, 'all');
// check image index for images
if (empty($db_img) || count($db_img) < 1) {
return;
}
$delete_time = time() - $settings['SET_AUTO_DELETED_TIME'] * 86400;
// check when image was last viewed
foreach ($db_img as $k => $image) {
// check to see if the image has been uploaded for long then the period
if ($delete_time > $image['added']) {
// image viewed db address
$img_view_db = CFBANDWIDTHPATH . $image['id'] . '_imgbw.db';
// check to see if there is a images viewed db file
if (is_file($img_view_db)) {
// read files last modified date (as this is most likely the last viewed date)
if ($last_modified = filemtime($img_view_db)) {
// check to see if it has not been view for the period
if ($delete_time > $last_modified) {
$delete_id[$image['id']] = array('deleteid' => $image['deleteid']);
// add image to remove array
}
} else {
$db_count = db_imageCounterList(null, $image['id']);
if (isset($db_count['date'])) {
if ($delete_time > $db_count['date']) {
$delete_id[$image['id']] = array('deleteid' => $image['deleteid']);
// add image to remove array
}
}
}
} else {
$delete_id[$image['id']] = array('deleteid' => $image['deleteid']);
// add image to remove array
}
}
}
//remove images
if (!empty($delete_id)) {
foreach ($delete_id as $k => $image) {
removeImage($image['deleteid']);
}
}
// remove image removed meg
$Suc = array();
// make lasted checked file
if (savefile(array(), CFDATAPATH . 'ad' . date($settings['SET_AUTO_DELETED_JUMP']))) {
// check for old file
if (is_file(CFDATAPATH . 'ad' . (date($settings['SET_AUTO_DELETED_JUMP']) - 1))) {
// remove old file if found
@unlink(CFDATAPATH . 'ad' . (date($settings['SET_AUTO_DELETED_JUMP']) - 1));
}
}
}