<?php

include_once("include/database.php");

if (array_key_exists('login', $_POST))
{
	if (dbAuthUser($_POST['user'], $_POST['pwd']))
	{
		header("Location:main.php");
	}
	else header("Location:index.php");
}
else
{
  print "<html>";
  print "<header>";
  print "<title> BibTeX Database Manager </title>";
  print "<link href=\"css/style.css\" rel=\"Stylesheet\" type=\"text/css\">";
  print "</header>";
  print "<body class=\"texte\">";
  print "<center>";
  print "<img src=\"images/banner2.gif\" width=\"700\" height=\"50\" />";
  print "<table>";
  print "<tr>";
  print "<FORM NAME=\"usersAdd\" ACTION=\"index.php\" METHOD=\"POST\">";
  print "<td>";
  print "User";
  print "</td>";
  print "<td><input type=\"text\" name=\"user\"  size=\"8\"></td>";
  print "</tr>";
  print "<tr>";
  print "<td>";
  print "Password";
  print "</td>";
  print "<td><input type=\"password\" name=\"pwd\"  size=\"8\"></td>";
  print "</tr>";
  print "<tr><td COLSPAN=2 align=\"center\"><input type=\"submit\" name=\"login\" value=\"Login\"></td></tr>";
  print "</form>";
  print "</tr>";
  print "</table>";
  print "</center>";
  print "</body>";
  print "</html>";
}
?>
