Пример #1
0
require_once 'db_tools.php';
$myresult = "";
$state = "";
$compname = "";
$db = new mysqli($db_hostname, $db_username, $db_password, $db_database);
$companies = array();
$companiesidxmax = 0;
$j = 0;
session_start();
if (!empty($_SESSION['compname'])) {
    $compname = $_SESSION['compname'];
} else {
    $compname = "";
}
$_POST['AllCompanies'] = '1';
$companies = getcompaniestable($db);
$companiesidxmax = count($companies) - 1;
if (isset($_POST['AddContactSubmit'])) {
    $contactname = "\"" . $_POST['contactname'] . "\"";
    $contactcomp = "\"" . $_POST['company'] . "\"";
    $contactjobtype = "\"" . $_POST['contactjobtype'] . "\"";
    $contactemail = "\"" . $_POST['contactemail'] . "\"";
    $contactphone = "\"" . $_POST['contactphone'] . "\"";
    $contactfax = "\"" . $_POST['contactfax'] . "\"";
    if (empty($_POST['contactname'])) {
        $state = "No contact to add (contact name blank) - try again.";
    } else {
        $sql = "INSERT INTO contacts (contactname, contactcomp, contactjobtype, contactemail, contactphone, contactfax)\n\t\t\tVALUES ({$contactname}, {$contactcomp}, {$contactjobtype}, {$contactemail}, {$contactphone}, {$contactfax})";
        $myresult = mysqli_query($db, $sql);
        if (!$myresult) {
            die("Database access failed: " . mysql_error());
Пример #2
0
        } else {
            $state = "{$contactname} deleted.";
        }
    } else {
        $state = "No contact chosen to be deleted - ignored";
    }
}
if (isset($_POST['SearchIt'])) {
    $mainSearchKey = $_POST['SearchTerm'];
}
if (isset($_POST['SearchContact'])) {
    $contactSearchKey = $_POST['ContactSearchTerm'];
}
$_SESSION['compname'] = "";
$_SESSION['contactname'] = "";
$companies = getcompaniestable($db, $mainSearchKey);
$contacts = getcontactstable($db, $contactSearchKey);
$companiesidxmax = count($companies) - 1;
$contactsidxmax = count($contacts) - 1;
print "\n";
?>
<head>
	<link href="style.css" rel="stylesheet" type="text/css">
	<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> 
	<title>Main Menu</title>
</head>

<body>
<div id="container">
<div id="header">
	<H1>Main Menu</H1>
Пример #3
0
<?php

require_once 'login.php';
require_once 'connect.php';
require_once 'db_tools.php';
$myresult = "";
$state = "";
$j = 0;
$recruiter_status = "";
$manager_status = "";
$disabledflag = "";
session_start();
$_POST['AllCompanies'] = "1";
$companies = getcompaniestable($db, "");
$companiesidxmax = count($companies) - 1;
if (isset($_POST['EditContact'])) {
    $contactname = $_POST['contact_to_edit'];
    $_SESSION['oldcontactname'] = $_POST['contact_to_edit'];
    $_SESSION['contactname'] = $_POST['contact_to_edit'];
    $contact = getcontact($db, $contactname);
    $contactcomp = $contact[1];
    $contactjobtype = $contact[2];
    $contactemail = $contact[3];
    $contactphone = $contact[4];
    $contactfax = $contact[5];
    $state = "";
} elseif (isset($_POST['EditContactSubmit'])) {
    $oldcontactname = $_SESSION['oldcontactname'];
    $contactname = $_POST['contactname'];
    $contactcomp = $_POST['contactcomp'];
    $contactjobtype = $_POST['contactjobtype'];