shout(); break; case 'addQuestion': addQuestion(); break; case 'addAnswer': addAnswer(); break; case 'addShop': addShop(); break; case 'idUpload': idUpload(); break; case 'updateForm': updateForm(); break; case 'updateUserImage': updateUserImage(); break; default: login(); } function login() { // login.. checks if session already set.. $results = array(); $results['pageTitle'] = "Home | Dating website"; if (!isset($_SESSION['email'])) { if (isset($_POST['email'])) { $email = $_POST['email'];
editForm($db); } else { if (isset($_GET['eid']) && !empty($_GET['eid'])) { getRequirements($db); } else { if (isset($_GET['deleteform']) && !empty($_GET['deleteform'])) { deleteForm($db); } else { if (isset($_GET['deletefield']) && !empty($_GET['deletefield'])) { deleteField($db); } else { if (isset($_GET['empid']) && !empty($_GET['empid'])) { pullVals($db); } else { if (isset($_POST['addField']) && !empty($_POST['addField'])) { updateForm($db); } else { if (isset($_POST['input']) && !empty($_POST['input'])) { editEmployee($db); } else { if (isset($_POST['formData']) && !empty($_POST['formData'])) { createForm($db); } else { if (isset($_POST['allVals']) && !empty($_POST['allVals'])) { submitUserCreatedForm($db); } else { if (isset($_POST) && !empty($_POST)) { deleteEmployee($db); } else { echo json_encode("There is no post and somehow you are here."); }
function processAddEditForm() { $formID = $_POST['FormID']; $mode = $_POST['Mode']; $name = $_POST['Name']; $disclaimer = $_POST['Disclaimer']; $errors = ''; if (empty($name)) { $errors .= "<br />* The form name must be provided"; } $uploadfile = null; if (isset($_FILES['userfile'])) { $uploadfile = '../data/forms/' . $_FILES['userfile']['name']; if ($_FILES['userfile']['type'] == "application/pdf") { move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile); if ($_FILES['userfile']['error'] == UPLOAD_ERR_NO_FILE) { $errors .= "<br />* No file found. Try again"; } } else { $errors .= "<br />* Only pdf files are supported. Make sure you are uploading a pdf file."; } } else { if ($mode != 'Edit') { $errors .= "<br />* You must include a pdf file"; } } if ($errors != '') { include '../view/editForm.php'; } else { if ($mode == 'Add') { $formID = insertForm($name, $disclaimer, $uploadfile); header("Location:../forms/"); } else { $rowsAffected = updateForm($formID, $name, $disclaimer, $uploadfile); header("Location:../forms/"); } } }