$emailcheck = false; $namescheck = false; $telephonecheck = false; $newFname = trim($_POST['myFname']); $newLname = trim($_POST['myLname']); $newEO = $_POST['EO']; $newPhone = trim($_POST['myPhone']); $newCperson = trim($_POST['myCperson']); $newCPhone = trim($_POST['myCphone']); $newEmail = trim(filter_input(INPUT_POST, 'myEmail')); $newWebsite = trim($_POST['myWeb']); $newNotes = trim($_POST['myNotes']); $newCUsername = trim($_POST['cUsername']); $newCPassword = trim($_POST['cPassword']); //check for empty first name/company name if (emptyTest($newFname)) { $namescheck = true; } else { $error = $error . "First Name Required!"; } //check email if (emailCheck($newEmail)) { $emailcheck = true; } else { $error = $error . "Invalid Email."; } if (phoneCheck($newPhone, 10)) { $telephonecheck = true; } else { $error = $error . "Invalid Phone."; }
$newStreet = trim($_POST['myStreet']); $newCity = trim($_POST['myCity']); $newState = trim($_POST['myState']); $newZip = trim($_POST['myZip']); $newdateAcc = trim($_POST['myAcc']); $newdateDue = trim($_POST['myDue']); $newborrow = trim($_POST['myborrow']); $newnotes = trim($_POST['myNotes']); $newClient = trim($_POST['myClient']); $newFee = trim($_POST['myFee']); $newINS = trim($_POST['myINS']); $newINTime = trim($_POST['myINTime']); $newEmN = trim($_POST['myEmN']); $newStat = trim($_POST['myStat']); //check for empty first name/company name if (emptyTest($newION) && emptyTest($newCON) && emptyTest($newOType) && emptyTest($newStreet) && emptyTest($newCity) && emptyTest($newState) && emptyTest($newZip) && emptyTest($newdateAcc) && emptyTest($newdateDue) && emptyTest($newborrow) && emptyTest($newClient) && emptyTest($newFee)) { $requiredCheck = true; if ($intOrd != $newION) { $sql = "select count(*) as c from Aegis_Order where `InternalOrder#` ='" . $newION . "'"; $result = mysqli_query($con, $sql) or die("Error in the consult.." . mysqli_error($con)); //send the query to the database or quit if cannot connect $count = 0; $field = mysqli_fetch_object($result); //the query results are objects, in this case, one object $count = $field->c; //if address does not yet exist if ($count != 0) { $requiredCheck = false; $error = $error . "There is already an order with this internal order number."; } }
<h2>Employee</h2> <?php $error = ""; //check if the form is made if (isset($_POST['SubButton'])) { //set up our booleans for the items $requiredCheck = false; $newfn = trim($_POST['fn']); $newln = trim($_POST['ln']); $newjT = trim($_POST['jobTitle']); $newpass = trim($_POST['pass']); $newEmail = trim($_POST['email']); $newPermissions = trim($_POST['permission']); //check for empty first name/company name if (emptyTest($newfn) && emptyTest($newln) && emptyTest($newpass) && emptyTest($newEmail) && emptyTest($newPermissions)) { $requiredCheck = true; } else { $error = $error . "Check your required fields!"; } if ($requiredCheck) { //update employee in database $sql = "UPDATE `Aegis_Employee` SET `FirstName`='" . $newfn . "',`LastName`='" . $newln . "',`JobTitle`='" . $newjT . "',`Password`='" . sha1($newpass) . "',`Email`='" . $newEmail . "',`Permissions`='" . $newPermissions . "' WHERE `Employee#` ='" . $employeeNum . "'"; $result = mysqli_query($con, $sql) or die("Error in the consult.." . mysqli_error($con)); //send the query to the database or quit if cannot connect Header("Location: dashboard.php"); //where we go after we get this working } } ?>