<?php
require_once("../core.php");
$path = file_get_contents("http://www.habbo.it/");
$WebBuild = explode('var habboStaticFilePath = "http://images.habbo.it/habboweb/', $path);
$WebBuild = explode('/web-gallery";', $WebBuild[1]);
$WebBuild = trim($WebBuild[0]);
require_once('API/facebook.php');
$facebook = new Facebook(array('appId' => APP_ID, 'secret' => APP_SECRET, 'cookie' => true));
$session = $facebook->getUser();
$loginUrl = $facebook->getLoginUrl();
$do = Securise($_GET['do']);
$profile = $facebook->api('/me');
$userq = mysql_query('SELECT * FROM users WHERE facebook_id = "'.$profile['id'].'"') or die(mysql_error());
$user = mysql_fetch_array($userq);
$userSQLnum = mysql_num_rows($userq);
if($userSQLnum > 0){
$_SESSION['username'] = $user['username'];
$_SESSION['password'] = $user['password'];
Redirect("/security_check.php");
}else{
$email = utf8_decode($profile['mail']);
$username = FilterText($_POST['username']);
$scredits = "100000";
$spixels = "90000";
/*
* Molto importante modificare "HoloHash" se non si usa HoloCMS.
*/
$hashed_pass = HoloHash($_POST['password'] , $username);
if($profile['gender'] == "male"){ #
//Look Maschile\\
$lookgenerate = "hr-100-0.wa-2007-0.ha-1002-70.hd-180-7.ch-215-66.sh-305-62.lg-270-79";
}
//////////////////////
if($profile['gender'] == "female"){
//Look Femminile\\
$lookgenerate = "hr-545-39.wa-2011-.hd-600-8.ch-685-62.sh-725-62.he-1602-1315.lg-710-1315.ca-1812-,s-0";
}
$authticket = rand(5000,10000).rand(9000,10000);
/////
/*
*Non toccare questa parte è per l'SQL
*/
if(!empty($_POST['username'])){
mysql_query("INSERT INTO users (username, real_name, password, mail, credits, look, motto, account_created, last_online, ip_last, ip_reg, home_room,facebook_id) VALUES ('".$username."', '".FilterText($real_name)."', '".$hashed_pass."', '".$profile['email']."', '50000', '".$lookgenerate."', '".$motto."Benvenuto in $shortname Hotel! ;D', UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), '".$_SERVER['REMOTE_ADDR']."', '".$_SERVER['REMOTE_ADDR']."', '0','".$profile['id']."')");
$user_id = mysql_insert_id();
mysql_query("INSERT INTO user_stats (id, RoomVisits, OnlineTime, Respect, RespectGiven, GiftsGiven, GiftsReceived, DailyRespectPoints, DailyPetRespectPoints) VALUES ('".$user_id."', 0, 0, 0, 0, 0, 0, 3, 3)");
mysql_query("INSERT INTO user_info (user_id, bans, cautions, reg_timestamp, login_timestamp, cfhs, cfhs_abusive) VALUES ('".$user_id."', '0', '0', UNIX_TIMESTAMP(), '0', '0', '0')");
$_SESSION['username'] = $username;
$_SESSION['password'] = $hashed_pass;
Redirect("/security_check.php");
die;
}
?>

<!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">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title><?php echo $shortname; ?> - Facebook Connect</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>$.noConflict();</script>
<link rel="shortcut icon" href="/favicon.ico" type="image/vnd.microsoft.icon"/>
<link rel="stylesheet" href="/web-gallery/v2/styles/quickregister.css" type="text/css" />
<script src="/web-gallery/static/js/quickregister.js" type="text/javascript"></script>

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

<script src="/web-gallery/static/js/libs2.js" type="text/javascript"></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>
<script src="/web-gallery/static/js/common.js" type="text/javascript"></script>
<!--[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/v2/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(/static/js/csshover.htc); }

</style>

<![endif]-->
</head><body id="client" class="background-captcha">
<div id="stepnumbers">
<div class="step1focus">Username e Password</div>
<div class="stephabbo"></div>
</div>
<div id="main-container">
<div id="error-placeholder"></div>
<h2>Registrati in hotel con Facebook</h2>
<div class="delimiter_smooth">
<h3><strong>Attenzione:</strong> L'user verra registrato con l'account di Facebook.</h3><br />
<div class="delimiter_smooth">
<h3>Questa e' la tua prima visita, dunque, scegli i tuoi dati.</h3><br />
</div>
<?php if(!empty($_SESSION['error_message'])){ ?>
<div class="rounded-container"><div style="background-color: rgb(0, 0, 0); "><div style="margin-top: 0px; margin-right: 4px; margin-bottom: 0px; margin-left: 4px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(0, 0, 0); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(118, 19, 19); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(171, 28, 28); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(197, 32, 32); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div></div></div></div><div style="margin-top: 0px; margin-right: 2px; margin-bottom: 0px; margin-left: 2px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(0, 0, 0); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(119, 19, 19); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(202, 33, 33); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div></div></div><div style="margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(0, 0, 0); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(152, 25, 25); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div></div><div style="margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(119, 19, 19); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(0, 0, 0); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(202, 33, 33); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(118, 19, 19); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(171, 28, 28); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(197, 32, 32); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div></div><div class="rounded-done" style="background-color: #cb2121;">
<div id="error-title" class="error">
<?php echo $_SESSION['error_message']; ?><br>
</div>
</div><div style="background-color: rgb(0, 0, 0); "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(197, 32, 32); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(171, 28, 28); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(118, 19, 19); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(0, 0, 0); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(202, 33, 33); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div></div><div style="margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(119, 19, 19); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div><div style="margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(0, 0, 0); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(152, 25, 25); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div></div><div style="margin-top: 0px; margin-right: 2px; margin-bottom: 0px; margin-left: 2px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(0, 0, 0); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(119, 19, 19); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(202, 33, 33); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div></div></div><div style="margin-top: 0px; margin-right: 4px; margin-bottom: 0px; margin-left: 4px; height: 1px; overflow-x: hidden; overflow-y: hidden; background-color: rgb(0, 0, 0); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(118, 19, 19); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(171, 28, 28); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(197, 32, 32); "><div style="height: 1px; overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; background-color: rgb(203, 33, 33); "></div></div></div></div></div></div></div>
<?php 	unset($_SESSION['error_message']);
} ?>
<div class="flat">&nbsp;</div>
<div class="arrow">&nbsp;</div>
<div class="flat">&nbsp;</div>
</div>
<form action="" id="captcha-form" method="post">
<div id="inner-container">
<div class="field">
<label for="email-address">Username</label>
<input type="text" id="pseudo" name="username" value=""/>
<br> <br/>
<label for="email-address">Password</label>
<input type="password" id="password" name="password" value=""/>
<br> <br/>
</div>
<input type="hidden" name="APP_FACEBOOK" value="<?php echo rand(1,500); ?>"/>
<input type="hidden" name="hidden" value="hidden"/>
</form>
</div>
<div id="select">
<a href="/" id="back-link"></a>
<div class="button">
<a id="" href="#" onclick="document.forms['captcha-form'].submit();" class="area">Registrati</a>
<span class="close"></span>
</div>
</div>
</div>
<script type="text/javascript">

    HabboView.run();

</script>
</body>
</html>
<?php
}
?>