GIF89a;
Direktori : /home/serb/www/lib/ |
Current File : /home/serb/www/lib/common.php |
<?php $domain = 'escortservice.org'; //ini_set('session.cookie_domain', $domain); session_set_cookie_params(0, '/', $domain); session_start(); $serverName = $_SERVER['SERVER_NAME']; $parts = explode('.', $serverName); if (count($parts) > 2) { array_shift($parts); } global $serverName; $serverName = implode('.', $parts); if (!isset($_SESSION['countryname'])) { $_SESSION['countryname'] = $_COOKIE['ESORG_COUNTRYNAME']; } include("Mobile_Redirect.php"); function getUrlAttrib($value) { return str_replace(array(' ', '_', '&'), array('-', '-', 'and'), strtolower($value)); } function getTitle($title) { return preg_replace('/[^\da-zA-Z]/i', '', $title); } include_once __DIR__ . '/../phpmailer/PHPMailerAutoload.php'; function sendEmail($to, $subject, $message, $replyTo = '') { $mail = new PHPMailer(); //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = SMTP_SERVER; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = SMTP_USER; // SMTP username $mail->Password = SMTP_PASS; // SMTP password $mail->Port = SMTP_PORT; // TCP port to connect to $mail->From = SMTP_FROM_EMAIL; $mail->FromName = SMTP_FROM_NAME; $mail->addAddress($to); if ($replyTo) { $mail->addReplyTo($replyTo); } $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subject; $mail->Body = $message; $mail->AltBody = strip_tags(str_replace(array('<br />', '<br>', '<BR>', '<BR/>', '<BR />'), "\n", $message)); try { return $mail->send(); } catch(\Exception $e) { return false; } } function execute_query($query) { global $servername; global $dbname; global $dbusername; global $dbpassword; $con = mysql_connect($servername,$dbusername,$dbpassword); if(!$con) { echo "Could not connect to MySQL : ".mysql_error(); exit(); } mysql_select_db($dbname,$con) or die ("Can not connect to $con : Database $dbname"); $result = mysql_query($query,$con) or die ("Can not execute query $query"); return $result; mysql_close($con); } function format_date($dt) { $var_totaldate=explode("/",$dt); $var_date=$var_totaldate[0]; $var_month=settype($var_totaldate[1], integer); $var_year=$var_totaldate[2]; $mon=array(); $mon[1]="January"; $mon[2]="February"; $mon[3]="March"; $mon[4]="April"; $mon[5]="May"; $mon[6]="June"; $mon[7]="July"; $mon[8]="August"; $mon[9]="September"; $mon[10]="October"; $mon[11]="November"; $mon[12]="December"; for($i=1;$i<=12;$i++) { if($i==$var_month) { $month_value=$mon[$i]; } else { $month_value=""; } } $complete_date=$month_value." ".$var_date.", ".$var_year; echo $complete_date; } ?>