403 PHP登录中的禁止错误

时间:2015-01-01 08:50:02

标签: javascript php html tornado

每当我点击登录的提交按钮时,我都会进入一个空白页面,其中包含文本" 403 Forbidden",我觉得这可能是由于我登录的URL因为它是" mywebsite.com8:8888 / login /"并托管在不同的端口上(我使用Tornado Web服务器)。

HTML

 <form method="POST">
      <fieldset id="inputs">
        <input name="username" id="username" required>   
        <input name="password" id="password" type="password" name="Password" placeholder="Password" required>
      </fieldset>
      <fieldset id="actions">
        <input type="submit" id="submit" value="Log in" name="submit">
        <label><input type="checkbox" checked="checked"> Keep me signed in</label>
      </fieldset> 
     </form> <div id="container"></div>

PHP

<?php header('Access-Control-Allow-Origin: *'); ?>
<?php
if (isset($_POST['submit'])){
session_start(); 
error_reporting(0); 

    $username = $_POST['username'];
    $password = md5($_POST['password']);

        $connection = mysql_connect("localhost", "moot", "lmlkmklmklmkl"); // Establishing Connection with Server
$db = mysql_select_db("snamr", $connection); // Selecting Database from Server
        $sql="SELECT * FROM accs WHERE name='$username' and password='$password'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
$check = mysql_query("SELECT active FROM accs WHERE name = '$username'");
while($rows=mysql_fetch_assoc($check)){
      $active = $rows['active'];
}

// If result matched $myusername and $mypassword, table row must be 1 row
if($count!=1){
echo "Wrong Username or Password";
}
elseif ($active == 0) {
echo "Your account isn't active!";
}
else {
    $_SESSION['username'] = $username; 
}
$time = time();
$setLogged= mysql_query("UPDATE accs SET loginstatus = '$time' WHERE name = '$username'") or die(mysql_error());
}
}
?>

将PHP加载到HTML中的JAVASCRIPT(很好的理由)

    <script type="text/javascript">     
$(document).ready(function(){
    $("#container").load('http://mywebsite.com/sname/signing.php');
  });
</script>

登录表单和PHP一起使用默认端口上的所有其他文件但是当我将代码带到托管在端口8888上的文件时出现问题。因此,为什么我认为主要问题可能在域中。

任何解决方案?

0 个答案:

没有答案