<?php
	/* WebWall */
	define("ONLINE", 1);
	$root = dirname( dirname( dirname(__FILE__) ) );
	require_once "$root/core.php";
	checkuserloggedin();
	$signUp["username"] = text_filter(ucfirst(strtolower($_POST["username"])),1);
	$signUp["password"] = text_filter(strtolower($_POST["password"]),1);
	$signUp["name"] = text_filter(ucfirst(strtolower($_POST["name"])),1);
	$signUp["surname"] = text_filter(ucfirst(strtolower($_POST["surname"])),1);
	$signUp["email"] = text_filter(strtolower($_POST["email"]),1);
	
	if($_SERVER['REQUEST_METHOD'] == "POST")
	{ 
		if($_SESSION['regnetwork'])
		{
			$engine_session->createuseraccountsocial($signUp["username"], $signUp["email"], $_SESSION['regnetwork'], $_SESSION['regid'], $_SESSION['regfirst_name'], $_SESSION['reglast_name'], $_SESSION['regphoto_big'], $_SESSION['regcountry'], $_SESSION['regcity']);
		}
		else
		{
			if ($_POST['captcha'] == $_SESSION['cap_code'])
			{
				$engine_session->createuseraccount($signUp["username"], $signUp["password"], $signUp["name"], $signUp["surname"], $signUp["email"]); 
			}
			else
			{
				$engine_session->captchaerror();
			}
		}
	}
	
	$template_session->loadhead($template_session->getlangval(114));
	$template_session->loadlogo(1); 
	$template_session->loadmenu(); 
	if($_SESSION['regnetwork'])
	{
		$template_session->loadtpl("signupsocial");
		$template_session->addline('<div id="footerspace"></div></div>');
	}
	else
	{
		$template_session->loadtpl("signup");
	}
	$template_session->loadtpl("footer");
	$template_session->loadend();
?>