您的位置:首页 > 其它

Word文档丢失的预防及数据的恢复

2007-07-16 10:48 281 查看
<form method="post" action="phpwenjian.php">
user:<input type="text" name="username"><br>
title:<input type="text" name="tit"><br>
body:<textarea name="con"></textarea><br>
<input type="submit" name="sub" value="message">

</form>
<?php

$mass="date.txt";
if(isset($_POST['sub'])){
$strmess=$_POST["username"].'<|>'.$_POST["tit"].'<|>'.$_POST["con"].'<|>'.time()."<n>";
write($mass,$strmess);
if(file_exists($mass)){
$cons=read($mass);
$cons=rtrim($cons,"<n>");
$row=explode("<n>",$cons);
foreach ($row as $value){
//list($username, $tit, $content, $time)=explode("<|>", $value);
list($username, $title, $content, $time)=explode("<|>", $value);
echo "<p>".$username.'<font color="red">'.date("Y-m-d H:i:s",$time).'</font>say:';
echo $title;
echo $content."</p><br>";
//echo $value;
}
}
}
function read($fileName){
$file=fopen($fileName,"r");
$con=fread($file,filesize($fileName));
fclose($file);
return $con;
}

function write($fileName,$mess){
$file=fopen($fileName,"a");
fwrite($file,$mess);
fclose($file);
}

?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: