📄 delmessage_ajax.php
字号:
<?php
header( "Content-type: text/html; charset=gbk");
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
require("../login/allow.php");
?>
<?php
include ("../inc/delete.inc");
require("../inc/loaddata.inc");
/**********************/
//删除记录,本例没有验证登陆了,只是给出个已经登陆后的例子;
$del="";if(isset($_GET["del"]))$del=$_GET["del"].trim();
$id="";if(isset($_GET["id"]))$id=$_GET["id"].trim();
if( ($del != "" && $id != "") || sizeof($_POST) >0 ){
if( ($del != "" && $id != "") ) {//单行删除;
deleteMessageId($fname ,$id);
echo "<br>single<br>";
}
if( sizeof($_POST) >0 ){//多行删除;
$postlen = 0;
arsort($_POST);//arsort()把post里的值降序排列,从而从最后一个开始删起;
foreach ( $_POST as $message => $idnum){
deleteMessageId($fname ,$idnum);
$id .= "<br>". $idnum ;
echo "<br>multi<br>";
$postlen++ ;
}
}
echo "postlen . $postlen .||";
echo "deleteSuccessfully删除第<font color=red>$id</font>条记录成功...";
echo exit;
}else{
echo "参数丢失deleteFailed";exit;
}
/*
if($del != "" && $id != ""){
$fa= file($fname);
$a=0;
for($i=0;$i<count($fa);$i++){
//读取获得数组,去掉指定行,重新排序赋值给新数组;
if($i != $id)
{
$fl[$a] = $fa[$i];//;explode("\t",$fa[$i]);
$a++;
}
}
if ($fd = @fopen($fname, "w+")) {
flock($fd, LOCK_EX);
fseek($fd, 0, SEEK_END);
//将新数组写入文本;//
for($l=0;$l<count($fl);$l++){
fwrite($fd,$fl[$l]);//逐行写入;
}
echo "deleteSuccessfully删除第<font color=red>$id</font>条记录成功...";
flock($fd, LOCK_UN);
fclose($fd);
}
echo exit;
}else{
echo "参数丢失deleteFailed";exit;
}*/
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -