\n"; $isRegistered=false; $result = mysql_query("select user_id from $dbtable where email='{$_REQUEST['email']}'"); if (mysql_num_rows($result) > 0) { $isRegistered=true; $msg = "This email address had registered already."; } $result = mysql_query("select user_id from $dbtable where username='{$_REQUEST['username']}'"); if (mysql_num_rows($result) > 0) { $isRegistered=true; $msg = "This username has been used by another person."; } // if ( $_REQUEST['fname']!="" && $_REQUEST['lname']!="" && $_REQUEST['department']!="" && $_REQUEST['country']!="" && $_REQUEST['phone']!="" && $_REQUEST['email']!="" && $_REQUEST['institution']!="" && !$isRegistered) if ( $_REQUEST['fname']!="" && $_REQUEST['lname']!="" && $_REQUEST['department']!="" && $_REQUEST['country']!="" && $_REQUEST['phone']!="" && $_REQUEST['email']!="" && $_REQUEST['institution']!="" && $_REQUEST['address']!="" && !$isRegistered) { // print("Pass\n"); //get a new user_id $result = mysql_query("select IFNULL(max(user_id),0)+1 from $dbtable"); $user_id= mysql_result($result,0); $attempt=0; //debug// echo $user_id. "
\n"; $FO_Code = "CONF"; ## FO confirmed Activity Code $syscode= sprintf("%06s", $user_id); ## System generated running number $syscode1= sprintf("%03s", $user_id); ## System generated running number $syscode2= sprintf("%02s", $attempt); $regnum = "ICTS".$FO_Code."13".$syscode; $invoiceNum = $regnum.$syscode2; $username=strtolower($_REQUEST[lname]).$syscode1; //debug// echo $username. "
\n"; $filename=$_FILES['upload_abstract']['name']; $filetype=$_FILES['upload_abstract']['type']; //debug// echo $filetype. "
\n"; $filesize=$_FILES['upload_abstract']['size']; $error = $_FILES['upload_abstract']['error']; $dir='/var/www/html/inele/register/abstract/'; $path = $dir . $username ; if (!file_exists($path)) mkdir($path, 0755); $file = $path . "/" . $filename ; $tmp_name=$_FILES['upload_abstract']['tmp_name']; if ($error==UPLOAD_ERR_OK) { move_uploaded_file($tmp_name, $file); } else if ($error==UPLOAD_ERR_NO_FILE) { print("No files specified.\n"); } else { print("Upload failed.\n"); } $password = genpass(); //debug// echo $password. "
\n"; $pwfile=$dir . 'userdata'; $fh = fopen($pwfile,'a') or die("Can't open file"); $cryptpass = crypt($password, base64_encode($password)); $stringdata = $username . ":" . $cryptpass . "\n"; fwrite($fh,$stringdata); fclose($fh); $authfile=$path . '/.htaccess'; $fp = fopen($authfile,'w') or die("Can't open file"); $authdata = "AuthType Basic\n"; $authdata .= "AuthName \"Protected file\"\n"; $authdata .= "AuthUserFile " . $pwfile . "\n"; $authdata .= "Require user " . $username . "\n"; fwrite($fp,$authdata); fclose($fp); $salute = $_REQUEST['salute']; $_REQUEST['house']='self'; list($rtype,$rfee) = split('-',$_REQUEST['rfee']); if ($_REQUEST['ptype']=='onsite') $rtype=$rtype."_site"; else { if (date("Ymd") <= '20130901') { if ($rfee=='2000') $rfee='1000'; if ($rtype=='regu') $rtype='early_regu'; if ($rfee=='1000') $rfee='500'; if ($rtype=='stud') $rtype='early_stud'; } } if ($_REQUEST['house']=='self') $house_fee=0; else { $house_fee = ($_REQUEST['house_roomtype']=="single") ? 570 : 285; $house_fee *= $_REQUEST['house_night']; } if (@$_REQUEST['invletter'] == NULL) { $invitationLetter = 'NO'; } else { $invitationLetter = 'YES'; } $total_fee = $rfee + $house_fee; // print("Pass
\n"); $ip = $_SERVER['REMOTE_ADDR']; $query="insert into $dbtable (user_id, regnum, salute, fname, lname, email, country, phone, fax, institution, department, topic, address, pretype, pretitle, filename, username, password, md5pass, rtype,rfee,ptype,house,invletter,hfee,attempt, ip,regdate) values ('{$user_id}','".handleOText($regnum)."', '".handleOText($salute)."', '".handleOText($_REQUEST['fname'])."', '".handleOText($_REQUEST['lname'])."', '".handleOText($_REQUEST['email'])."', '".handleOText($_REQUEST['country'])."', '".handleOText($_REQUEST['phone'])."','".handleOText($_REQUEST['fax'])."', '".handleOText($_REQUEST['institution'])."','".handleOText($_REQUEST['department'])."', '".handleOText($_REQUEST['topic'])."', '".handleOText($_REQUEST['address'])."', '".handleOText($_REQUEST['pre_type']). "', '".handleOText($_REQUEST['pre_title'])."', '".handleOText($filename)."', '".handleOText($username)."', '".handleOText($password)."', '".handleOText(md5($password))."', '".handleOText($rtype)."','".handleOText($rfee)."', '".handleOText($_REQUEST['ptype'])."', '".handleOText($_REQUEST['house'])."','".handleOText($invitationLetter)."', '".$house_fee."', '".$attempt."','$ip',SYSDATE())"; //echo $query; $result = mysql_query($query); // debug print $query . "
\n"; $_SESSION['user_id']=$user_id; $_SESSION['logined']= true; // email_start $query="select * from $dbtable where user_id='{$user_id}' "; $result = mysql_query($query); $user_record=mysql_fetch_assoc($result); $random_hash = md5(date('r', time())); $headers = ""; $receiver = $user_record['salute']." ".$user_record['fname']." ".$user_record['lname']; $receiver_email=$user_record['email']; $from = "icts@hkbu.edu.hk"; $bcc1 = "icts@hkbu.edu.hk"; // $bcc = "morris@hkbu.edu.hk"; $bcc = "morris@hkbu.edu.hk,icts@hkbu.edu.hk"; $headers .= "From: INELE 2013 Hongkong<".$from.">\r\n"; $headers .= "Reply-To: <".$bcc1.">\r\n"; $headers .= "Bcc: $bcc\r\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\""; $subject = "Confirmation of Online Abstract Submission of INELE 2013"; mb_internal_encoding('UTF-8'); $subject=mb_encode_mimeheader($subject, 'UTF-8'); //content $mail_message = " Dear $receiver,

