⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 delmessage.php

📁 无刷新技术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
require("../inc/delete.inc");//include ("delete.php");
require("../inc/loaddata.inc");
//$fname="data/LeaveMessage.txt";
$msg="";
/*
$fp=fopen($fname,"r+");
while (!feof($fp)){
$content.=fgetc($fp)."";
//$content.=fgets($fp)."<br>";
//$content.=fgetss($fp)."<br>";
}
fclose($fp);
echo $content;*/
/*
if ($fd = @fopen($fname, "r"))
 $msg= fgetss($fd,998);
if(strlen($msg)>0)
echo $msg;
*/

/**********************/

//删除记录,本例没有验证登陆了,只是给出个已经登陆后的例子;
$del="";if(isset($_GET["del"]))$del=$_GET["del"].trim();
$id="";if(isset($_GET["id"]))$id=$_GET["id"].trim();
$pageno="";if(isset($_GET["pageno"]))$pageno=$_GET["pageno"].trim();


if( ($del != "" &&  $id != "") || sizeof($_POST) >0  ){


  if( ($del != "" &&  $id != "") ) {//单行删除;
    deleteMessageId($fname ,$id);
  }

	arsort($_POST);//arsort()把post里的值降序排列,从而从最后一个开始删起;
  if( sizeof($_POST) >0 ){//多行删除;
	foreach ( $_POST as $message => $idnum){
	   deleteMessageId($fname ,$idnum); 
	   $id  .= "<br>". $idnum ;
	  }	 
  }  
  
  echo "删除第<font color=red> $id </font>条记录成功...";
       $js= "<script>".
 			 "var s=0;var set;function redirect(){s++;set=setTimeout(\"redirect()\",\"100\");if(s>=5){".
 			 "clearTimeout(set);window.location.href=\"../showall_normal.php?pageno=". $pageno."\";".
 			 "}}redirect();". 			  			 
  		 "</script>";
  echo $js;  

  
  echo exit;
 /*$url="showall_normal.php";
 header("Location:$url");
 echo "$url";*/
}else{
 echo "参数丢失";exit;
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -