I got this code from a tutorial however my University server has PHP 5.3 and on my own home WebServer I am running PHP5.7 and I believe that is what is causing an error as I am getting "This page isn’t working"
This is a very basic login script as that is all I need.
I am running IIS 10.0, PHP 5.7 and latest MySql Server / Windows server 2016 Stan
the code I am trying to use on my server is
<?php
//get information from index.php
$username = $_POST['username'];
$password = $_POST['password'];
//Prevent Sql injection
$username = stripcslashes($username);
$password = stripcslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
//connect to the MySql Server and select a Database
mysql_connect("localhost", "root", "password");
mysql_select_db("S0190282");
//Query the database for the user
$sql = mysql_query("SELECT * FROM login WHERE username = '$username' AND password = '$password'")
or die ("Failed to query database".mysql_error());
$row = mysql_fetch_array($sql);
if ($row['username'] == $username && $row['password'] == $password)
{
//if Username and password are both correct /Do this code here\
header('Location: secure/index.php');
}
else
{
//Do this code here
echo('Your Username or Password is incorrect');
}
?>
Anyone know of anyway to fix this thanks. I'd rather not go back to 5.3 as i'v always been on the latest version of server software.