<?php 
include "ASEngine/AS.php"; 
if(!isset($_GET['k']))
    header("Location: login.php");
?>
<!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" />
    <title><?php echo WEBSITE_NAME; ?></title>
    <meta name="author" content="Bookingo" />
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <meta name="application-name" content="Bookingo" />

    <!-- Mobile Specific Metas -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- Force IE9 to render in normla mode -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <!-- Le styles -->
    <link href="<?php echo SITE_URL; ?>css/bootstrap/bootstrap.css" rel="stylesheet" />
    <link href="<?php echo SITE_URL; ?>css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
    <link href="<?php echo SITE_URL; ?>css/supr-theme/jquery.ui.supr.css" rel="stylesheet" type="text/css"/>
    <link href="<?php echo SITE_URL; ?>css/icons.css" rel="stylesheet" type="text/css" />
    <link href="<?php echo SITE_URL; ?>plugins/forms/uniform/uniform.default.css" type="text/css" rel="stylesheet" />

    <!-- Main stylesheets -->
    <link href="<?php echo SITE_URL; ?>css/main.css" rel="stylesheet" type="text/css" /> 

    <!--[if IE 8]><link href="css/ie8.css" rel="stylesheet" type="text/css" /><![endif]-->
    
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script type="text/javascript" src="js/libs/excanvas.min.js"></script>
      <script type="text/javascript" src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
      <script type="text/javascript" src="js/libs/respond.min.js"></script>
    <![endif]-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="<?php echo SITE_URL; ?>images/favicon.ico" />
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<?php echo SITE_URL; ?>images/apple-touch-icon-144-precomposed.png" />
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo SITE_URL; ?>images/apple-touch-icon-114-precomposed.png" />
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php echo SITE_URL; ?>images/apple-touch-icon-72-precomposed.png" />
    <link rel="apple-touch-icon-precomposed" href="<?php echo SITE_URL; ?>images/apple-touch-icon-57-precomposed.png" />

    <script type="text/javascript" src="<?php echo SITE_URL; ?>js/libs/modernizr.js"></script>

    </head>
      
    <body class="loginPage">

    <div class="container-fluid">

        <div id="header">

            <div class="row-fluid">

                <div class="navbar">
                    <div class="navbar-inner">
                      <div class="container">
                            <a class="brand" href="./"><img src="images/logo.png" /></a>
                      </div>
                    </div><!-- /navbar-inner -->
                  </div><!-- /navbar -->
                

            </div><!-- End .row-fluid -->

        </div><!-- End #header -->

    </div><!-- End .container-fluid -->    

    <div class="container-fluid">

        <div class="loginContainer" id="confirm-modal">
            <h3>Confirmation</h3>
            				<div class="well">
                                <?php
                                $key = $_GET['k'];
                                $result = $db->select(
                                        "SELECT * FROM `as_users`
                                         WHERE `confirmation_key` = :k", array("k" => $key)
                                );
                                if (count($result) == 1) {
                                    $db->update(
                                            'as_users', array("confirmed" => "Y"), "`confirmation_key` = :k", array("k" => $key)
                                    );

                                    echo "<h4 class='text-success'>Email confirmed.</h4>";
                                    echo "<h5 class='text-success'>You can <a href='login.php'>log in</a> now.</h5>";
                                }
                                else
                                    echo "<h5 class='text-error'>User with this key doesn't exist in our database.</h5>";
                                ?>
                            </div>
                           
        </div>

    </div><!-- End .container-fluid -->                
        
        <!-- Le javascript
    ================================================== -->
    <script  type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="<?php echo SITE_URL; ?>js/bootstrap/bootstrap.js"></script>  
    <script type="text/javascript" src="<?php echo SITE_URL; ?>plugins/forms/validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="<?php echo SITE_URL; ?>plugins/forms/uniform/jquery.uniform.min.js"></script>

        
    <script type="text/javascript" src="<?php echo SITE_URL; ?>js/sha512.js"></script>
    <script type="text/javascript" src="<?php echo SITE_URL; ?>ASLibrary/js/asengine.js"></script>
    <script type="text/javascript" src="<?php echo SITE_URL; ?>ASLibrary/js/passwordreset.js"></script>
    
    </body>
</html>