Javascript 403 PHP登录中禁止的错误
每当我点击我登录的提交按钮时,我会看到一个空白页面,上面有“403禁止”,我觉得这可能是因为我的登录页面的URL是“mywebsite.com8:8888/login/”,并且托管在不同的端口上(我使用的是Tornado web服务器) HTMLJavascript 403 PHP登录中禁止的错误,javascript,php,html,tornado,Javascript,Php,Html,Tornado,每当我点击我登录的提交按钮时,我会看到一个空白页面,上面有“403禁止”,我觉得这可能是因为我的登录页面的URL是“mywebsite.com8:8888/login/”,并且托管在不同的端口上(我使用的是Tornado web服务器) HTML <form method="POST"> <fieldset id="inputs"> <input name="username" id="username" required>
<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());
}
}
?>
JS不会从不同的来源加载网站,除非你知道,php实际上会加载到网页中,因为我已经检查了Google Chrome控制台,并更改了php,在网页上生成随机数,它可以工作。或者我遗漏了什么?因此您提交到同一页面,因为您没有操作:
,即发布到html页面。将URL添加到formI added action=“”的action属性中登录成功,但当我将其指向实际的“/room/1”时,我收到了相同的错误。
<script type="text/javascript">
$(document).ready(function(){
$("#container").load('http://mywebsite.com/sname/signing.php');
});
</script>