"; //echo "alert('Database Connection Error !');"; //echo "window.location.href='config/errorConnect.php';"; //echo ""; //header('Location : http://'); exit; } } function insertEnquiry($username,$subject,$useremail,$contactno,$message,$ip){ if(isset($username) && $username!=""){ $sqlstmt = ""; $sqlstmt.= "INSERT INTO clients (name,subject,email,contactno,content,websource,ipaddress,createdtime) "; $sqlstmt.= "VALUES ('"; $sqlstmt.= htmlspecialchars($username,ENT_QUOTES)."','".htmlspecialchars($subject,ENT_QUOTES)."','".$useremail."','".htmlspecialchars($contactno)."','"; $sqlstmt.= (htmlspecialchars(nl2br($message),ENT_QUOTES))."','etoz','".$ip."','".date('Y-m-d H:i:s')."')"; //echo $sqlstmt; $result = mysql_query($sqlstmt);// or die("Query failed Enquiry: " . mysql_error()); } } function getUsercheck($id){ //if($id>0){ $strSQL ="select id,usercheck from mt_item where id=$id"; $result = mysql_query($strSQL); $row=mysql_fetch_array($result); $uc=$row['usercheck']; return $uc; //} } //# Category Section //# Delete Function function delCategory($id){ $result =false; if($id>0){ $strSQL = "delete from mt_item where id='$id'"; $result = mysql_query($strSQL); }//if($id>0) return $result; } function editCategory($id,$name,$desc,$pid,$enable,$prior){ if($id>0){ $strSQL = "update mt_item set "; $strSQL.= "name='$name',description='$desc',"; $strSQL.= "parentid='$pid',parentname='".getCategoryByID($pid)."',"; $strSQL.= "enable='$enable',prior='$prior'";//,createdtime='".getCurrentDateTime()." $strSQL.= " where id='$id'"; $result = mysql_query($strSQL); }//if($uid>0) return $result; } function setItemNameByBlank($name,$type){ if(isset($name)){ //$strItemName = str_replace("%","%25",trim($name)); $strItemName = trim($name); if($type=="z") $strItemName = ereg_replace(" ","-",$strItemName); else $strItemName = ereg_replace(" ","_",$strItemName); return $strItemName; }else{ return "ITEM_NOT_FOUND"; } } function getItemNameByID($id){ if($id>0){ $strSQL ="select ID,itemname from mt_item where ID=$id"; $result = mysql_query($strSQL); $row=mysql_fetch_array($result); $uc=$row['itemname']; return $uc; }else return "New Product"; } function getItemTypeByID($id){ if($id>0){ $strSQL ="select ID,type from mt_item where ID=$id"; $result = mysql_query($strSQL); $row=mysql_fetch_array($result); $uc=$row['type']; return $uc; } } function makeRandom($length = 10) { return substr(md5(uniqid(rand(),1)),0,$length); } function getFileName($filename){ global $basedir; if($filename!=""){ return makeRandom()."_".$filename; } } /* // Send an email function send_mail($myname, $myemail, $contactname, $contactemail, $subject, $message) { $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; //$headers .= "X-Priority: 1\n"; //$headers .= "X-MSMail-Priority: High\n"; //$headers .= "X-Mailer: php\n"; $headers .= "From: \"".$myname."\" <".$myemail.">\n"; return(mail("\"".$contactname."\" <".$contactemail.">", $subject, $message, $headers)); } */ //############################################# //# //# For URL Rewrite Testing only //# //# Format //# FOR "CATEGORY" is StrItemName_ItemID.html , using "_" underscore to combine. //# FOR "ITEM" is StrItemName-ItemID.html , using "-" dash to combine. //############################################# function getPictureURL2($valid,$isAdmin,$id,$itemname,$itemtype,$login){ $strItemName = setItemNameByBlank($itemname,$itemtype); if($isAdmin) {$strURL= ""; return $strURL;exit;} if($valid==1){ if($login){ //User already login ! //$strURL= ""; $strURL= ""; }else{ //User Not login yet $strURL=""; } //}else $strURL= ""; //}else $strURL= ""; }else $strURL= ""; return $strURL; } function isThumbnailPicture($id,$itemName,$folder,$pictureName,$width){ global $uploaddir; $imgSrc = ""; if($pictureName!=""){ $imgSrc = $folder."".$uploaddir.$pictureName; //else $imgSrc = $uploaddir.$pictureName; }else{ $imgSrc = $folder.""."button/nopict.gif"; //else $imgSrc = "button/nopict.gif"; } return "\"$itemName\""; //else return ""; } //###################################################### //# //# Testing using URL rewrite Function //# Format //# FOR "CATEGORY" is StrItemName_ItemID.html , using "_" underscore to combine. //# FOR "ITEM" is StrItemName-ItemID.html , using "-" dash to combine. //###################################################### //# Get Display on the Edit, Delete and Sort function function getCategoryValidURL2($valid,$id,$itemname,$pid,$login,$action,$isAdmin,$refItem,$show){ $strItemName = setItemNameByBlank($itemname,"f"); if($isAdmin){ if($action=="open") $strURL= ""; if($action=="edit") $strURL= ""; if($action=="delete") $strURL= ""; if($action=="sort") $strURL= ""; return $strURL; exit; } if($valid=="1"){ if($login){ //User already login ! //if($action=="open") $strURL= ""; if($action=="open") $strURL= ""; if($action=="edit" && $isAdmin==TRUE) $strURL= ""; if($action=="delete" && $isAdmin==TRUE) $strURL= ""; if($action=="sort" && $isAdmin==TRUE) $strURL= ""; }else{ //User Not login yet if($action=="open") $strURL=""; if($action=="edit" && $isAdmin==TRUE) echo ""; if($action=="delete" && $isAdmin==TRUE) echo ""; if($action=="sort" && $isAdmin==TRUE) echo ""; } }else{ //Original Copy //if($action=="open") $strURL= ""; if($action=="open") $strURL= ""; if($action=="edit" && $isAdmin==TRUE) $strURL= ""; if($action=="delete" && $isAdmin==TRUE) $strURL= ""; if($action=="sort" && $isAdmin==TRUE) $strURL= ""; } return $strURL; } function getSortButton($id,$type,$pid,$isAdmin,$refItem,$show){ if($isAdmin && $type=="folder"){ $strURL= ""; }else $strURL=NULL; return $strURL; } function getDeleteButton($id,$type,$pid,$isAdmin,$refItem,$show){ if($isAdmin){ if($type=="folder"){ $strURL= ""; }else{ $strURL.= ""; } } return $strURL; } function getEditButton($id,$type,$pid,$isAdmin,$refItem,$show){ if($isAdmin){ if($type=="folder"){ $strURL= ""; }else{ $strURL= ""; } } return $strURL; } function getOpenButton($valid,$type,$id,$itemname,$pid,$login,$isAdmin,$refItem,$show){ $strItemName = setItemNameByBlank($itemname,$type); if($isAdmin){ //$strURL= ""; $strURL= ""; return $strURL;exit; } if($valid=="1"){ if($login){ //User already login ! //if($action=="open") $strURL= ""; $strURL= ""; }else{ //User Not login yet $strURL=""; } }else{ if($type=="folder") $strURL= ""; else $strURL= ""; } return $strURL; } function showAddtoMyListBtn($isAdmin,$id,$pid,$type,$show,$key){ $strURL=""; if(($type=="z") && (!$isAdmin)){ //$strURL= ""; $strURL= ""; return $strURL; }else{ return FALSE; } } function showViewMyListBtn($isAdmin,$id,$pid,$width,$height,$picName){ $strURL=""; if(!$isAdmin){ $strURL= " "; return $strURL; }else{ return FALSE; } } function showAddAlltoMyListBtn($isAdmin,$idstring){ $strURL=""; if(!$isAdmin){ $strURL= ""; return $strURL; }else{ return FALSE; } } //# Get Display on the Edit, Delete Button function getItemAdminBtn($isAdmin,$id,$pid,$type,$show){ $strURL=""; if($isAdmin){ $strURL= ""; $strURL.= ""; return $strURL; } return FALSE; } //# Get Display on the Edit, Delete and Sort function function getValidURL($valid,$id,$login,$action,$isAdmin){ if($valid==1){ if($login=='Y'){ //User already login ! if($action=="open") $strURL= ""; }else{ //User Not login yet $strURL=""; } }else{ if($action=="open") $strURL= ""; } return $strURL; } //###################################################################### //# //# Testing using URL rewrite Function //# //# Change the URL format into StrItemName-ItemID-ShowNo.html //# Format //# FOR "CATEGORY" is StrItemName_ItemID.html , using "_" underscore to combine. //# FOR "ITEM" is StrItemName-ItemID.html , using "-" dash to combine. //# //###################################################################### function getDetailPage2($type,$valid,$id,$itemname,$login,$width,$height,$isAdmin){ $strItemName = setItemNameByBlank($itemname,$type); if(!$isAdmin){ if($valid==1){ if($login=='Y'){ if($type=="z"){ //User already login ! $strURL= ""; }else $strURL= ""; }else{ //User Not login yet $strURL=""; } //if($login=='Y'){ }else{ if($type=="z"){ //$strURL= ""; // # if the record is ITEM $strURL= ""; //}else $strURL= ""; // # If the record is CATEGORY }else $strURL= ""; //}else $strURL= ""; }//if($valid==1){ }else{ if($type=="z"){ // Original Copy $strURL= ""; //$strURL= ""; // Original Copy - testing URL rewrite }else $strURL= ""; //}else $strURL= ""; }//if($isAdmin){ return $strURL; } function getNewProductDetail($type,$valid,$id,$itemname,$login,$width,$height,$isAdmin){ $strItemName = setItemNameByBlank($itemname,$type); if(!$isAdmin){ if($valid==1){ if($login=='Y'){ if($type=="z"){ //User already login ! $strURL= ""; }else $strURL= ""; }else{ //User Not login yet $strURL=""; } }else{ if($type=="z"){ $strURL= ""; //}else $strURL= ""; }else $strURL= ""; } }else{ if($type=="z"){ //$strURL= ""; $strURL= ""; }else $strURL= ""; //}else $strURL= ""; }//if($isAdmin){ return $strURL; } function getTtlItem($id){ $count = 0; if($id>=0){ $strSQL = "select ID,parentid from mt_item where parentid='$id' "; $result = mysql_query($strSQL); $count = mysql_num_rows($result); }else{ $strSQL = "select ID,parentid from mt_item where newproduct='1' "; $result = mysql_query($strSQL); $count = mysql_num_rows($result); } if($id=="n"){ $strSQL = "select ID,parentid from mt_item where newproduct='1' "; $result = mysql_query($strSQL); $count = mysql_num_rows($result); } return $count; } //###################################################### //# //# Testing using URL rewrite Function //# //# Change the URL format into StrItemName-ItemID-ShowNo.html //# Format //# FOR "CATEGORY" is StrItemName_ItemID.html , using "_" underscore to combine. //# FOR "ITEM" is StrItemName-ItemID.html , using "-" dash to combine. //###################################################### function pagesGenerate2($itemid,$show,$count,$maxshow,$pageurl,$isAdmin){ $strItemName = setItemNameByBlank(getItemNameByID($itemid),"f"); if($count>0){ $pages = $count / $maxshow; //if($count>0) // # If admin , id = -1 remain , else change to ZERO //if(($isAdmin!="1") && ($itemid=="-1")) $itemid ="n"; if ($pages < 1){$pages = 1;} if ($pages / (int) $pages <> 1){ $pages = (int) $pages + 1; }else{ $pages = $pages; } $pagenow = ($show/$maxshow + 1); $str = "";//style=\"text-decoration:none;color:#000000;\" //$str.= "\">";//font-weight:bold;font-family:sans-serif;font-size:12px; $str.= "Pg " . $pagenow . " of " . $pages . ".         "; $next = $show + $maxshow; $previous = $show - $maxshow; $strpage= " "; $i = 0; while ($i < $pages){ $ri = $i + 1; $showpage = $i * $maxshow; if($isAdmin=="1") $strpage.= ""; else{ if($itemid=="-1" || $itemid=="n") $strpage.= ""; else $strpage.= ""; } //$strpage.= "".$ri.""; }else{ $strpage.= "".$ri.""; } $strpage.= " \n"; $i++; } if ($pages <> 1){ if ($previous < 0){ $str.= " $strpage "; if($isAdmin=="1") $str.= "\n";//style=\"text-decoration:none;color:#000000;\" $str.= "    Next \n"; }elseif ($next >= $count){ if($isAdmin=="1") $str.= "\n";//style=\"text-decoration:none;color:#000000;\" $str.= " Back    \n"; $str.= " $strpage "; }else{ if($isAdmin=="1") $str.= "\n";//style=\"text-decoration:none;color:#000000;\" $str.= " Back    \n"; $str.= " $strpage "; if($isAdmin=="1") $str.= "\n";//style=\"text-decoration:none;color:#000000;\" $str.= "    Next \n"; } }//if ($pages <> 1) return $str.""; }else return ""; //if($count>0){ } //###################################################### //# //# Page Generator for Search Function //# //# Change the URL format into StrItemName-ItemID-ShowNo.html //# eg. Jerseys-304-5.html //# //###################################################### function pagesGenerateForSearch($itemid,$show,$count,$maxshow,$pageurl,$isAdmin,$q){ $strItemName = setItemNameByBlank(getItemNameByID($itemid),"f"); if($count>0){ $pages = $count / $maxshow; //if($count>0) if ($pages < 1){$pages = 1;} if ($pages / (int) $pages <> 1){ $pages = (int) $pages + 1; }else{ $pages = $pages; } $pagenow = ($show/$maxshow + 1); $str = "";//style=\"text-decoration:none;color:#000000;\" //$str.= "\">";//font-weight:bold;font-family:sans-serif;font-size:12px; $str.= "Pg " . $pagenow . " of " . $pages . ".         "; $next = $show + $maxshow; $previous = $show - $maxshow; $strpage= " "; $i = 0; while ($i < $pages){ $ri = $i + 1; $showpage = $i * $maxshow; //if($isAdmin=="1") $strpage.= ""; //else $strpage.= ""; $strpage.= "".$ri.""; }else{ $strpage.= "".$ri.""; } $strpage.= " \n"; $i++; } if ($pages <> 1){ if ($previous < 0){ $str.= " $strpage "; //if($isAdmin=="1") $str.= "\n";//style=\"text-decoration:none;color:#000000;\" $str.= "    Next \n"; }elseif ($next >= $count){ //if($isAdmin=="1") $str.= "\n";//style=\"text-decoration:none;color:#000000;\" $str.= " Back    \n"; $str.= " $strpage "; }else{ //if($isAdmin=="1") $str.= "\n";//style=\"text-decoration:none;color:#000000;\" $str.= " Back    \n"; $str.= " $strpage "; //if($isAdmin=="1") $str.= "\n";//style=\"text-decoration:none;color:#000000;\" $str.= "    Next \n"; } }//if ($pages <> 1) return $str.""; }else{ return "";} } function showCreateCategoryBtn($isAdmin,$parentid,$index,$width,$height){ $str=""; if($isAdmin){ $str.=""; $str.=""; } return $str; } function showSortCategoryBtn($isAdmin,$parentid,$index,$width,$height){ $str=""; if($isAdmin){ $str.=""; $str.=""; } return $str; } //# Show Create Item Button in Item Page function showCreateItemBtn($isAdmin,$parentid,$width,$height,$picName,$show){ $str=""; if($isAdmin){ $str.=""; $str.=""; } return $str; } function isPicture($folder,$pictureName){ $imgSrc = ""; if($pictureName!=""){ $imgSrc ="$folder"."$pictureName"; }else{ $imgSrc ="button/nopict.gif"; } return ""; //else return ""; } //# Get the Search Box on the top of the page function getSearchBox($isAdmin,$id,$formName,$resultPage,$show){ if(!$isAdmin){ $SearchBoxstr=""; $SearchBoxstr.="
"; $SearchBoxstr.=""; $SearchBoxstr.="
"; $SearchBoxstr.=""; $SearchBoxstr.=" "; $SearchBoxstr.= ""; $SearchBoxstr.="
Search our latest products:
"; return $SearchBoxstr; }else return FALSE; } //# Get Footer word function getPageFooter($show){ $strDisplay = ""; $strDisplay = "

