Exemplo n.º 1
0
    db_delete("contacts", $_GET['id'], 'contactsid');
    header("Location: /contacts/");
    exit;
}
if (isset($_GET['go']) && $_GET['go'] == "y") {
    // Add to Address table
    $addsid = db_updateAddress($_POST, $addsid);
    $contactsUpdate = new Contacts();
    // Update DB
    $contactsUpdate->setContactsid($_GET['id']);
    $contactsUpdate->setFname($_POST['fname']);
    $contactsUpdate->setSname($_POST['sname']);
    $contactsUpdate->setCo_name($_POST['co_name']);
    $contactsUpdate->setRole($_POST['role']);
    $contactsUpdate->setCustid($_POST['custid']);
    $contactsUpdate->setSuppid($_POST['suppid']);
    $contactsUpdate->setNotes($_POST['notes']);
    $contactsUpdate->updateDB();
    header("Location: /contacts/?Updated=" . $result['id']);
    exit;
}
$pagetitle = "Edit contact";
include "../tmpl/header.php";
if (isset($_GET['SentAccessEmail']) && $_GET['SentAccessEmail'] == 1) {
    ?>
<div class="panel panel-success">
	<div class="panel-heading">Sent an Email</div>
	<div class="panel-body">
  
	An email has been sent to
	<?php 
Exemplo n.º 2
0
    }
}
if (isset($_GET['go']) && $_GET['go'] == "y") {
    $logContent = "\n";
    $pw = generatePassword();
    // Add to Address table
    $addsid = db_addAddress($_POST);
    $logon = generateContactlogon($_POST['fname'], $_POST['sname']);
    // Insert into DB
    $contactsNew = new Contacts();
    $contactsNew->setFname($_POST['fname']);
    $contactsNew->setSname($_POST['sname']);
    $contactsNew->setCo_name($_POST['co_name']);
    $contactsNew->setRole($_POST['role']);
    $contactsNew->setCustid($_POST['custid']);
    $contactsNew->setSuppid($_POST['suppid']);
    $contactsNew->setAddsid($addsid);
    $contactsNew->setNotes($_POST['notes']);
    $contactId = $contactsNew->insertIntoDB();
    // Insert into DB
    $pwdNew = new Pwd();
    $pwdNew->setUsr($logon);
    $pwdNew->setContactsid($contactId);
    $pwdNew->setSeclev(100);
    $pwdNew->setPw(mkPwd($pw));
    file_put_contents('/etc/athenace/pwd', "{$_POST['custid']}\t{$_POST['suppid']}\t{$logon}\t{$pw}\n", FILE_APPEND);
    // Dont add to the Password table unless they have a custid or a suppid
    if (isset($_POST['custid']) && $_POST['custid'] > 0 || isset($_POST['suppid']) && $_POST['suppid'] > 0) {
        $pwdNew->insertIntoDB();
    } else {
        // Not adding to passwd table