Table of Contents
简单留言本    QQ:1264897620
回复讨论(解决方案)
Home Backend Development PHP Tutorial 求教,关于php写留言板代码

求教,关于php写留言板代码

Jun 23, 2016 pm 01:44 PM

本人刚开始学php,学写代码做留言板,谁帮我看一下为什么写出来的页面中没有“回复”和“删除”的选项???



session_start();
$lydb=new LyDB();

if(isset($_POST["type"])){
if($_POST["type"]=="insert"){
if(Authority::check_insert()==true){
$lydb->insert($_POST["nickname"],"style/avatar/".$_POST["avatar"],$_POST["message"]);
header("Location:indexy.php");
exit();
}
}
else if($_POST["type"]=="login"){ 
if(isset($_POST["username"]) && isset($_POST["password"])){
$dd=User::validate($_POST["username"],$_POST["password"]);
if($dd==true){
$_SESSION["username"]=$_POST["username"];
header("Location:indexy.php");
exit();
}
else{
 
}
}
}
else if($_POST["type"]=="reply"){
$id=$_POST["id"];
$reply=$_POST["reply"];
$lydb->reply($id,$reply);
header("Location:indexy.php");
exit();
}
}
else if(isset($_GET["type"])){
if($_GET["type"]=="delete"&& isset($_GET["id"])){
if(Authority::check_delete()==true){
$lydb->delete_by_id($_GET["id"]);
header("Location:indexy.php");
exit();
}
}
else if($_GET["type"]=="logout"){
session_destroy();
header("Location:indexy.php");
exit();
}
}

header("Content-Type:text/html;charset=utf-8");
?>
nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



简单留言本

<script></script>
<script></script>







        
          

          

          
                
              
                
                

          

          

          
          

          
          

           欢迎您:    
            退出 

          
          

简单留言本    QQ:1264897620


  

        
        
  


        
  


                    

                    
您的昵称:

                    



                    

    

                    
选择头像:

                    

    
                                
                                     
                                
                                     
                                
                                     
                                
                                     
                                
                              
                                

                        

                    

                    

                    
留言内容:

                    



                    

                    

                    
 

                    




                    


                


?>


            
            
            


                     $page_result=$lydb->select_page_result($_GET["pn"]);
    $result=$page_result["page_data"];
        //$result=$lydb->select_all_result();
    while($row=mysql_fetch_assoc($result)){
    ?>
                    

  •                     

                              求教,关于php写留言板代码" width="54"  style="max-width:90%"  />
                            

        

                         

                                楼  
                            
                              " class="reply_button">回复  
                              ">删除
                                
                            

                            


                            


    if(isset($row["reply"]) && trim($row["reply"])!=""){
    echo "

    ";
    echo "回复:".$row["reply"];
    echo "__".$row["retime"]."";
    echo "

    ";

    }
    ?>
                          

      

  •                 
      

  


          

           当前第页/
           共页/
           每页显示条/
           共条留言
          ">上一页 
          ">下一页 
          首页 
          ">尾页
          

  

        
        

        
        

           

 


           

@yaokun 2012 QQ:1264897620


        

        
        






  

   

  
      
      
          
    

    






回复讨论(解决方案)

太长,没认真看

<?php if(Authority::check_delete()==true){?>  <a href="<?php echo $row["id"];?>" class="reply_button">回复</a>    <a href="indexy.php?type=delete&id=<?php echo $row["id"];?>">删除</a>  <?php }?>
Copy after login


应该是Authority::check_delete()=false,所以下面没有执行,当然没有回复和删除了

为什么头像照片删了,还有显示???还有管理员登陆怎么登不进去???

管理员登陆有问题,还有就是“删除”和“回复”功能实现不了。可能是什么原因啊,是不是数据库连接有问题???

管理员登陆有问题,还有就是“删除”和“回复”功能实现不了。可能是什么原因啊,是不是数据库连接有问题???


那块有权限验证,应该是库中你当前用户没有这两个操作的权限

想在问题基本上已经解决,但还是有一个小问题。
我想把之前的头像图片换掉,我先是把之前的图片删了,然后再添加几张新的图片到之前放旧图片的文件夹中,结果还是显示之前的图片???这是怎么回事???求解!!!

缓存 !!删除了 还有 不可能吧!!!

是真的,不知道为什么?删得干干净净,回收站也清空了。。。

是真的,不知道为什么?删得干干净净,回收站也清空了。。。



不是要你清空回收站,是删除浏览器缓存。。。

收到了,谢谢啊

以上代码连接js文件的部分是不是有问题,连了跟没连一样,删除了一点反应都没有????

我也想要做个留言的,怎么做?

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1269
29
C# Tutorial
1248
24
PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Apr 17, 2025 am 12:06 AM

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values ​​to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

How does PHP type hinting work, including scalar types, return types, union types, and nullable types? How does PHP type hinting work, including scalar types, return types, union types, and nullable types? Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP vs. Python: Understanding the Differences PHP vs. Python: Understanding the Differences Apr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP and Python: Code Examples and Comparison PHP and Python: Code Examples and Comparison Apr 15, 2025 am 12:07 AM

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

See all articles