我正在尝试从html表单向自己的文件发送发布请求,但它没有获取任何数据,但是同时,当我通过桌面应用Postman发布请求时,它也可以工作。每次单击“提交”按钮都只会刷新页面,并且什么也没有发生,我还尝试使用php // input和$ _request检查数据,但它们均未获取任何数据。不知道,但是可能在向服务器添加https之后出现了问题,我也尝试将请求发送到不同的路径/ panel和https://mysite/panel.html,谢谢您的帮助!
我的page.html
<?php
require 'db.php';
$data = $_POST;
if( isset($data['email']) ){ //PHP stops here, because var_dump($data); is always empty array
$user = R::findOne('users', 'email = ?', array($data['email']));
if( $user ){
if( $data['password'] == $user->password){
$_SESSION['logged'] = $user;
echo '<div class="black">Добро пожаловать в админ-панель</div><br>';
}else{
echo '<div class="black">Не верный пароль</div><br>'; //wrong password
echo $user->password;
}
}else{
echo '<div class="black">Не верный email</div><br>'; //wrong email
}
}
if($_SESSION['logged'])
{
?>
//some html content
<?php
} else {
?>
<div class="p-x-1 p-y-3">
<form class="card card-block m-x-auto bg-faded form-width" action="https://mysite/panel.html" method="post">
<legend class="m-b-1 text-xs-center">Авторизация</legend>
<div class="form-group input-group">
<span class="input-group-addon">@</span>
<span class="has-float-label">
<input class="form-control" name="email" type="email" placeholder="name@example.com" required>
<label for="email">E-mail</label>
</span>
</div>
<div class="form-group has-float-label">
<input class="form-control" name="password" type="password" placeholder="••••••••" required>
<label for="password">Пароль</label>
</div>
<div class="text-xs-center">
<input class="btn btn-block btn-primary" type="submit" name="do_login" value="Войти">
</div>
</form>
</div>
<?php
}
?>
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/panel.js"></script>
</body>
</html>
我的.htaccess
RewriteEngine On
# Выполняем PHP в html файлах
AddHandler fcgid-script .php .phtml .html .htm
FCGIWrapper /var/www/u0475852/data/php-bin/php .php
FCGIWrapper /var/www/u0475852/data/php-bin/php .phtml
FCGIWrapper /var/www/u0475852/data/php-bin/php .html
FCGIWrapper /var/www/u0475852/data/php-bin/php .htm
# редирект с www
RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ http://%1/$1 [L,R=301]
# Делаем редирект со слешем на без слеша
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]
# Убираем html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^.*$ $0.html [L,QSA]
RewriteCond %{THE_REQUEST} ([^\s]*)\.html(\?[^\s]*)?
RewriteRule (.*) %1 [R=301,L]
# Редирект с http на https
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]