While every effort has been taken to ensure the contents in this site are accurate and current, we cannot be held responsible for any omissions and/or errors. Please verify the information with us prior to any purchase.

"; if($show=="Y") return $strDisplay; //return ; } function getLockPic($usercheck,$isAdmin){ if($usercheck=="1" && $isAdmin==TRUE) return ""; } function getCategoryNameByID($id){ if($id>=0){ $strSQL = "select ID,itemname from mt_item "; $strSQL.= "where ID=$id"; $result = mysql_query($strSQL); $row = mysql_fetch_array($result); $name = $row['itemname']; } return $name; } function getCategoryByID($id){ if($id>0){ $strSQL = "select ID,itemname from mt_item where ID=$id"; $result = mysql_query($strSQL); $row = mysql_fetch_array($result); $CategoryName = $row['itemname']; }else{ $CategoryName=""; } return $CategoryName; } //# Generate Path function getParentPath($id,$url,$isAdmin){ if($id>=0){ $sql = "select ID,parentid,itemname from mt_item "; $sql.= "where ID='$id'"; $parent=mysql_query($sql); while($row=mysql_fetch_array($parent)){ $parentid=$row['parentid']; $parentname=getCategoryNameByID($parentid); if($isAdmin=="1") $strpath= "$parentname > "; else $strpath= "$parentname > "; $strpath= getParentPath($parentid,$url,$isAdmin)."".$strpath; } } return $strpath; } function getFullPath($id,$url,$isAdmin){ $strPath=""; if($id>=0){ $strPath=" Main "; $strPath.= getParentPath($id,$url,$isAdmin).getCategoryByID($id); //$strPath.=""; }else $strPath="Main > New Products !"; if($id=="n"){ $strPath="Main > New Products !"; } return $strPath; } // Get Root ID by itemID function getRootIDbyID($id){ $m=0; if($id>=0){ $sql = "select ID,parentid from mt_item "; $sql.= "where ID='$id'"; $parent=mysql_query($sql); while($row=mysql_fetch_array($parent)){ $parentid=$row['parentid']; $m= getRootIDbyID($parentid); $m++; } } return $m; } // Get Root ID by itemID function getUsercheckByRootID($id){ //$bFlag=""; $str=""; $m=1; if($id>=0){ $sql = "select ID,parentid,usercheck from mt_item "; $sql.= "where ID='$id'"; $parent=mysql_query($sql); while($row=mysql_fetch_array($parent)){ $parentid=$row['parentid']; $usercheck=$row['usercheck']; if($usercheck=="1") $bFlag=1; else $bFlag = 0; $bFlag+=getUsercheckByRootID($parentid); } } return $bFlag; } //###################################################### //# //# Function to filter special symbol on itemname //# //# //# //# //###################################################### function checkSpecialSymbol($str){ $iChars = "!@#$^%&*()+=[]\\\';,./{}|\":<>?"; $strValue = ""; $result=1; if(isset($str)) $strValue = trim($str); $strLen = strlen($strValue); if($strLen >0){ for($i=0;$i<$strLen;$i++){ $pos = strstr($iChars,$strValue{$i}); if($pos===false){$result=1;} else{ return false;} } } return $result; } function unhtmlspecialchars( $string ) { //$string = str_replace ( '&', '&', $string ); //$string = str_replace ( ''', '\'', $string ); //$string = str_replace ( '"', '\"', $string ); //$string = str_replace ( '', '', $string ); //$string = str_replace ( 'http://', 'http://', $string ); //$string = str_replace ('http://','http://', $string ); //$string = str_replace ( '>', '>', $string ); //$string = str_replace ( '', '', $string ); $string = str_replace ( '.js', '', $string ); //$string = str_replace ( '<sub>', '', $string ); //$string = str_replace ( '</sub>', '', $string ); return $string; } function removeDRE($string){ if($string!=""){ $string = str_replace ( '', '', $string ); } return $string; } ?> Contact us today for FREE quote and Free consultation. Engine Oil Change. ETOZ

Contact Info

Company :
Polypal Sdn. Bhd.
Office :
+603 - 5122 5520
Fax :
+603 - 5122 9520

Enquiry Form

We are constantly looking for better ways to serve your needs. Drop us a comment, your feedback, or any enquiry and we'll respond to them as soon as we can.
*Name:  
*Subject:
*Email:
*Contact No.: Example : Country Code + Contact Number
  ** This field must be filled.   * You must fill in at least one of these three fields.
Enquiry: Please be specific in your enquiry
*Verification code :