<?php include_once "common.inc.php";
$signup = getGlobalSetting("SignupPage", 0 );
if($signup == 0){
    echo "<script> window.location.href = 'login.php'; </script>"; exit();
} else if(!empty($_GET['x']) && !empty($_GET['e'])){
    # validate tyhe confirm link...
    $check = md5($_GET['e']."1972");

    # validate confirm code
    if($check == $_GET['x']){
        $q = $db->Execute("UPDATE ". TBL_USERS ." set active = 1 where username = ?", array($_GET['e']));
        echo "<script> window.location.href = 'login.php?confirm=true&email={$_GET['e']}'; </script>";
        exit();
    }
}
?>
<!DOCTYPE html>
<html class="lockscreen">
    <head>
        <meta charset="UTF-8">
        <title>Logaholic | Registration Page</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <link rel="icon" href="favicon.ico" type="image/x-icon">
        <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

        <link href="templates/logaholic_6/css/css.php" rel="stylesheet" type="text/css" />
        <style type="text/css">
            .wlogaholiclogo{ height: 75px; }
            .wlogaholiclogo > span{ float: left; }
            .wlogaholiclogo > i {
                background: rgba(0, 0, 0, 0) url("images/logaholic-ion-logo-blue.png") no-repeat scroll 0 0;
                float: left;
                height: 50px;
                margin: 3px 0 0 90px;
                width: 33px;
            }
            button, a{ cursor: pointer; }
        </style>

        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
          <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>

        <div class="form-box" id="login-box">
            <div>                                
                <div class="callout-success-template callout callout-success" style="display:none;">                              
                    <h4></h4>                               
                </div>
                <div class="callout-danger-template callout callout-danger" style="display:none;">                              
                    <h4></h4>                               
                </div>
            </div>

            <div class="header bg-light-blue wlogaholiclogo"><i></i><span>Logaholic</span></div>

            <form method="post">
                <div class="body bg-gray">
                    <div class="form-group">
                        <input type="text" name="name" class="form-control" placeholder="Full name"/>
                    </div>
                    <div class="form-group">
                        <input type="text" name="email" class="form-control" placeholder="Email"/>
                    </div>
                    <div class="form-group">
                        <input type="password" name="password" class="form-control" placeholder="Password"/>
                    </div>
                    <div class="form-group">
                        <input type="password" name="password2" class="form-control" placeholder="Retype password"/>
                    </div>
                </div>
                <div class="footer">                    

                    <button type="submit" class="btn bg-olive btn-block submit-register">Sign me up</button>

                    <a href="login.php" class="text-center">I am already registered</a>
                </div>
            </form>

        </div>

        <script src="templates/logaholic_6/js/js.php" type="text/javascript"></script>
        <?php
        if (file_exists("templates/custom.js")) {
            echo '<script src="templates/custom.js" type="text/javascript"></script>';
        }
        ?>        
        <script src="app/controller/signup.min.js" type="text/javascript"></script>

    </body>
</html>