search
HomeBackend DevelopmentPHP Tutorial求教,关于php写留言板代码

本人刚开始学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 }?>


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

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

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

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


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

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

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

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

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



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

收到了,谢谢啊

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

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

Statement
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
How to make PHP applications fasterHow to make PHP applications fasterMay 12, 2025 am 12:12 AM

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

PHP Performance Optimization Checklist: Improve Speed NowPHP Performance Optimization Checklist: Improve Speed NowMay 12, 2025 am 12:07 AM

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

PHP Dependency Injection: Improve Code TestabilityPHP Dependency Injection: Improve Code TestabilityMay 12, 2025 am 12:03 AM

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

PHP Performance Optimization: Database Query OptimizationPHP Performance Optimization: Database Query OptimizationMay 12, 2025 am 12:02 AM

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi

Simple Guide: Sending Email with PHP ScriptSimple Guide: Sending Email with PHP ScriptMay 12, 2025 am 12:02 AM

PHPisusedforsendingemailsduetoitsbuilt-inmail()functionandsupportivelibrarieslikePHPMailerandSwiftMailer.1)Usethemail()functionforbasicemails,butithaslimitations.2)EmployPHPMailerforadvancedfeatureslikeHTMLemailsandattachments.3)Improvedeliverability

PHP Performance: Identifying and Fixing BottlenecksPHP Performance: Identifying and Fixing BottlenecksMay 11, 2025 am 12:13 AM

PHP performance bottlenecks can be solved through the following steps: 1) Use Xdebug or Blackfire for performance analysis to find out the problem; 2) Optimize database queries and use caches, such as APCu; 3) Use efficient functions such as array_filter to optimize array operations; 4) Configure OPcache for bytecode cache; 5) Optimize the front-end, such as reducing HTTP requests and optimizing pictures; 6) Continuously monitor and optimize performance. Through these methods, the performance of PHP applications can be significantly improved.

Dependency Injection for PHP: a quick summaryDependency Injection for PHP: a quick summaryMay 11, 2025 am 12:09 AM

DependencyInjection(DI)inPHPisadesignpatternthatmanagesandreducesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itallowspassingdependencieslikedatabaseconnectionstoclassesasparameters,facilitatingeasiertestingandscalability.

Increase PHP Performance: Caching Strategies & TechniquesIncrease PHP Performance: Caching Strategies & TechniquesMay 11, 2025 am 12:08 AM

CachingimprovesPHPperformancebystoringresultsofcomputationsorqueriesforquickretrieval,reducingserverloadandenhancingresponsetimes.Effectivestrategiesinclude:1)Opcodecaching,whichstorescompiledPHPscriptsinmemorytoskipcompilation;2)DatacachingusingMemc

See all articles

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

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.