コード例 #1
0
{
    unset($_POST['empl_id']);
    unset($_POST['empl_name']);
    unset($_POST['gross_salary']);
}
if (isset($_POST['submit'])) {
    if (strlen(trim($_POST['empl_name'])) == 0) {
        display_error(_("The employee name cannot be empty."));
        set_focus('empl_name');
        return false;
    }
    if (isset($_POST['empl_id'])) {
        $empl_id = update_employee($_POST['empl_id'], $_POST['empl_name'], $_POST['pre_address'], $_POST['per_address'], $_POST['date_of_birth'], $_POST['age'], $_POST['mobile_phone'], $_POST['email'], $_POST['grade'], $_POST['department'], $_POST['designation'], $_POST['gross_salary'], $_POST['date_of_join']);
        meta_forward($_SERVER['PHP_SELF'], "Updated=yes&selected_id={$empl_id}");
    } else {
        $empl_id = add_employee($_POST['empl_name'], $_POST['pre_address'], $_POST['per_address'], $_POST['date_of_birth'], $_POST['age'], $_POST['mobile_phone'], $_POST['email'], $_POST['grade'], $_POST['department'], $_POST['designation'], $_POST['gross_salary'], $_POST['date_of_join']);
        meta_forward($_SERVER['PHP_SELF'], "Added=yes&selected_id={$empl_id}");
    }
}
start_form();
if (db_has_employees()) {
    start_table(TABLESTYLE_NOBORDER);
    start_row();
    hrm_year_list(_("Year:"), 'year', null);
    hrm_months_list(_("Month:"), 'month', null);
    employee_list_cells(_("Select an Employee: "), 'selected_id', null, _('New Employee'), true, check_value('show_inactive'));
    $new_item = get_post('selected_id') == '';
    end_row();
    end_table();
    if (get_post('_show_inactive_update')) {
        $Ajax->activate('selected_id');
コード例 #2
0
ファイル: index.php プロジェクト: baltincsoft/VarnerCC
function add_addndetails($msg = "", $error_msg = '')
{
    global $SERVER_PATH, $SignIN;
    $R = DIN_ALL($_REQUEST);
    if (($_SESSION['UserID'] <= 0 || $_SESSION['UserID'] == "") && $_SESSION['http_agent'] != $_SERVER['HTTP_USER_AGENT']) {
        header("Location:" . $SignIN);
        die;
    } else {
        if (intval($_SESSION['EmployeeID']) > 0) {
            #-------------------------------------------- Smarty Templates to Display ----------------------------------------------#
            $sqlQuery = "SELECT *,DATE_FORMAT(ADDropOffDate,'%m/%d/%Y') AS ADDropOffDate," . "DATE_FORMAT(ADDateDelivered,'%m/%d/%Y') AS ADDateDelivered," . "DATE_FORMAT(ADFU_QTNP_Date,'%m/%d/%Y') AS ADFU_QTNP_Date," . "DATE_FORMAT(ADFU_QTE_Date,'%m/%d/%Y') AS ADFU_QTE_Date," . "DATE_FORMAT(ADFU_SOC_Date,'%m/%d/%Y') AS ADFU_SOC_Date " . "FROM vcc_addndetails WHERE EmployeeID=" . $_SESSION['EmployeeID'] . ";";
            eqi($sqlQuery, $rs);
            $ADDNDetaiRecords = mfai($rs);
            $SMARTY = new Smarty();
            $SMARTY->assign($ADDNDetaiRecords);
            $SMARTY->assign(array("msg" => $msg, "error_msg" => $error_msg, "addnl_active" => "active", "title" => "Add Additional Detail", "Statelist" => $StateList, "action" => "save_addndetails", "SERVER_ACTUAL_PATH" => $SERVER_PATH, "LoginID" => $_SESSION['UserID'], "EmployeeID" => $_SESSION['EmployeeID'], $ADDNDetaiRecords[ADShippingVendor] . "_SELECTED" => "selected", $ADDNDetaiRecords[ADUndeliverable] . "_SELECTED" => "selected", "IsAdmin" => $_SESSION['IsAdmin'], "Name" => $_SESSION['Name']));
            $SMARTY->display('addAdditionDetails.tpl');
        } else {
            add_employee();
            die;
        }
    }
}
コード例 #3
0
<html>
<title> ADD EMPLOYEE </title>
<?php 
function add_employee($firstname, $lastname, $contact, $salary, $address, $sex, $bdate, $joindate, $type)
{
    $dbc = mysql_connect('localhost', 'root', 'rishi');
    if (!$dbc) {
        die('NOT CONNECTED:' . mysql_error());
    }
    $db_selected = mysql_select_db("restaurant", $dbc);
    if (!$db_selected) {
        die('NOT CONNECTED TO DATABASE:' . mysql_error());
    }
    $values = "\"" . $firstname . "\",\"" . $lastname . "\",\"" . $contact . "\",\"" . $address . "\",\"" . $salary . "\",\"" . $sex . "\",\"" . $bdate . "\",\"" . $joindate . "\"";
    $query = "insert into `" . $type . "`(`Fname`,`Lname`,`Contact`,`Address`,`Salary`,`Sex`,`Bdate`,`Join_Date`) values(" . $values . ");";
    $result = mysql_query($query);
}
add_employee($_POST["firstname"], $_POST["lastname"], $_POST["contact"], $_POST["salary"], $_POST["address"], $_POST["sex"], $_POST["bdate"], $_POST["joindate"], $_POST["type"]);
?>
<script type="text/javascript">
	function done() 
	{
		alert("EMPLOYEE ADDED!!!");
	}
</script>
<body onload="done()" background = "1.png">
<meta HTTP-EQUIV="REFRESH" content="0; url=admin.html">
</body>
</html>
コード例 #4
0
ファイル: addemployee.php プロジェクト: Fixated84/wca_alpha
    // if (preg_match('/^[a-zA-Z]+$/i', $_POST['lastname']) === 0)
    // { $errors[] = 'Your last name should contain letters only.';
    //}
    //Checks if the email is valid
    if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) {
        $errors[] = 'Your email address does not appear to be valid.';
    }
    if (preg_match('/^[a-zA-Z0-9]+$/i', $_POST['phone']) === 0) {
        $errors[] = 'The phone you selected does not appear to be valid.';
    }
    if (preg_match('/^[a-zA-Z0-9]+$/i', $_POST['address']) === 0) {
        $errors[] = 'Your username should contain letters only.';
    }
    //if there are no errors then it will add users to the database
    if (empty($errors)) {
        if (add_employee($_POST['name'], $_POST['address'], $_POST['phone'], $_POST['email']) === false) {
            $errors[] = 'Something went wrong, you may have already submitted your information.';
        }
        /*mail_order($_POST['email']);*/
    }
}
?>


