<link  href="../css/plugins.css" rel="stylesheet" type="text/css" media="screen" />
<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']; ?> - Contul t&#259;u</h2>
				<div class="inner-form-border">
					<div class="inner-form-box">
	<h3><a id="toLogin" href="index.php?s=profil" title="Datele utilizatorului">Datele utilizatorului</a>&#206;ntrebare de securitate</h3>
 <div class="trenner"></div><br/>
 <?PHP

  if(isset($_SESSION['user_admin']) && checkInt($_SESSION['user_admin']) && $_SESSION['user_admin']>=0) {
    
     if(isset($_POST['frage']) && $_POST['frage']=="Schimba") {

      if(!empty($_POST['opass']) && checkInt($_POST['sicherheitsf']) && checkAnum($_POST['sicherheitsa']) && strlen($_POST['sicherheitsa'])>=3 && strlen($_POST['sicherheitsa'])<=16) {
        
        $oldPass = mysql_real_escape_string($_POST['opass']);
        $frage = mysql_real_escape_string($_POST['sicherheitsf']);
        $antwort = mysql_real_escape_string(md5($_POST['sicherheitsa']));
        
        $sqlCmd = "SELECT id,login FROM account.account WHERE password=PASSWORD('".$oldPass."') AND id='".$_SESSION['user_id']."' LIMIT 1";
        $sqlQry = mysql_query($sqlCmd,$sqlServ);
        
        if(mysql_num_rows($sqlQry)==1) {
        
          $sfCmd = "UPDATE account.account SET question1='".$frage."',answer1='".$antwort."' WHERE id='".$_SESSION['user_id']."' LIMIT 1;";
          $sfUpdate = mysql_query($sfCmd,$sqlServ);
          
          if($sfUpdate) {
            echo'<h1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#206;ntrebarea de securitate a fost schimbat&#259; cu succes.<br/><br/></h1><div class="trenner"></div>';
          }
          else {
            echo'<h1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Schimbarea a e&#351;uat.<br/><br/></h1><div class="trenner"></div>';
          }
          
        }
        else {
          echo'<h1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Parola care a&#355;i introdus-o este incorect&#259;.<br/><br/></h1><div class="trenner"></div>';
        }
        
      }
      else {
        echo'<h1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nu a&#355;i introdus toate informa&#355;iile corect.<br/><br/></h1><div class="trenner"></div>';
      }
    }
	
  ?>
  <?PHP
  }
  else {
    echo'<h1><br/>Trebuie s&#259; fi &#238;nregistrat pentru a vedea aceast&#259; zon&#259;!</h1><br/>';
  }
?>

        <form name="registerForm" id="registerForm" action="index.php?s=seq_q" method="POST">
		<div> 					
		<div>
							<label for="password">Parol&#259; cont utilizator:*
								</label>
								<input
								type="password"
								class="validate[required,custom[noSpecialCharacters],length[8,16]]"
								id="password"
								name="opass"
								maxlength="16"
								value=""
								AUTOCOMPLETE="off"
								/>
							</div>
		
<label for="username">&#206;ntrebarea de securitate:*</label><select name="sicherheitsf"><br/><br/>
                  <?PHP
                    foreach($sFrage AS $fragew => $frage) {
                      echo'<option value="'.$fragew.'">'.$frage.'</option>';
                    }
                  ?>
                </select><br/><br/>
										<div>
							<label for="password">R&#259;spuns:*
								</label>
								<input
								type="password"
								class="validate[required,custom[noSpecialCharacters],length[3,16]]"
								id="password"
								name="sicherheitsa"
								maxlength="16"
								value=""
								AUTOCOMPLETE="off"
								/>
							</div><br/><br/>
              <input id="submitBtn" type="submit" name="frage" value="Schimba" class="btn-bg"/>

          </table></div>
        </form>
						<p id="regLegend">* este necesar</p>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>	