connect(); $valid = new validation(); if(isset($_POST["_task"]) && $_POST["_task"]=="Order"){ //phpinfo(); $strfname = $db->clean($_POST["firstname"]); $strlname = $db->clean($_POST["lastname"]); $stremail = trim($_POST["email"]); $straddress = $db->clean($_POST["address"]); $strcity = $db->clean($_POST["city"]); $strstate = $db->clean($_POST["state"]); $strcountry = $db->clean($_POST["country"]); $strzip = $db->clean($_POST["zip"]); $strphone = $db->clean($_POST["phone"]); $strformat = $_POST["format"]; $intcatid = $_POST["catid"]; $intpackid = $_POST["packid"]; $intdays = $_POST["days"]; $intsources = $_POST["sources"]; $intpages = $_POST["pages"]; $numtotal = 0; settype($intdays,"int"); settype($intpages,"int"); settype($intsources,"int"); $strdescription = $db->clean($_POST["description"]); $strtitle = $db->clean($_POST["essaytopic"]); if($strfname == ""){ $valid->adderror("Please provide your First Name."); } if($strlname == ""){ $valid->adderror("Please provide your Last Name."); } if(!$valid->isemail($stremail)){ $valid->adderror("Please provide a valid Email."); } if($strtitle==""){ $valid->adderror("Essay Title must be provided."); } if(!$valid->isint($intpages)){ $valid->adderror("Number of Pages must be valid."); }else{ if($intpages < 1){ $valid->adderror("Number of Pages must be valid."); } } if(!$valid->isint($intsources)){ $valid->adderror("Minimum Number of Sources must be valid."); }else{ $intsources < 1 ? $intsources=1:""; } if(!$valid->isint($intdays)){ $valid->adderror("Number of Days must be valid."); }else{ if($intdays < 1){ $valid->adderror("Number of Days must be valid."); } } if($intdays < 2){ $rs = $db->execute("SELECT ID,PACKAGE_PRICE FROM ".TBL_PACKAGE." WHERE ID = '31'");} elseif($intdays < 3){ $rs = $db->execute("SELECT ID,PACKAGE_PRICE FROM ".TBL_PACKAGE." WHERE ID = '32'");} elseif($intdays < 4){ $rs = $db->execute("SELECT ID,PACKAGE_PRICE FROM ".TBL_PACKAGE." WHERE ID = '33'");} elseif($intdays < 5){ $rs = $db->execute("SELECT ID,PACKAGE_PRICE FROM ".TBL_PACKAGE." WHERE ID = '34'");} elseif($intdays < 8){ $rs = $db->execute("SELECT ID,PACKAGE_PRICE FROM ".TBL_PACKAGE." WHERE ID = '35'");} elseif($intdays < 11){ $rs = $db->execute("SELECT ID,PACKAGE_PRICE FROM ".TBL_PACKAGE." WHERE ID = '36'");} else{ $rs = $db->execute("SELECT ID,PACKAGE_PRICE FROM ".TBL_PACKAGE." WHERE ID = '37'");} if($row = $db->row($rs)){ $numprice = $row["PACKAGE_PRICE"]; $intpackid = $row["ID"]; $numtotal = $numprice * $intpages; }else{ $valid->adderror("Order was not placed please try later."); } if($valid->errorcount==0){ if($_POST["_action"]=="Place"){ $intid = $db->nextid(TBL_ORDER,"ID"); $strtrack = $db->tracknumber($intid); $strdeadline = $db->adddate($intdays); $strsql = "INSERT INTO ".TBL_ORDER."(ID, FIRST_NAME, LAST_NAME, ADDRESS, CITY, ZIP, STATE, COUNTRY, PHONE, EMAIL, PAYMENT_NUMBER, LAST_UPDATE, TOPIC_TITLE, MIN_SOURCES, PAPER_DETAILS, NUM_PAGES, DEADLINE, PAPER_FORMAT, PACKAGE_ID, IS_VALID, DATE_ADD, RATE, TRACK_NUMBER, STATUS_ID, COMMENTS, TOTAL_AMOUNT, UPDATE_BY, TOPIC_CAT,NUM_DAYS) VALUES ('".$intid."', '".$strfname."', '".$strlname."', '".$straddress."', '".$strcity."', '".$strzip."', '".$strstate."', '".$strcountry."', '".$strphone."', '".$stremail."', '', NOW(), '".$strtitle."', '".$intsources."', '".$strdescription."', '".$intpages."', '".$strdeadline."', '".$strformat."', '".$intpackid."', 1, NOW(), ".$numprice.", '".$strtrack."', 0, '', '".$numtotal."', '', '".$intcatid."','".$intdays."')"; $strdeadline = $db->formatdate($strdeadline); if($db->update($strsql)>0){ $sorderid = $intid; session_register("sorderid"); header("location:order_confirm.php"); exit(); }else{ $valid->adderror("Order was not placed please try again."); } //echo $strsql; }else{ $intid = $_SESSION["sorderid"]; $strdeadline = $db->adddate($intdays); $strsql = "UPDATE ".TBL_ORDER." SET FIRST_NAME='".$strfname."', LAST_NAME='".$strlname."', ADDRESS='".$straddress."', CITY='".$strcity."', ZIP='".$strzip."', STATE='".$strstate."', COUNTRY='".$strcountry."', PHONE='".$strphone."', EMAIL='".$stremail."', LAST_UPDATE=now(), TOPIC_TITLE='".$strtitle."', MIN_SOURCES='".$intsources."', PAPER_DETAILS='".$strdescription."', NUM_PAGES='".$intpages."', DEADLINE='".$strdeadline."', PAPER_FORMAT= '".$strformat."', PACKAGE_ID='".$intpackid."', RATE=".$numprice.", TOTAL_AMOUNT='".$numtotal."',TOPIC_CAT='".$intcatid."',NUM_DAYS='".$intdays."' WHERE ID='".$intid."'"; $db->update($strsql); header("location:order_confirm.php"); exit(); } } }elseif(isset($_SESSION["sorderid"])){ $intid = $_SESSION["sorderid"]; $rs = $db->execute("SELECT O.*,T.NAME,P.PACKAGE_NAME,P.PACKAGE_PRICE FROM ".TBL_ORDER." O, ".TBL_TOPIC." T,".TBL_PACKAGE." P WHERE O.ID ='".$intid."' AND O.TOPIC_CAT = T.ID AND P.ID = O.PACKAGE_ID "); if($row = $db->row($rs)){ $strfname=$row["FIRST_NAME"]; $strlname=$row["LAST_NAME"]; $stremail=$row["EMAIL"]; $intcatid=$row["TOPIC_CAT"]; $strtitle=$row["TOPIC_TITLE"]; $strdescription=$row["PAPER_DETAILS"]; $intpages=$row["NUM_PAGES"]; $intsources =$row["MIN_SOURCES"]; $straddress =$row["ADDRESS"]; $strcity =$row["CITY"]; $strstate=$row["STATE"]; $strcountry=$row["COUNTRY"]; $intpackid =$row["PACKAGE_ID"]; $intdays =$row["NUM_DAYS"]; $strformat =$row["PAPER_FORMAT"]; $strphone =$row["PHONE"]; $strzip=$row["ZIP"]; } } ?> execute("SELECT * FROM ".TBL_TOPIC." WHERE IS_VALID='1' ORDER BY NAME ASC"); ?>
Ordering at CustomPaperWriting.info is a safe and easy process which normally takes few minutes to finish up. In order to proceed, kindly provide us the required information, as this would help our expert researchers and writers to write a top-quality custom paper for you.
errorcount > 0){?>
messages as $val){?>
Personal Information