}
    print_r(json_encode($response));
}
//	VISHWAS : 4 Dec 2015 :: Commenting following line as this file is already included at top.
//require_once '../core/config.php';
if (isset($_POST['reset']) && $_POST['reset'] != "") {
    $crud = CRUD::getInstance();
    $find = $crud->select("client_reset_tokens", "client_id", "where hash='{$_POST['reset']}'");
    if ($find) {
        $client_id = $crud->getFirst()['client_id'];
        $client = new Client();
        $data = $client->get($client_id);
        if (Hash::get($data['email'], 'reset_password') == $_POST['reset']) {
            $salt = Hash::salt(6);
            $password = Hash::get($_POST['new_password'], $salt);
            $update = $client->edit(array('password' => $password, 'salt' => $salt), $client_id);
            //var_dump($update); Vishwas : 4 Dec 2015 : Removing previous code.
            if ($update) {
                $crud->delete("client_reset_tokens", "where hash='{$_POST['reset']}'");
                //	Vishwas : 4 Dec 2015 :: Commenting following code as Shrikant have added different code for it.
                //	echo 'Your password has been reset.<br/><a href="' . RESOURCE_PATH_DIY . 'login">Go To Login Page</a>';
                // @shrikant:Correct reset password thank you page design
                echo '<div class="container"><header style="background-color:#fff; height:70px;width:100%;"><img src="http://plobalapps.com/images/plobal_apps_logo.png" height="35" style="margin:10px;"></header><div class="min-container" style="width:1000px; box-shadow: 0 0 3px -1px rgba(0, 0, 0, 0.42); border-radius: 4px;  padding: 59px 0; margin:25px auto; text-align:center; background-color:#f1f1ff1; font-family:arial;"><h3 style="font-size:25px; line-height:40px;margin:0px;">Thank You</h3><p style="font-size:16px;padding:8px 0;">Your password has been reset.</p><a style="background-color:#2075f2;border-radius: 4px;color: #fff;padding: 10px 15px;text-decoration: none;" href="' . RESOURCE_PATH_DIY . 'login">Go To Login Page</a></div></div>';
            }
            //VISHWAS : 4 Dec 2015 :: Added missing '}'. This was causing fatal error and resulting into Failure in sending "Reset Password' Mail.
        } else {
            //	VISHWAS : 4 Dec 2015 :: Matching style with success message.
            echo '<div class="container"><header style="background-color:#fff; height:70px;width:100%;"><img src="http://plobalapps.com/images/plobal_apps_logo.png" height="35" style="margin:10px;"></header><div class="min-container" style="width:1000px; box-shadow: 0 0 3px -1px rgba(0, 0, 0, 0.42); border-radius: 4px;  padding: 59px 0; margin:25px auto; text-align:center; background-color:#f1f1ff1; font-family:arial;"><p style="font-size:16px;padding:8px 0;">Invalid verification code.</p><a style="background-color:#2075f2;border-radius: 4px;color: #fff;padding: 10px 15px;text-decoration: none;" href="' . RESOURCE_PATH_DIY . 'login">Go To Login Page</a></div></div>';
            //echo "Invalid verification code";
        }
    } else {
require_once '../core/config.php';
if (isset($_GET['verify']) && $_GET['verify'] != "") {
    $crud = CRUD::getInstance();
    $find = $crud->select("client_reset_tokens", "client_id,expired_date", "where hash='{$_GET['verify']}'");
    /*
     * 25-03-15 :: check if hash is correct, check expiration, update is_verified and update expiration for hash 
     */
    if ($find) {
        $client_id = $crud->getFirst()['client_id'];
        $expired_date = $crud->getFirst()['expired_date'];
        if ($expired_date == "0000-00-00 00:00:00") {
            $client = new Client();
            $data = $client->get($client_id);
            if ($client->data()['is_verified'] == 0) {
                $client->edit(array('is_verified' => 1), $client_id);
                /*
                 * 27-03-15 :: expired_date updated  istead of delete
                 */
                $crud->update("client_reset_tokens", array('expired_date' => date("Y-m-d H:i:s")), "where type='email' and hash='{$_GET['verify']}'");
                $mail = new Mail();
                $mail->welcomeMail(array(array('name' => $data['name'], 'email' => $data['email'])));
            }
            /* redirect path corrected */
            echo '<body style="background-color:#f4f5f9; margin:0"><div class="page" style="width:100%; float:left; background-color:#f4f5f9;font-family:Arial, Helvetica, sans-serif;" >	<div class="header" style="width:100%; float:left; height:75px; background-color:#fff;"><div class="left_header" style="float:left; width:50%;  "><img style="margin:15px 0px 0px 50px;"  src="http://plobalapps.com/diy/images/emailer/plobal-logo.png" height="40"  /> </div> <div class="right_header" style="float:right; width:50%; "><div class="social_icons" style="float:right; margin:24px 0px 15px 0px;width:90px;"><a href="#"> <img style="margin-right:10px;" src="http://plobalapps.com/diy/images/emailer/fb-icon.png"  /></a><a href="#"> <img style="margin-right:10px;" src="http://plobalapps.com/diy/images/emailer/twitter-icon.png"  /></a></div><h3 style="line-height:70px; float:right; font-size:14px; color:#8b8b8b;   padding:0px; font-weight:normal;margin:0 15px 0 0;"><img src="http://plobalapps.com/diy/images/emailer/call.png" style="float:left; margin:24px 0px 3px 0px;" /> &nbsp;+91 9819405002&nbsp; </h3></div></div><div class="container" style="width:600px; margin:120px auto 0 auto; background-color:#fff; text-align:center; padding:100px;"><div class="inner_container" style="background-color:#fff;"><p style="font-size:20px;color:#222;">Thank You For Verifying Your Email Address</p><br /><br /><a style="background-color:#1fafec; color:#fff; padding:15px 25px; text-decoration:none;" href="' . RESOURCE_PATH_DIY . 'dashboard">Visit Homepage</a></div> </div>    <div class="contant">
    	    </div></div></body>';
        } else {
            echo '<body style="background-color:#f4f5f9; margin:0"><div class="page" style="width:100%; float:left; background-color:#f4f5f9;font-family:Arial, Helvetica, sans-serif;" >	<div class="header" style="width:100%; float:left; height:75px; background-color:#fff;">    	<div class="left_header" style="float:left; width:50%;  ">        <img style="margin:15px 0px 0px 50px;"  src="http://plobalapps.com/diy/images/emailer/plobal-logo.png" height="40"  /> </div> <div class="right_header" style="float:right; width:50%; "><div class="social_icons" style="float:right; margin:24px 0px 15px 0px;width:90px;"><a href="#"> <img style="margin-right:10px;" src="http://plobalapps.com/diy/images/emailer/fb-icon.png"  /></a><a href="#"> <img style="margin-right:10px;" src="http://plobalapps.com/diy/images/emailer/twitter-icon.png"  /></a></div><h3 style="line-height:70px; float:right; font-size:14px; color:#8b8b8b;   padding:0px; font-weight:normal;margin:0 15px 0 0;"><img src="http://plobalapps.com/diy/images/emailer/call.png" style="float:left; margin:24px 0px 3px 0px;" /> &nbsp;+91 9819405002&nbsp; </h3></div></div><div class="container" style="width:600px; margin:120px auto 0 auto; background-color:#fff; text-align:center; padding:100px;"><div class="inner_container" style="background-color:#fff;"><p style="font-size:20px;color:#222;">Expired verification link</p><br /><br /><a style="background-color:#1fafec; color:#fff; padding:15px 25px; text-decoration:none;" href="' . RESOURCE_PATH_DIY . 'dashboard">Visit Homepage</a></div> </div>    <div class="contant">
    	    </div></div></body>';
        }
    } else {