谁能帮个忙?一个修改txt数据库字段的代码?
- <?php //输入密码后访问本页内容$password = "123";//这里是密码$p = "";if(isset($_COOKIE["isview"]) and $_COOKIE["isview"] == $password){$isview = true;}else{if(isset($_POST["pwd"])){if($_POST["pwd"] == $password){setcookie("isview",$_POST["pwd"],time()+3600*3);$isview = true;}else{$p = (empty($_POST["pwd"])) ? "需要密码才能查看,请输入密码。" : "<div ?id='+id; } }</script><script> function xiugai(ab){ if(confirm("确定要修改吗?")){ window.location='?ab='+ab; } }</script><script language=javascript> function CheckPost() { if (myform.title.value.length<2) { alert("标题不能少于2个字符"); myform.title.focus(); return false; } if (myform.name.value=="") { alert("昵称不能为空"); myform.name.focus(); return false; } if (myform.content.value.length<10) { alert("内容不能少于10个字符"); myform.content.focus(); return false; } }</script><?phpif($_GET["id"]<>''){$id = $_GET["id"];$info = file_get_contents("chongdian.txt");$column = explode("@@@",$info); unset($column[$id]);$noinfo = implode("@@@",$column); file_put_contents("chongdian.txt",$noinfo); echo "<script language=javascript>alert('删除成功!');window.location='1.php'</script>";}?><?phpif($_GET["ab"]<>''){$id = $_GET["ab"];$filename="chongdian.txt";$file = fopen($filename, "r+");// 修改文件内容,将"Hello World"替换为"Hello PHP" $file_contents = file_get_contents($filename);$file_contents = str_replace($message[3], "123", $file_contents);fwrite($file, $file_contents); echo "<script language=javascript>alert('修改成功!');window.location='1.php'</script>";}?><body><form name="myform" method="post" onsubmit="return CheckPost()" action=""><table width="550" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#B3B3B3"> <tr> <td height="25" align="center" bgcolor="#EBEBEB"><a href="1.php">查看信息</a> | <a href="1.php?tj=add">赞助充值登记</a></td> </tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="5"></td> </tr></table><table width="550" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#B3B3B3"><tr><th width="60" bgcolor="#EBEBEB">是否处理</th><th width="76" bgcolor="#EBEBEB">姓名</th><th width="77" bgcolor="#EBEBEB">电话</th><th width="133" bgcolor="#EBEBEB">内容</th><th width="78" bgcolor="#EBEBEB">操作</th><th width="78" bgcolor="#EBEBEB">修改</th></tr><?php$info = file_get_contents("chongdian.txt");$info = rtrim($info,"@");if(strlen($info)>10){$column = explode("@@@",$info);foreach($column as $keys=>$values){$message = explode("%%",$values);?><tr><td align="center" bgcolor="#FFFFFF"></th> <?php echo $message[4];?><td align="center" bgcolor="#FFFFFF"><?php echo $message[0];?> </th></td><td align="center" bgcolor="#FFFFFF"><?php echo $message[3];?></th><td align="center" bgcolor="#FFFFFF"><?php echo $message[1];?> </th><td align="center" bgcolor="#FFFFFF"><?php echo "<a href='javascript:del({$keys})'>删除</a>"; ?><td align="center" bgcolor="#FFFFFF"><?php echo "<a href='1.php?ab=xiugai'>修改</a>";?></tr><?php }}?></table><?php if($_GET["tj"] == add){?><?phpif($_POST[submit]){$title = $_POST["title"];$name = $_POST["content"];$face = $_POST["face"];$content = $_POST["name"];$addtime = "未处理";$insert = "{$title}%%{$name}%%{$face}%%{$content}%%{$addtime}@@@";$content = file_get_contents("chongdian.txt"); file_put_contents("chongdian.txt",$content.$insert); echo "<script language=javascript>alert('留言成功!');window.location='1.php'</script>"; }?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="5"></td> </tr> </table> <table width="550" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#B3B3B3" brder="1"><tr> <td width="95" align="center" bgcolor="#FFFFFF"><div align="center"> 姓名:</div></td> <td width="432" bgcolor="#FFFFFF"><input type="text" name="title"/> *</td></tr><tr> <td align="center" bgcolor="#FFFFFF"><div align="center">电话:</div></td> <td bgcolor="#FFFFFF"><input name="name" type="text" id="name"/> *</td> </tr><tr> <td align="center" bgcolor="#FFFFFF"><div align="center">内容:</div></td> <td bgcolor="#FFFFFF"><input name="content" type="text" value=""> </td></tr><tr> <td colspan="2" align="center" bgcolor="#FFFFFF"> <input name="submit" type="submit"value="提交" /> <input name="reset" type="reset" value="重填"/> </td> </tr></table></form><?php }?><table width="100" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="5"></td> </tr></table><table width="550" height="20" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td align="left" bgcolor="#FFFFFF"> Copyright @<?php echo date('Y');?> <a target="_blank">Suanban</a> All Rights Reserved. Build V.01</td> </tr></table></body></html><?php }else{?><!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>后台能管1理</title><style type="text/css">body{background:none;}.passport{border:1px solid red;background-color:#FFFFCC;width:400px;height:100px;position:absolute;left:49.9%;top:49.9%;margin-left:-200px;margin-top:-55px;font-size:14px;text-align:center;line-height:30px;color:#746A6A;}</style></head><body><div class="passport"><div copycode($('code_foR'));">复制代码
我没弄成,有懂的看看代码?如何实现?https://3.suanban.cn/1.php 密码:123