"; echo "Monday"; echo "   "; echo "Tuesday"; echo "   "; echo "Wednesday"; echo "   "; echo "Thursday"; echo "   "; echo "Friday"; echo "   "; echo "Saturday"; echo "   "; echo "Sunday"; echo "   "; echo "
"; } function lookupprofession($Proid) { global $Profprovary; $link_id = db_connect(); if(!$link_id) die(sql_error()); if($_SESSION['userProprov']=="BC"){$servProdb="service_providers";} else if($_SESSION['userProprov']=="AB"){$servProdb="service_providers_ab";} else if($_SESSION['userProprov']=="SK"){$servProdb="service_providers_sk";} else if($_SESSION['userProprov']=="MB"){$servProdb="service_providers_mb";} else if($_SESSION['userProprov']=="ON"){$servProdb="service_providers_on";} else if($_SESSION['userProprov']=="QC"){$servProdb="service_providers_qc";} else if($_SESSION['userProprov']=="NS"){$servProdb="service_providers_ns";} else if($_SESSION['userProprov']=="NB"){$servProdb="service_providers_nb";} else if($_SESSION['userProprov']=="PE"){$servProdb="service_providers_pe";} else if($_SESSION['userProprov']=="NL"){$servProdb="service_providers_nl";} else if($_SESSION['userProprov']=="YK"){$servProdb="service_providers_yk";} else if($_SESSION['userProprov']=="NW"){$servProdb="service_providers_nw";} else if($_SESSION['userProprov']=="NV"){$servProdb="service_providers_nv";} $Profquery="SELECT Pro_type, Procity, ProcityA, ProcityB FROM $servProdb WHERE Pro_id='$Proid'"; $Profresult=mysql_query($Profquery); if(!$Profresult){error_message(sql_error());} else { $Profarray=mysql_fetch_array($Profresult); $Profession=$Profarray['Pro_type']; $Procity=$Profarray['Procity']; $ProcityA=$Profarray['ProcityA']; $ProcityB=$Profarray['ProcityB']; $Profprovary=array($Procity,$ProcityA,$ProcityB); if($Profession==1){$Profession_type="Psychologist";} else if($Profession==2){$Profession_type="Physiotherapist";} else if($Profession==3){$Profession_type="Chiropractor";} else if($Profession==4){$Profession_type="Chinese Med Prac/Acupuncturist";} else if($Profession==5){$Profession_type="Occupational Therapist";} else if($Profession==6){$Profession_type="Occupational Rehab Program";} else if($Profession==7){$Profession_type="Pain Program";} else if($Profession==8){$Profession_type="Work Conditioning Program";} else if($Profession==9){$Profession_type="Massage Therapist";} else if($Profession==10){$Profession_type="Counsellor";} else if($Profession==11){$Profession_type="Medical Rehab Program";} else if($Profession==12){$Profession_type="Day Spa";} else if($Profession==13){$Profession_type="Dentist";} else if($Profession==14){$Profession_type="Laser Surgery Clinic";} else if($Profession==15){$Profession_type="Physician";} else if($Profession==16){$Profession_type="Naturopath";} return $Profession_type; } } function eastr_date($Yeare) { $G = $Yeare % 19; $C = (int)($Yeare / 100); $H = (int)($C - ($C/4) - ((8 * $C+13)/25) + 19 * $G +15) % 30; $I = (int)$H - (int)($H/28) * (1 - (int)($H/28) * (int)(29/($H + 1))*((int)(21 - $G)/11)); $J = ($Yeare + (int)($Yeare/4) + $I + 2 - $C + (int)($C/4)) % 7; $L = $I - $J; $m = 3 + (int)(($L + 40) / 44); $d = $L + 28 - 31 * ((int)($m/4)); $y = $Yeare; $E = mktime(0,0,0, $m, $d, $y); return $E; } function ordinalDay($ord, $day, $month, $year) { $firstOfMonth = strtotime("$year-$month-01"); $lastOfMonth = $firstOfMonth + date("t", $firstOfMonth) * 86400; $dayOccurs = 0; for ($i = $firstOfMonth; $i < $lastOfMonth ; $i += 86400) { if (date("D", $i) == $day) { $dayOccurs++; if ($dayOccurs == $ord) { $ordDay = $i; } } } return $ordDay; } /////////////////// End function ordinalDay() function get_holidays($start_year, $end_year) { $years_subtracted=$end_year - $start_year; $years_subtracted++; //echo $years_subtracted; $holidays=array(); $current_year=$start_year; for($counter=0; $counter < $years_subtracted; $counter++) { $new_years=$current_year; $new_years .="-01-01"; //echo $new_years; $holidays[]=$new_years; $eastertimestamp=eastr_date($current_year); $Easter=strftime("%Y-%m-%d" , $eastertimestamp); $holidays[]=$Easter; $EasterMonOff=$_POST['EasterMonOff']; if($EasterMonOff) { $eastertimestampM=$eastertimestamp + 86400; $EasterMon=strftime("%Y-%m-%d" , $eastertimestampM); $holidays[]=$EasterMon; } $eastertimestamp1 = $eastertimestamp - 172800; $GoodFriday=strftime("%Y-%m-%d" , $eastertimestamp1); //echo "
Good Friday is "; //echo $GoodFriday; $holidays[]=$GoodFriday; /* Victoria Day 4th or 3rd Mon if < 24 */ $VictoriaMonts=ordinalDay(4, 'Mon', 5, $current_year); $dayFourthMon=strftime("%d",$VictoriaMonts); //echo $dayFourthMon; if($dayFourthMon > 24) { $VictoriaMonts=ordinalDay(3, 'Mon', 5, $current_year); } $VictoriaDay=strftime("%Y-%m-%d" , $VictoriaMonts); $holidays[]=$VictoriaDay; $July1=$current_year; $July1 .= "-07-01"; $holidays[]=$July1; /* BC day */ $BCDayts=ordinalDay(1, 'Mon', 8, $current_year); $BCDay=strftime("%Y-%m-%d" , $BCDayts); $holidays[]=$BCDay; $LabourDayts=ordinalDay(1, 'Mon', 9, $current_year); $LabourDay=strftime("%Y-%m-%d" , $LabourDayts); $holidays[]=$LabourDay; /* Thanksgiving */ $Thanksgivingts=ordinalDay(2, 'Mon', 10, $current_year); $Thanksgiving=strftime("%Y-%m-%d" , $Thanksgivingts); $holidays[]=$Thanksgiving; /* Nov 11 */ $RemembranceDay=$current_year; $RemembranceDay .= "-11-11"; $holidays[]=$RemembranceDay; /* Dec 25 26 */ $Christmas=$current_year; $Christmas .= "-12-25"; $holidays[]=$Christmas; $BoxingDay=$current_year; $BoxingDay .= "-12-26"; $holidays[]=$BoxingDay; $current_year++; }/////end of for loop return $holidays; }/////end function get_holidays function appointment_input($day_of_week, $counter) { global $Profession, $Profprovary, $Moncolor, $Tuescolor, $Wedcolor, $Thurscolor, $Fricolor, $Satcolor, $Suncolor; global $PHP_SELF; echo ""; echo "Location "; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } function check_dupe_appointments($service_provider21, $day21, $time21) { global $dbhost, $apptdb; $link_id = db_connect(); if(!$link_id) die(sql_error()); $query="SELECT appt_id, client_id, location, bill_to, lastaccess FROM $apptdb WHERE Agent_id = '$service_provider21' AND day = '$day21' AND time = '$time21'"; $result_id=mysql_query($query); if(!mysql_num_rows($result_id)) {return 0;}////return zero if no prob else {return 1;}////returns one if there is duplicate } ////////////////// function many_appts_one_day($start_time, $no_appts) { global $apptdb; //global $Date1, $Date2, $Date3; $Assmt1=0; $return_zero=0; $Date_in_func = $_POST['Date1'] . $_POST['Date2'] . $_POST['Date3']; for ($counter=0; $counter < $no_appts; $counter++) { $time_to_add0=$counter * 10000; $add_time0 = $start_time + $time_to_add0; //////check_dupe_appointments($_POST['user_Pro_id2'], $day, $time_to_add0); if( check_dupe_appointments($_POST['user_Pro_id2'], $Date_in_func, $add_time0)) error_message("Cannot book duplicate appointments.");///isnt working } for ($counter=0; $counter < $no_appts; $counter++) { $tempuserPro=$_POST['user_Pro_id2']; $time_to_add=$counter * 10000; $add_time = $start_time + $time_to_add; $templocation=$_POST['location_input']; $query="INSERT INTO $apptdb (appt_id, day, time, Assmt, Agent_id, client_id, location, lastaccess, bill_to) VALUES (NULL, $Date_in_func, $add_time, $Assmt1, '$tempuserPro', NULL, '$templocation', NULL, NULL)"; mysql_query($query); $result=mysql_affected_rows(); if(!$result) {$return_zero=1;} } if($return_zero) {return 0;} else {return 1;} } ///////////////// function add_appt_form() { global $PHP_SELF, $Profession, $noApps, $Moncolor, $Tuescolor, $Wedcolor, $Thurscolor, $Fricolor, $Satcolor, $Suncolor; global $Profprovary; ?>

