Exemplo n.º 1
0
//$rules[] = "valid_email,email,That doesn't look like a valid email address.";
//$rules[] = "required,password,Please enter your password.";
//$errors = validateFields('add_hunt', $_POST, $rules);
//var_dump_j("jeff errors", $errors);
//exit;
// if there were errors, re-populate the form fields
if (!empty($errors)) {
    $fields = $_POST;
    header("Location: /HuntingHarvestAddHunt.php");
} else {
    // They are trying to insert a new hunt.
    try {
        $lastName = $_POST['last_name'];
        $firstName = $_POST['first_name'];
        $newHunter = new hunter_info();
        $newHunter->setLastName($lastName);
        $newHunter->setFirstName($firstName);
        $createdDateString = getNow();
        $newHunter->setCreated($createdDateString);
        saveNewHunter($newHunter);
        header("Location: /php/hunters_admin_home.php");
    } catch (Exception $e) {
        // Unsuccessful login
        if ($e->getMessage() == 'no user found') {
            addError('login', 'We could not find you in our system');
            header('Location: /index.php');
        } else {
            if ($e->getMessage() == 'no results') {
                addError('login', 'Opps, looks like our system is down right now.');
                header('Location: /index.php');
            }
Exemplo n.º 2
0
function createHunterFromRow($dbRow)
{
    $rowHunter = new hunter_info();
    $rowHunter->setId($dbRow['id']);
    $rowHunter->setFirstName($dbRow['first_name']);
    $rowHunter->setLastName($dbRow['last_name']);
    $rowHunter->setCreated($dbRow['created']);
    return $rowHunter;
}