$intLastSlash) $intLastSlash = strrpos($_SERVER['SCRIPT_FILENAME'], "\\"); // cut out from begining to the last slash $php_root_path = substr($_SERVER['SCRIPT_FILENAME'],0,$intLastSlash+1); include($php_root_path . 'includes/functions.php'); include($php_root_path . 'includes/template.php'); include_once($php_root_path . 'includes/db.inc.php'); include_once($php_root_path . 'includes/captchalib.php'); if (isset($_REQUEST['email']) ) save_booking(); else show_booking(); function save_booking() { if (!checkcaptcha()) { $answer='

Sorry for the inconvenience

'; $answer.='

Your verification code is wrong! '; $answer.='
Please try again or '; $answer.='inform the '; $answer.='webmaster of this website

'; echo $answer; exit; } // Get the form data $dummy = ( isset($_REQUEST['artist']) ) ? $_REQUEST['artist']:"0"; $b_artist_id = intval($dummy); $b_country_code = ( isset($_REQUEST['country']) ) ? $_REQUEST['country']:"ALL"; $b_day = ( isset($_REQUEST['day']) ) ? $_REQUEST['day']:""; $b_month = ( isset($_REQUEST['month']) ) ? $_REQUEST['month']:""; $b_year = ( isset($_REQUEST['year']) ) ? $_REQUEST['year']:""; $b_name = ( isset($_REQUEST['name']) ) ? $_REQUEST['name']:""; $b_phone = ( isset($_REQUEST['phone']) ) ? $_REQUEST['phone']:""; $b_mail = ( isset($_REQUEST['email']) ) ? $_REQUEST['email']:""; $b_details = ( isset($_REQUEST['details']) ) ? $_REQUEST['details']:""; $sqlstmt = "SELECT cname FROM book_country WHERE country_code = '$b_country_code'"; $result = @mysql_query($sqlstmt); if (!$result) exit('

Error performing query: '. mysql_error() . '

'); while ($row = mysql_fetch_array($result)) {$b_countryname = $row['cname'];} $sqlstmt = "SELECT cname FROM book_artist WHERE artist_id = '$b_artist_id'"; $result = @mysql_query($sqlstmt); if (!$result) exit('

Error performing query: '. mysql_error() . '

'); while ($row = mysql_fetch_array($result)) {$b_artistname = $row['cname'];} $b_fulldate = (checkdate(intval($b_month),intval($b_day),intval($b_year))) ? $b_year.$b_month.$b_day : $b_fulldate="00000000"; $sql = "INSERT INTO book_request SET artist_id = '$b_artist_id', name = '$b_name', phone = '$b_phone', email = '$b_mail', country_code = '$b_country_code', eventdate = '$b_fulldate', details = '$b_details', flags = '0', insertiondate = NOW()"; // Perform the insertion. $ok = @mysql_query($sql); if ($ok) { // Here the request is registered ... Send out mail to the agency // for this country and the default agencies (like Ana and ArtistExclusive) $sql = "SELECT distinct C.cname, C.email FROM book_mail_route R , book_contact C WHERE R.contact_id = C.contact_id AND (R.country_code = '$b_country' OR R.country_code = 'ALL') AND (R.artist_id = $b_artist_id)"; //AND (R.artist_id = $b_artist_id OR R.artist_id = 0)"; $contacts = @mysql_query($sql); if ($contacts) { while ($mail = mysql_fetch_array($contacts)) { $bookingagency=$mail['cname']; $bookingagencymail=$mail['email']; $body="\nDear ".$bookingagency.",\n\n"; $body.="We would like to inform you that:\n\n"; if ($b_phone=="") $body.=$b_name."\nPhone: -"; else $body.=$b_name."\nPhone: ".$b_phone; $body.="\nE-Mail: ".$b_mail."\n\nhas posted a booking request "; $body.="for $b_artistname \n"; $body.="using the official website at www.9100723_artistex.com.\n\n"; if ($b_fulldate != "00000000") { $body.="The proposed date is: ".$b_day."-".$b_month."-".$b_year." (DD-MM-YYYY).\n"; $pdate=" proposed date: ".$b_day."-".$b_month."-".$b_year." (DD-MM-YYYY)"; } else $pdate = ''; $body.=$b_name." entered the following additional remarks:\n"; if ($b_details=="") $body.='- nothing -'; else $body.=$b_details; $body.="\n\nPlease note that this is an automatically generated message."; $body.="\n\nBest Regards,\n Artistexclusive"; // our testserver does not need to send mail // $answer.='

