Find String or Variable

{ Posted on Nov 26 2009 by admin }
Categories : PHP
Sometimes it is really hard to find string or variables if there are tons if included files or nested inclusion to locate the file that contains this string or variable i use the following: Using PHP Paste this at the bottom ...Read More »

Page Cache to Avoid Using PHP Engine

{ Posted on Nov 20 2009 by admin }
Categories : PHP
and here's the htaccess redirection snippet RewriteCond %{DOCUMENT_ROOT}/cache/%{REQUEST_URI} -f RewriteRule ^(.+) /cache/$1 [L] sample implementation if(PAGE_CACHE){ require DOC_ROOT.'../lib/PageCache.php'; $cache = new PageCache(); // initialize and declare cache DIR $cache -> startCache(); } //html here if(PAGE_CACHE){ $cache -> endCache(); } using the codes above after the page has been cached it wont bother ...Read More »

unexpected $end parse error

{ Posted on Sep 15 2009 by admin }
Categories : Errors
Q: Why am I receiving an unexpected $end parse error on the last line of my code? A: if you're experiencing this type of parse error, you might be missing closing brace or quote in this case it like telling the script to ...Read More »

Resize Thumb Images

{ Posted on Sep 15 2009 by admin }
Categories : PHP
I just found this code It works great and so I use it hope this one save your day function getImageSizes($sourceImageFilePath, $maxResizeWidth, $maxResizeHeight) { // Get the width and height of the original image $size = getimagesize($sourceImageFilePath); if($size ...Read More »

Flat File Database

{ Posted on Sep 15 2009 by admin }
Categories : Others, PHP
An easy way of creating flat file database. in my sample i use "[]" as my marker container you can also try using <> to make it look like or make it as XML file /** * @ Author : TENG * @ ...Read More »

Raider 150

{ Posted on Sep 04 2009 by admin }
Categories : suzuki
The Suzuki Raider 150 is one of the fastest motorcycles in the underbone category. The displacement is 150 cc, using the same DOHCfour-valve 150 cc single-cylinder oil-cooled engine which also powers its sports bike twin, the Suzuki FXR150. Its popularity in South ...Read More »

MySQL class

{ Posted on Aug 27 2009 by admin }
Categories : PHP
This is simple class that helps you to connect php to MySQL and perform some PHP / MySQL as Object. I will be updating this code once everything is final /* * @connect from SQL * @param: array array('host'=>value,'username'=>value,'password'=>value,'db'=>optional) */ public function connect($con){ extract($con); $this->con_link ...Read More »

Prevent SQL injection

{ Posted on Aug 27 2009 by admin }
Categories : Others, PHP
Here's an easy way of preventing SQL injection in this sample I use POST as my array you. basic way of escaping string for your SQL $var = 'foo'; $var = mysql_escape_string($var); Escaping string and overriding value of an array $_POST = array_map('mysql_escape_string',$_POST); looping ...Read More »

Read CSV file

{ Posted on Aug 23 2009 by admin }
Categories : PHP
This simple Script read CSV file /* * @Author: Ronaldo Bernal * @ simple class that parse CSV file */ class ReadCsv{ private $_keys =''; private $_file=''; /* * #constructor */ public function __construct($file,$keys){ $this->_file = $file; $this->_keys = $keys; } /* * @get file size of csv file */ private function getSize(){ return filesize($this->_file); } /* * @ open CSV file */ private ...Read More »

Group array

{ Posted on Aug 23 2009 by admin }
Categories : PHP
Group Array I made this function / script to divide array equally I usually use this for displaying array in li or td format. public function group_array($array,$column){ $count = count($array); $res = (int)($count / $column); $remaining = $count - ($column * $res); $start = ...Read More »