".$strEmailHeader."
 
".$strHi." ".$strYourFriendName.",
 
".$strMessage.".
 
".$strTarget."
"; $headers = "MIME-Version: 1.0;\n"; $headers .= "Content-type: text/html; charset=iso-8859-1;\n"; $headers .= "Content-Transfer-Encoding: quoated-pritable;\n"; $headers .= "FROM: ".$strfrom."\r\n"; $conf_email=mail($strto, $strsubject ,$strmsg, $headers); //echo $conf_email;exit; return $conf_email; } function getFileExt($filename) { $ext = substr(strrchr($filename, "."), 1); return $ext; } function IsFileExtValid($filename,$strValidExt) { $arrExtArr = explode(",",$strValidExt); if( in_array(getFileExt($filename),$arrExtArr) ) return true; else return false; } // FOR FOLLOWING FUNCTION // FIRST PARAMETER IS DROPDOWN NAME. // SECOND PARM IS OPTION VALUES AND THEY MUST BE COMMA SEPARATED VALUES i.e (1,2,3,abc) etc // THIRD PARAM IS DROPDOWN LABELS OR CAPTION AND THEY MUST BE COMMA SEPARATED VALUES i.e (Caption1,Caption2,Caption3,Caption4) etc // NUMBER OF OPTION VALUES AND NUMBER OF OPTION LABELS MUST BE EQUAL OTHER WISE IT WILL GENERATE AN ERROR function UploadFile($strRealPathFile, $strDestFolder, $strImagePrefix, $strValidExtension, $strControlName, $intMaxSize=36700160, $intMaxWidth=0, $intMaxHeight=0) { $strInvalidMsg = ""; $mypath = realpath ($strRealPathFile); $strUploadDir = $strDestFolder;//echo "|||".$strUploadDir;exit; if (strpos($mypath,"\\") > -1 ) $strFinalPath = substr($mypath,0,strrpos($mypath,"\\")+1).$strUploadDir."\\"; else $strFinalPath = substr($mypath,0,strrpos($mypath,"/")+1).$strUploadDir."/"; $intImageSize = $_FILES["".$strControlName.""]['size']; $strImageName = $_FILES["".$strControlName.""]['name']; $strImageName = ExcludeSpecialCharacters($strImageName); //print $strFinalPath;exit; $strTempPath = $_FILES["".$strControlName.""]['tmp_name']; $strImageExt = strtolower(getFileExt($strImageName)); if($intMaxWidth != 0 && $intMaxHeight !=0) { list($intWidth, $intHeight, $strType, $strAttr) = getimagesize($strTempPath); if($intWidth > $intMaxWidth) {$strInvalidMsg="InvalidWidth"; return $strInvalidMsg; exit();} else if($intHeight > $intMaxHeight) {$strInvalidMsg="InvalidHeight"; return $strInvalidMsg; exit();} } if($intImageSize > $intMaxSize) {$strInvalidMsg="InvalidSize"; return $strInvalidMsg; exit();} if(strpos($strValidExtension,",")>0) { $intExtCheck = 0; $strExtArr = explode(",",$strValidExtension); for($counter=0;$counter < count($strExtArr);$counter++) { if($strExtArr[$counter] == $strImageExt) { $intExtCheck = 1; break; } } if($intExtCheck == 0) {$strInvalidMsg="InvalidExtension"; return $strInvalidMsg; exit();} } else if($strImageExt != $strValidExtension) {$strInvalidMsg="InvalidExtension"; return $strInvalidMsg; exit();} $strImageCompName = $strImagePrefix."_".$strImageName; $strDestination = $strFinalPath.$strImageCompName; //echo "
tempPath==>".$strTempPath; //echo "
Destination==>".$strDestination;exit; $intIsUploaded = copy($strTempPath,$strDestination); if($intIsUploaded>0) {$strInvalidMsg=$strImageCompName;return $strInvalidMsg; exit();} else {$strInvalidMsg="UploadErr"; return $strInvalidMsg; exit();} } function ExcludeSpecialCharacters($tmpString) { $tmpString = str_replace(" ", "", $tmpString); $tmpString = str_replace("&", "", $tmpString); $tmpString = str_replace("!", "", $tmpString); $tmpString = str_replace("#", "", $tmpString); $tmpString = str_replace("@", "", $tmpString); $tmpString = str_replace("`", "", $tmpString); $tmpString = str_replace("~", "", $tmpString); $tmpString = str_replace("%", "", $tmpString); $tmpString = str_replace("^", "", $tmpString); $tmpString = str_replace("*", "", $tmpString); $tmpString = str_replace("+", "", $tmpString); $tmpString = str_replace("!", "=", $tmpString); $tmpString = str_replace("?", "", $tmpString); $tmpString = str_replace("/", "", $tmpString); $tmpString = str_replace("\\", "", $tmpString); $tmpString = str_replace(",", "", $tmpString); $tmpString = str_replace("|", "", $tmpString); $tmpString = str_replace("<", "", $tmpString); $tmpString = str_replace(">", "", $tmpString); //$tmpString = str_replace(".", "", $tmpString); $tmpString = str_replace(":", "", $tmpString); $tmpString = str_replace(";", "", $tmpString); $tmpString = str_replace("'", "", $tmpString); $tmpString = str_replace("\"", "", $tmpString); $tmpString = str_replace("$", "", $tmpString); $tmpString = str_replace("Ø", "O", $tmpString); $tmpString = str_replace("ø", "o", $tmpString); $tmpString = str_replace("Æ", "AE", $tmpString); $tmpString = str_replace("æ", "ae", $tmpString); $tmpString = str_replace("Å", "A", $tmpString); $tmpString = str_replace("å", "a", $tmpString); $tmpString = str_replace("_", "", $tmpString); //Ø ø Æ æ Å å return $tmpString; } function mail_attachment ($from , $to, $strBCC='', $subject, $message, $arrFiles='',$strPath='') { // generate a random string to be used as the boundary marker $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x"; // now we'll build the message headers $headers = "From: $from\r\n" . $headers .= "bcc: $strBCC\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\""; // here, we'll start the message body. // this is the text that will be displayed // in the e-mail //$message="This is an example"; // next, we'll build the invisible portion of the message body // note that we insert two dashes in front of the MIME boundary // when we use it $message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; // now we'll process our uploaded files //echo "i am here";exit; //print_r($arrFiles); if($arrFiles!='' && is_array($arrFiles)) { foreach($arrFiles as $userfile) { // open the file for a binary read $name = $userfile;//substr(strstr($userfile,'_'),1); //list($strPrefix,$strUserFileName) = explode("_",$userfile); $strUserFileName=$userfile; $name = $strUserFileName; //echo "

