$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)) { echo "This username have been used"; } else { if ($customerService->duplicationEmail($email)) { echo "This email have been used"; } else { $saveResult = $customerService->saveCustomer($customerVO); if ($saveResult == 200) { if ($iniConfiguration['email.sending.to.customer'] == true) { $emailContent = new EmailContent(); $emailBody = $emailContent->getCusRegisterNormalContent($iniConfiguration['web.application.prefix']); $sendingEmail = new SendingEmail($iniConfiguration['email.host'], $iniConfiguration['email.username'], $iniConfiguration['email.password'], $email, $iniConfiguration['email.subject.customer.register.prefix'], $emailBody, $iniConfiguration['email.username'], $iniConfiguration['email.name']);
//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 if ($iniConfiguration['email.sending.to.customer'] == true) { $resetUrl = $iniConfiguration['web.application.prefix'] . "view/forceChangePassword?cusID=" . $cusID; $emailContent = new EmailContent(); $emailBody = $emailContent->getCustomerEmailRegister($resetUrl, $email, $iniConfiguration['guest.password.default'], $iniConfiguration['web.application.prefix']); $sendingEmail = new SendingEmail($iniConfiguration['email.host'], $iniConfiguration['email.username'], $iniConfiguration['email.password'], $email, $iniConfiguration['email.subject.customer.register.prefix'], $emailBody, $iniConfiguration['email.username'], $iniConfiguration['email.name']); $sendingEmail->sendingEmail(); } $resultFromCheckCust = $custEnrollService->checkCustAlreadyEnrollByEnrollID($courseID, $cusID); if ($resultFromCheckCust == 200) { $custEnrollVO = new CustomerEnrollVO(); $custEnrollVO->setEnrollID(md5(date("h:i:sa") . "-" . $cusID)); $custEnrollVO->setRefCusID($cusID);