<?php
/*===================================================+ 
|| # HoloCMS - Website and Content Management System
|+===================================================+ 
|| # Copyright © 2012 DnT [Tutti i diritti riservati]
|| # http://dnt.webnet32.com/
|+===================================================+ 
|| # DnT HoloCMS v2 - Created By Donatello (DnT)
|| # http://code.google.com/p/dnt-project/downloads/list
|+===================================================*/ 


require_once("../core.php");

if(!$_SESSION['reg_date'] || !$_SESSION['reg_gender'])
{
	header("Location: /quickregister/start");
}

if(is_numeric($_GET['p']))
{
	$refresh = true;
	$error = 0;
	$Taken = mysql_num_rows(mysql_query("SELECT mail FROM users WHERE mail = '".$_POST['bean_email']."'")) != 0;
	$Taken1 = mysql_num_rows(mysql_query("SELECT username FROM users WHERE username = '".$_POST['bean_name']."'")) != 0;
	$pos = strrpos($refer, "MOD-");
	if($Taken){ header("Location: ".$path."quickregister/duplicateEmailLogin"); }
	if($_POST['bean_email'] == "" || $Taken || !preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $_POST['bean_email'])){ $errore1 = "Inserisci un indirizzo e-mail valido<br>"; $error = 1; $state1 = "class='error'"; }
	if(!$_POST['bean_name'] || $Taken1 || $pos == true || !preg_match("/^[0-9a-zA-Z\xE0-\xFF ]+$/i",$_POST['bean_name'])){ $errore0 = "Il Nome utente non &egrave; Valido.<br>"; $error = 1; $state0 = "class='error'"; }
	if($_POST['bean_password'] != $_POST['bean_retypedPassword']){ $errore2 = "Le password non corrispondono, riprova!<br>"; $error = 1; $state2 = "class='error'"; $state3 = "class='error'"; }
	if($_POST['bean_password'] == ""){ $errore3 = "Inserisci una password!<br>"; $error = 1; $state2 = "class='error'"; }
	if($_POST['bean_retypedPassword'] == ""){ $errore4 = "Inserisci di nuovo la tua password<br>"; $error = 1; $state3 = "class='error'"; }
	if($_POST['bean_termsOfServiceSelection'] != "true"){ $errore5 = "Per continuare, devi accettare i Termini di Servizio!"; $error = 1; $state4 = "error"; }

	if($error == 1){

		$errore = '<div id="error-messages-container" class="cbb"> 
		<div class="rounded" style="background-color: #cb2121;"> 
		<div id="error-title" class="error"> 
	'.$errore0.$errore1.$errore2.$errore3.$errore4.$errore5.'
	</div> 
	</div> 
	</div>';

	}else{
		$_SESSION['reg_name'] = $_POST['bean_name'];
		$_SESSION['reg_email'] = $_POST['bean_email'];
		$_SESSION['reg_password'] = $_POST['bean_password'];
		header("Location: /quickregister/captcha");
	}
}
	?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:og="http://opengraphprotocol.org/schema/">

<head>

	<meta http-equiv="content-type" content="text/html; charset=utf-8" />

	<title><?php echo $sitename; ?>: Registrazione 2/3</title>



<script type="text/javascript">

var andSoItBegins = (new Date()).getTime();

</script>

<script src="/web-gallery/static/js/visual.js" type="text/javascript"></script>

<script src="/web-gallery/static/js/libs.js" type="text/javascript"></script>

<link rel="stylesheet" href="/web-gallery/v2/styles/style.css" type="text/css" />

<link rel="stylesheet" href="/web-gallery/v2/styles/buttons.css" type="text/css" />

<link rel="stylesheet" href="/web-gallery/v2/styles/boxes.css" type="text/css" />

<link rel="stylesheet" href="/web-gallery/v2/styles/tooltips.css" type="text/css" />

<link rel="stylesheet" href="/web-gallery/v2/styles/changepassword.css" type="text/css" />

<link rel="stylesheet" href="/web-gallery/v2/styles/quickregister.css" type="text/css" />

<script src="/web-gallery/static/js/common2.js" type="text/javascript"></script>

<script type="text/javascript">

var ad_keywords = "";

var ad_key_value = "";

</script>



<script type="text/javascript">

document.habboLoggedIn = true;

var habboName = null;

var habboReqPath = "/";

var habboStaticFilePath = "./web-gallery";

var habboImagerUrl = "http://www.habbo.it/habbo-imaging/";

var habboPartner = "Meth0d.org";

window.name = "habboMain";



</script>



<link rel="stylesheet" href="/web-gallery/v2/styles/forcedemaillogin.css" type="text/css" />
<script src="/web-gallery/static/js/landing.js" type="text/javascript"></script>
<link rel="stylesheet" href="/web-gallery/v2/styles/frontpage.css" type="text/css" />


<meta name="description" content="<?php echo $shortname; ?> Hotel &egrave; un hotel in cui puoi conoscere tanti nuovi Amici!" />

<meta name="keywords" content="<?php echo $shortname; ?>,<?php echo $shortname; ?> Hotel,virtuale, mondo, social network, gratis, community, avatar, personaggio, chat, online, giovane, gruppi, forum, sicurezza, giocare, giochi, online, amici, rari, furni rari, collezione, creare, collezionare, furni, creare stanze, distintivi, badge, uscire, mmo, mmorpg, multiplayer" />



<!--[if IE 8]>