Set your regular appointments (or add one appointment at a time here)!


If there are not enough slots, you can use this page a number of times and set groups of appointments each time (for example, mornings and then afternoons).
Click on one of the following to input appointment slots for that day of the week
";DayLinks(); ?>
"; echo ""; for($counter=0; $counter < $noApps; $counter++) { appointment_input(Mon, $counter); } } else if($_GET['by_day']==2) { echo ""; echo ""; for($counter=0; $counter < $noApps; $counter++) { appointment_input(Tues, $counter); } } else if($_GET['by_day']==3) { echo ""; echo ""; for($counter=0; $counter < $noApps; $counter++) { appointment_input(Wed, $counter); } } else if($_GET['by_day']==4) { echo ""; echo ""; for($counter=0; $counter < $noApps; $counter++) { appointment_input(Thu, $counter); } } else if($_GET['by_day']==5) { echo ""; echo ""; for($counter=0; $counter < $noApps; $counter++) { appointment_input(Fri, $counter); } } else if($_GET['by_day']==6) { echo ""; echo ""; for($counter=0; $counter < $noApps; $counter++) { appointment_input(Sat, $counter); } } else if($_GET['by_day']==7) { echo ""; echo ""; for($counter=0; $counter < $noApps; $counter++) { appointment_input(Sun, $counter); } } //echo ""; ?>
Your ID
Dates From to
Give me Easter Monday off  
Mondays
Tuesdays
Wednesdays
Thursdays
Fridays
Saturdays
Sundays
Back to appts
"; ?>
"; echo ""; echo""; echo ""; echo "

