本文整理汇总了PHP中delfile函数的典型用法代码示例。如果您正苦于以下问题:PHP delfile函数的具体用法?PHP delfile怎么用?PHP delfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delfile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: supppage
function supppage($idpage)
{
delfile($idpage);
global $db;
if (!$db->Query("delete from contenu where id=" . $idpage)) {
$db->Kill('Error1');
}
return true;
}
示例2: suppnews
function suppnews($idalbum)
{
delfile($idalbum);
global $db;
if (!$db->Query("delete from album where id=" . $idalbum)) {
$db->Kill('Error1');
return false;
} else {
return true;
}
}
示例3: suppevent
function suppevent($idevent)
{
delfile($idevent);
global $db;
if (!$db->Query("delete from event where id=" . $idevent)) {
$db->Kill('Error1');
return false;
} else {
return true;
}
}
示例4: suppnews
function suppnews($iddoc)
{
delfile($iddoc);
global $db;
if (!$db->Query("delete from document where id=" . $iddoc)) {
$db->Kill('Error1');
return false;
} else {
return true;
}
}
示例5: supppage
function supppage($idpage)
{
delfile($idpage);
global $db;
$parent = $db->QuerySingleValue("SELECT parent from page where id=" . $idpage);
$sqlparen = "select id from page where parent=" . $parent;
if (!$db->Query("delete from page where id=" . $idpage)) {
$db->Kill('Error1');
}
if ($parent != "") {
if (!$db->Query($sqlparen)) {
$db->Kill("");
}
if ($db->RowCount() == 0) {
if (!$db->Query("update page set app = NULL where id=" . $parent)) {
$db->Kill('Error1');
}
}
}
return true;
}
示例6: file
echo 'Kategorie erfolgreich editiert!';
}
#########################################
#########################################
# Kategorie löschen #
#########################################
if ($_GET['go'] == 'delete') {
$zeile = file($catfile);
$zeilen = sizeof($zeile);
for ($i = 0; $i < $zeilen; $i++) {
$eintrag = explode('§', $zeile[$i]);
if ($eintrag[0] == $_GET['catid']) {
if ($eintrag[2] != '') {
// Alte Datei löschen
$file = $dir . $eintrag[2];
if (delfile($file) == 0) {
echo 'Alte Datei konnte nicht gelöscht werden!';
}
}
$zeilen--;
for ($j = $i; $j < $zeilen; $j++) {
$zeile[$j] = $zeile[$j + 1];
}
}
}
$fp = fopen($catfile, "w+");
flock($fp, 2);
for ($i = 0; $i < $zeilen; $i++) {
fwrite($fp, $zeile[$i]);
}
flock($fp, 3);
示例7: db_exec
$lastid = $dbh->lastInsertId();
$newid = $lastid;
echo "<script>document.location='{$scriptname}?action=edititem&id={$newid}'</script>";
echo "<a href='{$scriptname}?action=edititem&id={$newid}'>Go here</a></body></html>";
exit;
}
/* delete associated file */
if (isset($_GET['delfid'])) {
/* displayed from showfiles() */
//remove file link
$sql = "DELETE from item2file where itemid={$id} AND fileid=" . $_GET['delfid'];
$sth = db_exec($dbh, $sql);
//check if others point to this file
$nlinks = countfileidlinks($_GET['delfid'], $dbh);
if ($nlinks == 0) {
delfile($_GET['delfid'], $dbh);
}
//echo "$nlinks DELETED ".$_GET['delfid'];
echo "<script>window.location='{$scriptname}?action={$action}&id={$id}'</script> ";
echo "<br><a href='{$scriptname}?action={$action}&id={$id}'>Go here</a></body></html>";
exit;
}
//check for arguments
if (!isset($_GET['id'])) {
echo "edititem:missing arguments";
exit;
}
/* update item data */
//if came here from a form post, update db with new values
if (isset($_POST['itemtypeid']) && $_GET['id'] != "new" && isvalidfrm()) {
//get form post variables and create the sql query
示例8: dbex
$dbo = new dbex();
dbtarget('w', $dbServs);
$pre = get_argg('pre');
bakindata($dbo, '../docs/' . $pre . '_1.sql');
echo "<script language='javascript'> alert('{$d_langpackage->d_lead_suc}'); location.href='database.save.php'; </script>";
}
//删除备份文件
$fid = get_argg('fid');
if ($fid) {
$is_check = check_rights("g05");
if (!$is_check) {
echo $m_langpackage->m_no_pri;
exit;
}
$file_pre = $fid . "_1.sql";
delfile('../docs/' . $file_pre);
echo "{$d_langpackage->d_del_suc}";
exit;
}
function delfile($filename, $check = 1)
{
@chmod($filename, 0777);
return @unlink($filename);
}
function bakindata($dbo, $filename)
{
$sql = file($filename);
$query = '';
$num = 0;
foreach ($sql as $key => $value) {
$value = trim($value);
示例9: tminisave
function tminisave($have)
{
global $_M;
//新方法
$this->iniclass->tminisave($have);
$wap_ok = 0;
$cglist = $this->configlist;
if ($have['mobile'] == '1') {
$have['wap_skin_user'] = $have['met_skin_user'];
$have['wap_skin_css'] = $have['met_skin_css'];
$cglist = $this->mobile_configlist;
//$have['flash_10001'] = $_M['config']['flash_10001'];
$have['flash_10001'] = '1|' . $have['met_flash_10001_y'];
$wap_ok = 1;
} else {
/*备用字段*/
$preview['otherinfo']['imgurl1'] = $have['imgurl1'];
$preview['otherinfo']['imgurl2'] = $have['imgurl2'];
$query = "update {$_M[table][otherinfo]} SET ";
for ($i = 1; $i <= 10; $i++) {
$infoval = $have['info' . $i];
if (isset($have['info' . $i])) {
$query .= "info{$i} = '{$infoval}',";
}
}
$query .= "\n\t\t\t\timgurl1 = '{$have['imgurl1']}',\n\t\t\t\timgurl2 = '{$have['imgurl2']}'\n\t\t\t\twhere id='{$have['otherinfoid']}'\n\t\t\t";
DB::query($query);
load::sys_func('file');
delfile(PATH_WEB . "cache/otherinfo_{$this->lang}.inc.php");
$have['flash_10001'] = '1|' . $have['met_flash_10001_x'] . '|' . $have['met_flash_10001_y'] . '|' . $have['met_flash_10001_imgtype'];
}
$cglist[] = 'met_productTabok';
$cglist[] = 'met_productTabname';
$cglist[] = 'met_productTabname_1';
$cglist[] = 'met_productTabname_2';
$cglist[] = 'met_productTabname_3';
$cglist[] = 'met_productTabname_4';
configsave($cglist, $have, $this->lang);
/*保存系统配置*/
/*保存banner设置*/
$nowidold = array();
$bannerid = DB::get_all("select * from {$_M[table][flash]} where wap_ok='{$wap_ok}' and (module like '%,10001,%' or module = 'metinfo') and lang='{$this->lang}' and img_path!='' order by no_order ");
foreach ($bannerid as $key => $val) {
$nowidold[] = $val['id'];
}
$nowidnew = array();
$have['indexbannerlist'] = str_replace("\\", "", $have['indexbannerlist']);
$bannerlist = json_decode($have['indexbannerlist'], true);
foreach ($bannerlist as $key => $val) {
if ($val['img_path'] != '') {
if (!strstr($val['img_path'], "../")) {
$val['img_path'] = '../' . $val['img_path'];
}
if ($val['id']) {
$query = "update {$_M[table][flash]} SET \n\t\t\t\t\timg_title = '{$val['img_title']}',\n\t\t\t\t\timg_path = '{$val['img_path']}',\n\t\t\t\t\timg_link = '{$val['img_link']}',\n\t\t\t\t\tno_order = '{$key}'\n\t\t\t\t\tWHERE id = '{$val['id']}'";
$nowidnew[] = $val['id'];
} else {
$query = "INSERT INTO {$_M[table][flash]} SET \n\t\t\t\t\timg_title = '{$val['img_title']}',\n\t\t\t\t\timg_path = '{$val['img_path']}',\n\t\t\t\t\timg_link = '{$val['img_link']}',\n\t\t\t\t\tno_order = '{$key}',\n\t\t\t\t\tmodule = ',10001,',\n\t\t\t\t\twap_ok = '{$wap_ok}',\n\t\t\t\t\tlang = '{$this->lang}'";
}
DB::query($query);
}
}
$nowid = array_diff($nowidold, $nowidnew);
if ($nowid) {
foreach ($nowid as $key => $val) {
$query = "delete from {$_M[table][flash]} where id='{$val}'";
DB::query($query);
}
}
}
示例10: output_onpost_table_photosview
function output_onpost_table_photosview()
{
global $vars, $db, $main;
if (isset($_POST['id'])) {
foreach ((array) $_POST['id'] as $key => $value) {
$db->del("photos", "id = '" . $value . "'");
$uploaddir = $vars['folders']['photos'];
$filename = 'photo-' . $value . ".*";
delfile(ROOT_PATH . $uploaddir . $filename);
$filename = 'photo-' . $value . "-*.*";
delfile(ROOT_PATH . $uploaddir . $filename);
}
}
foreach ((array) array('N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW', 'PANORAMIC') as $value) {
if (isset($_FILES[$value]['tmp_name']) && $_FILES[$value]['tmp_name'] != '') {
if (@(!imagecreatefromjpeg($_FILES[$value]['tmp_name']))) {
continue;
}
$db->add("photos", array('node_id' => intval(get('node')), 'type' => 'view', 'view_point' => $value, 'info' => $_POST['info-' . $value]));
$ins_id = $db->insert_id;
$uploaddir = $vars['folders']['photos'];
$filename = 'photo-' . $ins_id . '.jpg';
$filename_s = 'photo-' . $ins_id . '-s.jpg';
if (@move_uploaded_file($_FILES[$value]['tmp_name'], ROOT_PATH . $uploaddir . $filename) === FALSE) {
$db->del("photos", "id = '" . $ins_id . "'");
log_admin_action($nodes, "#photos_node#" . get('node'), "upload_failed");
#@#
$main->message->set_fromlang("error", "upload_file_failed");
return;
}
if ($value == 'PANORAMIC') {
$image_s = resizeJPG(ROOT_PATH . $uploaddir . $filename, 600, 200);
} else {
$image_s = resizeJPG(ROOT_PATH . $uploaddir . $filename, 200, 200);
}
imagejpeg($image_s, ROOT_PATH . $uploaddir . $filename_s);
} elseif ($_POST['info-' . $value] != '') {
$db->set("photos", array('info' => $_POST['info-' . $value]), "node_id = " . intval(get('node')) . " AND view_point = '" . $value . "'");
}
}
log_admin_action($nodes, "#photos_node#" . get('node'), "update_success");
#@#
$main->message->set_fromlang('info', 'update_success', makelink("", TRUE));
}
示例11: deletefile
function deletefile($fid)
{
global $DreamCMS;
$rs = $DreamCMS->db->get_row("SELECT * FROM `#DC@__file` WHERE `id`='{$fid}' LIMIT 1");
delfile(DCPATH . $rs->path);
if ($rs->thumbpath) {
delfile(DCPATH . $rs->thumbpath);
$DreamCMS->db->query("UPDATE `#DC@__article` SET `pic`='' WHERE `pic`='{$rs->thumbpath}'");
}
$DreamCMS->db->query("UPDATE `#DC@__article` SET `pic`='' WHERE `pic`='{$rs->path}'");
$DreamCMS->db->query("DELETE FROM `#DC@__file` WHERE `id`='{$fid}' LIMIT 1");
return true;
}
示例12: deletefile
function deletefile($fid)
{
global $iCMS;
$rs = $iCMS->db->getRow("SELECT * FROM `#iCMS@__file` WHERE `id`='{$fid}' LIMIT 1");
$thumbfilepath = gethumb($rs->path, '', '', true, true);
delfile(iPATH . $rs->path, false);
echo $rs->path . ' 文件删除…<span style="color:green;">√</span><br />';
if ($thumbfilepath) {
foreach ($thumbfilepath as $wh => $fp) {
delfile($fp, false);
echo '缩略图 ' . $wh . ' 文件删除…<span style="color:green;">√</span><br />';
}
}
$iCMS->db->query("UPDATE `#iCMS@__article` SET `pic`='' WHERE `pic`='{$rs->path}'");
$iCMS->db->query("DELETE FROM `#iCMS@__file` WHERE `id`='{$fid}' LIMIT 1");
return true;
}
示例13: explode
$tmp_name = $_FILES['face']['tmp_name'];
$tmp_file_name_arr = explode('.', $filename);
$new_file_name = $tmp_file_name_arr[0] . '_' . time() . '.' . $tmp_file_name_arr[1];
if (file_exists($_FILES['face']['tmp_name'])) {
savefile($tmp_name, $new_file_name);
} else {
$result = array('status' => -1, 'msg' => '上传图片失败');
echo json_encode($result);
return;
}
$url = $host_sae . $new_file_name;
$result = array('status' => 1, 'msg' => 'ok', 'info' => array('url' => $url));
$r = detect($url);
if ($r['status'] == 1) {
if (empty($r['output']['face'])) {
delfile($new_file_name);
$result = array('status' => -2, 'msg' => '上传的图片没有脸呀,亲');
echo json_encode($result);
return;
}
$college_id = charge($r['output']);
$result['info']['college'] = array('id' => $college_id, 'name' => $college[$college_id]);
$result['info']['face'] = $r['output']['face'];
}
echo json_encode($result);
return;
}
function detect($url)
{
if (!$url) {
return array('status' => -1);
示例14: deldir
/**
* 删除文件夹
* @param string $fileDir 要删除的文件夹
* @param int $type 0:删除本文件夹及文件夹下文件,1:只删除本文件夹下的文件。默认都删除
* @return boolean 删除成功返回true,否则返回false
*/
function deldir($fileDir, $type = 0)
{
$fileDir = path_absolute($fileDir);
@clearstatcache();
$fileDir = substr($fileDir, -1) == '/' ? $fileDir : $fileDir . '/';
if (!is_dir($fileDir)) {
return false;
}
$resource = opendir($fileDir);
@clearstatcache();
while (($file = readdir($resource)) !== false) {
if ($file == '.' || $file == '..') {
continue;
}
if (!is_dir($fileDir . $file)) {
delfile($fileDir . $file);
} else {
deldir($fileDir . $file);
}
}
closedir($resource);
@clearstatcache();
if ($type == 0) {
rmdir($fileDir);
}
return true;
}
示例15: preg_quote
$htaccess = "RewriteEngine On\n";
$htaccess .= "RewriteBase {$iCMS->dir}\n";
$htaccess .= "# 首页\n";
$htaccess .= "RewriteRule ^index" . preg_quote($_POST['rewrite']['ext'], '/') . "\$ index.php\n";
$htaccess .= "# 独立页面、栏目、文章、评论、搜索、留言、标签\n";
if ($_POST['customlink'] == '2' && empty($_POST['rewrite']['dir'])) {
if ($_POST['linkmode'] == 'id') {
$htaccess .= "RewriteRule ^(list|show){$preg_quote_split}(.*)\$ \$1.php?id{$preg_quote_split}\$2\n";
} elseif ($_POST['linkmode'] == 'title') {
$htaccess .= "RewriteRule ^(list|show){$preg_quote_split}(.*)\$ \$1.php?t{$preg_quote_split}\$2\n";
}
$htaccess .= "RewriteRule ^index{$preg_quote_split}page{$preg_quote_split}(.*)" . preg_quote($_POST['rewrite']['ext'], '/') . "\$ index.php?page{$preg_quote_split}\$1" . preg_quote($_POST['rewrite']['ext'], '/') . "\n";
$htaccess .= "RewriteRule ^index{$preg_quote_split}(.*)" . preg_quote($_POST['rewrite']['ext'], '/') . "\$ index.php?p{$preg_quote_split}\$1" . preg_quote($_POST['rewrite']['ext'], '/') . "\n";
$htaccess .= "RewriteRule ^comment{$preg_quote_split}(.*)\$ comment.php?aid{$preg_quote_split}\$1\n";
$htaccess .= "RewriteRule ^tag{$preg_quote_split}(.*)\$ tag.php?t{$preg_quote_split}\$1\n";
$htaccess .= "RewriteRule ^search{$preg_quote_split}(.*)\$ search.php?keyword{$preg_quote_split}\$1\n";
} else {
$htaccess .= "RewriteRule ^(index|list|show|comment|search|message|tag)" . preg_quote($_POST['rewrite']['dir'], '/') . "(.*)\$ \$1.php?\$2\n";
}
writefile(iPATH . '.htaccess', $htaccess);
}
if ($_POST['ishtm'] == "1") {
delfile(iPATH . '.htaccess');
// delfile(iPATH.$config['indexname'].'.html');
}
$iCMS->clear_compiled_tpl();
redirect('配置已更新', __REF__);
}
exit;
}
include iCMS_admincp_tpl("setting");