<?php 
	// brak raportow na localu
	error_reporting(E_ERROR | E_WARNING | E_PARSE);

	// Mysql localhost/remote
	$link = mysqli_connect('localhost', 'root', '', 'gra_rpg') or die('NIE MOŻNA POŁĄCZYĆ Z BAZĄ');
	
	session_start();
	
	if(!$_SESSION['login']){
		$id = "gracz_".date("ymdhis");
		$_SESSION['login'] = $id;
		mysqli_query($link, "INSERT INTO `players` (`login`, `x`, `y`, `color`) VALUES ('$id', '5', '5', '#".substr(md5(rand()), 0, 6)."')");
	}else{
		$user=mysqli_fetch_array(mysqli_query($link, "SELECT * FROM `players` WHERE `login`='".$_SESSION['login']."'")); 
	}
	
	
?>