Pesquisar na Comunidade
Mostrando resultados para as tags ''request''.
Encontrado 2 registros
-
Erro retornado no console do navegador: 400 bad request Rastreei o erro ate essa parte no arquivo admin-ajax.php mudando o valor de resposta de 0 para 1: if ( is_user_logged_in() ) { // If no action is registered, return a Bad Request response. if ( ! has_action( "wp_ajax_{$action}" ) ) { wp_die( '0', 400 ); } Tentei de tudo, mas infelizmente nao entendi oq realmente significa esse login e como ele funciona. Vi algumas pessoas tendo problema com o host, no meu caso estou usando hostinger. (Nao creio que isso e relevante mas ta ai.) Código utilizado: Javascript function formValidation() { event.preventDefault(); var name = document.forms["contactForm"]["name"].value; var email = document.forms["contactForm"]["email"].value; var subject = document.forms["contactForm"]["subject"].value; var message = document.forms["contactForm"]["message"].value; document.getElementById('status').innerHTML = ''; var errorMessage="<span class='error'>All fields are required.</span>"; var regEx = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; if (name.trim() == "" ||email.trim() == "" || subject.trim() == "" || message.trim() == "") { document.getElementById('status').innerHTML = errorMessage; return false; } if (!regEx.test(email)) { var errorMessage="<span class='error'>Invalid email.</span>"; document.getElementById('status').innerHTML = errorMessage; return false; } processContactSubmit(); return true; } function processContactSubmit() { var request = new XMLHttpRequest(); request.open("POST", "/wp-admin/admin-ajax.php?action=process_contact_form"); request.onreadystatechange = function() { if(this.readyState === 4 && this.status === 200) { document.getElementById("status").innerHTML = this.responseText; } }; var myForm = document.getElementById("contactForm"); var formData = new FormData(contactForm); request.send(formData); } functions.php add_action('wp_ajax_nopriv_process_contact_form', 'process_contact_form'); add_action('wp_ajax_process_contact_form', 'process_contact_form'); //Retirar essa parte para error no console, no contrario ira aparecer no navegador o numero 0. function process_contact_form() { $to = "Recipient Email Address"; $subject = $_POST["subject"]; $headers = "Testing"; $message = $_POST["message"]; $attachments = ""; $sent = wp_mail($to, $subject, $message, $headers, $attachments); if (! $sent) { echo "<span class='error'>Problem in sending mail.</span>"; } else { echo "<span class='success'>Hi, thank you for the message.</span>"; } wp_die(); } Html <form name="contactForm" id="contactForm" method="post" onsubmit="return formValidation()" action=""> <p class="comment-form-comment"><textarea id="message" name="message" required="" placeholder="" aria-required="true"></textarea></p> <p class="comment-form-author"><label for="author">Nome: </label> <input id="name" name="name" required="" size="30" type="text" value=" " /></p> <p class="comment-form-author about"><label for="author">Assunto: </label> <input id="subject" name="subject" required="" size="40" type="text" value=" " /></p> <p class="comment-form-email"><label for="email">Email: </label> <input id="email" name="email" required="" size="30" type="text" value="" /></p> <p class="form-submit"><input id="submit" class="submit" name="email_contato" type="submit" value="Enviar" /></p> </form> <h3><div id="status"></div></h3>
-
Boa tarde, uso o Wampserv To com fazendo um sisteminha de login com esses códigos abaixo. .htaccess RewriteEngine On Options All -Indexes DirectoryIndex index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA, L] index.php <?php echo "Olá"; Config.php <?php #Caminhos absolutos $pastaInterna="projetologin.com/"; define('DIRPAGE',"http://{$_SERVER['HTTP_HOST']}/{$pastaInterna}"); (substr($_SERVER['DOCUMENT_ROOT'],-1)=='/') ? $barra="" : $barra="/"; define('DIRREQ',"{$_SERVER['DOCUMENT_ROOT']}{$barra}{$pastaInterna}"); #Atalhos define('DIRIMG',DIRPAGE.'img/'); define('DIRCSS',DIRPAGE.'lib/css/'); define('DIRJS',DIRPAGE.'lib/js/'); #Dados de DB define('HOST',"localhost"); define('DB',"sistema"); define('USER',"root"); define('PASS',""); Compuser gerado certinho { "name": "login/wef", "description": "Cadastro e login php", "authors": [ { "name": "Jeova em Foco", "email": "jeovacnp20012@gmail.com" } ], "require": {}, "autoload": { "psr-4": { "Classes\\": "../classes/", "Models\\": "../models/", "Traits\\": "../traits" } } } Mais não vai de forma alguma. Lista dos erros do apache The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at wampserver@wampserver.invalid to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. Arquivo de log do apache [Wed Dec 04 15:37:56.202961 2019] [core:notice] [pid 5912:tid 756] AH00094: Command line: 'c:\\wamp64\\bin\\apache\\apache2.4.41\\bin\\httpd.exe -d C:/wamp64/bin/apache/apache2.4.41' [Wed Dec 04 15:37:56.205960 2019] [mpm_winnt:notice] [pid 5912:tid 756] AH00418: Parent: Created child process 15108 [Wed Dec 04 15:37:57.043478 2019] [mpm_winnt:notice] [pid 15108:tid 708] AH00354: Child: Starting 64 worker threads. [Wed Dec 04 15:37:59.941815 2019] [core:alert] [pid 15108:tid 1224] [client ::1:55274] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:38:01.600863 2019] [core:alert] [pid 15108:tid 1224] [client ::1:55275] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:38:02.306458 2019] [core:alert] [pid 15108:tid 1224] [client ::1:55277] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:38:03.738636 2019] [core:alert] [pid 15108:tid 1224] [client ::1:55279] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:39:00.689953 2019] [mpm_winnt:notice] [pid 5912:tid 756] AH00422: Parent: Received shutdown signal -- Shutting down the server. [Wed Dec 04 15:39:02.691802 2019] [mpm_winnt:notice] [pid 15108:tid 708] AH00364: Child: All worker threads have exited. [Wed Dec 04 15:39:02.720786 2019] [mpm_winnt:notice] [pid 5912:tid 756] AH00430: Parent: Child process 15108 exited successfully. [Wed Dec 04 15:39:05.010479 2019] [mpm_winnt:notice] [pid 15120:tid 880] AH00455: Apache/2.4.41 (Win64) PHP/7.3.12 configured -- resuming normal operations [Wed Dec 04 15:39:05.011487 2019] [mpm_winnt:notice] [pid 15120:tid 880] AH00456: Apache Lounge VS16 Server built: Aug 9 2019 16:46:32 [Wed Dec 04 15:39:05.011487 2019] [core:notice] [pid 15120:tid 880] AH00094: Command line: 'c:\\wamp64\\bin\\apache\\apache2.4.41\\bin\\httpd.exe -d C:/wamp64/bin/apache/apache2.4.41' [Wed Dec 04 15:39:05.015470 2019] [mpm_winnt:notice] [pid 15120:tid 880] AH00418: Parent: Created child process 11112 [Wed Dec 04 15:39:06.112840 2019] [mpm_winnt:notice] [pid 11112:tid 708] AH00354: Child: Starting 64 worker threads. [Wed Dec 04 15:39:15.352539 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55291] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:39:16.524866 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55292] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:39:17.228463 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55293] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:39:18.519721 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55294] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:42:11.197193 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55324] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:42:12.211612 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55326] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:42:13.004156 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55328] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters [Wed Dec 04 15:43:06.518563 2019] [core:alert] [pid 11112:tid 1224] [client ::1:55336] C:/wamp64/www/projetologin.com/.htaccess: RewriteRule: bad flag delimiters O que fazer, ajudem-me.