Appointment booking method Patent Pending"; echo "      LOGOUT

"; echo ""; //echo ""; echo "
"; echo "

This page will take some time to load

"; echo "

Back to zappointments.com home page

"; echo "

"; if($_POST['action']=="added_appt") { $DateFrom=$_POST['DateFrom1'] . "-" . $_POST['DateFrom2'] . "-" . $_POST['DateFrom3']; $DateTo=$_POST['DateTo1'] . "-" . $_POST['DateTo2'] . "-" . $_POST['DateTo3']; $start_day=strtotime($DateFrom); $end_day=strtotime($DateTo); $start_day_of_week = date( "D", $start_day); if($start_day_of_week=='Mon'){$day_of_week_no=1;} if($start_day_of_week=='Tue'){$day_of_week_no=2;} if($start_day_of_week=='Wed'){$day_of_week_no=3;} if($start_day_of_week=='Thu'){$day_of_week_no=4;} if($start_day_of_week=='Fri'){$day_of_week_no=5;} if($start_day_of_week=='Sat'){$day_of_week_no=6;} if($start_day_of_week=='Sun'){$day_of_week_no=7;} $yearone=$_POST['DateFrom1']; $yearlast=$_POST['DateTo1']; $holidays=get_holidays($yearone,$yearlast); $num_of_appts_booked=0; /*while(list(,$holiday_date)=each($holidays)) { echo $holiday_date; echo "
"; }*/ $tempuserPro=$_POST['user_Pro_id2']; $Date_of_appts=$DateFrom; $currentday=$start_day; $dayflag=0; $link_id = db_connect(); if(!$link_id) die(sql_error()); $Date_of_appts_array=array($Date_of_appts); $day_before=$end_day -= 82800; $dalightendbefore = date('I', $day_before); $dalightendafter = date('I', $end_day); $end_day += 82800; if($dalightendbefore - $dalightendafter == 1) {$end_day += 3600;} else if($dalightendbefore - $dalightendafter == -1) {$end_day -=3600;} $book_day=$_GET['by_day']; if($day_of_week_no > $book_day) {$nodays= (7 - $day_of_week_no); $nodays += $book_day; } else if($day_of_week_no < $book_day) { $nodays = $book_day - $day_of_week_no; } else {$nodays =0;} $dalightbefore = date('I', $currentday); $currentday += ($nodays * 86400); $dalightafter = date('I', $currentday); if($dalightbefore - $dalightafter == 1) {$currentday += 3600;} else if($dalightbefore - $dalightafter == -1) {$currentday -=3600;} while($currentday <= $end_day) { $Date_of_appts=strftime('%Y-%m-%d', $currentday); $Date_of_appts_array=array($Date_of_appts); $intersect_array=array_intersect($holidays, $Date_of_appts_array); //echo "Intersect array is "; //echo $intersect_array; if(count($intersect_array)==0) { $Date_of_appts_array=array($Date_of_appts); //echo "currentday is " . $currentday . " end_day is " . $end_day; if($book_day==1) { for($counting=0; $counting < $noApps; $counting++) { $arrayMontime1=$_POST['Montime1']; $arrayMontime2=$_POST['Montime2']; $arrayMonAssmt=$_POST['MonAssmt']; $arrayMonlocation=$_POST['Monlocation_input']; if($arrayMontime1[$counting]!='99') { $Montime=$arrayMontime1[$counting] . $arrayMontime2[$counting]; $MonAssmt=$arrayMonAssmt[$counting]; $templocation=$arrayMonlocation[$counting]; if($allowSameTime==0) { $Monquerypre="SELECT * FROM $apptdb where ((day='$Date_of_appts' && time='$Montime') && Agent_id='$tempuserPro')"; $Monresultpre=mysql_query($Monquerypre); $Monresultpre1=mysql_num_rows($Monresultpre); } else {$Monresultpre1=0;} if($Monresultpre1==0) { $Monquery="INSERT INTO $apptdb (appt_id, day, time, Assmt, Agent_id, client_id, location, lastaccess, bill_to) VALUES (NULL, '$Date_of_appts', '$Montime', '$MonAssmt', '$tempuserPro', NULL, '$templocation', NULL, NULL)"; $nowresult=mysql_query($Monquery); if(!$nowresult) {echo "Error at ". $Montime . " on " . $Date_of_appts . "
";} else {$num_of_appts_booked++;} }else{echo "Already had an appointment at " . $Montime . " on " . $Date_of_appts . "
";} } } } if($book_day==2) { for($counting=0; $counting < $noApps; $counting++) { $arrayTuestime1=$_POST['Tuestime1']; $arrayTuestime2=$_POST['Tuestime2']; $arrayTuesAssmt=$_POST['TuesAssmt']; $arrayTueslocation=$_POST['Tueslocation_input']; if($arrayTuestime1[$counting]!='99') { $Tuestime=$arrayTuestime1[$counting] . $arrayTuestime2[$counting]; $TuesAssmt=$arrayTuesAssmt[$counting]; $templocation=$arrayTueslocation[$counting]; if($allowSameTime==0) { $Tuesquerypre="SELECT * FROM $apptdb where ((day='$Date_of_appts' && time='$Tuestime') && Agent_id='$tempuserPro')"; $Tuesresultpre=mysql_query($Tuesquerypre); $Tuesresultpre1=mysql_num_rows($Tuesresultpre); } else {$Tuesresultpre1=0;} if($Tuesresultpre1==0) { $Tuesquery="INSERT INTO $apptdb (appt_id, day, time, Assmt, Agent_id, client_id, location, lastaccess, bill_to) VALUES (NULL, '$Date_of_appts', '$Tuestime', '$TuesAssmt', '$tempuserPro', NULL, '$templocation', NULL, NULL)"; $nowresult=mysql_query($Tuesquery); if(!$nowresult) {echo "Error at ". $Tuestime . " on " . $Date_of_appts . "
";} else {$num_of_appts_booked++;} }else{echo "Already had an appointment at " . $Tuestime . " on " . $Date_of_appts . "
";} } } } if($book_day==3) { for($counting=0; $counting < $noApps; $counting++) { $arrayWedtime1=$_POST['Wedtime1']; $arrayWedtime2=$_POST['Wedtime2']; $arrayWedAssmt=$_POST['WedAssmt']; $arrayWedlocation=$_POST['Wedlocation_input']; if($arrayWedtime1[$counting]!='99') { $Wedtime=$arrayWedtime1[$counting] . $arrayWedtime2[$counting];$WedAssmt=$arrayWedAssmt[$counting]; $templocation=$arrayWedlocation[$counting]; if($allowSameTime==0) { $Wedquerypre="SELECT * FROM $apptdb where ((day='$Date_of_appts' && time='$Wedtime') && Agent_id='$tempuserPro')"; $Wedresultpre=mysql_query($Wedquerypre); $Wedresultpre1=mysql_num_rows($Wedresultpre); } else {$Wedresultpre1=0;} if($Wedresultpre1==0) {$Wedquery="INSERT INTO $apptdb (appt_id, day, time, Assmt, Agent_id, client_id, location, lastaccess, bill_to) VALUES (NULL, '$Date_of_appts', '$Wedtime', '$WedAssmt', '$tempuserPro', NULL, '$templocation', NULL, NULL)"; $nowresult=mysql_query($Wedquery); if(!$nowresult) {echo "Error at ". $Wedtime . " on " . $Date_of_appts . "
";} else {$num_of_appts_booked++;} }else{echo "Already had an appointment at " . $Wedtime . " on " . $Date_of_appts . "
";} } } } if($book_day==4) { for($counting=0; $counting < $noApps; $counting++) { $arrayThutime1=$_POST['Thutime1']; $arrayThutime2=$_POST['Thutime2']; $arrayThuAssmt=$_POST['ThuAssmt']; $arrayThulocation=$_POST['Thulocation_input']; if($arrayThutime1[$counting]!='99') { $Thutime=$arrayThutime1[$counting] . $arrayThutime2[$counting];$ThuAssmt=$arrayThuAssmt[$counting]; $templocation=$arrayThulocation[$counting]; if($allowSameTime==0) { $Thuquerypre="SELECT * FROM $apptdb where ((day='$Date_of_appts' && time='$Thutime') && Agent_id='$tempuserPro')"; $Thuresultpre=mysql_query($Thuquerypre); $Thuresultpre1=mysql_num_rows($Thuresultpre); } else{$Thuresultpre1=0;} if($Thuresultpre1==0) {$Thuquery="INSERT INTO $apptdb (appt_id, day, time, Assmt, Agent_id, client_id, location, lastaccess, bill_to) VALUES (NULL, '$Date_of_appts', '$Thutime', '$ThuAssmt', '$tempuserPro', NULL, '$templocation', NULL, NULL)"; $nowresult=mysql_query($Thuquery); if(!$nowresult) {echo "Error at ". $Thutime . " on " . $Date_of_appts . "
";} else {$num_of_appts_booked++;} }else{echo "Already had an appointment at " . $Thutime . " on " . $Date_of_appts . "
";} } } } if($book_day==5) { for($counting=0; $counting < $noApps; $counting++) { $arrayFritime1=$_POST['Fritime1']; $arrayFritime2=$_POST['Fritime2']; $arrayFriAssmt=$_POST['FriAssmt']; $arrayFrilocation=$_POST['Frilocation_input']; if($arrayFritime1[$counting]!='99') { $Fritime=$arrayFritime1[$counting] . $arrayFritime2[$counting];$FriAssmt=$arrayFriAssmt[$counting]; $templocation=$arrayFrilocation[$counting]; if($allowSameTime==0) { $Friquerypre="SELECT * FROM $apptdb where ((day='$Date_of_appts' && time='$Fritime') && Agent_id='$tempuserPro')"; $Friresultpre=mysql_query($Friquerypre); $Friresultpre1=mysql_num_rows($Friresultpre); } else {$Friresultpre1=0;} if($Friresultpre1==0) {$Friquery="INSERT INTO $apptdb (appt_id, day, time, Assmt, Agent_id, client_id, location, lastaccess, bill_to) VALUES (NULL, '$Date_of_appts', '$Fritime', '$FriAssmt', '$tempuserPro', NULL, '$templocation', NULL, NULL)"; $nowresult=mysql_query($Friquery); if(!$nowresult) {echo "Error at ". $Fritime . " on " . $Date_of_appts . "
";} else {$num_of_appts_booked++;} }else{echo "Already had an appointment at " . $Fritime . " on " . $Date_of_appts . "
";} } } } if($book_day==6) { for($counting=0; $counting < $noApps; $counting++) { $arraySattime1=$_POST['Sattime1']; $arraySattime2=$_POST['Sattime2']; $arraySatAssmt=$_POST['SatAssmt']; $arraySatlocation=$_POST['Satlocation_input']; if($arraySattime1[$counting]!='99') { $Sattime=$arraySattime1[$counting] . $arraySattime2[$counting];$SatAssmt=$arraySatAssmt[$counting]; $templocation=$arraySatlocation[$counting]; if($allowSameTime==0) { $Satquerypre="SELECT * FROM $apptdb where ((day='$Date_of_appts' && time='$Sattime') && Agent_id='$tempuserPro')"; $Satresultpre=mysql_query($Satquerypre); $Satresultpre1=mysql_num_rows($Satresultpre); } else {$Satresultpre1=0;} if($Satresultpre1==0) {$Satquery="INSERT INTO $apptdb (appt_id, day, time, Assmt, Agent_id, client_id, location, lastaccess, bill_to) VALUES (NULL, '$Date_of_appts', '$Sattime', '$SatAssmt', '$tempuserPro', NULL, '$templocation', NULL, NULL)"; $nowresult=mysql_query($Satquery); if(!$nowresult) {echo "Error at ". $Sattime . " on " . $Date_of_appts . "
";} else {$num_of_appts_booked++;} }else{echo "Already had an appointment at " . $Sattime . " on " . $Date_of_appts . "
";} } } } if($book_day==7) { for($counting=0; $counting < $noApps; $counting++) { $arraySuntime1=$_POST['Suntime1']; $arraySuntime2=$_POST['Suntime2']; $arraySunAssmt=$_POST['SunAssmt']; $arraySunlocation=$_POST['Sunlocation_input']; if($arraySuntime1[$counting]!='99') { $Suntime=$arraySuntime1[$counting] . $arraySuntime2[$counting];$SunAssmt=$arraySunAssmt[$counting]; $templocation=$arraySunlocation[$counting]; if($allowSameTime==0) { $Sunquerypre="SELECT * FROM $apptdb where ((day='$Date_of_appts' && time='$Suntime') && Agent_id='$tempuserPro')"; $Sunresultpre=mysql_query($Sunquerypre); $Sunresultpre1=mysql_num_rows($Sunresultpre); } else {$Sunresultpre1=0;} if($Sunresultpre1==0) {$Sunquery="INSERT INTO $apptdb (appt_id, day, time, Assmt, Agent_id, client_id, location, lastaccess, bill_to) VALUES (NULL, '$Date_of_appts', '$Suntime', '$SunAssmt', '$tempuserPro', NULL, '$templocation', NULL, NULL)"; $nowresult=mysql_query($Sunquery); if(!$nowresult) {echo "Error at ". $Suntime . " on " . $Date_of_appts . "
";} else {$num_of_appts_booked++;} }else{echo "Already had an appointment at " . $Suntime . " on " . $Date_of_appts . "
";} } } }//////end of if }///////end of big if else{ echo "
Skipped holiday on " . $Date_of_appts; } $currentday=strtotime($Date_of_appts); $dalightbefore = date('I', $currentday); $currentday += 604800; ////this is one week $dalightafter = date('I', $currentday); if($dalightbefore - $dalightafter == 1) {$currentday += 3600;} else if($dalightbefore - $dalightafter == -1) {$currentday -=3600;} $Date_of_appts = strftime("%Y-%m-%d", $currentday); }///////end of while echo "

";echo $num_of_appts_booked . " empty appointment(s) set! Use back button to set more!

"; //$result1=enter_new_appt(); } else { add_appt_form(); } }///end of else echo "

Appointment booking method Patent Pending

"; echo "


zappointments.com: online booking for health professionals

"; echo ""; ?>