function createCustomer($data) { $id = generateID(6); $data['id'] = $id; if (insertCustomer($data) != false) { return $id; } else { return false; } }
* 2007-07-19 * * License: * GPL v2 or above * * Website: * http://www.simpleinvoices.org */ //stop the direct browsing to this file - let index.php handle which files get displayed checkLogin(); # Deal with op and add some basic sanity checking $op = !empty($_POST['op']) ? addslashes($_POST['op']) : NULL; #insert customer $saved = false; if ($op === "insert_customer") { if (insertCustomer()) { $saved = true; // saveCustomFieldValues($_POST['categorie'],lastInsertId()); } } if ($op === 'edit_customer') { if (isset($_POST['save_customer'])) { if (updateCustomer()) { $saved = true; //updateCustomFieldValues($_POST['categorie'],$_GET['customer']); } } } $smarty->assign('saved', $saved); $smarty->assign('pageActive', 'customer'); $smarty->assign('active_tab', '#people');
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <?php ob_start(); include '../common/process_DB.php'; if (!empty($_POST['UserName'])) { $result = insertCustomer(); if (!$result) { print "<div class=\"alert alert-danger\" role=\"alert\"> <p class=\"text-center\">Email Already Registered!</p></div>"; } else { print "<div class=\"alert alert-success\" role=\"alert\">"; print " <a href=\"../../index.php\" class=\"alert-link\"> <p class=\"text-center\">Successful! Go to main page!</p></a>"; print " </div>"; } } ?> <form action="index.php" class="form-signin" role="form" method="post"> <h2 class="form-signin-heading">Please sign up</h2> <input type="text" name="UserName" class="form-control" placeholder="Name" required autofocus> <input type="email" name="UserEmail" class="form-control" placeholder="Email address" required autofocus> <input type="password" name="UserPassword" class="form-control" placeholder="Password" required>
if (empty($zip)) { $error['zip'] = $lang['error_zip_empty']; } if (empty($country)) { $error['country'] = $lang['error_country_empty']; } //if(empty($state)){ // $error['state'] = $lang['error_state_empty']; //} if (empty($phone)) { $error['phone'] = $lang['error_phone_empty']; } if (empty($error)) { if ($action == "insert") { $insert_data = array('username' => $username, 'email' => $email, 'password' => md5($password), 'token' => $token, 'status' => $status, 'fname' => $fname, 'lname' => $lname, 'dob' => $dob, 'gender' => $gender, 'add1' => $add1, 'add2' => $add2, 'city' => $city, 'zip' => $zip, 'country' => $country, 'state' => $state, 'phone' => preg_replace("/[^0-9]+/", "", $phone)); $insert_query = insertCustomer($insert_data); if ($insert_query) { $_SESSION['success'] = $lang['success_insert']; } else { $_SESSION['error_warning'] = $lang['error_query']; } } else { if ($action == "update") { $edit_data = array('customerId' => $cid, 'username' => $username, 'email' => $email, 'password' => md5($password), 'token' => $token, 'status' => $status, 'fname' => $fname, 'lname' => $lname, 'dob' => $dob, 'gender' => $gender, 'add1' => $add1, 'add2' => $add2, 'city' => $city, 'zip' => $zip, 'country' => $country, 'state' => $state, 'phone' => preg_replace("/[^0-9]+/", "", $phone), 'modify_by' => "a" . $logged); echo $edit_query = editCustomer($edit_data); if ($edit_query) { $_SESSION['success'] = $lang['success_edit']; } else { $_SESSION['error_warning'] = $lang['error_query']; } }
if ($data["CustEmail"] == "") { $errors .= "Email must have a value"; } if ($data["CustUserName"] == "") { $errors .= "Username must have a value"; } if ($data["CustPassword"] == "") { $errors .= "Password must have a value"; } return $errors; } //Here I am checking to see that the CustFirstName has a value. If it isset then process for data and return message. if (isset($_REQUEST["CustFirstName"])) { $message = phpvalidate($_REQUEST); if (!$message) { $message = insertCustomer($_REQUEST); } } ?> <!DOCTYPE html> <html> <head> <title>Travel Experts - Register</title> <meta charset="utf-8" /> <meta name="keywords" content="travel, tours, vacations, flights"> <meta name="author" content="Mark Wilson"> <link rel="stylesheet" type="text/css" href=".\css\bootstrap.css" media="all"> <link rel="stylesheet" type="text/css" href=".\css\bootstrap.min.css" media="all"> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href=".\css\site.css" media="all">
//echo $varEmail."<br />"; //echo $varHomeAddress."<br />"; //echo $varArrDate."<br />"; //echo $varArrTime."<br />"; //echo $varDepDate."<br />"; //echo $varDepTime."<br />"; $query = "SELECT ID FROM Customers\n where FullName = '{$varName}'"; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); if (mysql_num_rows($result) > 0) { $line = mysql_fetch_array($result, MYSQL_BOTH); $varCID = $line["ID"]; mysql_free_result($result); updateCustomerInfo($varCID, $varHomePhone, $varMobile, $varEmail, $varHomeAddress); insertReservation($varCID, $varArrDate, $varArrTime, $varDepDate, $varDepTime, $varNumPer); } else { insertCustomer($varName, $varHomePhone, $varMobile, $varEmail, $varHomeAddress, $varCID); insertReservation($varCID, $varArrDate, $varArrTime, $varDepDate, $varDepTime, $varNumPer); } function updateCustomerInfo($CID, $homePhone, $mobile, $email, $homeAddress) { $query = "UPDATE Customers\n\t\tSET HomePhone='{$homePhone}', Mobile='{$mobile}', Email='{$email}', HomeAddress='{$homeAddress}'\n\t\tWHERE ID='{$CID}'"; mysql_query($query); } function insertCustomer($name, $homePhone, $mobile, $email, $homeAddress, &$CID) { $query = "INSERT INTO Customers (FullName, HomePhone, Mobile, Email, HomeAddress)\n\tVALUES ('{$name}', '{$homePhone}', '{$mobile}', '{$email}', '{$homeAddress}')"; mysql_query($query); $CID = mysql_insert_id(); } function insertReservation($CID, $arrDate, $arrTime, $depDate, $depTime, $numPer) {