\n"); echo ("\n"); if(is_array($returnVariables)) { foreach($returnVariables as $key=>$val) { echo ("\n"); } } echo "\n"; echo ("\n"); exit; } //======================================================================= function errorHandeler($errNo) { $path='include/messages.xml'; $count=0; if (file_exists($path)) { if(is_readable($path)) { $xml = simplexml_load_file($path); foreach($xml->MSG as $a) { echo $a; if($xml->MSG[$count]->ID==$errNo) return $xml->MSG[$count]->DESC; $count=$count+1; } } } return false; } //=================================================== function checkBoxVal($chkBoxName) { if(isset($_POST[$chkBoxName])) return $_POST[$chkBoxName]; else return 0; } //===================================================================== function getVar($var) { $rVar=$_REQUEST[$var]; $rVar=str_replace("'","''",trim($rVar)); $rVar=str_replace('"','""',$rVar); return $rVar; } //================================================================================= function dateCheck($arrayDate) { for($count=0;$count < count($arrayDate);$count++) { $arr=split('/',$arrayDate[$count]); $arrVal=mktime(0, 0, 0, $arr[0],$arr[1],$arr[2]); $arrayDate[$count]=$arrVal; } asort($arrayDate); foreach($arrayDate as $Key=>$val) { return $Key; } } //================================================================================ function mySqlDateFormat($rdate) { list($day, $month,$year) = split('[/.-]', $rdate); return $year."/".$month."/".$day; } function dateFormat($rdate) { if(!is_null($rdate)) { list($year, $month,$day) = split('[/.-]', $rdate); return $day."/".$month."/".$year; } return ''; } //=============================For Listing=========================== function splitText($text,$length) { $shortText=''; if(strlen($text)>$length) { $shortText=substr($text,0,$length); $shortText=$shortText.'...'; $shortText="$shortText"; return $shortText; } else return $text; } //=======Seting secuirty======================================================= function setMemberSecuirty($page_name = "") { @session_start(); $arr = array('pagName'=>$page_name); //if(isset($_SESSION['isGuest']) && $_SESSION['isGuest'] != 1) //{ if(!isset($_SESSION['member_id']) || $_SESSION['member_id'] <= 0) redirectPage("login.html",ERROR_LOGIN_TO_ACC, $arr); //} } function setTradeMemberSecuirty($page_name = "") { @session_start(); $arr = array('pagName'=>$page_name); if(!isset($_SESSION['user_id']) || $_SESSION['user_id'] <= 0) redirectPage($basehref."login",ERROR_LOGIN_TO_ACC, $arr); } function videoId($video_url) { preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+#", $video_url, $v_id); return $v_id[0]; } //============================================================================ // mail with attachement //============================================================================ function mail_attach($to, $from, $subject, $message, $files = FALSE,$lb="\n") { $a=0; // $to Recipient // $from Sender (like "email@domain.com" or "Name ") // $subject Subject // $message Content // $files hash-array of files to attach // $lb is linebreak characters... some mailers need \r\n, others need \n $mime_boundary = "<<<:" . md5(uniqid(mt_rand(), 1)); $header = "From: ".$from; if(is_array($files)) { $header.= $lb; $header.= "MIME-Version: 1.0".$lb; $header.= "Content-Type: multipart/mixed;".$lb; $header.= " boundary=\"".$mime_boundary."\"".$lb; $content = "This is a multi-part message in MIME format.".$lb.$lb; $content.= "--".$mime_boundary.$lb; $content.= "Content-Type: text/html; charset=\"iso-8859-1\"".$lb; $content.= "Content-Transfer-Encoding: 7bit".$lb.$lb; } $content.= $message.$lb; if(is_array($files)) { $content.= "--".$mime_boundary.$lb; //print_r($files)."------"; // foreach($files as $filename=>$filelocation) { if(is_readable($files['tmp_name'])) { $data = chunk_split(base64_encode(implode("", file($files['tmp_name'])))); $content.= "Content-Disposition: attachment;".$lb; $content.= "Content-Type: Application/Octet-Stream;"; $content.= " name=\"".$files['name']."\"".$lb; $content.= "Content-Transfer-Encoding: base64".$lb.$lb; $content.= $data.$lb; // $content.= "--".$mime_boundary.$lb; $a+=1; } } if(@mail($to, $subject, $content, $header)) { return TRUE; } return FALSE; } //===================================== //===================================== // send response back to visitor //===================================== function responseEmail($toEmail, $mailID){ global $con; if(!empty($toEmail)) { $resQuery = "SELECT * FROM ".DB_PRE."email_response WHERE id = $mailID"; $resErrNo = $con->DML_executeQry($resQuery); if(mysql_num_rows($resErrNo) > 0){ $resRow = mysql_fetch_object($resErrNo); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: zuguzu.com ' . "\r\n"; $subject = $resRow->email_subject; $message = $resRow->email_text; @mail($toEmail, $subject, $message, $headers); } } } ?>