<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP User-Group Philippines &#187; Beginner</title>
	<atom:link href="http://www.phpugph.com/blog/category/beginner/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpugph.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 23 Dec 2009 04:00:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Scrawlr: Crawls your website for SQL Injection</title>
		<link>http://www.phpugph.com/blog/2008/07/03/scrawlr-crawls-your-website-for-sql-injection/</link>
		<comments>http://www.phpugph.com/blog/2008/07/03/scrawlr-crawls-your-website-for-sql-injection/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 03:16:34 +0000</pubDate>
		<dc:creator>aj</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[Software Review]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[injection]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[parameters]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[web applications]]></category>

		<guid isPermaLink="false">http://www.phpugph.com/blog/?p=43</guid>
		<description><![CDATA[
Scrawlr, short for SQL Injector and Crawler will crawl your website and will analyze the parameters of each individual pages for SQL injection vulnerabilities. Very useful tool for small to medium sized websites. Free for the first 1,500 pages.
From HPs website:
Technical details for Scrawlr

Identify Verbose SQL Injection vulnerabilities in URL parameters
Can be configured to use [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.communities.hp.com/securitysoftware/blogs/spilabs/archive/2008/06/23/finding-sql-injection-with-scrawlr.aspx?jumpid=reg_R1002_USEN"><img src="https://download.spidynamics.com/Products/scrawlr/scrawler-screenshot.png" alt="" width="400" height="272" /></a></p>
<p><a href="http://www.communities.hp.com/securitysoftware/blogs/spilabs/archive/2008/06/23/finding-sql-injection-with-scrawlr.aspx?jumpid=reg_R1002_USEN">Scrawlr</a>, short for SQL Injector and Crawler will crawl your website and will analyze the parameters of each individual pages for SQL injection vulnerabilities. Very useful tool for small to medium sized websites. Free for the first 1,500 pages.</p>
<p>From HPs website:</p>
<blockquote><p><em>Technical details for Scrawlr</em></p>
<ul>
<li><em>Identify Verbose SQL Injection vulnerabilities in URL parameters</em></li>
<li><em>Can be configured to use a Proxy to access the web site</em></li>
<li><em>Will identify the type of SQL server in use</em></li>
<li><em>Will extract table names (verbose only) to guarantee no false positives</em></li>
</ul>
<p><em>Scrawlr does have some limitations versus our professional solutions and our fully functional SQL Injector tool<br />
</em></p>
<ul>
<li><em>Will only crawls up to 1500 pages</em></li>
<li><em>Does not support sites requiring authentication</em></li>
<li><em>Does not perform Blind SQL injection</em></li>
<li><em>Cannot retrieve database contents</em></li>
<li><em>Does not support JavaScript or flash parsing</em></li>
<li><em>Will not test forms for SQL Injection (POST Parameters)</em></li>
</ul>
</blockquote>
<p><a href="https://download.spidynamics.com/Products/scrawlr/">It&#8217;s worth trying out.</a></p>
<p>&#8211;aj</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.phpugph.com%2Fblog%2F2008%2F07%2F03%2Fscrawlr-crawls-your-website-for-sql-injection%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.phpugph.com/blog/2008/07/03/scrawlr-crawls-your-website-for-sql-injection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Colorful phpinfo();</title>
		<link>http://www.phpugph.com/blog/2008/03/05/colorful-phpinfo/</link>
		<comments>http://www.phpugph.com/blog/2008/03/05/colorful-phpinfo/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 20:50:02 +0000</pubDate>
		<dc:creator>aj</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.phpugph.com/blog/2008/03/05/colorful-phpinfo/</guid>
		<description><![CDATA[Just for fun and if you have nothing to do, run this custom phpinfo(); to get a view of the old and dull phpinfo with cool colors.
&#60;?php
ob_start();
phpinfo();
$phpinfo = ob_get_contents();
ob_end_clean();
preg_match_all(&#8216;/#[0-9a-fA-F]{6}/&#8217;, $phpinfo, $rawmatches);
for ($i = 0; $i &#60; count($rawmatches[0]); $i++)
$matches[] = $rawmatches[0][$i];
$matches = array_unique($matches);
$hexvalue = &#8216;0123456789abcdef&#8217;;
$j = 0;
foreach ($matches as $match)
{
$r = &#8216;#&#8217;;
$searches[$j] = $match;
for ($i = [...]]]></description>
			<content:encoded><![CDATA[<p>Just for fun and if you have nothing to do, run this custom phpinfo(); to get a view of the old and dull phpinfo with cool colors.</p>
<blockquote><p><code><span class="html"><span class="default">&lt;?php</span></span></code></p>
<p>ob_start<span class="keyword">();<br />
</span><span class="default">phpinfo</span><span class="keyword">();<br />
</span><span class="default">$phpinfo </span><span class="keyword">= </span><span class="default">ob_get_contents</span><span class="keyword">();<br />
</span><span class="default">ob_end_clean</span><span class="keyword">();</span></p>
<p><span class="default">preg_match_all</span><span class="keyword">(</span><span class="string">&#8216;/#[0-9a-fA-F]{6}/&#8217;</span><span class="keyword">, </span><span class="default">$phpinfo</span><span class="keyword">, </span><span class="default">$rawmatches</span><span class="keyword">);<br />
for (</span><span class="default">$i </span><span class="keyword">= </span><span class="default">0</span><span class="keyword">; </span><span class="default">$i </span><span class="keyword">&lt; </span><span class="default">count</span><span class="keyword">(</span><span class="default">$rawmatches</span><span class="keyword">[</span><span class="default">0</span><span class="keyword">]); </span><span class="default">$i</span><span class="keyword">++)<br />
</span><span class="default">$matches</span><span class="keyword">[] = </span><span class="default">$rawmatches</span><span class="keyword">[</span><span class="default">0</span><span class="keyword">][</span><span class="default">$i</span><span class="keyword">];<br />
</span><span class="default">$matches </span><span class="keyword">= </span><span class="default">array_unique</span><span class="keyword">(</span><span class="default">$matches</span><span class="keyword">);</span></p>
<p><span class="default">$hexvalue </span><span class="keyword">= </span><span class="string">&#8216;0123456789abcdef&#8217;</span><span class="keyword">;</span></p>
<p><span class="default">$j </span><span class="keyword">= </span><span class="default">0</span><span class="keyword">;<br />
foreach (</span><span class="default">$matches </span><span class="keyword">as </span><span class="default">$match</span><span class="keyword">)<br />
{</span></p>
<p><span class="default">$r </span><span class="keyword">= </span><span class="string">&#8216;#&#8217;</span><span class="keyword">;<br />
</span><span class="default">$searches</span><span class="keyword">[</span><span class="default">$j</span><span class="keyword">] = </span><span class="default">$match</span><span class="keyword">;<br />
for (</span><span class="default">$i </span><span class="keyword">= </span><span class="default">0</span><span class="keyword">; </span><span class="default">$i </span><span class="keyword">&lt; </span><span class="default">6</span><span class="keyword">; </span><span class="default">$i</span><span class="keyword">++)<br />
</span><span class="default">$r </span><span class="keyword">.= </span><span class="default">substr</span><span class="keyword">(</span><span class="default">$hexvalue</span><span class="keyword">, </span><span class="default">mt_rand</span><span class="keyword">(</span><span class="default">0</span><span class="keyword">, </span><span class="default">15</span><span class="keyword">), </span><span class="default">1</span><span class="keyword">);<br />
</span><span class="default">$replacements</span><span class="keyword">[</span><span class="default">$j</span><span class="keyword">++] = </span><span class="default">$r</span><span class="keyword">;<br />
unset(</span><span class="default">$r</span><span class="keyword">);<br />
}</span></p>
<p>for (<span class="default">$i </span><span class="keyword">= </span><span class="default">0</span><span class="keyword">; </span><span class="default">$i </span><span class="keyword">&lt; </span><span class="default">count</span><span class="keyword">(</span><span class="default">$searches</span><span class="keyword">); </span><span class="default">$i</span><span class="keyword">++)<br />
</span><span class="default">$phpinfo </span><span class="keyword">= </span><span class="default">str_replace</span><span class="keyword">(</span><span class="default">$searches</span><span class="keyword">, </span><span class="default">$replacements</span><span class="keyword">, </span><span class="default">$phpinfo</span><span class="keyword">);<br />
echo </span><span class="default">$phpinfo</span><span class="keyword">;<br />
</span><span class="default">?&gt;</span></p></blockquote>
<p>Once you&#8217;re done, refresh your browser to see more color schemes. Very old, but still very cool. <img src='http://www.phpugph.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a href="http://ca3.php.net/manual/en/function.phpinfo.php#57532">Credit</a></p>
<p>&#8211;aj</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.phpugph.com%2Fblog%2F2008%2F03%2F05%2Fcolorful-phpinfo%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.phpugph.com/blog/2008/03/05/colorful-phpinfo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Video: PHP, HTML Tutorial // POST, Table, Forms</title>
		<link>http://www.phpugph.com/blog/2007/12/15/video-php-html-tutorial-post-table-forms/</link>
		<comments>http://www.phpugph.com/blog/2007/12/15/video-php-html-tutorial-post-table-forms/#comments</comments>
		<pubDate>Sat, 15 Dec 2007 01:42:35 +0000</pubDate>
		<dc:creator>aj</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://www.phpugph.com/blog/2007/12/15/video-php-html-tutorial-post-table-forms/</guid>
		<description><![CDATA[


]]></description>
			<content:encoded><![CDATA[<div>
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/SQw645qw1os&#038;rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/SQw645qw1os&#038;rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>
</div>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.phpugph.com%2Fblog%2F2007%2F12%2F15%2Fvideo-php-html-tutorial-post-table-forms%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.phpugph.com/blog/2007/12/15/video-php-html-tutorial-post-table-forms/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>40 Tips for optimizing your php Code</title>
		<link>http://www.phpugph.com/blog/2007/10/18/40-tips-for-optimizing-your-php-code/</link>
		<comments>http://www.phpugph.com/blog/2007/10/18/40-tips-for-optimizing-your-php-code/#comments</comments>
		<pubDate>Thu, 18 Oct 2007 03:38:47 +0000</pubDate>
		<dc:creator>aj</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Beginner]]></category>

		<guid isPermaLink="false">http://www.phpugph.com/blog/2007/10/18/40-tips-for-optimizing-your-php-code/</guid>
		<description><![CDATA[Original Content Source:
http://reinholdweber.com/?p=3

If a method can be static, declare it static. Speed improvement is by a factor of 4.
echo is faster than print.
Use echo&#8217;s multiple parameters instead of string concatenation.
Set the maxvalue for your for-loops before and not in the loop.
Unset your variables to free memory, especially large arrays.
Avoid magic like __get, __set, __autoload
require_once() is [...]]]></description>
			<content:encoded><![CDATA[<p>Original Content Source:<br />
<a href="http://reinholdweber.com/?p=3">http://reinholdweber.com/?p=3</a></p>
<ol>
<li>If a method can be static, declare it static. Speed improvement is by a factor of 4.</li>
<li><em>echo</em> is faster than <em>print</em>.</li>
<li>Use echo&#8217;s multiple parameters instead of string concatenation.</li>
<li>Set the maxvalue for your for-loops before and not in the loop.</li>
<li>Unset your variables to free memory, especially large arrays.</li>
<li>Avoid magic like __get, __set, __autoload</li>
<li>require_once() is expensive</li>
<li>Use full paths in includes and requires, less time spent on resolving the OS paths.</li>
<li>If you need to find out the time when the script started executing, $_SERVER[’REQUEST_TIME’] is preferred to time()</li>
<li>See if you can use strncasecmp, strpbrk and stripos instead of regex</li>
<li>str_replace is faster than preg_replace, but strtr is faster than str_replace by a factor of 4</li>
<li>If the function, such as string replacement function, accepts both arrays and single characters as arguments, and if your argument list is not too long, consider writing a few redundant replacement statements, passing one character at a time, instead of one line of code that accepts arrays as search and replace arguments.</li>
<li>It&#8217;s better to use select statements than multi if, else if, statements.</li>
<li>Error suppression with @ is very slow.</li>
<li>Turn on apache&#8217;s mod_deflate</li>
<li>Close your database connections when you&#8217;re done with them</li>
<li>$row[’id’] is 7 times faster than $row[id]</li>
<li>Error messages are expensive</li>
<li>Do not use functions inside of for loop, such as for ($x=0; $x &lt; count($array); $x) The count() function gets called each time.</li>
<li>Incrementing a local variable in a method is the fastest. Nearly the same as calling a local variable in a function.</li>
<li>Incrementing a global variable is 2 times slow than a local var.</li>
<li>Incrementing an object property (eg. $this-&gt;prop++) is 3 times slower than a local variable.</li>
<li>Incrementing an undefined local variable is 9-10 times slower than a pre-initialized one.</li>
<li>Just declaring a global variable without using it in a function also slows things down (by about the same amount as incrementing a local var). PHP probably does a check to see if the global exists.</li>
<li>Method invocation appears to be independent of the number of methods defined in the class because I added 10 more methods to the test class (before and after the test method) with no change in performance.</li>
<li>Methods in derived classes run faster than ones defined in the base class.</li>
<li>A function call with one parameter and an empty function body takes about the same time as doing 7-8 $localvar++ operations. A similar method call is of course about 15 $localvar++ operations.</li>
<li>Surrounding your string by &#8216; instead of &#8221; will make things interpret a  little faster since php looks for variables inside &#8220;&#8230;&#8221; but not inside  &#8216;&#8230;&#8217;. Of course you can only do this when you don&#8217;t need to have  variables in the string.</li>
<li>When echoing strings it&#8217;s faster to separate them by comma instead of dot.   	          Note: This only works with echo, which is a function that can take several strings as arguments.</li>
<li>A PHP script will be served at least 2-10 times slower than a static  HTML page by Apache. Try to use more static HTML pages and fewer  scripts.</li>
<li>Your PHP scripts are recompiled every time unless the scripts are cached. Install a PHP caching product to typically increase performance by 25-100% by removing compile times.</li>
<li>Cache as much as possible. Use memcached &#8211; memcached is a high-performance memory object caching system intended to speed up dynamic web applications by alleviating database load. OP code caches are useful so that your script does not have to be compiled on every request</li>
<li>When working with strings and you need to check that the string is  either of a certain length you&#8217;d understandably would want to use the  strlen() function. This function is pretty quick since it&#8217;s operation  does not perform any calculation but merely return the already known  length of a string available in the zval structure (internal C struct  used to store variables in PHP). However because strlen() is a function  it is still somewhat slow because the function call requires several  operations such as lowercase &amp; hashtable lookup followed by the  execution of said function. In some instance you can improve the speed  of your code by using an isset() trick.
<p>Ex.</p>
<p>if (strlen($foo) &lt; 5) { echo &#8220;Foo is too short&#8221;; }</p>
<p>vs.</p>
<p>if (!isset($foo{5})) { echo &#8220;Foo is too short&#8221;; }</p>
<p>Calling isset() happens to be faster then strlen() because unlike  strlen(), isset() is a language construct and not a function meaning  that it&#8217;s execution does not require function lookups and lowercase.  This means you have virtually no overhead on top of the actual code  that determines the string&#8217;s length.</li>
<li>When incrementing or decrementing the value of the variable $i++  happens to be a tad slower then ++$i. This is something PHP specific  and does not apply to other languages, so don&#8217;t go modifying your C or  Java code thinking it&#8217;ll suddenly become faster, it won&#8217;t. ++$i happens  to be faster in PHP because instead of 4 opcodes used for $i++ you only  need 3. Post incrementation actually causes in the creation of a  temporary var that is then incremented. While pre-incrementation  increases the original value directly. This is one of the optimization  that opcode optimized like Zend&#8217;s PHP optimizer. It is a still a good  idea to keep in mind since not all opcode optimizers perform this  optimization and there are plenty of ISPs and servers running without  an opcode optimizer.</li>
<li>Not everything has to be OOP, often it is too much overhead, each method and object call consumes a lot of memory.</li>
<li>Do not implement every data structure as a class, arrays are useful, too</li>
<li>Don&#8217;t split methods too much, think, which code you will really re-use</li>
<li>You can always split the code of a method later, when needed</li>
<li>Make use of the countless predefined functions</li>
<li>If you have very time consuming functions in your code, consider writing them as C extensions</li>
<li>Profile your code. A profiler shows you, which parts of your code consumes how many time. The Xdebug debugger already contains a profiler. Profiling shows you the bottlenecks in overview</li>
<li>mod_gzip which is available as an Apache module compresses your data on the fly and can reduce the data to transfer up to 80%</li>
<li><a href="http://phplens.com/lens/php-book/optimizing-debugging-php.php" target="_blank">Excellent Article</a> about optimizing php by John Lim</li>
</ol>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.phpugph.com%2Fblog%2F2007%2F10%2F18%2F40-tips-for-optimizing-your-php-code%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.phpugph.com/blog/2007/10/18/40-tips-for-optimizing-your-php-code/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Did you forget that connection string?</title>
		<link>http://www.phpugph.com/blog/2007/07/13/did-you-forget-that-connection-string/</link>
		<comments>http://www.phpugph.com/blog/2007/07/13/did-you-forget-that-connection-string/#comments</comments>
		<pubDate>Fri, 13 Jul 2007 14:44:47 +0000</pubDate>
		<dc:creator>aj</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.phpugph.com/blog/2007/07/13/did-you-forget-that-connection-string/</guid>
		<description><![CDATA[No problem! ConnectionStrings.com is here.

&#8211;aj
]]></description>
			<content:encoded><![CDATA[<p>No problem! <a href="http://www.connectionstrings.com/">ConnectionStrings.com</a> is here.</p>
<p><a href="http://www.connectionstrings.com/"><img src="http://www.phpugph.com/blog/wp-content/uploads/2007/07/connection_strings.jpg" alt="connection_strings.jpg" /></a></p>
<p>&#8211;aj</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.phpugph.com%2Fblog%2F2007%2F07%2F13%2Fdid-you-forget-that-connection-string%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.phpugph.com/blog/2007/07/13/did-you-forget-that-connection-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
