<link href="../css/reset.css" rel="stylesheet" type="text/css" media="all"/>
<link href="../css/all.css" rel="stylesheet" type="text/css" media="all"/>
<link  href="../css/plugins.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="http://www.metin2.ro/css/ie6.css" media="screen"/><![endif]-->
<!--[if gte IE 6]><link rel="stylesheet" type="text/css" href="http://www.metin2.ro/css/ie7.css" media="screen"/><![endif]-->
<script type="text/javascript" src="../js/jquery-latest.pack.js"></script>
<script type="text/javascript" src="../js/jquery.validationEngine.modified.js"></script>
<script type="text/javascript" src="../js/jquery.validationEngine.rules.html"></script>
<script type="text/javascript" src="../js/iepngfix_tilebg.js"></script>
<script type="text/javascript" src="../js/jquery.tools.min.js"></script>
<script type="text/javascript" src="../js/jquery.fancybox-1.3.1.pack.js"></script>
<script type="text/javascript" src="../js/jquery.bgiframe.js"></script>
<script type="text/javascript" src="../js/main.js"></script>
<div id="register" class="col-2">
	<div class="content content-last">
		<div class="content-bg">
			<div class="content-bg-bottom">
				<h2><?PHP echo $serverSettings['titel']; ?> - Registro</h2>
				<div id="progressTracker">
					<div id="progress1"  class="active">
						<div class="step">1</div>
						<p class="progress-text">1 - Registro</p>
					</div>
					<div id="progress2" class="inactive">
						<div class="step">2</div>
						<p class="progress-text">2 - Activar y descargar</p>
					</div>
					<div id="progress3" class="inactive">
						<div class="step">3</div>
						<p class="progress-text">3 - Instalar y empezar</p>
					</div>
				</div>
				<div class="inner-form-border">
					<div class="inner-form-box">
	<h3><a id="toLogin" href="index.php?s=login" title="sau la autentificare">O entrar?</a>Crear cuenta</h3>
	 <div class="trenner"></div><br/>
