<?php
/*======================================================================*\
|| #################################################################### ||
|| # EoT-Clan BF3 Leaderboard                                         # ||
|| # ---------------------------------------------------------------- # ||
|| # Dieses Copyright darf nicht entfernet werden                     # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # -----------------BF3 Leaderboard is a free Software--------------# ||
|| #                   http://eot-clan.net                            # ||
|| #################################################################### ||
\*======================================================================*/
include '../inc/config.php';
require_once ('../language/'.$row['language'].'.php');
session_start();

$_GET = security::escape($_GET);
$_POST = security::escape($_POST);

$error = $styleSettings.'
<title>Login error!!</title>
         <table class="defaultUpdate" style="width:470px; margin-left: -250px;margin-top: -100px;position: absolute;left: 50%;top: 50%;" border="0" cellspacing="0" cellpadding="4"><td>
'.LANG_LOGIN_LOGIN_ERROR.'
</td></table>';


if (isset($_POST["username"]) && $_POST["username"] != ""){
	$username = $_POST["username"];
  $passwort = md5($_POST["password"]);

$abfrage = "SELECT id, username, passwort FROM ".DBPrefix."login WHERE username LIKE '$username' LIMIT 1";
$ergebnis = mysql_query($abfrage);
$row = mysql_fetch_assoc($ergebnis);

if($row['passwort'] == $passwort)
    {
    $_SESSION["username"] = $username;
    $abfrage = "SELECT id, username FROM ".DBPrefix."login WHERE username = '{$_SESSION['username']}'";
    $ergebnis = mysql_query($abfrage);
    $row = mysql_fetch_assoc($ergebnis);
    $_SESSION["id"] = $row['id'];
    
    header("Location: admin.php");

  }else{
  	echo $error;
 }
}else{
	 echo $error;
	}