$pdo->query($sql); } header("Location: /JGWentworth/View/Client.php"); } /******* Edit No Company Client *********************************************************************************************/ if (isset($_POST['editNoCompClient'])) { $target_dir = $_SERVER["DOCUMENT_ROOT"] . '/JGWentworth/ClientImages/'; $target_file = $target_dir . basename($_FILES['editNoCompPhoto']['name']); $compClientId = $_POST['editClientID']; $editClientFName = valString($_POST['editClientFName'], true); $editClientLName = valString($_POST['editClientLName'], true); $editClientTitle = valString($_POST['editClientTitle'], true); $editClientEmail = valEmail($_POST['editClientEmail'], true); $editClientPhone = valPhone($_POST['editClientPhone'], true); $editClientAddress = valString($_POST['editClientAddress'], true); $editClientFContacted = valDate($_POST['editClientFContacted'], true); if (!empty($target_file)) { move_uploaded_file($_FILES['editNoCompPhoto']['tmp_name'], $target_file); $sql = "UPDATE NON_MEMBER " . "SET FirstName ='" . $editCompFName . "', LastName ='" . $editCompLName . "', " . "Title ='" . $editCompTitle . "', Email ='" . $editCompEmail . "', Phone ='" . $editCompPhone . "', " . "Address = '" . $editClientAddress . "', DateFirstContact ='" . $editCompFContacted . "', " . "PhotoURL ='" . $target_file . "' " . "WHERE MemberID ='" . $editClientID . "';"; $pdo->query($sql); } if (empty($target_file)) { $sql = "UPDATE NON_MEMBER " . "SET FirstName = '" . $editCompFName . "', " . "LastName = '" . $editCompLName . "', Title ='" . $editCompTitle . ", " . "Email = '" . $editCompEmail . "', Phone = '" . $editCompPhone . "', " . "Address = '" . $editClientAddress . "', DateFirstContact = '" . $editCompFContacted . "' " . "WHERE MemberID ='" . $editClientID . "';"; $pdo->query($sql); } header("Location: /JGWentworth/View/Client.php"); } /******* Delete Company Client **********************************************************************************************/ if (isset($_GET['delete_compClient'])) { $memberId = $_GET['delete_compClient']; $sql = "DELETE FROM COMPANY_MEMBER WHERE MemberID=" . $memberId;
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ include $_SERVER["DOCUMENT_ROOT"] . '/JGWentworth/Model/database.php'; include $_SERVER["DOCUMENT_ROOT"] . '/JGWentworth/Model/validate.php'; if (isset($_POST['createContact'])) { $newUserID = $_POST['UserID']; $newMember = $_POST['MemberID']; $newSubject = valString($_POST['Subject'], true); $newDuartion = valString($_POST['Duration'], true); $newDateTime = valDate($_POST['DateTime'], true); $newResult = valString($_POST['Result'], true); $sql = "INSERT INTO sql591897.CONTACT (ContactID,UserID,MemberID, Subject, Duration, DateTime, Result)" . " VALUES (NULL, '" . $newUserID . "', '" . $newMember . "', '" . $newSubject . "', '" . $newDuartion . "','" . $newDateTime . "','" . $newResult . "');"; $pdo->exec($sql); header("Location: /JGWentworth/View/contact.php"); } // end second if
*/ require_once $_SERVER["DOCUMENT_ROOT"] . '/JGWentworth/Model/companyClass.php'; include $_SERVER["DOCUMENT_ROOT"] . '/JGWentworth/Model/validate.php'; if (isset($_POST['edit-submit'])) { // retrieve posted data $id = $_POST['editID']; $name = valString($_POST['editName'], true); $type = valString($_POST['editType'], true); $dateBusiness = valDate($_POST['editDate'], true); $compAdd = valString($_POST['editAddress'], true); //send update to database $com = new companyClass($name, $dateBusiness, $compAdd, $type, $id); $com->updateCompany(); echo '<script type="text/javascript">', 'redirect();', '</script>'; } // end first if if (isset($_POST['create-submit'])) { $newName = valString($_POST['newCompName'], true); $newType = valString($_POST['newBusiness'], true); $newDate = valDate($_POST['newDateOfBusiness'], true); $newAddress = valString($_POST['newAddress'], true); $newCom = new companyClass($newName, $newDate, $newAddress, $newType); $newCom->createCompany(); echo '<script type="text/javascript">', 'redirect();', '</script>'; } // end second if if (isset($_GET['delete'])) { $deleteID = urldecode(base64_decode($_GET['delete'])); companyClass::deleteCompany($deleteID); echo '<script type="text/javascript">', 'redirect();', '</script>'; }