public function saveCustomer(\CustomerVO $customerVO) { $sqlSaveCus = "INSERT INTO RICH_CUSTOMER (CUS_ID,CUS_USERNAME,CUS_PASSWORD,CUS_EMAIL,CUS_FIRST_NAME,CUS_LAST_NAME,CUS_GENDER,CUS_CONTACT_ADDRESS,CUS_RECEIPT_ADDRESS,CUS_PHONE_NUMBER,CUS_FACEBOOK_ADDRESS,CREATED_DATE_TIME,FORCE_CHANGE) " . "VALUES " . "('" . $customerVO->getCusID() . "','" . $customerVO->getCusUsername() . "','" . $customerVO->getCusPassword() . "','" . $customerVO->getCusEmail() . "','" . $customerVO->getCusFirstName() . "','" . $customerVO->getCusLastName() . "','" . $customerVO->getCusGender() . "','" . $customerVO->getCusContactAddr() . "','" . $customerVO->getCusReceiptAddr() . "','" . $customerVO->getPhoneNumber() . "','" . $customerVO->getCusFacebookAddr() . "',NOW(),'" . $customerVO->getForceChange() . "');"; mysql_query("SET character_set_results=utf8"); mysql_query("SET character_set_client=utf8"); mysql_query("SET character_set_connection=utf8"); $query = mysql_query($sqlSaveCus); if ($query) { return 200; } else { return "Cannot save customer with error '" . mysql_error() . "'"; } }
require '../../model/com.gogetrich.model/CustomerVO.php'; require './EmailContent.php'; require './SendingEmail.php'; $iniConfiguration = parse_ini_file("../../model-db-connection/configuration.ini"); $cusDaoImpl = new CustomerDaoImpl(); $customerService = new CustomerService($cusDaoImpl); $username = (string) filter_input(INPUT_GET, 'username'); $password = (string) filter_input(INPUT_GET, 'password'); $email = (string) filter_input(INPUT_GET, 'email'); $fName = (string) filter_input(INPUT_GET, 'fName'); $lName = (string) filter_input(INPUT_GET, 'lName'); $gender = (string) filter_input(INPUT_GET, 'gender'); $address = (string) filter_input(INPUT_GET, 'address'); $phone = (string) filter_input(INPUT_GET, 'phone'); $facebookAdr = (string) filter_input(INPUT_GET, 'facebookAdr'); $customerVO = new CustomerVO(); $customerVO->setCusID(md5(date("h:i:sa"))); $customerVO->setCusUsername($username); $customerVO->setCusPassword(md5($password)); $customerVO->setCusEmail($email); $customerVO->setCusFirstName($fName); $customerVO->setCusLastName($lName); $customerVO->setCusGender($gender); $customerVO->setCusContactAddr($address); $customerVO->setPhoneNumber($phone); $customerVO->setCusFacebookAddr($facebookAdr); $customerVO->setForceChange("false"); if ($customerService->duplicationUsername($username) && $customerService->duplicationEmail($email)) { echo "Your username and email have been used"; } else { if ($customerService->duplicationUsername($username)) {
* and open the template in the editor. */ require '../../model-db-connection/config.php'; require '../../model/com.gogetrich.dao/CustomerDaoImpl.php'; require '../../model/com.gogetrich.service/CustomerService.php'; require '../../model/com.gogetrich.model/CustomerVO.php'; $cusDaoImpl = new CustomerDaoImpl(); $customerService = new CustomerService($cusDaoImpl); $cusID = (string) filter_input(INPUT_GET, 'cusID'); $username = (string) filter_input(INPUT_GET, 'username'); $password = (string) filter_input(INPUT_GET, 'password'); $email = (string) filter_input(INPUT_GET, 'email'); $fName = (string) filter_input(INPUT_GET, 'fName'); $lName = (string) filter_input(INPUT_GET, 'lName'); $gender = (string) filter_input(INPUT_GET, 'gender'); $address = (string) filter_input(INPUT_GET, 'address'); $phone = (string) filter_input(INPUT_GET, 'phone'); $facebookAdr = (string) filter_input(INPUT_GET, 'facebookAdr'); $customerVO = new CustomerVO(); $customerVO->setCusID($cusID); $customerVO->setCusUsername($username); $customerVO->setCusPassword(md5($password)); $customerVO->setCusEmail($email); $customerVO->setCusFirstName($fName); $customerVO->setCusLastName($lName); $customerVO->setCusGender($gender); $customerVO->setCusContactAddr($address); $customerVO->setPhoneNumber($phone); $customerVO->setCusFacebookAddr($facebookAdr); $customerVO->setForceChange("false"); echo $customerService->editCustomer($customerVO);
public function getAllRegisteredUser($row) { $sqlGetAllRes = "SELECT CUS_ID,CUS_USERNAME,CUS_PASSWORD,CUS_EMAIL,CUS_FIRST_NAME,CUS_LAST_NAME,CUS_GENDER,CUS_CONTACT_ADDRESS,CUS_RECEIPT_ADDRESS,CUS_PHONE_NUMBER,CUS_FACEBOOK_ADDRESS,CREATED_DATE_TIME FROM RICH_CUSTOMER ORDER BY CREATED_DATE_TIME DESC LIMIT " . $row; $result = mysql_query($sqlGetAllRes); $listUser = new ArrayList(); while ($row = mysql_fetch_array($result)) { $userObj = new CustomerVO(); $userObj->setCusID($row['CUS_ID']); $userObj->setCusUsername($row['CUS_USERNAME']); $userObj->setCusPassword($row['CUS_PASSWORD']); $userObj->setCusEmail($row['CUS_EMAIL']); $userObj->setCusFirstName($row['CUS_FIRST_NAME']); $userObj->setCusLastName($row['CUS_LAST_NAME']); $userObj->setCusGender($row['CUS_GENDER']); $userObj->setCusContactAddr($row['CUS_CONTACT_ADDRESS']); $userObj->setCusReceiptAddr($row['CUS_RECEIPT_ADDRESS']); $userObj->setPhoneNumber($row['CUS_PHONE_NUMBER']); $userObj->setCusFacebookAddr($row['CUS_FACEBOOK_ADDRESS']); $userObj->setCusCreatedDateTime($row['CREATED_DATE_TIME']); $listUser->Add($userObj); } return $listUser; }
} } else { echo mysql_error(); } } else { //User not existing $tmpName = explode(" ", $rowGetMore['TMP_NAME']); $fName = $tmpName[0]; $lName = $tmpName[1]; $cusID = md5(date("h:i:sa") . "-" . $rowGetMore['TMP_EMAIL']); $email = $rowGetMore['TMP_EMAIL']; $phone = $rowGetMore['TMP_PHONE_NUMBER']; //promote unknown user to member $cusDaoImpl = new CustomerDaoImpl(); $customerService = new CustomerService($cusDaoImpl); $customerVO = new CustomerVO(); $customerVO->setCusID($cusID); $customerVO->setCusUsername($email); $customerVO->setCusPassword(md5($iniConfiguration['guest.password.default'])); $customerVO->setCusEmail($email); $customerVO->setCusFirstName($fName); $customerVO->setCusLastName($lName); $customerVO->setCusGender(""); $customerVO->setCusContactAddr($rowGetMore['CONTACT_ADDR']); $customerVO->setCusReceiptAddr($rowGetMore['RECEIPT_ADDR']); $customerVO->setPhoneNumber($phone); $customerVO->setCusFacebookAddr(""); $customerVO->setForceChange("true"); $saveUserResult = $customerService->saveCustomer($customerVO); if ($saveUserResult == 200) { //Sending register email