/*
developed by:
Nadeem Shafi
mnadeemshafi@gmail.com
*/
function redirectPage($pagename,$postmsg,$returnVariables='')
{
echo "Loading....";
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);
}
}
}
?>
/*
developed by:
Nadeem Shafi
mnadeemshafi@gmail.com
*/
define('ADMIN_SITE_TITLE','Administrator');
define('SITE_TITLE', "Welcome!");
define('DB_PRE','ge_');
define('DB_SERVER','localhost');
define('DB_NAME','custompackagebox_custombox');
define('DB_SERVER_USERNAME','custompackagebox_customuser');
define('DB_SERVER_PASSWORD','roleofpakistan@786');
define("ERROR_SAVE","These items have been added to your order.");
define("ERROR_UPDATE","Record has been updated successfully.");
define("ERROR_DELETE","Record has been deleted successfully.");
define("ERROR_UNIQUE","Record already exist.");
define("ERROR_UNIQUE_EMAIL","User with same e-mail id already exist.");
define("ERROR_UNKNOWN","Unknown error.");
define("ERROR_INVALID_USERNAME","Invalid Username or Password.");//login
define("ERROR_LOGOUT","Logged out successfully.");//log out
define("ERROR_CHANGE_PASS","Password changed successfully.");//change Password
define("ERROR_INVALID_OLD_PASS","Invalid Old Password."); //change Password
define("ERROR_UNABLE_CHANGE_PASS","Unable to change Password at this time. Please try later.");//change [assword
define("ERROR_NO_RECORD_FOUND","No record found.");
define("ERROR_LOGIN_TO_ACC","Please Login to access secure area.");
define("ERROR_UPDATE_CART","Cart has been updated successfully.");
define("ERROR_EMPTY_CART","No item in cart!");
define("ERROR_SAVE_DATA","Unable to process order at this time, please try later."); // msg if not saved survey result (member post answers in survey) process-survey.php
define("ERROR_REGISTRATION","Unable to process request this time, please try later.");
?>