<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
       <link rel="shortcut icon" href="../images/icon.ico">
コード例 #5
0
        if (empty($employee['phone'])) {
            $error_phone = 'Phone must be filled out';
            $formValidation = false;
        }
        if (!preg_match("/^[0-9]{3}-[0-9]{3}-[0-9]{4}\$/", $employee['phone'])) {
            $error_phone = 'Phone must be valid phone number';
            $formValidation = false;
        }
        if (!empty($employee['fax']) && !preg_match("/^[0-9]{3}-[0-9]{3}-[0-9]{4}\$/", $employee['fax'])) {
            $error_fax = 'Fax must be valid fax number';
            $formValidation = false;
        }
        if ($formValidation) {
            if (empty($employee['employeeID'])) {
                $employee['password'] = password_hash($employee['password'], PASSWORD_DEFAULT);
                add_employee($employee);
            } else {
                if (!empty($employee['password']) && !empty($_POST['confirmPassword']) && $employee['password'] == $_POST['confirmPassword']) {
                    $employee['password'] = password_hash($employee['password'], PASSWORD_DEFAULT);
                } else {
                    $employee['password'] = get_employee($employee['employeeID'])['password'];
                }
                update_employee($employee);
            }
            $success_notification = 'Successfully saved';
        }
    } catch (Exception $e) {
        $error_notification = $e->getMessage();
    }
} else {
    if (isset($_GET['employeeID'])) {
コード例 #6
0
    //Checks if the email is valid
    if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) {
        $errors[] = 'Your email address does not appear to be valid.';
    }
    if (preg_match('/^[a-zA-Z0-9]+$/i', $_POST['phone']) === 0) {
        $errors[] = 'The phone you selected does not appear to be valid.';
    }
    if (preg_match('/^[a-zA-Z0-9]+$/i', $_POST['username']) === 0) {
        $errors[] = 'Your username should contain letters only.';
    }
    if (preg_match('/^[a-zA-Z0-9]+$/i', $_POST['password']) === 0) {
        $errors[] = 'Your password should contain letters only.';
    }
    //if there are no errors then it will add users to the database
    if (empty($errors)) {
        if (add_employee($_POST['name'], $_POST['phone'], $_POST['email'], $_POST['username'], $_POST['password']) === false) {
            $errors[] = 'Something went wrong, you may have already submitted your information.';
        }
        /*mail_order($_POST['email']);*/
    }
}
?>
 



<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">