- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm developing an app where I need implements login, the all data are stored in PostgreSQL database, I'm using PHP and XAMPP as server, but it's not works, an error appears:
Cannot POST /http-services/emulator-webserver/ripple/userapp/x/C/Users/Gabriel.DESKTOP-HUBGD9F/AppData/Local/XDK/xdk-scratchdir/d1b4c333-e5d3-4334-9276-67c06d0fba6f/platforms/ios/www/verifica_usuario.php
I don't know why this error appears, the verifica_usuario.php is in the same folder as html, I put bellow the form code of my login page:
<form action="verifica_usuario.php" method="POST" id="formLogin"> <label>User</label><br/> <input name="user" type="text" id="user" /><br/> <label>Password</label><br/> <input name="password" type="password" id="password" /><br/><br/> <input type="submit" name="Submit" value="LOGIN" /> </form>
Here are the verifica_usuario.php code:
<?php session_start(); //inicia a sessao include "http://localhost:8080/ConexaoBD/conecta.class"; $user = $_GET['user']; $password = $_GET['password']; if((!$user) || (!$password)){ echo "Por favor, todos campos devem ser preenchidos! <br /><br />"; include "index.html"; }else{ $password = md5($password); $sql = pg_query( "SELECT * FROM pessoa WHERE email_pessoa = '{$user}' AND senha_pessoa = '{$password}' AND status_pessoa='A' "; ); $login_check = pg_num_rows($sql); if($login_check > 0){ while($row = pg_fetch_array($sql)){ foreach ($row as $key => $val){ $$key = stripslashes( $val ); } $_SESSION['id_pessoa'] = $id_pessoa; $_SESSION['nome_pessoa'] = $nome_pessoa; $_SESSION['tipo_pessoa'] = $tipo_pessoa; $_SESSION['email_pessoa'] = $email_pessoa; header("location: area_restrita.php"); } }else{ echo "Você não pode logar-se! Este usuário e/ou senha não são válidos!<br /> Por favor tente novamente!<br />"; include "index.html"; } } ?>
Someone can help me please? Thanks!
**Sorry for my bad English :l
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Might it be that you need an absolute url instead of a relative url here?
action
=
"verifica_usuario.php"
RELATIVE -name of a file that is on the same machine as the one calling it. It usually is just a file name.
ABSOLUTE -access a file on a remote machine. it includes the protocol, path, and file name.
https://en.wikipedia.org/wiki/Absolute%20url
Maybe something like this?
action
=
"https://mysite.com/mobile-services/verifica_usuario.php"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dwight B. wrote:
Might it be that you need an absolute url instead of a relative url here?
action="verifica_usuario.php"RELATIVE -name of a file that is on the same machine as the one calling it. It usually is just a file name.
ABSOLUTE -access a file on a remote machine. it includes the protocol, path, and file name.https://en.wikipedia.org/wiki/Absolute%20url
Maybe something like this?
action="https://mysite.com/mobile-services/verifica_usuario.php"Hope this helps.
Thanks for the reply, I put the verifica_usuario.php on server, and I changed the action url, and that error don't show anymore, but i have a new problem :(
At verifica_usuario.php have this lines:
include "index.html"; // line 13 and 43 header("location: area_restrita.php"); // line 36
index.html is the main page of my app and it's in the folder in my pc, don't in the server, so he can't find.
How can I solve it?
<?php session_start(); //inicia a sessao include "http://localhost:8080/ConexaoBD/conecta.class"; $user = $_GET['user']; $password = $_GET['password']; if((!$user) || (!$password)){ echo "Por favor, todos campos devem ser preenchidos! <br /><br />"; include "index.html"; //----------HERE------------ }else{ $password = md5($password); $sql = pg_query( "SELECT * FROM pessoa WHERE email_pessoa = '{$user}' AND senha_pessoa = '{$password}' AND status_pessoa='A' "; ); $login_check = pg_num_rows($sql); if($login_check > 0){ while($row = pg_fetch_array($sql)){ foreach ($row as $key => $val){ $$key = stripslashes( $val ); } $_SESSION['id_pessoa'] = $id_pessoa; $_SESSION['nome_pessoa'] = $nome_pessoa; $_SESSION['tipo_pessoa'] = $tipo_pessoa; $_SESSION['email_pessoa'] = $email_pessoa; header("location: area_restrita.php"); } }else{ echo "Você não pode logar-se! Este usuário e/ou senha não são válidos!<br /> Por favor tente novamente!<br />"; include "index.html";//------------HERE---------- } } ?>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Gabriel,
Is not clear to me if you are developing a device app or a web app. My answer is based in index.html as the main file created by XDK.
In first case, you should call the php authorization script from the app and process the result in the app. Not include index.html on the server side php scripts.
If it is the second case, you should build the app as a Web App, upload all files to server and add the php files (or call them with the complete url path)
I hope this help
Regards
Diego

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page