Online Appointment
session_start();
function connect(){
include('app_date_picker.php');
global $g_link;
if( $g_link ){
return $g_link;
}
$g_link = mysql_connect( 'localhost', 'wordpress', '10001100') or die('Could not connect to server.' );
mysql_select_db('healthwayph', $g_link) or die('Could not select database.');
return $g_link;
}
function checkemail($email) {
if(eregi(”^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]”, $email))
{
return FALSE;
}
list($Username, $Domain) = split(”@”,$email);
if(getmxrr($Domain, $MXHost))
{
return TRUE;
}
else
{
if(fsockopen($Domain, 25, $errno, $errstr, 30))
{
return TRUE;
}
else
{
return FALSE;
}
}
}
if( isset($_POST['submit'])) {
if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
// Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
$check = checkemail($_POST['email']);
if($check!=1){
$error = “Invalid email address”;
}else{
/*echo ““;
echo ““;*/
################### INSERT TO DATABASE ########################
$insert=”INSERT INTO `h_appoint`(
`ID`,
`BCODE`,
`LASTNAME`,
`FIRSTNAME`,
`MIDDLE NAME`,
`DATE OF BIRTH`,
`GENDER`,
`TELEPHONE`,
`MOBILE`,
`EMAIL`,
`PHYSICIAN NAME`,
`SYSTEM PHYSICIAN CODE`,
`APDATE`,
`DESCRIPTION`,
`INPUTDATETIME`,
`STATUS`)
VALUES(NULL,
‘”.$_POST['branch'].”‘,
trim(’”.$_POST['lastname'].”‘),
trim(’”.$_POST['firstname'].”‘),
trim(’”.$_POST['middlename'].”‘),
‘”.$_POST['year'].’-’.$_POST['month'].’-’.$_POST['day'].”‘,
‘”.$_POST['gender'].”‘,
‘”.$_POST['telnos'].”‘,
‘”.$_POST['mobile'].”‘,
‘”.$_POST['email'].”‘,
‘”.$_POST['physician'].”‘,
‘”.$_POST['physiciancode'].”‘,
‘”.$_POST['adate'].”‘,
‘”.addslashes($_POST['description']).”‘,NOW(),0)”;
$query = mysql_query($insert, connect());
#################### EMAIL THE FORM CONTENT#######
$branchcode = $_POST['branch'];
switch($branchcode){
case 2:
$mymail = ‘rhea.rodriguez@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘levie.bendicio@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘daisy.garcia@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘maja.dino@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘atc@healthway.com.ph’;
$esubject = “Healthway Alabang Town Center Appointment - “.$_POST["firstname"].’ ‘.$_POST["middlename"].’ ‘.$_POST["lastname"];
$body= “Lastname: “.$_POST["lastname"].”\n”;
$body.= “Firstname: “.$_POST["firstname"].”\n”;
$body.= “Middle name: “.$_POST["middlename"].”\n”;
$body.= “Birthday: “.$_POST['year'].’-’.$_POST['month'].’-’.$_POST['day'].”\n”;
$body.= “Gender: “.$_POST["gender"].”\n”;
$body.= “Telephone nos: “.$_POST["telnos"].”\n”;
$body.= “Mobile: “.$_POST["mobile"].”\n”;
$body.= “Email: “.$_POST["email"].”\n”;
$body.= “Physician: “.$_POST["physician"].”\n”;
$body.= “Appointment Date: “.$_POST["adate"].”\n”;
$body.= “Description: “.nl2br($_POST["description"]).”\n\n\n”;
$body.= “************************************************”.”\n”;
$body.= “Reminder: this is just a notification, please do not reply to this email”;
$eemail = $_POST['email'];
$sent = mail($mymail,$esubject,$body,”From: $eemail\n”);
break;
case 4:
$mymail = ‘daisy.garcia@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘levie.bendicio@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘fm@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘maja.dino@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘rhea.rodriguez@healthway.com.ph’;
$esubject = “Healthway Festival Mall Appointment - “.$_POST["firstname"].’ ‘.$_POST["middlename"].’ ‘.$_POST["lastname"];
$body= “Lastname: “.$_POST["lastname"].”\n”;
$body.= “Firstname: “.$_POST["firstname"].”\n”;
$body.= “Middle name: “.$_POST["middlename"].”\n”;
$body.= “Birthday: “.$_POST['year'].’-’.$_POST['month'].’-’.$_POST['day'].”\n”;
$body.= “Gender: “.$_POST["gender"].”\n”;
$body.= “Telephone nos: “.$_POST["telnos"].”\n”;
$body.= “Mobile: “.$_POST["mobile"].”\n”;
$body.= “Email: “.$_POST["email"].”\n”;
$body.= “Physician: “.$_POST["physician"].”\n”;
$body.= “Appointment Date: “.$_POST["adate"].”\n”;
$body.= “Description: “.nl2br($_POST["description"]).”\n\n\n”;
$body.= “************************************************”.”\n”;
$body.= “Reminder: this is just a notification, please do not reply to this email”;
$eemail = $_POST['email'];
$sent = mail($mymail,$esubject,$body,”From: $eemail\n”);
break;
case 7:
$mymail = ‘daisy.garcia@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘levie.bendicio@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘maja.dino@healthway.com.ph’ . ‘, ‘;
$mymail .= ’sm@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘rhea.rodriguez@healthway.com.ph’;
$esubject = “Healthway SM City the Block Appointment - “.$_POST["firstname"].’ ‘.$_POST["middlename"].’ ‘.$_POST["lastname"];
$body= “Lastname: “.$_POST["lastname"].”\n”;
$body.= “Firstname: “.$_POST["firstname"].”\n”;
$body.= “Middle name: “.$_POST["middlename"].”\n”;
$body.= “Birthday: “.$_POST['year'].’-’.$_POST['month'].’-’.$_POST['day'].”\n”;
$body.= “Gender: “.$_POST["gender"].”\n”;
$body.= “Telephone nos: “.$_POST["telnos"].”\n”;
$body.= “Mobile: “.$_POST["mobile"].”\n”;
$body.= “Email: “.$_POST["email"].”\n”;
$body.= “Physician: “.$_POST["physician"].”\n”;
$body.= “Appointment Date: “.$_POST["adate"].”\n”;
$body.= “Description: “.nl2br($_POST["description"]).”\n\n\n”;
$body.= “************************************************”.”\n”;
$body.= “Reminder: this is just a notification, please do not reply to this email”;
$eemail = $_POST['email'];
$sent = mail($mymail,$esubject,$body,”From: $eemail\n”);
break;
case 11:
$mymail = ‘daisy.garcia@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘levie.bendicio@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘maja.dino@healthway.com.ph’ . ‘, ‘;
$mymail .= ’sp@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘rhea.rodriguez@healthway.com.ph’;
$esubject = “Healthway Shangri-La Appointment - “.$_POST["firstname"].’ ‘.$_POST["middlename"].’ ‘.$_POST["lastname"];
$body= “Lastname: “.$_POST["lastname"].”\n”;
$body.= “Firstname: “.$_POST["firstname"].”\n”;
$body.= “Middle name: “.$_POST["middlename"].”\n”;
$body.= “Birthday: “.$_POST['year'].’-’.$_POST['month'].’-’.$_POST['day'].”\n”;
$body.= “Gender: “.$_POST["gender"].”\n”;
$body.= “Telephone nos: “.$_POST["telnos"].”\n”;
$body.= “Mobile: “.$_POST["mobile"].”\n”;
$body.= “Email: “.$_POST["email"].”\n”;
$body.= “Physician: “.$_POST["physician"].”\n”;
$body.= “Appointment Date: “.$_POST["adate"].”\n”;
$body.= “Description: “.nl2br($_POST["description"]).”\n\n\n”;
$body.= “************************************************”.”\n”;
$body.= “Reminder: this is just a notification, please do not reply to this email”;
$eemail = $_POST['email'];
$sent = mail($mymail,$esubject,$body,”From: $eemail\n”);
break;
case 12:
$mymail = ‘daisy.garcia@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘levie.bendicio@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘maja.dino@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘rpm@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘rhea.rodriguez@healthway.com.ph’;
$esubject = “Healthway Robinson’s Place Appointment - “.$_POST["firstname"].’ ‘.$_POST["middlename"].’ ‘.$_POST["lastname"];
$body= “Lastname: “.$_POST["lastname"].”\n”;
$body.= “Firstname: “.$_POST["firstname"].”\n”;
$body.= “Middle name: “.$_POST["middlename"].”\n”;
$body.= “Birthday: “.$_POST['year'].’-’.$_POST['month'].’-’.$_POST['day'].”\n”;
$body.= “Gender: “.$_POST["gender"].”\n”;
$body.= “Telephone nos: “.$_POST["telnos"].”\n”;
$body.= “Mobile: “.$_POST["mobile"].”\n”;
$body.= “Email: “.$_POST["email"].”\n”;
$body.= “Physician: “.$_POST["physician"].”\n”;
$body.= “Appointment Date: “.$_POST["adate"].”\n”;
$body.= “Description: “.nl2br($_POST["description"]).”\n\n\n”;
$body.= “************************************************”.”\n”;
$body.= “Reminder: this is just a notification, please do not reply to this email”;
$eemail = $_POST['email'];
//$patientname = ” “.$_POST["firstname"].’ ‘.$_POST["lastname"];
$sent = mail($mymail,$esubject,$body,”From: $eemail\n”);
break;
case 14:
$mymail = ‘daisy.garcia@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘levie.bendicio@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘maja.dino@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘mm@healthway.com.ph’ . ‘, ‘;
$mymail .= ‘rhea.rodriguez@healthway.com.ph’;
$esubject = “Healthway Market! Market! Appointment - “.$_POST["firstname"].’ ‘.$_POST["middlename"].’ ‘.$_POST["lastname"];
$body= “Lastname: “.$_POST["lastname"].”\n”;
$body.= “Firstname: “.$_POST["firstname"].”\n”;
$body.= “Middle name: “.$_POST["middlename"].”\n”;
$body.= “Birthday: “.$_POST['year'].’-’.$_POST['month'].’-’.$_POST['day'].”\n”;
$body.= “Gender: “.$_POST["gender"].”\n”;
$body.= “Telephone nos: “.$_POST["telnos"].”\n”;
$body.= “Mobile: “.$_POST["mobile"].”\n”;
$body.= “Email: “.$_POST["email"].”\n”;
$body.= “Physician: “.$_POST["physician"].”\n”;
$body.= “Appointment Date: “.$_POST["adate"].”\n”;
$body.= “Description: “.nl2br($_POST["description"]).”\n\n\n”;
$body.= “************************************************”.”\n”;
$body.= “Reminder: this is just a notification, please do not reply to this email”;
$eemail = $_POST['email'];
$sent = mail($mymail,$esubject,$body,”From: $eemail\n”);
break;
}
#################################################
$select1 = “SELECT COUNT(tb1.`ID`) AS NUMCOUNT, tb1.`BCODE`,tb1.`APDATE`,tb1.`SYSTEM PHYSICIAN CODE`
FROM h_appoint tb1
JOIN h_ldr tb2 USING(`SYSTEM PHYSICIAN CODE`)
WHERE tb2.`SYSTEM PHYSICIAN CODE` = ‘”.$_POST['physiciancode'].”‘
AND tb1.`BCODE`=’”.$_POST['branch'].”‘
AND tb2.`DOCTOR STATUS` LIKE ‘ACTIVE’
AND tb1.`APDATE` = ‘”.$_POST['adate'].”‘
GROUP BY tb1.`APDATE`,tb1.`SYSTEM PHYSICIAN CODE`”;
$result = mysql_query($select1, connect());
$count = mysql_fetch_array($result);
$total = $count['NUMCOUNT'] + 3;
echo ““;
echo ““;
//echo ““;
echo ““;
}
} else {
?>
}
?>