<link rel="stylesheet" href="/web-gallery/v2/styles/ie8.css" type="text/css" />

<![endif]-->

<!--[if lt IE 8]>

<link rel="stylesheet" href="/web-gallery/v2/styles/ie.css" type="text/css" />

<![endif]-->

<!--[if lt IE 7]>

<link rel="stylesheet" href="/web-gallery/v2/styles/ie6.css" type="text/css" />

<script src="/web-gallery/static/js/pngfix.js" type="text/javascript"></script>

<script type="text/javascript">

try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {}

</script>



<style type="text/css">

body { behavior: url(/js/csshover.htc); }

</style>

<![endif]-->

</head>

<?php if($email_force_verify == true){ ?>
<div id="forced-email-login" style="display: none;">

<div id="forced-email-login-container" class="clearfix">

<div id="forced-email-login-title" class="bottom-border">Attenzione!</div>

<div class="bottom-border">
<ul id="forced-email-login-content" class="clearfix">

<li>
<span>Caro <?php echo $shortname; ?>, per evitare spiacevoli inconvenienti e per accertarci che gli utenti siano creati da utenti veri, sei pregato di inserire la tua vera Email senò non potrai confermare l'email e quindi non potrai effettuare il Login in <?php echo $shortname; ?>.</span>
</li>

</ul>
</div>

<a href="#" id="force-email-ok-button" class="new-button"><b>Ok</b><i></i></a>

</div>
<div id="forced-email-login-container-bottom"></div>

</div>  
<?php if($refresh == false){ ?>
<script type="text/javascript">
HabboView.add( function() {
LandingPage.showForcedEmailNotice();
});
</script>
<?php } } ?>

<body id="client" class="background-accountdetails-<?php echo $_SESSION['reg_gender2']; ?>">

<div id="overlay"></div>

<img src="/web-gallery/v2/images/page_loader.gif" style="position:absolute; margin: -1500px;" />

<div id="stepnumbers">

    <div class="stepdone">Data di nascita e sesso</div>

    <div class="step2focus">Dettagli Account</div>

    <div class="step3">Controllo sicurezza</div>

</div>



<div id="main-container"> <br> </br> <br> </br> <?php echo $errore; ?>
<div id="title">Dettagli Account</div>

	<form method="post" action="/quickregister/email_password?p=2" id="quickregister-form">



      <div id="inner-container">

        <div class="inner-content bottom-border">

            <div id="email-notice" class="field-content"><span style="font-size:14px; color: #22b9f1;">Hai <b>bisogno della tua email</b> e della Password per registrarti su <?php echo $shortname; ?></span></div>

            <div class="field-content clearfix">

                <div class="left">

                    <div class="label" class="registration-text">Nome</div>

                    <input type="text" id="email-address" name="bean.name" maxlength="24" value="<?php echo $_POST['bean_name']; ?>" <?php echo $state0; ?>>

                </div>

                <div class="right">

                    <div class="help">Segli un nome per il tuo <?php echo $shortname; ?>.</div>

                </div>

            </div>

			<div class="field-content clearfix">

                <div class="left">

                    <div class="label" class="registration-text">Email</div>

                    <input type="text" id="email-address" name="bean.email" value="<?php echo $_POST['bean_email']; ?>" <?php echo $state1; ?> />

                </div>

                <div class="right">

                    <div class="help">Se dovessi dimenticare la tua password dovrai utilizzare questo <b>indirizzo email per recuperarla</b>. Utilizza l'indirizzo email corretto.</div>

                </div>

            </div>

            <div class="field-content clearfix">

                <div class="left">

                    <div class="field">

                        <div class="label" class="registration-text">Password</div>

                        <input type="password" name="bean.password" id="register-password" maxlength="32" value="<?php echo $_POST['bean_password']; ?>" <?php echo $state2; ?>>

                    </div>

                    <div class="password-field">

                        <div class="label" class="registration-text">Inserisci di nuovo la Password</div>

                        <input type="password" name="bean.retypedPassword" id="register-password2" maxlength="32" value="<?php echo $_POST['bean_retypedPassword']; ?>" <?php echo $state3; ?>>

                    </div>

                </div>

                <div class="right">

                    <div class="help">La Password deve essere di almeno <b>6 caratteri </b> e deve includere <b>lettere e numeri</b></div>

                </div>

            </div>

        </div>

        <div class="inner-content top-margin">

			<div class="field-content checkbox <?php echo $state4; ?>">

			  <label>

			    <input type="checkbox" name="bean.termsOfServiceSelection" id="terms" value="true" class="checkbox-field" checked="">

			    Accetto le <a href="#" target="_blank" onclick="window.open('/rules'); return false;">Regole</a>

			  </label>

			</div>
         </div>

      </div>

    </form>

	<div id="select">

        <div class="button">

            <a id="proceed-button" href="#" class="area">Avanti >></a>

            <span class="close"></span>

        </div>

        <a href="/quickregister/start" id="back-link">Torna indietro</a>

   </div>

</div>

<script type="text/javascript">

    document.observe("dom:loaded", function() {

        Event.observe($("back-link"), "click", function() {

            Overlay.show(null,'Loading...');

        });

        Event.observe($("proceed-button"), "click", function() {

            Overlay.show(null,'Loading...');

            $("quickregister-form").submit();

        });

            $("email-address").focus();

    });

</script>

</div>


<script type="text/javascript">

    HabboView.run();

</script>



</body>

</html>