<title><?php echo Config::$_SITE_NAME; ?></title>
<?php
if(!defined('panel'))
	die('Nope.');	

if(!isset(Config::$_url[1])) {
	echo '
<title>Error! Invalid ID</title>
	</div>
	<div class="main-content">	
			<div class="breadcrumbs" id="breadcrumbs">
				<script type="text/javascript">
					try{ace.settings.check("breadcrumbs" , "fixed")}catch(e){}
				</script>

				<ul class="breadcrumb">
					<li>
						<i class="ace-icon fa fa-home home-icon"></i>
						<a href="<?php echo Config::$_PAGE_URL; ?>">Home</a>
					</li>
				</ul><!-- /.breadcrumb -->

				<div class="nav-search" id="nav-search">
					<form method="POST" action="<?php echo Config::$_PAGE_URL; ?>search">
						<span class="input-icon">
							<input type="text" placeholder="Search ..." name="sname" id="username" type="submit" class="nav-search-input" autocomplete="on"> 
							<i class="ace-icon fa fa-search nav-search-icon"></i>
						</span>
					</form>
				</div> <!-- /.nav-search -->
			</div>

	<div class="page-content">	
	<div class="alert alert-danger">Error! Invalid ID.</div>';
	echo '<meta http-equiv="refresh" content="0;URL=\''.Config::$_PAGE_URL.'\'/>';
	return;
}
?>
	</div>
		<div class="main-content">	
			<div class="breadcrumbs" id="breadcrumbs">
				<script type="text/javascript">
					try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
				</script>

				<ul class="breadcrumb">
					<li>
						<i class="ace-icon fa fa-home home-icon"></i>
						<a href="<?php echo Config::$_PAGE_URL; ?>">Home</a>
					</li>
				</ul><!-- /.breadcrumb -->

				<div class="nav-search" id="nav-search">
					<form method="POST" action="<?php echo Config::$_PAGE_URL; ?>search">
						<span class="input-icon">
							<input type="text" placeholder="Search ..." name="sname" id="username" type="submit" class="nav-search-input" autocomplete="on"> 
							<i class="ace-icon fa fa-search nav-search-icon"></i>
						</span>
					</form>
				</div> <!-- /.nav-search -->
			</div>	
<div class="page-content">
<div class="row-fluid">
<div class="span12">
<?php 
	$q = Config::$g_con->prepare('SELECT * FROM `changemail` WHERE `ChangeMailKey` = ?'); 
	$q->execute(array(Config::$_url[1]));
	if($row = $q->fetch(PDO::FETCH_OBJ)) {

	$q = Config::$g_con->prepare('UPDATE `users` SET `Email` = ? WHERE `name` = ?');
	$q->execute(array($row->email,$row->name));	
	
	$dele = Config::$g_con->prepare("DELETE FROM changemail WHERE ChangeMailKey='".Config::$_url[1]."'");
	$dele->execute();
?>
<div class="alert alert-success"><h4>Email confirmat!</h4><br>Emailul tau a fost confirmat cu succes (<?php echo $row->email ?>)!</div>
$q = Config::$g_con->prepare('UPDATE `users` SET `Email` = ?  WHERE `name` = ?');
$q->execute(array($_POST['email'],$data->name));
<?php 
echo '<meta http-equiv="refresh" content="2;URL=\''.Config::$_PAGE_URL.'\'/>';
} else { ?>
<div class="alert alert-danger"><h4>Link invalid!</h4><br>Nu iti poti schimba emailul.<br>Link-urile expira dupa 2 zile sau cand emailul este schimbat.<br>
Daca ai schimbat emailul recent sau ai primit emailul acum mai mult de 2 zile, incearca sa-ti schimbi emailul din nou.<br>
Incearca sa setezi emailul din nou peste cateva ore. Daca nu va functiona nici atunci, deschide un tichet pe user panel.</div>
<?php
echo '<meta http-equiv="refresh" content="2;URL=\''.Config::$_PAGE_URL.'\'/>';
}
?>
