/** Contact Form **/ function TB_ContactForm($emailTo, $emailCC = FALSE, $sentHeading = 'Your message has been successfully submitted..', $sentMessage = 'We will get back to you asap.') { if (isset($_POST['contact_submit'])) { $error = ""; $fullname = makeSafe($_POST['fullname']); $email = makeSafe($_POST['email']); $phone = makeSafe($_POST['phone']); $message = makesafe($_POST['message']); $subject = "Enquiry from Canareef Resort Maldives"; $from_name = "Canareef"; $from_email = "*****@*****.**"; if (empty($fullname)) { $error['fullname'] = "Your Name"; } if (empty($email) || !isValidEmail($email)) { $error['email'] = "Your Email"; } if (empty($message)) { $error['message'] = "Your Message"; } if (!empty($_POST['antispam'])) { echo '<p>We don’t appreciate spam.</p>'; } elseif (!empty($error)) { TB_DisplayForm($error); } else { $content = __('Name') . ' : ' . $fullname . "\n" . __('Email') . ' : ' . $email . "\n" . __('Phone Number') . ' : ' . $phone . "\n" . __('Message') . " : \n" . $message . "\n\n"; $headers = 'From: =?UTF-8?B?' . base64_encode($fullname) . '?= <' . $email . '>' . "\r\n"; // $headers = 'From: =?UTF-8?B?'.base64_encode($from_name).'?= <'.$from_email.'>'."\r\n"; $emailBCC = ''; if ($emailCC) { $headers .= 'CC: ' . $emailCC . "\r\n"; } if ($emailBCC != '') { $headers .= 'BCC: ' . $emailBCC . "\r\n"; } $headers .= 'Reply-To: ' . $email . "\r\n"; $headers .= 'Content-type: text/plain; charset=UTF-8'; if (mail($emailTo, $subject, $content, $headers)) { echo '<a id="contact-status" name="status"></a>' . "\n"; echo '<p class="tbSuccess">' . __($sentHeading) . ' ' . __($sentMessage) . '</p>' . "\n"; $fullname = ""; $email = ""; $phone = ""; $message = ""; } else { $error['sendemail'] = "Email could not be sent."; } TB_DisplayForm($error); } } else { TB_DisplayForm(); } }
/** Contact Form **/ function TB_ContactForm($emailTo, $emailCC = FALSE, $sentHeading = 'Your message was sent successfully.', $sentMessage = 'We will get back to you soon.') { if (isset($_POST['contact_submit'])) { $error = ""; $fullname = makeSafe($_POST['fullname']); $email = makeSafe($_POST['email']); $phone = makeSafe($_POST['phone']); $message = makesafe($_POST['message']); $subject = "Enquiry from Estadia by Hatten"; if (empty($fullname)) { $error['fullname'] = "Your name"; } if (empty($email) || !isValidEmail($email)) { $error['email'] = "Email Address"; } if (empty($message)) { $error['message'] = "General Enquiry"; } if (!empty($_POST['antispam'])) { echo '<p>We don’t appreciate spam.</p>'; } elseif (!empty($error)) { TB_DisplayForm($error); } else { $content = __('Name') . ' : ' . $fullname . "\n\n" . __('Email Address') . ' : ' . $email . "\n\n" . __('Contact No.') . ' : ' . $phone . "\n\n" . __('General Enquiry') . " : \n\n" . $message . "\n\n"; $headers = 'From: =?UTF-8?B?' . base64_encode($fullname) . '?= <' . $email . '>' . "\r\n"; $emailBCC = ''; if ($emailCC) { $headers .= 'CC: ' . $emailCC . "\r\n"; } if ($emailBCC != '') { $headers .= 'BCC: ' . $emailBCC . "\r\n"; } $headers .= 'Reply-To: ' . $email . "\r\n"; $headers .= 'Content-type: text/plain; charset=UTF-8'; if (mail($emailTo, $subject, $content, $headers)) { echo '<a id="contact-status" name="status"></a>' . "\n"; echo '<p class="tbSuccess">' . __($sentHeading) . ' ' . __($sentMessage) . '</p>' . "\n"; } else { $error['sendemail'] = "Email could not be sent."; } TB_DisplayForm($error); } } else { TB_DisplayForm(); } }
/** * Extracts file argument either from file parameter or PATH_INFO. * @param string $scriptname name of the calling script * @return string file path (only safe characters) */ function get_file_argument_limited($scriptname) { $relativepath = FALSE; // first try normal parameter (compatible method == no relative links!) if (isset($_GET['file'])) { return makesafe($_GET['file']); } // then try extract file from PATH_INFO (slasharguments method) if (!empty($_SERVER['PATH_INFO'])) { $path_info = $_SERVER['PATH_INFO']; // check that PATH_INFO works == must not contain the script name if (!strpos($path_info, $scriptname)) { return makesafe(rawurldecode($path_info)); } } // now if both fail try the old way // (for compatibility with misconfigured or older buggy php implementations) $arr = get_query($scriptname); if (!empty($arr[1])) { return makesafe(rawurldecode(strip_querystring($arr[1]))); } error('Unexpected PHP set up. Turn off the smartpix config option.'); }
function babblebox() { global $userrow; if (isset($_POST["babble"])) { $safecontent = makesafe($_POST["babble"]); if ($safecontent == "" || $safecontent == " ") { //blank post. do nothing. } else { $insert = doquery("INSERT INTO {{table}} SET id='',posttime=NOW(),author='" . $userrow["charname"] . "',babble='{$safecontent}'", "babble"); } header("Location: index.php?do=babblebox"); die; } $babblebox = array("content" => ""); $bg = 1; $babblequery = doquery("SELECT * FROM {{table}} ORDER BY id DESC LIMIT 100", "babble"); while ($babblerow = mysql_fetch_array($babblequery)) { if ($bg == 1) { $new = "<div style=\"width:98%; background-color:#eeeeee;\">[<b>" . $babblerow["author"] . "</b>] " . $babblerow["babble"] . "</div>\n"; $bg = 2; } else { $new = "<div style=\"width:98%; background-color:#ffffff;\">[<b>" . $babblerow["author"] . "</b>] " . stripslashes($babblerow["babble"]) . "</div>\n"; $bg = 1; } $babblebox["content"] = $new . $babblebox["content"]; } $babblebox["content"] .= "<center><form action=\"index.php?do=babblebox\" method=\"post\"><input type=\"text\" name=\"babble\" size=\"15\" maxlength=\"120\" /><br /><input type=\"submit\" name=\"submit\" value=\"Falar\" /> <input type=\"reset\" name=\"reset\" value=\"Apagar\" /></form></center>"; // Make page tags for XHTML validation. $xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" . "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n" . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n"; $page = $xml . gettemplate("babblebox"); echo parsetemplate($page, $babblebox); die; }
function babbleboxpage($tamanho, $quantidade) { //tamanho do campo da fala. if ($tamanho == "") { $tamanho = 400; } if ($quantidade == "") { $quantidade = 10; } global $userrow; if (isset($_POST["babble"])) { $safecontent = makesafe($_POST["babble"]); if ($safecontent == "" || $safecontent == " ") { //blank post. do nothing. } else { $insert = doquery("INSERT INTO {{table}} SET id='',posttime=NOW(),author='" . $userrow["charname"] . "',babble='{$safecontent}'", "babble"); } header('Location: index.php'); die; } $babblebox = array("content" => ""); $bg = 1; $babblequery = doquery("SELECT * FROM {{table}} ORDER BY id DESC LIMIT {$quantidade}", "babble"); while ($babblerow = mysql_fetch_array($babblequery)) { //cor do nick $querycor = doquery("SELECT * FROM {{table}} WHERE charname='" . $babblerow["author"] . "' LIMIT 1", "users"); $usercor = mysql_fetch_array($querycor); if ($usercor["authlevel"] == 1) { $link = "<font color=darkgreen>"; $link2 = "</font>"; $linkn = " id=\"adm\" "; } elseif ($usercor["acesso"] == 2) { $link = "<font color=darkorange>"; $link2 = "</font>"; $linkn = " id=\"tutor\" "; } elseif ($usercor["acesso"] == 3) { $link = "<font color=darkblue>"; $link2 = "</font>"; $linkn = " id=\"gm\" "; } else { $link = "<font color=black>"; $link2 = "</font>"; $linkn = ""; } if ($bg == 1) { $new = "<div style=\"width:98%; background-color:#eeeeee;\" id=\"divchat\">[<a href=\"javascript: mostrarchar('" . $babblerow["author"] . "');\" {$linkn} title=\"Visualizar Perfil\">{$link}<b>" . $babblerow["author"] . "</b>{$link2}</a>] {$link}" . $babblerow["babble"] . "{$link2}</div>\n"; $bg = 2; } else { $new = "<div style=\"width:98%; background-color:#ffffff;\" id=\"divchat\">[<a href=\"javascript: mostrarchar('" . $babblerow["author"] . "');\" {$linkn} title=\"Visualizar Perfil\">{$link}<b>" . $babblerow["author"] . "</b>{$link2}</a>] {$link}" . stripslashes($babblerow["babble"]) . "{$link2}</div>\n"; $bg = 1; } $babblebox["content"] = $new . $babblebox["content"]; } $babblebox["content"] .= "<center><form action=\"index.php?do=babbleboxpage\" method=\"post\"><input type=\"text\" name=\"babble\" style=\"width:" . $tamanho . "px\" maxlength=\"120\" /><br /><button type=\"submit\" id=\"uffuff\" value=\"\"></form><script type=\"text/javascript\" language=\"JavaScript\">sumirbotao('uffuff');sumirbotao('uffuff');</script>\n</center>"; return $babblebox["content"]; }
function babblebox() { global $userrow; if (isset($_POST["babble"])) { $safecontent = makesafe($_POST["babble"]); if ($safecontent == "" || $safecontent == " ") { //blank post. do nothing. } else { $insert = doquery("INSERT INTO {{table}} SET id='',posttime=NOW(),author='" . $userrow["charname"] . "',babble='{$safecontent}'", "babble"); } header("Location: index.php?do=babblebox"); die; } $babblebox = array("content" => ""); $bg = 1; $babblequery = doquery("SELECT * FROM {{table}} ORDER BY id DESC LIMIT 20", "babble"); while ($babblerow = mysql_fetch_array($babblequery)) { if ($bg == 1) { $new = "<div style=\"width:98%; background-color:#eeeeee;\">[<b>" . $babblerow["author"] . "</b>] " . $babblerow["babble"] . "</div>\n"; $bg = 2; } else { $new = "<div style=\"width:98%; background-color:#ffffff;\">[<b>" . $babblerow["author"] . "</b>] " . stripslashes($babblerow["babble"]) . "</div>\n"; $bg = 1; } $babblebox["content"] = $new . $babblebox["content"]; } $babblebox["content"] .= "<center><form action=\"index.php?do=babblebox\" method=\"post\"><input type=\"text\" name=\"babble\" size=\"15\" maxlength=\"120\" /><br /><input type=\"submit\" name=\"submit\" value=\"Babble\" /> <input type=\"reset\" name=\"reset\" value=\"Clear\" /></form></center>"; $page = gettemplate("babblebox"); echo parsetemplate($page, $babblebox); die; }