<div class="modul-box">
<div class="modul-box-bg">
<div class="modul-box-bg-bottom">
		<h3>Logare</h3>
	<form action="index.php?s=home" method="post">
<div class="form-login">
		<label>Nume de utilizator</label>
<div class="input">
			<input type="text" name="user"/><br/>
</div>
		<label>Parol&#259;</label>
<div class="input">
			<input type="password" name="pw"/><br/>
</div>
<div>
		<input type="submit" class="button btn-login" name="login" value="Login"/>
		<p class="agbok">
			Aten&#355;ie: Intr&#226;nd aici, accept <a href="#"><strong>Termenii &#351;i condi&#355;iile</strong></a> .	
			<a href="?s=passwordlost" class="password">Ai uitat parola?</a>
		</p>
</div>
</div>
</form>
</div>
</div>
</div>

<?php

	if(isset($_POST['login']) && $_POST['login'] == 'Login') {
	
		include('./include/config.inc.php');
			mysql_select_db('account');
			
		$user = mysql_real_escape_string($_POST['user']);
		$pw = mysql_real_escape_string($_POST['pw']);
		
			$check = "SELECT * from account where login = '" . $user . "' and password = PASSWORD('$pw')";
				$query = mysql_query($check);
					$num = mysql_num_rows($query);
						
						
			if($num > 0) {
			
				$array = mysql_fetch_array($query);
				
				
			// SESSION Variablen erstellen //
			
			$_SESSION['id'] = $array['login'];
			$_SESSION['login'] = $array['login'];
			$_SESSION['login2'] = $array['login'];
			$_SESSION['login3'] = $array['login'];
			$_SESSION['coins'] = $array['monede_is_dr'];
			$_SESSION['isadmin'] = $array['isadmin'];
			$_SESSION['pscadmin'] = $array['pscadmin'];
			$_SESSION['email'] = $array['email'];
			$_SESSION['real_name'] = $array['real_name'];
			$_SESSION['social_id'] = $array['social_id'];
            $_SESSION['user_admin'] = $array['web_admin']; 
			$_SESSION['user_id'] = $array['id'];
            $_SESSION['user_name'] = $array['login'];
            $_SESSION['user_coins'] = $array['monede_is_dr'];
            $_SESSION['user_email'] = $array['email'];
			echo "<meta http-equiv='refresh' content='0; URL=index.php?s=home'>";
			} else {
			echo "<meta http-equiv='refresh' content='0; URL=index.php?s=login_error'>";
			}
		}
		
?>