CORS with php headers PHP
Olá pessoal, não estou conseguindo fazer uma requisição de um formulário html para um arquivo php que está em outro diretório no meu localhost, se puderem me ajudar, já estou há um tempo pesquisando e testando, mas nada.. Seguem os códigos, do html e do php:
html:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/jquery.mobile.icons.min.css">
<link rel="stylesheet" href="css/theme-classic.css">
<link rel="stylesheet" href="css/jquery.mobile.structure-1.4.5.min.css">
<link rel="shortcut icon" href="favicon.ico">
<script src="js/jquery.js"></script>
<script src="js/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<center><img src="images/logo.png" style="width:15%"></center>
</div>
<div data-role="main" class="ui-content">
<!-- <a href="#myPopup" data-rel="popup" class="ui-btn ui-btn-inline ui-corner-all ui-icon-check ui-btn-icon-left">Show Popup Form</a> data-role="popup" -->
<div data-role="" class="ui-content" style="min-width:250px;">
<form method="post" action="../mobile_ar/index.php">
<div>
<h3>Login</h3>
<label for="email" class="ui-hidden-accessible">E-mail:</label>
<input required="" type="email" name="email" id="email" placeholder="E-mail">
<label for="senha" class="ui-hidden-accessible">Senha:</label>
<input required="" type="password" name="senha" id="senha" placeholder="Senha">
<!-- <label for="log">Keep me logged in</label>
<input type="checkbox" name="login" id="log" value="1" data-mini="true"> -->
<input type="submit" data-inline="true" value="Entrar">
</div>
</form>
</div>
</div>
</div>
</body>
</html>
php:
<?php
session_start();
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type, Content-Range, Content-Disposition, Content-Description');
include_once 'Model/DAO/HomeDao.php';
$dao = new Model\DAO\HomeDao();
$row = $dao->loginDao($_POST["email"], $_POST["senha"]);
if (count($row) == 1) {
$dao->registroDeAcao($row[0]["id"], $row[0]["perfil"], "Logou no Sistema", "Sistema","Sistema");
$_SESSION["login"] = $row[0]["email"];
$_SESSION["perfil"] = $row[0]["perfil"];
$_SESSION["id"] = $row[0]["id"];
$_SESSION["nome"] = $row[0]["nome"];
$_SESSION["foto"] = $row[0]["foto"];
$_SESSION["tempo"] = time();
$dao->acessoDao(1, $row[0]["id"]);
header("location:../mobile/admin.html");} else {
$msg = "Login/Senha inválido(s)";
header("location:../mobile/login.html?msg=" . $msg);
}Discussão (2)
Carregando comentários...