<?php
ob_start("ob_gzhandler");
error_reporting(0);
include_once 'includes/db.php';
include_once 'includes/User.php';
session_start();
$session_uid = isset($_SESSION['uid']) ? $_SESSION['uid'] : NULL;
$User = new User($db);
if(!empty($session_uid))
{
header("location:index.php");
}

if(empty($_GET['id']))
{
header("location:index.php");
}
else
{
$get_active_code=$_GET['id'];
$Activecode=$User->Activecode($get_active_code);
if(empty($Activecode))
{
header("location:index.php");
}
}




$Get_Configurations=$User->Get_Configurations();
$forgot=$Get_Configurations['forgot'];
//Login
$login_error='';
if($_POST['newpassword'] && $_POST['confirmpassword']  )
{
$newpassword=$_POST['newpassword'];
$confirmpassword=$_POST['confirmpassword'];

if (strlen($newpassword)>=8)
{
if($newpassword==$confirmpassword)
{
$ChangePassword=$User->ChangePassword($newpassword,$get_active_code);
$login_error="<span class='msg'>Password has been changed successfully. </span>";
}
else
{
  $login_error="<span class='error'>New Password and Confirm Password not matched. </span>";
}
}
else
{
$login_error="<span class='error'>Password minimum 8 characters. </span>";
}

}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>SocialMat  || Login and Register Page</title>
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="stylesheet" type="text/css" href="css/animate.min.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script src="js/login.js" type="text/javascript"></script>  
<script src="js/loginsignup.js" type="text/javascript"></script> 
<script src="js/md.js"></script>
<script type="text/javascript">
$(window).load(function() {
 $('.preloader').addClass('animated fadeOut').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
 $('.preloader').hide();
});
$(".typed").typewriter({
   speed: 60
});	
});
</script>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>

<body>
<div class="preloader"><img src="css/icons/loader.gif" alt="Preloader image"></div>			
<div id="large-header" class="large-header">
<canvas id="demo-canvas"></canvas>
</div>
		
<div class="global-main-container">
<form method="post" action="" name="login">
<div class="login">
<div class="input-global">
<input type="password" name="newpassword" class="input-style background-pass" placeholder="Password" AUTOCOMPLETE='OFF'/>
</div>
<div class="input-global">
<input type="password" name="confirmpassword" class="input-style background-pass-again" placeholder="Password" AUTOCOMPLETE='OFF'/>
</div>
<div ><?php echo $login_error; ?></div>
</div>
<div>
</div>
<div id="button">
<input type="submit" class="newpass_btn background-newpass" value="Change Password">
</div>
</div>
</form>
</div>
<div class="footer"><div class="footer_in"><!--About Area--></div></div>
<script src="js/typewriter.js"></script>
<script src="js/bubble.js" type="text/javascript"></script>  
<script src="js/rAF.js" type="text/javascript"></script>  
</body>
</html>
