<?php

echo 'Current PHP version: ' . phpversion();

$un = $_GET["un"];
$pw = $_GET["pw"];
	

//$servername = "52.74.77.8";
//$dbusername = "sql6128519";
//$dbpassword = "XlAqZnLRwM";
//$dbname = "sql6128519";	

$servername = "85.10.205.173";
$dbusername = "sumhohoho04";
$dbpassword = "THMSSsumho04";
$dbname = "sumho2017";	

// Create connection
$conn = mysqli_connect($servername, $dbusername, $dbpassword,$dbname,3306);

// Check connection
if (mysqli_connect_errno()) {
     echo "Failed to connect to MySQL: " . mysqli_connect_error();
} 
//echo "Connected successfully";

$sql = "select * from account where usename = '".$un."'and password='".$pw."' ";
//execute the QUERY
$result = $conn->query($sql);
if ($result->num_rows > 0) 
{
		
		setcookie("user", $un, time()+3600);
		
		header("Location: homepage.php");
} 
else 

{
     echo "wrong username or password"  ; 
	header("Location: index.html");

}


$conn->close();	

?>




