<强>可能重复:结果   返回按钮重新提交表单数据($ _POST)

有些人建议而不是我编辑的问题把它作为,这就是为什么我在做什么太新的问题...

<?php
session_start();

if(isset($_POST['username']) && ($_POST['password'])) 
{

                $con=mysql_connect("localhost","root","");
                if(!$con)
                {
                die('Could Not Connect:'.mysql_error());
                } 

                mysql_select_db("tcs",$con);

                $usr=$_POST["username"];                 //pick username from login page
                $pwd=hash('sha1',$_POST['password']);    //pick password from login page and use hash algorithm to encrypt it

                $query="select * from employee where Username='$usr' and Password='$pwd'";  //serch that single row in which both r found
                $result=mysql_query($query,$con);


                    if ($result) 
                    {

                                $row=mysql_fetch_array($result);

                        if (($row["Username"]==$usr) && ($row["Password"]==$pwd))
                        {

                                $_SESSION['employee']['id']=$row['User Id'];
                                $_SESSION['employee']['username']=$row['Username'];
                        }       
                        else
                        {
                                echo "Login Not Successfull";
                        }
                    }   
}

else
{
echo 'Error! Username & Password were not sent!';
}

$_SESSION['user_authenticated'] = true;

?>

<html>
<body bgcolor="black">


<?php 
if($_SESSION['user_authenticated']) 
{


                                echo "<font color=red>"."<h3 align=center>"."Welcome ".$_SESSION['employee']['username']."</h3>"."</font>";
                                echo "<br />"."<a href='upload_file.php'>"."<font color='white'>"."<h4>"."Up-Load Files"."</h4>"."<font>"."</a>";
                                echo "<br />"."<br />"."<a href='list_files.php'>"."<font color='white'>"."<h4>"."List All Up-Loaded Files"."</h4>"."<font>"."</a>";

}



?>

</font>
<a  href="logout_file.php"><font color="white"><h3 align="right">Sign Out</h3></font></a>
<font color="white">

</body>
</html>

那么好吧,现在我正在point.But还有一个problem.Suppose我是具有标志out.When我签上了点击按钮的链接登入动作页面上我是重新定向到登录page.ok没有问题,但再次如果我按后退按钮我再次要求重新发送数据(甚至登出后),我再次登录行动网页上为什么如此。这是错误的yar..What做this.For所有其他网页一样,如果我的标志点击上传从出按钮 按钮 - >重定向到登录和如果我按后退按钮它显示u的退出。我不知道如何检查会话变量出境的signinaction

饰演Felix先生告诉我要检查这个 HTTP://www.thefutureoftheweb .COM /博客/获得重定向消息后后

但实际上我没有得到这个家伙是什么saying.I很抱歉,我还没有那么techanical监守我是一个begineer我知道我面临哪些问题?

据我知道

    if (count($_POST)) {             //checking how many time data is being resend.
        // process the POST data
   add_comment($_POST);        //what this function do i dont know 

   // redirect to the same page without the POST data
header("Location: ".$_SERVER['PHP_SELF']);  //i think it is like  
                                //refreshing without get input again from allpication form
        die;
    }

请,解释它,特别是,这是什么$_server(;PHP_SELF)

没有正确的解决方案

其他提示

关于$_SERVER - 见

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top