コード例 #1
0
ファイル: auth.php プロジェクト: shsirk/htf
function authenticate()
{
    $username = trim($_POST["username"]);
    $password = trim($_POST["password"]);
    $captcha = trim($_POST["captcha"]);
    if ($username == '' || $password == '' || $captcha == '') {
        set_login_error("Any emtpy field is not allowed");
    } else {
        include_once "/var/www/includes/captch_code.php";
        if (check_code($captcha)) {
            $cr = new crypto();
            $password = $cr->one_way_crypt($password);
            $u = new user();
            if ($u->validate_user($username, $password)) {
                $session = new user_session();
                setcookie('app_session_id', $session->create_session_id($u->get_uid(), $u->get_uname(), $u->get_email()));
                session_register($username);
                header("Location: /challenges.php");
            } else {
                set_login_error("Authentication Failed");
            }
        } else {
            set_login_error("Invalid Captcha");
        }
    }
}
コード例 #2
0
ファイル: index.php プロジェクト: shsirk/htf
        <header>
          <div id="logo">
            <div id="logo_text">
              <!-- class="logo_colour", allows you to change the colour of the text -->
              <h1><a href="index.php">HackWeek<span class="logo_colour">#hackTheFlag</span></a></h1>
              <h2>Hack like ninja!, play for pride, fun and prizes!</h2>
            </div>
          </div>
      
      <nav>
		<?php 
include_once "/var/www/includes/error.php";
$msg = get_login_error();
if ($msg != '') {
    set_login_error("");
    ?>
			<div id="menu_container">
				<center><h3 id="err_msg" style="color: red"><?php 
    echo $msg;
    ?>
</h3></center>
			</div>
		<?php 
} else {
    ?>
			<div id="menu_container">
				<center><h3 id="err_msg" style="color: red"></h3></center>
			</div>
		<?php 
}