<?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 variable start //
			
			$_SESSION['id'] = $array['login'];
			$_SESSION['coins'] = $array['coins'];
			$_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['coins'];
            $_SESSION['user_email'] = $array['email'];
			echo "<meta http-equiv='refresh' content='0; URL=/user/shop/scripts/itemshop/'>";
			} else {
			echo "<meta http-equiv='refresh' content='0; URL=index_is.php?s=login_error_is'>";
			}
		}
		
?>
				<h2><?PHP echo $serverSettings['titel']; ?> - Item Shop</h2>
						<form name="loginForm" id="loginForm" action="index_is.php?s=login_is" method="post">
							
							<div>
								<label for="username">Nume de utilizator: *<br></label>
								<input AUTOCOMPLETE="off" type="text" class="validate[required,custom[noSpecialCharacters],length[3,16]]" id="username" name="user" maxlength="16" value=""/>
							</div>
							<div>
								<label for="password">Parol&#259;: *<br></label>
								<input AUTOCOMPLETE="off" type="password" class="validate[required,length[5,16]]" id="password" name="pw" maxlength="16" value=""/>
							</div>
							<input id="submitBtn"class="btn-big" type="submit" name="login" value="Login"/>
							<script type="text/javascript">
							</script>
						</form>	