Your online abstract submission for INELE2013 has been sent to $bcc1.
\n Below are details that you have submitted. For any query, please feel free to contact us by:
\n "; $mail_table=" .
Reference number : $regnum
Personal Particulars
Name: $receiver
Country: $user_record[country] Email Address: $user_record[email]
Phone: $user_record[phone] Fax: $user_record[fax]
Institution: $user_record[institution] Department/Division: $user_record[department]
Mailing Address:$user_record[address]
Conference Details
Abstract file:$user_record[filename]
Abstract Enquiry Login
Username: $username
Password: $password
For enquiry, please quote the above reference number. You may also use the above username and password for online registration
"; //real send // $actual_msg= ''.$mail_message.$mail_table.''; $actual_msg= $mail_message.$mail_table; $actual_msg=str_replace(">",">\n",$actual_msg); //to avoid chopping characters if a line is too long $actual_msg=str_replace(" "," \n",$actual_msg); //define the body of the message. $actmsg = "--PHP-mixed-$random_hash\r\n" ."Content-Type: multipart/alternative; boundary=\"PHP-alt-$random_hash\"\r\n\r\n"; $actmsg .= "--PHP-alt-$random_hash\r\n" ."Content-Type: text/plain; charset=\"iso-8859-1\"\r\n" ."Content-Transfer-Encoding: 7bit\r\n\r\n"; $textmessage='this is a plain text'; $actmsg .= strip_tags($textmessage); $actmsg .= "\r\n\r\n--PHP-alt-$random_hash\r\n" ."Content-Type: text/html; charset=\"iso-8859-1\r\n" ."Content-Transfer-Encoding: 7bit\r\n\r\n"; $actmsg .= $actual_msg; $actmsg .="\r\n\r\n--PHP-alt-$random_hash--\r\n\r\n"; //include attachment $actmsg .= "--PHP-mixed-$random_hash\r\n" ."Content-Type: ".$filetype."; name=\"$filename\"\r\n" ."Content-Transfer-Encoding: base64\r\n" ."Content-Disposition: attachment; filename=\"$filename\"\r\n\r\n"; $actmsg .= chunk_split(base64_encode(file_get_contents($file))); $actmsg .= "/r/n--PHP-mixed-$random_hash--"; ## Uncomment the following line to pre-assign the receiver_email for testing // $receiver_email = "morris@hkbu.edu.hk"; ## Uncomment the following line for production (actual send out) mail($receiver_email, $subject,$actmsg, $headers); // email_end ?> Online Abstract Submission for INELE2013 International Conference
INELE2013
December 2013, Hong Kong Baptist University, Hong Kong
Reference Number:
Personal Particulars
Name:
Email Address:
Country:
Phone: Fax:
Institution: Department:
Mailing Address:  
Conference Details
Abstract file details:
Abstract Enquiry Login
Username: Password:
For enquiry, please quote the above reference number
Abstract Submission for INELE 2013 HongKong International Conference

INELE2013 Online Abstract Submission
Personal Particulars
Title: Surname : Personal name :
Institution : Dept/Division :
Email : Country :
Phone : Fax:
Mailing Address :
*  
Conference Details
Abstract file:
Abstract file in PDF file format is preferred, other file formats would be converted to PDF file format without any adjustment.
Abstract template files for your references in MSWord format.


Enter the above code: