コード例 #1
0
ファイル: verify.php プロジェクト: nilav/nitc-leave-app
<?php 
//    TODO: Make email and password checkin as MD5...
if (isset($_POST["email"])) {
    $email = $_POST["email"];
    $userpassword = $_POST["userpassword"];
    if ($email == "" || $userpassword == "") {
        $error = 1;
    } else {
        include "DB/initDB.php";
        include "DB/registerDB.php";
        $rDB = new registerDB();
        $id = $rDB->checkLogin($email, $userpassword);
        if ($id) {
            $userType = $rDB->getUserType($id);
            session_start();
            $sid = session_id();
            $_SESSION["usertype"] = $userType;
            $_SESSION["leave_app_id"] = $id;
            header("Location: profile.php");
        } else {
            $error = 2;
        }
    }
}
コード例 #2
0
ファイル: register.php プロジェクト: nilav/nitc-leave-app
<!--
TODO: Make sure password is used as md5
To change this template, choose Tools | Templates
and open the template in the editor.
-->

<?php 
$error = 0;
if (isset($_GET['error'])) {
    $error = $_GET['error'];
}
require_once 'DB/initDB.php';
require_once 'DB/registerDB.php';
$rDB = new registerDB();
$departmentlist = $rDB->getDepartmentList();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Register</title>
        
        <script type="text/javascript" src="static/js/jquery.js"></script>
        <script type="text/javascript" src="static/js/register.js"></script>
    </head>
    <body>
        <div id="registration_form">
            <?php 
switch ($error) {
    case 1:
        echo "<div class='form-error' style='display: block;'>";
コード例 #3
0
ファイル: registerUser.php プロジェクト: nilav/nitc-leave-app
<?php

require_once 'DB/initDB.php';
require_once 'DB/registerDB.php';
$rDB = new registerDB();
$redirect = 'register.php';
$fname = htmlspecialchars(trim($_POST['first_name']));
$lname = htmlspecialchars(trim($_POST['last_name']));
$email = mysql_escape_string(trim($_POST['email']));
$sex = mysql_escape_string(trim($_POST['sex']));
$contact = mysql_escape_string(trim($_POST['contact']));
$pass1 = mysql_escape_string(trim($_POST['pass1']));
$pass2 = mysql_escape_string(trim($_POST['pass2']));
$user_type = mysql_escape_string(trim($_POST['user_type']));
$category = mysql_escape_string(trim($_POST['category']));
//    $user_name= $_POST['user_name'];
$activated = 0;
if (isset($_POST['department'])) {
    $department = $_POST['department'];
} else {
    $department = 0;
    //User is office staff
}
if (isset($_POST['roll_number'])) {
    $roll_number = $_POST['roll_number'];
}
if (!preg_match('/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/', $email)) {
    header("Location:/" . $redirect . "?error=1");
    die;
}
if ($rDB->checkExistingUser($email)) {