".$name; //exit; //$strPath.$userfile; if(is_file($strPath)) { $file = fopen($strPath,'rb'); // read the file content into a variable $data = fread($file,filesize($strPath)); // close the file fclose($file); // now we encode it and split it into acceptable length lines $data = chunk_split(base64_encode($data)); $type= 'application/octet-stream';//filetype("MessageFiles/".$intMessage."_".$userfile); // now we'll insert a boundary to indicate we're starting the attachment // we have to specify the content type, file name, and disposition as // an attachment, then add the file content. // NOTE: we don't set another boundary to indicate that the end of the // file has been reached here. we only want one boundary between each file // we'll add the final one after the loop finishes. $message .= "--{$mime_boundary}\n" . "Content-Type: {$type};\n" . " name=\"".$name."\"\n" . "Content-Disposition: attachment;\n" . " filename=\"".$name."\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n"; } } } // here's our closing mime boundary that indicates the last of the message $message.="--{$mime_boundary}--\n"; // now we just send the message // echo "To==>>".$to."
Subject==>>".$subject."
Message==>>".$message."
Headers==>>".$headers; // exit; $Conf = mail($to, $subject, $message, $headers); if($Conf) { //print_r($arrFiles); return true; } else return false; } function fix_quotes($value) { if(get_magic_quotes_gpc()==1) { return $value; } else { return addslashes($value); } } function html2txt($document) { if(!empty($document)) { $search = array('@]*?>.*?@si', // Strip out javascript '@]*?>.*?@siU', // Strip style tags properly "@<[\/\!]*?[^<>]*?>@si", // Strip out HTML tags '@@' // Strip multi-line comments including CDATA ); $text = preg_replace($search, '', $document); return $text; } } /*function ImageResize($srcImgPath, $dstImgPath, $resize_width, $resize_height) { list($width_orig, $height_orig) = getimagesize($srcImgPath); $image_p = imagecreatetruecolor($resize_width, $resize_height); $image_n = imagecreatefromjpeg($srcImgPath); imagecopyresampled($image_p, $image_n, 0, 0, 0, 0, $resize_width, $resize_height, $width_orig, $height_orig); $resultResize = imagejpeg($image_p, $dstImgPath, 100); }*/ function ImageResize($srcImgPath, $dstImgPath, $resize_width, $resize_height) { $ext = end(explode('.', $srcImgPath)); if (stristr('jpeg|JPEG|jpg|jpg|jpg|JPG', $ext ) == true) { list($width_orig, $height_orig) = getimagesize($srcImgPath); $image_p = imagecreatetruecolor($resize_width, $resize_height); $image_n = imagecreatefromjpeg($srcImgPath); imagecopyresampled($image_p, $image_n, 0, 0, 0, 0, $resize_width, $resize_height, $width_orig, $height_orig); $resultResize = imagejpeg($image_p, $dstImgPath, 100); } elseif (stristr('png|PNG', $ext ) == true) { list($width_orig, $height_orig) = getimagesize($srcImgPath); $image_p = imagecreatetruecolor($resize_width, $resize_height); $image_n = imagecreatefrompng($srcImgPath); imagecopyresampled($image_p, $image_n, 0, 0, 0, 0, $resize_width, $resize_height, $width_orig, $height_orig); //$resultResize = imagepng($image_p, $dstImgPath, 100); $resultResize = imagejpeg($image_p, $dstImgPath, 100); } elseif (stristr('gif|GIF', $ext ) == true) { list($width_orig, $height_orig) = getimagesize($srcImgPath); $image_p = imagecreatetruecolor($resize_width, $resize_height); $image_n = imagecreatefromgif($srcImgPath); imagecopyresampled($image_p, $image_n, 0, 0, 0, 0, $resize_width, $resize_height, $width_orig, $height_orig); $resultResize = imagegif($image_p, $dstImgPath, 100); } } function SEF_URLS($str, $replace=array(), $delimiter='-') { $str=trim($str); //exit; if( !empty($replace) ) { $str = str_replace((array)$replace, ' ', $str); } $clean = @iconv('UTF-8', 'ASCII//TRANSLIT', $str); $clean = @preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean); $clean = @strtolower(trim($clean, '-')); $clean = @preg_replace("/[\/_|+ -]+/", $delimiter, $clean); return ucwords($clean); } ?>