·设为首页收藏本站📧邮箱修改🎁免费下载专区🔐设置/修改密码👽群雄群聊
12下一页
返回列表 发布新帖

谁能帮个忙?一个修改txt数据库字段的代码?

106 15
发表于 2024-3-25 14:59:36 | 显示全部楼层 阅读模式

马上注册,免费下载更多dz插件网资源。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
  1. <?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 style="color:#F00;">密码不正确,请重新输入。</div>";}}else{$isview = false;$p = "请输入密码查看,获取密码可联系我。";}}?><?php if($isview){?><!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>后台能管理</title><style type="text/css">body{background:none;}.passport{width:400px;position:absolute;left:50%;top:50%;margin-left:-200px;margin-top:-55px;font-size:18px;text-align:center;line-height:30px;color:red;}</style><style type="text/css"><!--body,td,th {        font-family: 宋体;        font-size: 9pt;        color: #222;}body {        margin-left: 0px;        margin-top: 0px;        margin-right: 0px;        margin-bottom: 0px;        background-color: #FFFFFF;        line-height:20px;}a:link {        color: #222;        text-decoration: none;}a:visited {        text-decoration: none;        color: #222;}a:hover {        text-decoration: underline;        color: #FF0000;}a:active {        text-decoration: none;        color: #999999;}--></style><script>    function del(id){                if(confirm("确定要删除吗?")){                        window.location='?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 style="padding-top:20px;"><form action="" method="post" style="margin:0px;">输入查看密码<input type="password" name="pwd" /> <input type="submit" value="查看" /></form><?php echo $p;?></div></div></body></html><?php }?>
复制代码
点击后面的修改,该行前面的未处理变更为已经处理

我没弄成,有懂的看看代码?如何实现?https://3.suanban.cn/1.php   密码:123
我要说一句 收起回复

评论15

拾光Lv.8 发表于 2024-3-25 15:00:04 | 显示全部楼层
帮顶,谢谢金币咯
我要说一句 收起回复
IT618发布Lv.8 发表于 2024-3-25 15:00:16 | 显示全部楼层
点击后面的修改,该行前面的未处理变更为已经处理。

我没弄成,有懂的看看代码?如何实现?https://3.suanban.cn/1.php   密码:123
我要说一句 收起回复
TyCodingLv.8 发表于 2024-3-25 15:00:55 | 显示全部楼层
帮顶,谢谢金币咯
我要说一句 收起回复
浅生Lv.8 发表于 2024-3-25 15:01:43 | 显示全部楼层
关注一下,等大神
我要说一句 收起回复
IT618发布Lv.8 发表于 2024-3-25 15:02:21 | 显示全部楼层
让给大神,这个搞不了
我要说一句 收起回复
拾光Lv.8 发表于 2024-3-25 15:02:54 | 显示全部楼层
多谢金币
我要说一句 收起回复
浅生Lv.8 发表于 2024-3-25 15:03:17 | 显示全部楼层
感谢金币啊
我要说一句 收起回复
IT618发布Lv.8 发表于 2024-3-25 15:03:42 | 显示全部楼层
感谢金币
我要说一句 收起回复
独家记忆Lv.8 发表于 2024-3-25 15:03:58 | 显示全部楼层
  1. <?php// Define the correct password$password = "123";// Check if the password is entered or stored in a cookieif (isset($_COOKIE["isview"]) && $_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 style='color:#F00;'>密码不正确,请重新输入。</div>";        }    } else {        $isview = false;        $p = "请输入密码查看,获取密码可联系我。";    }}if ($isview) {    // Display the content for authorized users?><!DOCTYPE html><html><head>    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />    <title>后台能管理</title>    <!-- Add your CSS styles and scripts here --></head><body>    <script>        function del(id) {            if (confirm("确定要删除吗?")) {                window.location = '?id=' + id;            }        }        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>    <?php    if ($_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>";    }    if ($_GET["ab"] <> '') {        $id = $_GET["ab"];        $filename = "chongdian.txt";        $file_contents = file_get_contents($filename);        $file_contents = str_replace($message[3], "已处理", $file_contents);        file_put_contents($filename, $file_contents);        echo "<script language=javascript>alert('修改成功!');window.location='1.php'</script>";    }    ?>    <form name="myform" method="post" onsubmit="return CheckPost()" action="">        <!-- Add your HTML content for managing information -->    </form></body></html><?php} else {    // Display password input form for unauthorized users?><!DOCTYPE html><html><head>    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />    <title>后台能管理</title>    <style type="text/css">        /* Add your CSS styles for the password input form */    </style></head><body>    <div class="passport">        <div style="padding-top:20px;">            <form action="" method="post" style="margin:0px;">                输入查看密码                <input type="password" name="pwd" />                <input type="submit" value="查看" />            </form>            <?php echo $p; ?>        </div>    </div></body></html><?php}?>
复制代码
我要说一句 收起回复

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图

您的IP:18.117.153.38,111.170.25.83,GMT+8, 2024-4-28 22:49 , Processed in 0.259117 second(s), 145 queries , Gzip On, Redis On.

Based on Discuz! W1.0 Licensed

© 2001-2024 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表