需求状态删除功能指南

如何解决需求状态删除功能指南

| 我需要添加删除状态功能的帮助。我需要知道我的删除按钮是否在正确的位置,以及我需要在delete.php页面中放置哪些内容,以便从数据库和用户供稿中删除用户注释。 我听说这很简单。但是我只是无法理解,这是我从未真正完成过的事情。因此,我只希望用户按下X键,然后弹出窗口以链接到delete.php,如果用户接受删除,则它将同时从流和数据库中删除该注释。 这是我的STREAMFULL.PHP
<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js\"></script>
<script type=\"text/javascript\">
                                                function show_confirm()
                                                {
                                                var r=confirm(\"are you sure you want to delete?\");
                                                if (r==true)
                                                  {
                                                  window.location=\"http://www.fightstar.org/raw/sn-extend/theme/default/delete.php\'\";
                                                  }
                                                else
                                                  {
                                                  alert(\"You pressed Cancel!\");
                                                  }
                                                }
                                                </script>\'

<style>

<?php


            while($streamitem_data = mysql_fetch_array($chant)){
                echo \"<div class=\'stream_object\'>\";
                echo \"<table style=\'word-wrap: break-word;\'><td valign=\'top\' style=\'word-wrap: break-word;padding:5px;\'>\";
                echo \"<img class=\'stream_profileimage\' style=\'border:none;padding:0px;\' src=\'\";sn_user_core::output_profile_image_url($streamitem_data[\'streamitem_creator\']);echo \"\' onerror=\'this.src=\\\"sn-admin/css/img/no_profile_img.jpeg\\\";\'><td valign=top>\";
                    $poster_name = sn_user_core::getuser($streamitem_data[\'streamitem_creator\']);
                    $target_name = sn_user_core::getuser($streamitem_data[\'streamitem_target\']);
                    $cont = stripslashes($streamitem_data[\'streamitem_content\']);

                    if(!($streamitem_data[\'streamitem_type_id\']==2)){
                    $cont = htmlentities($cont);
                    $cont = ereg_replace(\"[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]\",\"<a class=\'user_link\' href=\\\"\\\\0\\\">\\\\0</a>\",$cont);

                    }

                    if($streamitem_data[\'streamitem_creator\']==$streamitem_data[\'streamitem_target\']){
                        echo \"<a href=\'sn-profile.php?uid=\".$poster_name[\'id\'].\"\'>\" . $poster_name[\'firstname\'].\" \".$poster_name[\'lastname\'] .\"</a>\";
                    }else{
                        echo \"<a href=\'sn-profile.php?uid=\".$poster_name[\'id\'].\"\'>\" .$poster_name[\'firstname\'].\" \".$poster_name[\'lastname\'] .\" </a>  
                        >
                              <a href=\'sn-profile.php?uid=\".$target_name[\'id\'].\"\'>\" .$target_name[\'firstname\'].\" \".$target_name[\'lastname\'] .\"</a>\";
                    }

                    if($streamitem_data[\'streamitem_type_id\']==2){
                    $cont = nl2br($cont);
                    echo \"<div style=\'display:inline;\'> \".$cont.\" </div>\";
                    }else{

                        if($streamitem_data[\'streamitem_creator\']==$streamitem_data[\'streamitem_target\']){
                        $cont = nl2br($cont);
                            echo \"<div>\".$cont.\"</div>\";
                        }else{
                        $cont = nl2br($cont);
                        echo \"<div>\".$cont.\"</div>\";
                        }

                    }
                echo \"<div class=\'post_contextoptions\'>\";

                                echo \"<div class=\'stream_option\'>\".Agotime($streamitem_data[\'streamitem_timestamp\']);
                                    if(!($streamitem_data[\'streamitem_viaid\']==0)){


                    //COMMENTS

                        echo \'<a href=\"\"  onclick=\"show_confirm()\" alt=\"Delete\" title=\"Delete\" class=\"delete\">X</a>&nbsp;&nbsp;&nbsp;&nbsp;\';
            }
    

解决方法

        现在,您的脚本不会执行任何操作,但是如果用户单击确认,则将用户重定向到\'delete.php \'页面。您需要嵌入某种标识符,以显示他们单击了删除按钮的注释。这会使网址看起来像“ 1”。删除脚本将检索注释ID并执行任何操作。 就我所能达到的程度。我不会通读代码墙以弄清楚您要做什么。虽然总是欢迎显示代码,但实在太多了。将其提炼为您要尝试的代表性示例。我们需要Cliff \'s Notes版本,而不是完整的《战争与和平》。     ,        这有什么难的? 开始情况:您在数据库中有一条评论 下一个: 用户识别 用户浏览到显示我的评论页面 显示“显示我的评论”页面,例如带有评论预览的列表,该列表是可单击的并且已经与主键绑定,例如: a href = somepage?comm_id = $ res [0]> substr($ res [1],0,50)/ a 其中$ res是一个数组,其结果来自mysql,而$ res [0]是主键的值,而$ res [1]是注释的预览。 4.单击评论后,您仍然拥有它的ID,因此请在带有编辑的新页面中显示此评论,删除如下所示的任何按钮:
<form .... action=delete.php>
<input type=button name=edit value=edit>
<input type=button name=delete value=delete>
<input type=hidden name=comment_id value=$_GET[\'comm_id\']>
</form>
$ _GET [comm_id]来自上一页。 此时,您可以选择以传统方式或http请求调用delete.php 一旦您拥有delete.php,它就会变成: if(isset($ _ POST [\'delete \']))    删除($ _POST [\'comment_id \']) ...等等 删除功能就像:
...etc
$sql=\'delet...etc where `id`=\'.$_POST[\'comment_id\']
...etc 
成功时显示一些失败时页面... 当然没有安全性,这里没有给出sql攻击预防,这是您的工作。这只是一个基本情况。 您始终希望使事情尽可能地自动化,数据清理,SQL插入,查询等都为自动化事情提供了理想的基础!     ,        在您的网站上执行以下操作:
1.Echo the sql in the page(just for testing)
2.Copy the id
在mysql客户端中执行以下所有操作(heidisql是免费的)
2.Paste sql to the sql editor,click the execute button (is a blue one)
5.after you make the sql working 100% check results
6.1 A result is returned then ok leave the client
6.2 A result is not returned you can view the data of the  table (click data tab) copy an existing value paste it to the sql editor and now the query must return this record
通过这种方式,您可以知道应该关注的地方或问题所在: -查询 -错误的ID 等等 通常,当仍在开发中时,通常需要回显sql并直接从客户端运行它。成功的调试通常需要单独隔离和测试事物。在php中,最常用的调试工具是以下各项的组合:
print_r [you see the structure of sth]
var_dump [in addition show type of,int,str etc]
echo [if hello is echoed this means the code reaches at certain point]
if(true){echo \'hello\';} [if hello is echoed then the condition inside if was the problem]
echo \'hello\'; exit; [you don\'t care for the rest you want to check up to hello]
die(\'hello\') [fast way for echo \'string\';exit; die does not work well with int die(332)]
注意:采取一些基本的顺序措施。 1.任何登录的用户都可以在更改url上的ID的同时删除某人的其他注释,因此在删除注释之前,请确保至少要删除的注释与登录的用户匹配,例如伪代码: 如果存在行,其中注释id =登录用户ID,则返回true,否则返回false 如果为true,则删除;如果为false,则不删除 2.尽可能采用PDO方式,如果使用得当,可以帮助进行sql注入攻击。 3.可以在可能的情况下使用post,如果您搜索有关php安全的信息,则有很多可用的方法。     

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-
参考1 参考2 解决方案 # 点击安装源 协议选择 http:// 路径填写 mirrors.aliyun.com/centos/8.3.2011/BaseOS/x86_64/os URL类型 软件库URL 其他路径 # 版本 7 mirrors.aliyun.com/centos/7/os/x86
报错1 [root@slave1 data_mocker]# kafka-console-consumer.sh --bootstrap-server slave1:9092 --topic topic_db [2023-12-19 18:31:12,770] WARN [Consumer clie
错误1 # 重写数据 hive (edu)&gt; insert overwrite table dwd_trade_cart_add_inc &gt; select data.id, &gt; data.user_id, &gt; data.course_id, &gt; date_format(
错误1 hive (edu)&gt; insert into huanhuan values(1,&#39;haoge&#39;); Query ID = root_20240110071417_fe1517ad-3607-41f4-bdcf-d00b98ac443e Total jobs = 1
报错1:执行到如下就不执行了,没有显示Successfully registered new MBean. [root@slave1 bin]# /usr/local/software/flume-1.9.0/bin/flume-ng agent -n a1 -c /usr/local/softwa
虚拟及没有启动任何服务器查看jps会显示jps,如果没有显示任何东西 [root@slave2 ~]# jps 9647 Jps 解决方案 # 进入/tmp查看 [root@slave1 dfs]# cd /tmp [root@slave1 tmp]# ll 总用量 48 drwxr-xr-x. 2
报错1 hive&gt; show databases; OK Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object Time taken: 0.474 se
报错1 [root@localhost ~]# vim -bash: vim: 未找到命令 安装vim yum -y install vim* # 查看是否安装成功 [root@hadoop01 hadoop]# rpm -qa |grep vim vim-X11-7.4.629-8.el7_9.x
修改hadoop配置 vi /usr/local/software/hadoop-2.9.2/etc/hadoop/yarn-site.xml # 添加如下 &lt;configuration&gt; &lt;property&gt; &lt;name&gt;yarn.nodemanager.res