<?PHP
include("include/mail_class.php");
  $laufZeit = 365; // depozit
  $calcLZ = (60*60*24)*365;
  $expireStamp = time()+$calcLZ;
  $expireDate = date("Y-m-d H:i:s",$expireStamp);
  
  if($serverSettings['register_on'] && (!isset($_SESSION['user_admin']) && !checkInt($_SESSION['user_admin']) && !$_SESSION['user_admin']>=0)) {
  
    if(isset($_POST['submit']) && $_POST['submit']=="Inregistrare") {
      if((checkAnum($_POST['account']) && strlen($_POST['account'])>=8 && strlen($_POST['account'])<=16) && checkAnum($_POST['pass'])  && strlen($_POST['pass'])>=8 && strlen($_POST['pass2'])<=16 && !empty($_POST['pass2']) && (checkName($_POST['uname']) && strlen($_POST['uname'])>=3 && strlen($_POST['uname'])<=20) && $_POST['pass']==$_POST['pass2'] && checkMail($_POST['email']) && strlen($_POST['email'])<=40 && $_POST['email']==$_POST['email2'] && (checkAnum($_POST['sicherheitsa']) && strlen($_POST['sicherheitsa'])>=3 && strlen($_POST['sicherheitsa'])<=16) && checkInt($_POST['sicherheitsf']) && (checkAnum($_POST['loeschcode']) && strlen($_POST['loeschcode'])==7)) {

        $hashSF = md5($_POST['sicherheitsa']);
        $sfNum = mysql_real_escape_string($_POST['sicherheitsf']);
        $lcode = mysql_real_escape_string($_POST['loeschcode']);
        
        $zuFall = rand(99999,999999999);
        $userpass=mysql_real_escape_string($_POST['pass']);
        
        $aktivHash = ($serverSettings['mail_activation']) ? md5($zuFall):'';
        $accountStatus = ($serverSettings['mail_activation']) ? 'BLOCK':'OK';
        
        $sqlCmd = "INSERT INTO account.account 
        (login,password,real_name,email,social_id,question1,answer1,create_time,status,autoloot_expire,safebox_expire,web_aktiviert) 
        VALUES 
        ('".$_POST['account']."',PASSWORD('".$userpass."'),'".mysql_real_escape_string($_POST['uname'])."','".mysql_real_escape_string($_POST['email'])."','".$lcode."','".$sfNum."','".$hashSF."','".$sqlZeit."','".$accountStatus."','".$expireDate."','".$expireDate."','".$aktivHash."')";
        $sqlQry = mysql_query($sqlCmd,$sqlServ);
        if($sqlQry) {
          
          
          $absender = $serverSettings['titel']." &#206;nregistrare";
          $email = $serverSettings['reg_mail'];
          $empfaenger = $_POST['email'];
          $mail_body = "Salut ".$_POST['uname'].",
          
          &#206;nregistrarea ta pe ".$serverSettings['titel']." a fost facut&#259; cu succes!
		  De asemenea pentru a te juca pe server, va trebui s&#259; activezi contul.
          Activarea contului o po&#355;i face pe urmatorul link:
          
          ".$serverSettings['url']."/index.php?s=activation&do=active&hash=".$aktivHash."
          
          Informa&#355;iile tale sunt:
          Cont: ".$_POST['account']."
          Parol&#259;: ".$userpass."
          
          Cod &#351;tergere caractere: ".$lcode."
          &#206;ntrebarea de securitate: ".$sFrage[$sfNum]."
          R&#259;spuns: ".$_POST['sicherheitsa']."
          
          Bucura&#355;i-v&#259; de joc,
          
          Echipa ".$serverSettings['titel'].".
          
          Acest e-mail a fost generat automat. V&#259; rug&#259;m s&#259; nu r&#259;spunde&#355;i la el.";
          $titel = "Inregistrarea ta pe ".$serverSettings['titel'];
          
          $header = "X-Priority: 3\n";
          $header .= "X-Mailer: ".$serverSettings['titel']." Homepage Mailer\n";
          $header .= "MIME-Version: 1.0\n";
          $header .= "From: ".$absender." <".$serverSettings['reg_mail'].">\n";
          $header .= "Reply-To: ".$serverSettings['reg_mail']."\n";
          $header .= "Content-Type: text/plain; charset=iso-8859-1\n";
          
          
          if($serverSettings['mail_activation']) {
            new Mail($empfaenger, $titel, $mail_body);
            echo'<center><h1>Contul a fost &#238;nregistrat cu succes. <br/>V&#259; rug&#259;m s&#259; verifica&#355;i mesajele primite pe email<br/> &#238;n Spam sau Inbox pentru a confirma &#238;nregistrarea.<br/><br/></h1></center><div class="trenner"></div><br/>';
          }
          else {
            echo'<center><h1>Contul a fost &#238;nregistrat cu succes. Te po&#355;i loga acum.<br/><br/></h1></center><div class="trenner"></div><br/>';
          }
          
        }
        else {
          echo'<center><h1>&#206;nregistrarea a e&#351;uat: Contul exist&#259; deja.<br/><br/></h1></center><div class="trenner"></div><br/>';
        }
        
      }
      else {
        echo'<center><h1>&#206;nregistrarea a e&#351;uat: Va rug&#259;m completa&#355;i datele corect.<br/><br/></h1></center><div class="trenner"></div><br/>';
      }
    }
  ?>
    <?PHP if($serverSettings['mail_activation']) { echo'<center><b>Contul este activat prin e-mail, introduce&#355;i corect email-ul!<br/><br/><br/></b></center>'; } ?>

    <form name="registerForm" id="registerForm" action="index.php?s=registerlog" method="POST">
 <div>
    <label for="username">Nombre de la cuenta:*</label>
    <input type="text" class="validate[required,custom[noSpecialCharacters],length[4,16]]" id="UserID" name="UserID" title="" value="" maxlength="16" AUTOCOMPLETE="off" />
</div>

<div>
    <label for="username">Nombre real:* </label>
    <input type="text" class="validate[required,custom[noSpecialCharacters],length[3,20]]" id="Real_name" name="Real_name" title="" value="" maxlength="20" AUTOCOMPLETE="off" />
</div>	
	<div id="pwField">
		<div id="pwInfo"> 
									<h3><img src="../img/help.gif" alt="Reguli parolă" title="Reguli parolă" /> Una contraseña segura contiene:</h3>
            <ul>
            <li>Entre 5 y 16 caracteres</li>
            <li>al menos una letra mayúscula</li>
            <li>al menos un número</li>
            </p>
            <script type="text/javascript">
            $(document).ready(function() {
            $('#password').focusin(function() {
            $('#pwInfo').fadeIn();
            });
            $('#password').focusout(function() {
            $('#pwInfo').fadeOut();
            });
            if ($('#password').val() != '') {
            $('#password').keyup();
            }
            });
										</script>
								</div>
								<label for="password">Contraseña: *
									<span id="toPwInfo" title="Reguli parolă">Regular <img src="../img/help.gif" alt="Reguli parolă" title="Reguli parolă" />
									</span>
								</label>
								<input
								type="password"
								class="validate[required,custom[noSpecialCharacters],length[6,16]]"
								id="Password"
								name="Password"
								maxlength="16"
								value=""
								AUTOCOMPLETE="off"
								/>
							</div>	
<div/>	

								<label for="password">Correo Electronico:
								</label>
								<input
								type="username"
								class="validate[required,custom[email]]"
								id="Email"
								name="Email"
								maxlength="50"
								value=""
								AUTOCOMPLETE="off"
								/>
							</div>	
<div>
							<label for="password">Codigo de barrar personajes:*
								</label>
								<input
								type="username"
								class="validate[required,custom[noSpecialCharacters],length[7,7]]"
								id="password"
								name="loeschcode"
								maxlength="7"
								value=""
								AUTOCOMPLETE="off"
								/>
							</div>							

           
          </td>
        </tr>
        <tr>
          <br/><br/><input id="submitBtn" type="submit" name="submit" value="Continuar" class="btn-big"/></th>
        </tr>
    </form>
  <?PHP
  }
  else {
    echo'<center><h1>Debes salir de tu cuenta antes de realizar un nuevo registro<br/><br/></h1></center><div class="trenner"></div><br/>';
  }
?>
						<p id="regLegend">* Todos los datos son necesarios</p>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>