I have a Google App Engine application (php website) with a Cloud SQL Instance database connected to it. First of all my app.yaml is:
application: applicationid
version: 1
runtime: php
api_version: 1
handlers:
- url: /(.*\.(gif|png|jpg|ico|js|css))
static_files: \1
upload: (.*\.(gif|png|jpg|ico|js|css))
- url: /dbconn.php
script: dbconn.php
- url: /logincheck.php
script: logincheck.php
- url: /loginsuccess.php
script: loginsuccess.php
- url: /register.php
script: register.php
- url: /sign.php
script: sign.php
- url: /viewcurrent.php
script: viewcurrent.php
- url: /.*
script: mainpage.php
I have the following login form on the mainpage:
<form method="post" enctype="application/x-www-form-urlencoded" action="logincheck.php" autocomplete="off" >
<table>
<tr>
<td><label for="username">Username</label></td>
<td><input type="text" name="username"></input></td>
</tr>
<tr>
<td><label for="password">Password</label></td>
<td><input name="password" type="password"></input></td>
</tr>
<tr>
<td><input type="submit" value="Submit"</td>
And logincheck.php is:
<?php
session_start();
require "dbconn.php";
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT * FROM students WHERE username = '".$username."'
AND password = '".$password."'";
$result = $connect->query($query);
$row = $result->fetch_assoc();
if ($row != null)
{
$_SESSION['username'] = $username;
header("Location: loginsuccess.php");
exit();
}
else
{
header("Location: wrongdetails.php?showerror=1");
exit();
}
?>
So the user is then suppose to be sent to 'loginsuccess.php' when they have logged in. I have the correct database set up on Cloud SQL with the correct fields, such as username and password. But when the user types in the correct username and password the page just reloads exactly the same but with the url:
http://localhost:8080/logincheck.php
Instead of actually doing the actions in 'logincheck.php'
Any ideas of what I'm doing wrong?