<?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
|+===================================================*/ 

include('core.php');
include('includes/session.php');




$pagename = "Compra un Bot";
$pageid = "shopbots";


include('templates/community/subheader.php');
include('templates/community/header.php');

include("locale/".$language."/login.php");
	
	
	
	$do = (Securise($_GET['buy']));
	if($do == "1") {
	if ($myrow['vip_points'] >= "20"){
	
	$text = (FilterText($_POST['text']));
	$motto = (FilterText($_POST['missions']));
	$room_id = (FilterText($_POST['roomid']));
	$nom_bot = (FilterText($_POST['nom']));
	
	$userrooms2 = mysql_query("SELECT * FROM rooms WHERE id = '".$room_id."' AND owner = '".$myrow['username']."'");
		if(mysql_num_rows($userrooms2) == 0)
		{
				$message = "<div id=\"purse-redeem-result\"> 
        <div class=\"redeem-error\"> 
            <div class=\"rounded rounded-red\">Tu non hai stanze.</div> 
        </div> 
</div>";
		} else {
	$userrooms = mysql_query("SELECT * FROM rooms WHERE owner = '".$myrow['username']."'");
		if(mysql_num_rows($userrooms) == 0)
		{
				$message = "<div id=\"purse-redeem-result\"> 
        <div class=\"redeem-error\"> 
            <div class=\"rounded rounded-red\">Tu non hai stanze.</div> 
        </div> 
</div>";
		} else {
	if(strlen($text) > 100){
			$message = "<div id=\"purse-redeem-result\"> 
        <div class=\"redeem-error\"> 
            <div class=\"rounded rounded-red\">La frase del tuo Bot e' troppa lunga.</div> 
        </div> 
</div>";
			} else {
	if(strlen($motto) > 38){
			$message = "<div id=\"purse-redeem-result\"> 
        <div class=\"redeem-error\"> 
            <div class=\"rounded rounded-red\">La missione del tuo Bot e' troppo lunga.</div> 
        </div> 
</div>";
			} else {
	if(strlen($nom_bot) < 3){
			$message = "<div id=\"purse-redeem-result\"> 
        <div class=\"redeem-error\"> 
            <div class=\"rounded rounded-red\">Il nome del tuo Bot e' troppo corto.</div> 
        </div> 
</div>";
			}  else {
if (strlen($nom_bot) > 25){
$message = "<div id=\"purse-redeem-result\"> 
        <div class=\"redeem-error\"> 
            <div class=\"rounded rounded-red\"> 
              Il nome del tuo Bot e' troppo lungo,
            </div> 
        </div> 
</div><br>";
} else {
SendMUS(update_bots, $my_id);
SendMUS(updatepoints, $my_id);
$jetons = 20;
mysql_query("INSERT INTO bots (name, room_id, motto, ai_type, look, walk_mode, rotation, x, y, z, min_x, max_x, min_y, max_y) VALUES ('".$nom_bot."', '".$room_id."', '".$motto."', 'generic', '".$myrow['look']."', 'freeroam', '0', '0', '0', '0', '0', '0', '0', '0');");
$id = mysql_insert_id();
$bot_id = $id;
mysql_query("INSERT INTO bots_user (bots_id, user_id) VALUES ('".$bot_id."', '".$myrow['id']."');");	
mysql_query("INSERT INTO bots_speech (bot_id, text, shout) VALUES ('".$bot_id."', '".$text."', '0');");
mysql_query("UPDATE users SET vip_points = vip_points - '".$jetons."' WHERE username = '".$myrow['username']."'");
	$message = "<div id=\"purse-redeem-result\"> 
        <div class=\"redeem-error\"> 
            <div class=\"rounded rounded-green\"> 
               Il tuo Bot e' stato creato !
			   
            </div> 
        </div>
</div><br>";
}
}
}
}
}
}
} else {
$message = "<div id=\"purse-redeem-result\"> 
        <div class=\"redeem-error\"> 
            <div class=\"rounded rounded-red\"> 
               Non hai abbastanza Bolts !<br>
            </div> 
        </div> 
</div><br>";
}
	}
	?>
<!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="fr" lang="fr">
<head> 
<meta http-equiv="content-type" content="text/html; charset=ISO 5589-1" /> 
<title><?PHP echo $sitename; ?>: <?PHP echo $pagename; ?></title> 
 


 

