地址栏中的链接返回到php浏览器的php文件夹

时间:2016-01-20 03:58:19

标签: php mysql

我有一个php mysql网站。它适用于Chrome和Opera浏览器。

但是当我在Internet Explorer中工作时,php页面无效。

我有一个登录页面

本地主机/ ABC / login.php中

当我提交登录页面表格时,地址栏中的链接会返回

本地主机/ ABC /

出现404浏览器错误。但是,Chrome和Opera浏览器的一切都很好。还有一些其他线程,但对我来说还不够。

有人可以建议我是否需要在php页面上添加任何额外的html标签行?

代码是:

<!DOCTYPE html >
<html>
<head>

<title> Login Page </title>

<script type="text/javascript">
window.history.forward();
function noBack() { window.history.forward(); }
</script>

</head>
<body onload="noBack();"
    onpageshow="if (event.persisted) noBack();" onunload="">

<?php
session_start();
$show_form=true;
$MerrorMessage = "";
$PerrorMessage = "";
$MailformaterrorMessage="";
$MailIdPwderrorMessage="";

if(!isset($_POST['Submit']))
{
$_POST['MailId']="";
$_POST['Password']=""; 
}


if(isset($_POST['Submit']))
{
sleep( 2 );

    $path6 = $_SERVER['DOCUMENT_ROOT'];
        $path6 .= "/CMP/passwordLib.php";
    include_once($path6);

    $path7 = $_SERVER['DOCUMENT_ROOT'];
        $path7 .= "/CMP/passwordLibClass.php";
    include_once($path7);

$MailId=$_POST['MailId']; 
$Password=$_POST['Password']; 

    if (empty($_POST['MailId']) || !preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/", $MailId) || empty($_POST['Password']))
        {

      if(empty($_POST['MailId'])) 
        {
          $MerrorMessage = "You forgot to enter a MailId!";
        }

      else if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/", $MailId))
        {
          $MailformaterrorMessage = "Email ID format is not correct!";
        }

      if(empty($_POST['Password'])) 
        {
          $PerrorMessage = "You forgot to enter a Password!";
        }
         }

      else
        {
          $path1 = $_SERVER['DOCUMENT_ROOT'];
              $path1 .= "/cmp/Connection.php";
          include_once($path1);
              $tbl_name="cmp_usertable";

// To protect MySQL injection (more detail about MySQL injection)
              $MailId = mysqli_real_escape_string($conn,$MailId);
          $Password = mysqli_real_escape_string($conn,$Password);
          $MailId=strip_tags($MailId);
              $Password=strip_tags($Password);

          $sql="SELECT * FROM $tbl_name WHERE Email='$MailId' ";
          $result=mysqli_query($conn,$sql);
          $row = mysqli_fetch_assoc($result);

          $Status=$row['AccountStatus'];
          $UserId=$row['Userid'];
          $FirstName=$row['FirstName'];
          $LastName=$row['LastName'];
          $Gender=$row['Gender'];
          $hash=$row['Password'];
              $count=mysqli_num_rows($result);



// If result matched $MailId , table row must be 1 row
          if($count==1)
        {

           if (password_verify($Password, $hash))
           {

            $_SESSION['$MailId'] = $_POST['MailId'];
            $_SESSION['UserId'] = $UserId;
            $_SESSION['FirstName'] = $FirstName;
            $_SESSION['LastName'] = $LastName;
            $_SESSION['Gender'] = $Gender;

            if ($Status=='A')
                {

// Register $MailId, $Password and redirect to file "Home.php"
                    header("location:Home.php");
                }


            else if ($Status=='P')
                {

                    header("location:FirstLogin.php");
                    echo "First Time Login";
                }
            else if ($Status=='D')
                {

                    header("location:Deactivated.php");
                }
                }

            else
            {
            $MailIdPwderrorMessage="Invalid Email or Password";
            }
        }

           else {
            $MailIdPwderrorMessage="Invalid Email or Password";

                }


          }

}


if(true == $show_form)
{
?>

<table width="900" border="3"  align="center" cellpadding="0" cellspacing="1" bgcolor="#006666">


<tr height="500">
<td width="700" align="center"><font color="FFFFFF" size="5" face="Biondi"> My website </br>
</font> 
</td>

<form name="form1" method="post" action=" ">
<td width="300" rowspan="2">
<table  width="70%" border="2" align="center" cellpadding="3" cellspacing="1" bgcolor="#006666">
<tr>
<td colspan="3"><strong><font color="FFFFFF">Member Login</font> </strong></td>
</tr>
<tr>

<td width="78"><font color="FFFFFF">MailId</font></td>
<td width="6">:</td>
<td width="294"><input name="MailId" type="text" value="<?php echo $_POST['MailId'] ?>" id="MailId" maxlength="60">
<span class="isa_error"><?php echo "<FONT color='RED'> $MerrorMessage </font>"?></span>
<span class="isa_error"><?php echo "<FONT color='RED'> $MailformaterrorMessage </font>"?></span>

</td>

</tr>
<tr>
<td><font color="FFFFFF">Password</font></td>
<td>:</td>
<td><input name="Password" type="Password" id="Password" maxlength="30">
<span class="isa_error"><?php echo "<FONT color='RED'> $PerrorMessage </font>" ?></span>
<span class="isa_error"><?php echo "<FONT color='RED'> $MailIdPwderrorMessage </font>"?></span>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Login" style="width: 100px;"></td>
</tr>

</table>
</td>
</form>


</tr>


</table>
<?PHP
}//true == $show_form
?>

</body>
</html>

感谢。

0 个答案:

没有答案