<?php
 //header('Content-Type: charset=utf-8');
//$LoginError=0 ;
 
$DB_SERVER = '127.0.0.1';  
$DB_USERNAME = 'root'; 
$DB_PASSWORD = 'P@ssw0rd~!'; 
$DB_NAME = 'vsapps'; 
 
// =========================== 
// Connect to MySQL database 
// ===========================
   $conn = mysqli_connect($DB_SERVER, $DB_USERNAME, $DB_PASSWORD, $DB_NAME);
 
if($conn === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}


function symvolaia_sql() {
	
	 $sql = "SELECT * FROM symvolaia WHERE UserName='$txtUserName' and UserPassword='$txtUserPassword'";
	$vrs = $conn->query($sql);

	if ($vrs->num_rows > 0) {
	  // output data of each row
	  while($row = $vrs->fetch_assoc()) {
		echo "IDUser: " . $row["IDUser"] . "\r\n" . "Name: " . $row["Eponymia"] . "\r\n";	 
		$LoginError=0;
		header("Location: SymvolaiaList.php");
	 }
	} else {
	 $LoginError=1;
	 header("Location: login.php?LoginError=$LoginError");
	 //echo '<script>alert("Λάθος όνομα χρήστη ή κωδικός (Password).");</script>';
	
	}
	$conn->close();

}

// ===============================
// READ USER TABLE
// ===============================


?>

 