Mail will be sent to: '; // $answer.=$bookingagency.' ('.$bookingagencymail.')'; //$answer.='

'.$body.'
'; $rtn= MAIL_NVLP("ArtisteXclusive Online", "noreply@9100723_artistex.com", $bookingagency, $bookingagencymail, "Booking request for $b_artistname ".$pdate, $body); } // end while $body="Thank you for your interest in booking $b_artistname "; $body.="\r\nWe will get back to you as soon as possible."; $body.="\r\n\r\nPlease note that this is an automatically generated message."; $body.="\r\nBest Regards,\n Artistexclusive"; $rtn= MAIL_NVLP("ArtisteXclusive Online", "noreply@9100723_artistex.com", $b_name, $b_mail, "Booking request for $b_artistname ".$pdate, $body); } // end contact } // end ok if ($ok) { $answer='

Thank you for your interest!

'; $answer.='
We will get back to you as soon as possible.
'; } else { $answer='

Sorry for the inconvenience

'; $answer.='

Due to technical problems we are not able '; $answer.='to register your request at the moment.
Please try again later or '; $answer.='inform the '; $answer.='webmaster of this website

'; } echo $answer; } /* ####################################################### */ function show_booking() { global $php_root_path; global $PHP_SELF; // ----------------------------------------------------------------------------- // Display Booking // ----------------------------------------------------------------------------- $pagebody = 'getbooking_form.html'; $template = new Template($php_root_path."/templates"); $sqlstmt = "SELECT country_code,cname FROM book_country ORDER BY ordering ASC"; $result = @mysql_query($sqlstmt); if (!$result) exit('

Error performing query: '. mysql_error() . '

'); $countryoption = "";; while ($row = mysql_fetch_array($result)) { $countryoption = $countryoption."\n"; } $dummy = ( isset($_REQUEST['artist']) ) ? $_REQUEST['artist']:"-1"; $b_artist_id = intval($dummy); $artistoption = ""; $sqlstmt = "select artist_id, cname from book_artist order by ordering"; $result = @mysql_query($sqlstmt); if (!$result) exit('

Error performing query: '. mysql_error() . '

'); while ($row = mysql_fetch_array($result)) { $selected = ( $b_artist_id == $row['artist_id']) ? "selected" : ""; $artistoption .= "\n"; } if ( $b_artist_id < 0) $artistoption = "".$artistoption; $dayoption = ""; for ($day = 1;$day <= 31;$day++) $dayoption = $dayoption."\n"; $monthoption = ""; for ($month = 1;$month <= 12;$month++) $monthoption = $monthoption."\n"; $yearoption = ""; for ($year = date("Y");$year <= date("Y")+2;$year++) $yearoption = $yearoption."\n"; // assign template $template->set_filenames(array('body' => $pagebody)); $template->assign_vars(array( 'L_THIS' => $PHP_SELF, 'L_ARTIST' => $artistoption, 'L_COUNTRY' => $countryoption, 'L_DAY' => $dayoption, 'L_MONTH' => $monthoption, 'L_YEAR' => $yearoption ) ); $template->pparse('body'); } function flushheader() { if (!empty($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache/2')) { header ('Cache-Control: no-cache, pre-check=0, post-check=0'); } else { header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0'); } header ('Expires: 0'); header ('Pragma: no-cache'); } ?>