예제 #1
0
파일: login.php 프로젝트: klangrud/tcshl
function process_login_form($smarty)
{
    global $Link;
    $errors = array();
    global $username;
    global $password;
    $Query = 'SELECT * FROM ' . USER . ' WHERE eMail = "' . $username . '" AND password = "******" AND accessLevel > 0';
    $Results = mysql_query($Query, $Link) or die("sp_clubs (Line " . __LINE__ . "): " . mysql_errno() . ": " . mysql_error());
    $num_rows = mysql_num_rows($Results);
    if ($num_rows == 1 && ($row = mysql_fetch_array($Results))) {
        // OK to Enter;
        // set userdata;
        $_SESSION['logged_in'] = true;
        $_SESSION['userid'] = $row['userID'];
        $_SESSION['playerid'] = $row['playerId'];
        $_SESSION['username'] = $row['eMail'];
        $_SESSION['firstname'] = $row['firstName'];
        $_SESSION['lastname'] = $row['lastName'];
        $_SESSION['email'] = $row['eMail'];
        $_SESSION['site_access'] = $row['accessLevel'];
        session_write_close();
        set_cookie($row);
        //TODO: Setup where the user goes once login is verified
        if (true) {
            // User
            header("Location: account.php");
        } else {
            // Disabled Account
            header("Location: logout.php");
        }
    } else {
        $errors[] = "Access Not Permitted:<br />Username / Password Error";
        handle_errors($errors);
        handle_reposts();
    }
}
예제 #2
0
$PAYMENT_DATE_4 = '';
initialize_payment_dates($SEASON);
$smarty->assign('daysToFirstPayment', get_payment_date_difference(1));
$smarty->assign('daysToSecondPayment', get_payment_date_difference(2));
$smarty->assign('daysToThirdPayment', get_payment_date_difference(3));
$smarty->assign('daysToFourthPayment', get_payment_date_difference(4));
if (isset($_POST['action']) && $_POST['action'] == "Edit Payments") {
    // If form does not validate, we need to return with errors.
    if ($errors = validate_payments_form()) {
        handle_errors($errors);
        handle_reposts();
    } else {
        // If errors occur while trying to create user, we need to return with errors.
        if ($errors = process_payments_form()) {
            handle_errors($errors);
            handle_reposts();
        } else {
            header("Location: editpaymentplan4.php?id={$P4_ID}&success=yes");
        }
    }
} else {
    populateFieldsFromDatabase();
}
format_date_fields();
$smarty->assign('P4_AUDIT', $P4_AUDIT);
$smarty->assign('P4_NAME', $P4_NAME);
$smarty->assign('P4_ID', $P4_ID);
$smarty->assign('P4_PAY1_PROCESS', $P4_PAY1_PROCESS);
$smarty->assign('P4_PAY1_DATE_SELECT', $P4_PAY1_DATE_SELECT);
$smarty->assign('P4_PAY1_DATE', $P4_PAY1_DATE);
$smarty->assign('P4_PAY1_DATE_DB', $P4_PAY1_DATE_DB);
예제 #3
0
function process_registration_form($smarty)
{
    global $Link;
    $errors = array();
    $fname = format_uppercase_text($_POST['firstname']);
    $lname = format_uppercase_text($_POST['lastname']);
    $email = format_trim(strtolower($_POST['email']));
    $pass = md5($_POST['password']);
    $verificationKey = createVerificationKey($email);
    //Check if user exists with accessLevel > 0.  If true, then we will just error out registration and explain that user exists.
    $query = 'SELECT email, accessLevel FROM ' . USER . ' WHERE email = "' . $email . '" AND accessLevel > 0';
    $result = mysql_query($query, $Link) or die("sp_clubs (Line " . __LINE__ . "): " . mysql_errno() . ": " . mysql_error());
    if ($result && mysql_num_rows($result) > 0) {
        $errors[] = 'User already exists.  If you forgot your password, <a href="resetpassword.php">click here</a> to have it reset.';
        handle_errors($errors);
        handle_reposts();
    }
    if (count($errors) == 0) {
        //Check if user exists with accessLevel 0.  If true, then we will just resend validation email
        $query = 'SELECT email, accessLevel, verificationKey FROM ' . USER . ' WHERE email = "' . $email . '" AND accessLevel = 0';
        $result = mysql_query($query, $Link) or die("sp_clubs (Line " . __LINE__ . "): " . mysql_errno() . ": " . mysql_error());
        if ($result && mysql_num_rows($result) > 0 && ($row = mysql_fetch_array($result))) {
            $verificationKey = $row['verificationKey'];
            send_validation_email($email, $verificationKey);
            header("Location: pending.php");
        } else {
            // Insert new user query
            $query = "INSERT INTO " . USER . " (firstname, lastname, email, password, verificationKey) ";
            $query .= "VALUES ('{$fname}', '{$lname}', '{$email}', '{$pass}', '{$verificationKey}')";
            $result = mysql_query($query, $Link) or die("sp_clubs (Line " . __LINE__ . "): " . mysql_errno() . ": " . mysql_error());
            if ($result) {
                send_validation_email($email, $verificationKey);
                send_admin_email();
            } else {
                $errors[] = "No user was created.";
            }
        }
        // End of else
    }
    // if (!errors)
    return $errors;
}