<meta name="description" content="<?PHP echo $description; ?>" /> 
<meta name="keywords" content="<?PHP echo $keyword; ?>" />  
<!--[if IE 8]>
<link rel="stylesheet" href="<?PHP echo $imagepath; ?>v2/styles/ie8.css" type="text/css" />
<![endif]--> 
<!--[if lt IE 8]>
<link rel="stylesheet" href="<?PHP echo $imagepath; ?>v2/styles/ie.css" type="text/css" />
<![endif]--> 
<!--[if lt IE 7]>
<link rel="stylesheet" href="<?PHP echo $imagepath; ?>v2/styles/ie6.css" type="text/css" />
<script src="<?PHP echo $imagepath; ?>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(http://www.habbo.it/js/csshover.htc); }
</style>
<![endif]--> 
<meta name="build" content="<?PHP echo $build; ?> >> <?PHP echo $version; ?>" /> 
</head>


	 
<body id="home" class=" "> 
<div id="overlay"></div> 
<!-- MENU -->
<!-- FIN MENU -->

<div id='container'>
<div id='content'>
<div id='column1' class='column'>
           
<div class="habblet-container ">		
						<div class="cbb clearfix blue">
	
							<h2 class="title">Compra un bot
							</h2>
					<center>
<?PHP if(isset($message)) { echo $message; } ?>	
			<form action="?buy=1" method="post" id="profileForm"> 
					<br><br>Nome del tuo Bot : <b><input type="text" name="nom" size="25" maxlength="25" value="BOT-<?php echo $myrow['username']; ?>" id="avatarmotto" /></b><br>
				<img src="http://www.habbo.fr/habbo-imaging/avatarimage?figure=<?php echo $myrow['look']; ?>&action=std&gesture=sml&direction=3&head_direction=3&size=b&img_format=gif"><br>
Missione del tuo Bot : <input type="text" name="missions" size="38" maxlength="38" value="Sono il bot di <?php echo $myrow['username'] ?>" id="avatarmotto" />
<br>
Frase del tuo Bot : <input type="text" name="text" size="50" maxlength="100" value="Yeah! <?php echo $shortname ?> Hotel e' il migliore!" id="avatarmotto" />
<br>
Stanza per il Bot : <?php
		$userrooms = mysql_query("SELECT * FROM rooms WHERE owner = '".$myrow['username']."'");
		if(mysql_num_rows($userrooms) == 0)
		{
			echo '<strong>Non hai stanze</strong>';
		}
		else {
		echo "<SELECT NAME='roomid' onChange='FocusObjet()'>"; 
		while($userroom = mysql_fetch_array($userrooms))
		{
		echo "<OPTION VALUE='$userroom[0]'>$userroom[2]</OPTION>\n"; 
		}
		echo "</SELECT>"; 
		}
?>

<br><input type="submit" name="bots" value="Crea il Bot" />
 
</form></center>
			<font color="#A67A3E"><h3><u><b>Prezzo: 20 Bolts</b></u></h3></font>
					
					</div>

				</div>
				
</div>



  

			     	

		


<div id="column2" class="column">

                <div class="habblet-container ">        

                        <div class="cbb clearfix brown ">

    

                           

                                                        
  <h2 class="title">Borsellino

                            </h2>

                        <div id="purse-habblet">

                                                       

<ul>

    <li class="even icon-purse-jetons">

        <div>Voi avete attualmente::</div>

        <span class="purse-balance-amount"><?PHP echo $myrow['vip_points']; ?> Bolts</span>

        
    </li>



 

</ul>

<div id="purse-redeem-result">

</div>    

        </div>



<script type="text/javascript">

    new PurseHabblet();

</script>

    

                        

                    </div>

                </div>

                <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
             
                <div class="habblet-container ">        
    
                        
                        
                    
                </div>

                <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>             

               


                <script type='text/javascript'>if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
             
                             
</div>

<div id="column2" class="column">

                <div class="habblet-container ">        

                        <div class="cbb clearfix brown ">

    

                           

                                                        
  <h2 class="title">Come far comparire il Bot?</h2>
  
  <center><br><b>
						Una volta entrati nella vostra stanza usate questo comandi :
:unload <br><br>
                      </b> </center>



<script type="text/javascript">

    new PurseHabblet();

</script>

    

                        

                    </div>

                </div>

                <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
             
                <div class="habblet-container ">        
    
                        
                        
                    
                </div>

                <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>             

               


                <script type='text/javascript'>if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
             
                             
</div>

                <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>             

               


                <script type='text/javascript'>if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
             
                             
</div>

<script type="text/javascript">
HabboView.run();
</script>    
                </div>
               


    
	<!--[if lt IE 7]>
<script type="text/javascript">
Pngfix.doPngImageFix();
</script>
<![endif]--> 
<!-- FOOTER -->
<?PHP include("./templates/community/footer.php"); ?>
<!-- FIN FOOTER -->


<div style="clear: both;"></div>

<footer>

			 			</footer>

</div></div></div></div>

 
<script type="text/javascript"> 
HabboView.run();

</script>


</body> 
</html> 


