Execute($sqlCheckDuplicate);
if ($rsCheck) {
while (!$rsCheck->EOF) {
if ($rsCheck->fields["total"] > 0) {
$err = "Duplicated User";
break;
}
$rsCheck->MoveNext();
}
}
if ($err == "") {
$allowedExts = array("gif", "jpeg", "jpg", "png", "doc", "docx", "pdf");
$temp = explode(".", $_FILES["attachment"]["name"]);
$extension = end($temp);
$attachment = "";
//echo "ATTACHMENT TYPE: ";
//echo $_FILES["attachment"]["type"];
if ((($_FILES["attachment"]["type"] == "image/gif")
|| ($_FILES["attachment"]["type"] == "image/jpeg")
|| ($_FILES["attachment"]["type"] == "image/jpg")
|| ($_FILES["attachment"]["type"] == "image/pjpeg")
|| ($_FILES["attachment"]["type"] == "image/x-png")
|| ($_FILES["attachment"]["type"] == "application/pdf")
|| ($_FILES["attachment"]["type"] == "application/x-pdf")
|| ($_FILES["attachment"]["type"] == "application/msword")
|| ($_FILES["attachment"]["type"] == "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
|| ($_FILES["attachment"]["type"] == "image/png"))
&& ($_FILES["attachment"]["size"] < 20000000)
&& in_array($extension, $allowedExts)) {
$attachment = $_FILES["attachment"]["name"];
$fileext = "";
if (($_FILES["attachment"]["type"] == "image/gif"))
$fileext = ".gif";
if (($_FILES["attachment"]["type"] == "image/jpeg"))
$fileext = ".jpg";
if (($_FILES["attachment"]["type"] == "image/jpg"))
$fileext = ".jpg";
if (($_FILES["attachment"]["type"] == "image/png"))
$fileext = ".png";
if (($_FILES["attachment"]["type"] == "application/pdf"))
$fileext = ".pdf";
if (($_FILES["attachment"]["type"] == "application/msword"))
$fileext = ".doc";
if (($_FILES["attachment"]["type"] == "application/vnd.openxmlformats-officedocument.wordprocessingml.document"))
$fileext = ".docx";
if ($fileext == "") {
$name = $_FILES["attachment"]["name"];
$ext = end((explode(".", $name))); # extra () to prevent notice
$fileext = $ext;
}
//$attachment = uniqid("m") . $fileext;
$attachment = $title."_".$surname . $fileext;
if ($_FILES["attachment"]["error"] > 0) {
//echo "Return Code: " . $_FILES["attachment"]["error"] . "
";
} else {
//if (file_exists("./uploads/member/" . $_FILES["attachment"]["name"])) {
// echo $_FILES["attachment"]["name"] . " already exists. ";
//} else {
move_uploaded_file($_FILES["attachment"]["tmp_name"], "./uploads/member/" . $attachment); //$_FILES["attachment"]["name"]);
//echo "Stored in: " . "uploads/" . $_FILES["attachment"]["name"];
//}
}
} else {
//echo "Invalid file";
}
$sql = "insert into register (activated, title, attachment, surname, middleName, givenName, department, correspondentAddress, institute, city, country, phoneNumber, mailAddress, password, realpwd, proposerName, seconderName, status, seq, createby, createdt, updateby, updatedt) " .
" values (" .
"'P'," .
"'" . addslashes($title) . "'," .
"'" . addslashes($attachment) . "'," .
"'" . addslashes($surname) . "'," .
"'" . $middleName . "'," .
"'" . $givename . "'," .
"'" . $department . "'," .
"'" . addslashes($address) . "'," .
"'" . $ins . "'," .
"'" . $city . "'," .
"'" . $country . "'," .
"'" . $phoneNumber . "'," .
"'" . $email . "'," .
"'" . md5($password) . "'," .
"'" . $password . "'," .
"'" . $proposer . "'," .
"'" . $secname . "'," .
"'c'," .
"'0'," .
"'ADMIN'," .
"Now()," .
"'ADMIN'," .
"NOW())";
$linkptr->Execute($sql);
// Email the password to user
$emailnamefrom = "AASTS";
$emailfromadd = "aasts@aasts.org";
$emailtoadd = $email;
$emailtitle = "AASTS - Member Registration";
$emailcontent = "
Dear ".$givename." ".$surname.",
Thank you for applying for memebership of the Asian Association for Single Port
Thoracic Surgery. Your application is being processed. Successful application will be
confirmed by e-mail as soon as possible.
Regards,
President,
Asian Association for Single Port Thoracic Surgery
";
/*
Dear [".$givename."] [".$surname."],
We are delighted to to confirm that your application for membership of the Asian
Association for Single Port Thoracic Surgery is acccepted.You are now entitled to have
access to educational rescources that are available to memebers only and enjoy other
member's benefits.
Your login information are as followed:
Login ID: [".$email."]
Password: [".$password."]
You are adviced to change your password.
If you have any enquiry, please do not hesitate to contact as through the 'Contact Us'
section in our websitehttp://www.aasts.org.
Regards,
President,
Asian Association for Single Port Thoracic Surgery
*/
if (sendEmail($emailnamefrom, $emailfromadd, $emailtoadd, $emailtitle, $emailcontent)) {
header("Location: membership_success.php?rid=" . $email);
exit;
}
}
//header("Location: membership_success.php");
//exit();
}
$photo=array();
$photo[]=array("id"=>"0", "src"=>"./img/member/benefit_btn2.png", "src2"=>"./img/member/benefit_btn.png");
$photo[]=array("id"=>"1", "src"=>"./img/member/memberLogin_btn2.png", "src2"=>"./img/member/memberLogin_btn.png");
$photo[]=array("id"=>"2", "src"=>"./img/member/membership_btn2.png", "src2"=>"./img/member/membership_btn2.png");
?>