<?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"
	>

<channel>
	<title>TechWhiz.info</title>
	<atom:link href="http://www.techwhiz.info/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techwhiz.info</link>
	<description>Your #1 Source For Everything Tech!</description>
	<pubDate>Wed, 23 Jul 2008 16:28:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Simple &#8220;Hack Check&#8221; Script and Cron Job</title>
		<link>http://www.techwhiz.info/2008/07/23/simple-hack-check-script-and-cron-job/</link>
		<comments>http://www.techwhiz.info/2008/07/23/simple-hack-check-script-and-cron-job/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 16:10:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Linux/Unix]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Utilities]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[cron]]></category>

		<category><![CDATA[cron job]]></category>

		<category><![CDATA[cronjob]]></category>

		<category><![CDATA[deface]]></category>

		<category><![CDATA[defaced]]></category>

		<category><![CDATA[email]]></category>

		<category><![CDATA[file_get_contents]]></category>

		<category><![CDATA[function]]></category>

		<category><![CDATA[hack]]></category>

		<category><![CDATA[hacked]]></category>

		<category><![CDATA[job]]></category>

		<category><![CDATA[mail]]></category>

		<category><![CDATA[md5]]></category>

		<category><![CDATA[program]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[script]]></category>

		<category><![CDATA[secure]]></category>

		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://www.techwhiz.info/?p=37</guid>
		<description><![CDATA[In this simple tutorial, I am going to show you how to create a little script that will update you daily via email as to whether or not your website has been hacked or modified by anyone other than yourself.
 If you're like me then you know that no site is 100% secure and that [...]]]></description>
			<content:encoded><![CDATA[<p>In this simple tutorial, I am going to show you how to create a little script that will update you daily via email as to whether or not your website has been hacked or modified by anyone other than yourself.</p>
<p><span id="more-37"></span> If you're like me then you know that no site is 100% secure and that someone somewhere will find a way into your site if they really want to. If you're lucky then they won't deface your site and make it nearly impossible to recover without side effects. However, few are that lucky and so eventually you will probably have your site defaced. This little script will help you determine when it happened and help you catch it earlier so you won't have to worry about it as much.</p>
<p>First of all I will give you the script, then I will explain it step by step so you know how it works.</p>
<p>The script (hack_check.php):</p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showPlainTxt('php-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;lt;?php</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$open</span> = <a href="http://www.php.net/file_get_contents"><span style="color:#000066;">file_get_contents</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"http://www.techwhiz.info/index.php"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;  <span style="color:#FF9933; font-style:italic;">//Insert your site's URL</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$open</span> = <a href="http://www.php.net/substr"><span style="color:#000066;">substr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$open</span>, <span style="color:#CC66CC;color:#800000;">0</span>, <span style="color:#CC66CC;color:#800000;">1000</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$md5</span> = <a href="http://www.php.net/md5"><span style="color:#000066;">md5</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$open</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$md5_ok</span> = <span style="color:#FF0000;">'1cdd0523cca5d8d3f5308cf6a0c6b0a1'</span>;  <span style="color:#FF9933; font-style:italic;">//This is the MD5 hash of your sites first 1000 bytes (usually the head, title, meta, etc tags)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$md5</span> != <span style="color:#0000FF;">$md5_ok</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mail"><span style="color:#000066;">mail</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"[YOUR EMAIL HERE]"</span>, <span style="color:#FF0000;">"ERROR: Possible Hack Attempt On TechWhiz.info"</span>, <span style="color:#FF0000;">"There has been a possible hack attempt on your site, I suggest you check out the index and make sure everything is OK."</span>, <span style="color:#FF0000;">"From: TechWhiz Hack-Check &amp;lt;webmaster@YOUR URL HERE.com&amp;gt;"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">else</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mail"><span style="color:#000066;">mail</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"[YOUR EMAIL HERE]"</span>, <span style="color:#FF0000;">"SUCCESS: No one tried to hack TechWhiz.info today!"</span>, <span style="color:#FF0000;">"Guess what...No one tried to hack your site today! I suggest you check it out anyway, if anything you can moderate some comments or something :D"</span>, <span style="color:#FF0000;">"From: TechWhiz Hack-Check &amp;lt;webmaster@YOUR URL HERE.com&amp;gt;"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">?&amp;gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now, to explain the script.</p>
<p>First, the script opens your site URL and grabs the first 1000 bytes (~1KB) of your site's index page. This is usually just the head, title, meta tags, etc. and compares it to a set MD5 hash of your site. If it is the same it will email you saying that no one has tried to hack or deface your site. If they don't match then your site has possibly been defaced or hacked (or you changed a meta tag or something <img src='http://www.techwhiz.info/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ) and will again email you but this time it will say that someone has defaced or hacked your site and that you should check it out.</p>
<p>Second step, we need to get the MD5 hash that we insert into the script for it to compare the sampling to.</p>
<p>In this case my MD5 hash is "1cdd0523cca5d8d3f5308cf6a0c6b0a1", this will be different for your site but to get it is the same. It is simple, just add one line of code to your script above and run it on your server. Under the line <em>"$md5 = md5($open);"</em> add <em>"echo $md5;"</em> and you may want to comment out the rest after that so you don't get an email everytime you run it. This will echo the MD5 hash of your site in a normal (unhacked/defaced) state (make sure it is normal when you run it) then take the MD5 hash that is spit out and insert it into the script. Delete the line we added above and you are good to go.</p>
<p>Now that we have our script up and running we need to setup the cron job to run the script every so often. I run mine every morning at 5:00am so I have an email waiting for me when I sit down in the morning. You may want to alter this depending on your needs (some paranoid people may want to run it every hour, others would be fine running it once a month, it's up to you)</p>
<p>To setup the cron job, all you have to do is go to "Cron Jobs-&gt;Basic" (in cPanel) and enter the required information (the time/schedule to run the script, and the script location on your server) and you will be all set to receive an email at the scheduled time.</p>
<p>This is a very simple script and tutorial but I have found it to be very effective and handy. I hope this tutorial helped and maybe even tought you a little PHP <img src='http://www.techwhiz.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Feel free to leave your comments and suggestions/feedback below. I will try to answer any/all questions you may have</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techwhiz.info/2008/07/23/simple-hack-check-script-and-cron-job/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP&#8217;s Levenshtein Function</title>
		<link>http://www.techwhiz.info/2008/05/22/phps-levenshtein-function/</link>
		<comments>http://www.techwhiz.info/2008/05/22/phps-levenshtein-function/#comments</comments>
		<pubDate>Thu, 22 May 2008 20:34:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Utilities]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[example]]></category>

		<category><![CDATA[function]]></category>

		<category><![CDATA[levenshtein]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[script]]></category>

		<category><![CDATA[spell checker]]></category>

		<category><![CDATA[tech]]></category>

		<category><![CDATA[tech whiz]]></category>

		<category><![CDATA[techwhiz]]></category>

		<category><![CDATA[whiz]]></category>

		<category><![CDATA[word suggestion]]></category>

		<guid isPermaLink="false">http://www.techwhiz.info/?p=36</guid>
		<description><![CDATA[The levenshtein() function in PHP is a fairly uncommon function and is unknown to most coders, however, this function is a very cool and powerful function that has many uses and is VERY handy! Today, I am going to show you how to use it and what it can do by making a simple, yet [...]]]></description>
			<content:encoded><![CDATA[<p>The levenshtein() function in PHP is a fairly uncommon function and is unknown to most coders, however, this function is a very cool and powerful function that has many uses and is VERY handy! Today, I am going to show you how to use it and what it can do by making a simple, yet powerful, word suggestion tool.</p>
<p><span id="more-36"></span></p>
<p>First of all, the way this function works, is that it takes one string and compares it to another and finds the shortest amount of changes necessary to make them similar. Now while this may sound both confusing and unnecessary, it is quite extraordinary and very useful.</p>
<p>This is the script we are going to make today, it will take a word as an input (spelled wrong) and tell you the closest matches to your input, thereby acting as a word suggestion tool or a spell checker tool.</p>
<p>The Script:</p>
<div class="igBar"><span id="lphp-4"><a href="#" onclick="javascript:showPlainTxt('php-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-4">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$REQUEST_METHOD</span> == <span style="color:#FF0000;">"post"</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$input</span> = <span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'word'</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$dict</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'dog'</span>, <span style="color:#FF0000;">'fish'</span>, <span style="color:#FF0000;">'cat'</span>, <span style="color:#FF0000;">'parrot'</span>, <span style="color:#FF0000;">'humming bird'</span>, <span style="color:#FF0000;">'snake'</span>, <span style="color:#FF0000;">'rabbit'</span>, <span style="color:#FF0000;">'frog'</span>, <span style="color:#FF0000;">'turtle'</span>, <span style="color:#FF0000;">'bee'</span>, <span style="color:#FF0000;">'ant'</span>, <span style="color:#FF0000;">'scorpion'</span>, <span style="color:#FF0000;">'wolf'</span>, <span style="color:#FF0000;">'bear'</span>, <span style="color:#FF0000;">'panda'</span>, <span style="color:#FF0000;">'anaconda'</span>, <span style="color:#FF0000;">'llama'</span>, <span style="color:#FF0000;">'cow'</span>, <span style="color:#FF0000;">'sheep'</span>, <span style="color:#FF0000;">'horse'</span>, <span style="color:#FF0000;">'goat'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$shortest</span> = -<span style="color:#CC66CC;color:#800000;">1</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">foreach</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$dict</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$word</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color:#0000FF;">$search</span> = <a href="http://www.php.net/levenshtein"><span style="color:#000066;">levenshtein</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$input</span>, <span style="color:#0000FF;">$word</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$search</span> == <span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$suggest</span> = <span style="color:#0000FF;">$word</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$shortest</span> = <span style="color:#CC66CC;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">break</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$search</span> &lt;= <span style="color:#0000FF;">$shortest</span> || <span style="color:#0000FF;">$shortest</span> &lt;<span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$suggest</span> = <span style="color:#0000FF;">$word</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$shortest</span> = <span style="color:#0000FF;">$search</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print"><span style="color:#000066;">Print</span></a> <span style="color:#FF0000;">"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &nbsp;Input: $input &lt;br /&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &nbsp;Closest Match: $suggest</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;html&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;head&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;title&gt;Levenshtein Example&lt;/title&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/head&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;body&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;form action=<span style="color:#FF0000;">"&lt;?php echo($PHP_SELF); ?&gt;"</span> method=<span style="color:#FF0000;">"POST"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;Word: &lt;input type=<span style="color:#FF0000;">"text"</span> name=<span style="color:#FF0000;">"word"</span> /&gt;&lt;br /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;&lt;input type=<span style="color:#FF0000;">"submit"</span> value=<span style="color:#FF0000;">"Find Suggestion"</span> /&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/form&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/body&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/html&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>That is the script in it's entirety. Now I will explain the code and what it does.</p>
<p>First of all it displays a form in which the user inputs a word (preferably spelled wrong <img src='http://www.techwhiz.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ). Then upon submitting the form it will check the input against an array of words. When it finds the word that is the closest match to the input it echo's the results.</p>
<p>This code can easily be modified to check the input against a dictionary file, a database, or even an online dictionary (such as dictionary.com <img src='http://www.techwhiz.info/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ). It has many possibilities and endless uses.</p>
<p>Feel free to comment on my script and any changes you make to it, I encourage you to take this script and make changes, play with it, and learn cool new ways to use the levenshtein() function!</p>
<p>Happy Coding and Good Luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techwhiz.info/2008/05/22/phps-levenshtein-function/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MP3 Search Engine!</title>
		<link>http://www.techwhiz.info/2008/05/05/mp3-search-engine/</link>
		<comments>http://www.techwhiz.info/2008/05/05/mp3-search-engine/#comments</comments>
		<pubDate>Mon, 05 May 2008 10:18:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PPP]]></category>

		<category><![CDATA[Services]]></category>

		<guid isPermaLink="false">http://www.techwhiz.info/?p=35</guid>
		<description><![CDATA[Check out this awesome new MP3 search engine! You can find and download any song you like, it searches the net and it's 3 HUGE databases for songs of all genres, artists, and record label. You can find any song GUARANTEED! I suggest everybody go give it a try!
Link: MP3 Search Engine
]]></description>
			<content:encoded><![CDATA[<p>Check out this awesome new MP3 search engine! You can find and download any song you like, it searches the net and it's 3 HUGE databases for songs of all genres, artists, and record label. You can find any song GUARANTEED! I suggest everybody go give it a try!</p>
<p>Link: <a href="http://www.musiczoom.net">MP3 Search Engine</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.techwhiz.info/2008/05/05/mp3-search-engine/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Cool new service, get paid to write!</title>
		<link>http://www.techwhiz.info/2008/05/04/cool-new-serviceget-paid-to-write/</link>
		<comments>http://www.techwhiz.info/2008/05/04/cool-new-serviceget-paid-to-write/#comments</comments>
		<pubDate>Mon, 05 May 2008 03:24:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PPP]]></category>

		<category><![CDATA[Services]]></category>

		<guid isPermaLink="false">http://www.techwhiz.info/?p=34</guid>
		<description><![CDATA[Thats right! There is this new service I found that PAYS you to write stuff ANYWHERE on the internet. You can write it on your MySpace, Facebook, Etc. page or just on your Google or Yahoo groups! They will pay you to write as little as 10 words and you get paid a MINIMUM of [...]]]></description>
			<content:encoded><![CDATA[<p>Thats right! There is this new service I found that PAYS you to write stuff ANYWHERE on the internet. You can write it on your MySpace, Facebook, Etc. page or just on your Google or Yahoo groups! They will pay you to write as little as 10 words and you get paid a MINIMUM of $0.25 per post (some are MINIMUM $1.00/post!!) This site is awesome and everybody needs to go check it out <img src='http://www.techwhiz.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Referer (Help me out <img src='http://www.techwhiz.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ): <a href="http://www.GetPaidToPost.com/index.php?ref=hyerdesign">GetPaidToPost.com</a></p>
<p>Link: <a href="http://www.getpaidtopost.com">GetPaidToPost.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.techwhiz.info/2008/05/04/cool-new-serviceget-paid-to-write/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Grab and Display Digg.com Frontpage Posts with Flash and AS2</title>
		<link>http://www.techwhiz.info/2008/05/01/grab-and-display-diggcom-frontpage-posts-with-flash-and-as2/</link>
		<comments>http://www.techwhiz.info/2008/05/01/grab-and-display-diggcom-frontpage-posts-with-flash-and-as2/#comments</comments>
		<pubDate>Fri, 02 May 2008 01:53:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Entertainment]]></category>

		<category><![CDATA[Flash/ActionScript]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[actionscript]]></category>

		<category><![CDATA[app]]></category>

		<category><![CDATA[application]]></category>

		<category><![CDATA[as]]></category>

		<category><![CDATA[digg]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[tech]]></category>

		<category><![CDATA[techwhiz]]></category>

		<category><![CDATA[timer]]></category>

		<category><![CDATA[tut]]></category>

		<category><![CDATA[tutorial]]></category>

		<category><![CDATA[whiz]]></category>

		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.techwhiz.info/?p=33</guid>
		<description><![CDATA[In this tutorial I will show you how to make a really cool Flash application using Flash 8 and ActionScript 2.0 (AS2). This application that we are about to build will grab the xml feed from Digg.com and display the first 3 stories from the frontpage in a nice little window for us to look [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial I will show you how to make a really cool Flash application using Flash 8 and ActionScript 2.0 (AS2). This application that we are about to build will grab the xml feed from <a title="Digg.com" href="http://digg.com/">Digg.com</a> and display the first 3 stories from the frontpage in a nice little window for us to look at.</p>
<p><span id="more-33"></span></p>
<p>First of all, as I mentioned earlier, we will be using Macromedia Flash 8 (Now Adobe Flash) and ActionScript 2.0 (built-in scripting language in Flash 8). Now lets get on to the real cool stuff!</p>
<p><strong><span style="text-decoration: underline;">Step 1</span></strong></p>
<p>Create a New Flash Document using the default size (550 x 400px).</p>
<p><strong><span style="text-decoration: underline;">Step 2</span></strong></p>
<p>Set the background color to whatever you want, I chose a medium greenish blue. Then place the text "Loading..." in the center of the document. This frame (frame 1) will serve as a loading page and in the next step we will implement the code to advance the frame upon loading the XML file. The reason we have this frame is because I found that Digg.com's XML file is quite large and can take some time to load so we show this page while the file is being loaded.</p>
<p><strong><span style="text-decoration: underline;">Step 3</span></strong></p>
<p>Insert the following code into the Actions for the first frame:</p>
<div class="igBar"><span id="lactionscript-8"><a href="#" onclick="javascript:showPlainTxt('actionscript-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-8">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> GetDiggXML<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Void</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">myXML = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">myXML.<span style="color: #0066CC;">ignoreWhite</span> = <span style="color: #000000; font-weight: bold;">true</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">myXML.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"http://digg.com/rss/index.xml"</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">myXML.<span style="color: #006600;">ref</span> = <span style="color: #0066CC;">this</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">myXML.<span style="color: #0066CC;">onLoad</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>succes<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>succes<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">gotoAndPlay</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> root = <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">firstChild</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">nodes = root.<span style="color: #0066CC;">childNodes</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> h:<span style="color: #0066CC;">Number</span> = i+<span style="color: #cc66cc;color:#800000;">1</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> j:<span style="color: #0066CC;">Number</span> = i+<span style="color: #cc66cc;color:#800000;">2</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">subnodes = nodes<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">childNodes</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">this</span>.<span style="color: #006600;">ref</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"txt_Title1"</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">text</span> = subnodes<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">firstChild</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">7</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, -<span style="color: #cc66cc;color:#800000;">8</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">this</span>.<span style="color: #006600;">ref</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"txt_Description"</span>+h<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">text</span> = subnodes<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">childNodes</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">13</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, -<span style="color: #cc66cc;color:#800000;">14</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">65</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #ff0000;">"..."</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">this</span>.<span style="color: #006600;">ref</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"txt_Diggs"</span>+h<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">text</span> = subnodes<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">childNodes</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">16</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, -<span style="color: #cc66cc;color:#800000;">17</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">this</span>.<span style="color: #006600;">ref</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"txt_Title2"</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">text</span> = subnodes<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">4</span>+h<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">firstChild</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">7</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, -<span style="color: #cc66cc;color:#800000;">8</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">this</span>.<span style="color: #006600;">ref</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"txt_Description2"</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">text</span> = subnodes<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">4</span>+h<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">childNodes</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">13</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, -<span style="color: #cc66cc;color:#800000;">14</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">65</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #ff0000;">"..."</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">this</span>.<span style="color: #006600;">ref</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"txt_Diggs2"</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">text</span> = subnodes<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">4</span>+h<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">childNodes</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">16</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, -<span style="color: #cc66cc;color:#800000;">17</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">this</span>.<span style="color: #006600;">ref</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"txt_Title3"</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">text</span> = subnodes<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">4</span>+j<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">firstChild</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">7</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, -<span style="color: #cc66cc;color:#800000;">8</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">this</span>.<span style="color: #006600;">ref</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"txt_Description3"</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">text</span> = subnodes<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">4</span>+j<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">childNodes</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">13</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, -<span style="color: #cc66cc;color:#800000;">14</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">65</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #ff0000;">"..."</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">this</span>.<span style="color: #006600;">ref</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"txt_Diggs3"</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">text</span> = subnodes<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">4</span>+j<span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">childNodes</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">16</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">substr</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, -<span style="color: #cc66cc;color:#800000;">17</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"Error opening 'Digg.com XML File make sure it exitsts!"</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GetDiggXML<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This code will grab the XML file and when it has loaded will go the the next frame (frame 2) and display the data from the XML file for the first 3 posts on the front page.</p>
<p><strong><span style="text-decoration: underline;">Step 4</span></strong></p>
<p>Now insert a second frame and draw your display. You will need 9 text boxes (dynamic) with the following labels:</p>
<p>txt_Title1<br />
txt_Description1<br />
txt_Diggs1</p>
<p>txt_Title2<br />
txt_Description2<br />
txt_Diggs2</p>
<p>txt_Title3<br />
txt_Description3<br />
txt_Diggs3</p>
<p>Then you will need another text box with the text "Refresh". Then convert that to a button and label it "btn_Refresh" and add the following actionscript code to the button:</p>
<div class="igBar"><span id="lactionscript-9"><a href="#" onclick="javascript:showPlainTxt('actionscript-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-9">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">on</span> <span style="color: #66cc66;">&#40;</span>release<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0066CC;">gotoAndPlay</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This will make it refresh the XML file and grab any new items.</p>
<p><strong><span style="text-decoration: underline;">Step 5</span></strong></p>
<p>The next step is to add the following code to the second frame:</p>
<div class="igBar"><span id="lactionscript-10"><a href="#" onclick="javascript:showPlainTxt('actionscript-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-10">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> countdown_time:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">900</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">var</span> counter:<span style="color: #0066CC;">Number</span> = countdown_time;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> countdown<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; counter--;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>counter == <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">gotoAndPlay</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">clearInterval</span><span style="color: #66cc66;">&#40;</span>intID<span style="color: #66cc66;">&#41;</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">countdown_txt.<span style="color: #0066CC;">text</span> = countdown_time;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">intID = <span style="color: #0066CC;">setInterval</span><span style="color: #66cc66;">&#40;</span>countdown,<span style="color: #cc66cc;color:#800000;">1000</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This code will act as a timer, it will refresh every 15 minutes (so if you leave it running it will automatically refresh).</p>
<p>This concludes this tutorial, if you have any questions, comments, etc. feel free to leave a comment below. I will try to answer any and all questions brought up below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techwhiz.info/2008/05/01/grab-and-display-diggcom-frontpage-posts-with-flash-and-as2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Automatically Fetch Data From AWStats</title>
		<link>http://www.techwhiz.info/2008/03/31/automatically-fetch-data-from-awstats/</link>
		<comments>http://www.techwhiz.info/2008/03/31/automatically-fetch-data-from-awstats/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 16:34:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Utilities]]></category>

		<category><![CDATA[aw stats]]></category>

		<category><![CDATA[awstats]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[dynamic]]></category>

		<category><![CDATA[file_get_contents]]></category>

		<category><![CDATA[fopen]]></category>

		<category><![CDATA[html]]></category>

		<category><![CDATA[preg_match]]></category>

		<category><![CDATA[stats]]></category>

		<category><![CDATA[substr]]></category>

		<category><![CDATA[tech]]></category>

		<category><![CDATA[techwhiz]]></category>

		<category><![CDATA[text files]]></category>

		<category><![CDATA[whiz]]></category>

		<guid isPermaLink="false">http://www.techwhiz.info/2008/03/31/automatically-fetch-data-from-awstats/</guid>
		<description><![CDATA[Anyone who owns a website knows that stats are important. If you're like me you like to know how many visitors your site is getting and what kind of bandwidth your using. With AWStats you can get comprehensive reports of your user statistics but I don't want to have to go through my Control Panel [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone who owns a website knows that stats are important. If you're like me you like to know how many visitors your site is getting and what kind of bandwidth your using. With AWStats you can get comprehensive repo<code></code>rts of your user statistics but I don't want to have to go through my Control Panel and open AWStats everyday to see how many visitors my site has gotten. To make it easier I created this little script to automatically grab my AWStats data and display it in a neat and orderly way.<br />
<span id="more-32"></span></p>
<p>First off, here is the complete code in it's entirety. You can copy and paste this code, change some settings and your good to go, I'll explain the what the code does next.</p>
<blockquote><p>&lt;?php</p>
<p>$open = file_get_contents("http://CPANEL_USERNAME:CPANEL_PASSWORD@www.YOURDOMAIN:2082/awstats.pl?config=techwhiz.info&amp;ssl=〈=en&amp;framename=mainright");<br />
$regex_1 = '/&lt;span style="font-size: 12px"&gt;(.*)&lt;\/span&gt;/';<br />
$regex_2 = '/&lt;b&gt;(.*)&lt;\/b&gt;<br />
/';<br />
preg_match_all($regex_1, $open, $result);<br />
preg_match_all($regex_2, $open, $result2);</p>
<p>$month = substr($result[0][0], 34, -20);<br />
$day = substr($result[0][0], 31, -24);<br />
$year = substr($result[0][0], 37, -15);<br />
$time = substr($result[0][0], 44, -7);</p>
<p>$uniques = substr($result2[0][0], 3, -198);<br />
$visitors = substr($result2[0][0], 35, -166);<br />
$hits = substr($result2[0][0], 136, -64);</p>
<p>$date = "$month | $day | $year | $time";</p>
<p>$file = fopen("awstats.txt", "r");<br />
$old_date = fread($file, filesize("awstats.txt"));</p>
<p>if ($old_date != $date) {<br />
$file2 = fopen("awstats.txt", "r+");<br />
fwrite($file2, $date);<br />
fclose($file2);<br />
$updated = "1";<br />
}</p>
<p>fclose($file);</p>
<p>if ($updated == "1") {<br />
Print "<br />
&lt;span class=\"updated\"&gt;Updated!&lt;/span&gt;<br />
";<br />
unset($updated);<br />
}</p>
<p>Print "<br />
Last Update: $month $day, $year - $time<br />
&lt;table cellpadding=\"5\"&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Unique Visitors: &lt;/td&gt;&lt;td&gt;$uniques&lt;/td&gt;<br />
&lt;td&gt;Total Visitors: &lt;/td&gt;&lt;td&gt;$visitors&lt;/td&gt;<br />
&lt;td&gt;Total Hits: &lt;/td&gt;&lt;td&gt;$hits&lt;/td&gt;<br />
";</p>
<p>?&gt;</p></blockquote>
<p>This script will generate the following output:</p>
<p style="text-align: center"><a href="http://www.techwhiz.info/uploaded_files/desktop_awstats.bmp" rel="lightbox" title="AWStats On My Desktop!"><img src="http://www.techwhiz.info/uploaded_files/desktop_awstats.bmp" /></a></p>
<p>This is an example of the output. I just put it on my Desktop using an Active Desktop object.</p>
<p>Now, I will explain the script and how it works:</p>
<blockquote><p> $open = file_get_contents("http://CPANEL_USERNAME:CPANEL_PASSWORD@www.YOURDOMAIN:2082/awstats.pl?config=techwhiz.info&amp;ssl=〈=en&amp;framename=mainright");<br />
$regex_1 = '/<span style="font-size: 12px">(.*)&lt;\/span&gt;/';<br />
$regex_2 = '/(.*)&lt;\/b&gt;<br />
/';<br />
preg_match_all($regex_1, $open, $result);<br />
preg_match_all($regex_2, $open, $result2);</span></p></blockquote>
<p>This code grabs the awstats main page. Note that you will need to insert the correct data where it says CPANEL_USERNAMe and CPANEL_PASSWORD, but remember to keep the ":" between them. Also replace YOURDOMAIN with your domain you use for your cPanel access.</p>
<p>The $regex_1 and $regex_2 are used to find the "last updated" date and the unique visitors, total hits, etc that we will use later. the preg_match grabs the matching results and puts them   into an array for easy access.</p>
<blockquote><p> $month = substr($result[0][0], 34, -20);<br />
$day = substr($result[0][0], 31, -24);<br />
$year = substr($result[0][0], 37, -15);<br />
$time = substr($result[0][0], 44, -7);</p></blockquote>
<p>This code basically separates the different parts that make up the date, this is used multiple times for both displaying the date and saving it as a formatted string in a text file to compare with future versions of the fetched page to determine if it has been updated.</p>
<blockquote><p>$uniques = substr($result2[0][0], 3, -198);<br />
$visitors = substr($result2[0][0], 35, -166);<br />
$hits = substr($result2[0][0], 136, -64);</p></blockquote>
<p>This code is very similar to the code above, however instead of breaking up (substr) $result it breaks up $result2. The code here pulls out the Unique Visitors, Total Visitors, and Total Hits. It is very easy to expand this code to pull the other stats available through AWStats such as Bandwidth, etc.</p>
<blockquote><p>$date = "$month | $day | $year | $time";</p>
<p>$file = fopen("awstats.txt", "r");<br />
$old_date = fread($file, filesize("awstats.txt"));</p>
<p>if ($old_date != $date) {<br />
$file2 = fopen("awstats.txt", "r+");<br />
fwrite($file2, $date);<br />
fclose($file2);<br />
$updated = "1";<br />
}</p>
<p>fclose($file);</p></blockquote>
<p>This section of code formats the date to be put into the text file, then opens the file "awstats.txt". Next it determines if the "Last Updated" date is the same as the "old date" stored in the text file are the same, if so then it doesn't need to update it, else it stores the current date in the text file and sets "$updated=1" which tells the script the stats have been updated. At the end it closes the file.</p>
<blockquote><p>if ($updated == "1") {<br />
Print "&lt;span class=\"updated\"&gt;Updated!&lt;/span&gt;<br />
";<br />
unset($updated);<br />
}</p></blockquote>
<p>This piece of code determines if the stats have been updated by reading "$updated" if it equals "1" then it has been updated, anything else and it has not. If it has been updated then it prints "Updated!" to the user (output) and then unsets the "$updated" variable to prepare for the next go around.</p>
<blockquote><p>Print "<br />
Last Update: $month $day, $year - $time<br />
&lt;table cellpadding=\"5\"&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Unique Visitors: &lt;/td&gt;&lt;td&gt;$uniques&lt;/td&gt;<br />
&lt;td&gt;Total Visitors: &lt;/td&gt;&lt;td&gt;$visitors&lt;/td&gt;<br />
&lt;td&gt;Total Hits: &lt;/td&gt;&lt;td&gt;$hits&lt;/td&gt;</p>
<p>";</p>
<p>?&gt;</p></blockquote>
<p>This code prints the stats in a neat orderly table as shown in the picture at the beginning of this article. Then closes off the body and html tags and everything is done!</p>
<p>I know this has been a very long tutorial but I hope it was worth it! It is definitely a useful script and can be easily modified and used in other scripts or for anything really!</p>
<p>If you see anything wrong or any mistakes or just want to leave a comment by all means please do, just leave a comment below!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techwhiz.info/2008/03/31/automatically-fetch-data-from-awstats/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Monitor Websites For Changes In Content</title>
		<link>http://www.techwhiz.info/2008/03/24/monitor-websites-for-changes-in-content/</link>
		<comments>http://www.techwhiz.info/2008/03/24/monitor-websites-for-changes-in-content/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 15:23:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://www.techwhiz.info/2008/03/24/monitor-websites-for-changes-in-content/</guid>
		<description><![CDATA[Recently I had a problem where I was trying to figure out how to monitor a site for new content or changes in current content. The problem was the site didn't have an RSS or Atom feed or anything similar to monitor it automatically via a simple PHP script or similar method so I had [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had a problem where I was trying to figure out how to monitor a site for new content or changes in current content. The problem was the site didn't have an RSS or Atom feed or anything similar to monitor it automatically via a simple PHP script or similar method so I had to come up with this method to monitor a site for changes.</p>
<p>As I sat and thought about it I realized there were couple ways to achieve this level of monitoring I was looking for. One method I came up with was to grab the entire contents of the page and cache it in a text file then periodically grab the page and compare the data to the cached version. This solution although it would work just fine was a little more trouble and effort than I wanted <img src='http://www.techwhiz.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p><span id="more-31"></span></p>
<p>The other method, and the one I'm going to illustrate in this tutorial is similar to the above method except we don't cache the content of the site, rather we hash it and compare the pages hash to another hash to see if there has been any changes in the site. This method works perfectly for what I need it for because I don't need to specifically know what the changes were just that there has been changes made. Basically I need to be alerted when the page changes but I don't need to know the specific changes in the page.</p>
<p>So lets get this tutorial started! First off, what we are basically going to do is grab the page</p>
<p>that we are monitoring and hash it using md5, then we will compare that hash to a set hash of the page from the state we are comparing it to. That way even if one letter or character was changed the hash would be different and therefore would show us that a change has been made. It is really more simple than it sounds <img src='http://www.techwhiz.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><u><strong>Step 1</strong></u></p>
<p>Since we are going to need a preset hash for our script to compare periodic hashes to we are going to make a script that will give us a preliminary hash of the page.</p>
<blockquote><p> &lt;?php</p>
<p>$url = "URL OF THE PAGE YOU'RE MONITORING";</p>
<p>$page = file_get_contents($url);</p>
<p>echo md5($page);</p>
<p>?&gt;</p></blockquote>
<p>Now, save that script and execute it, it will give you the  md5 hash that you need to insert into this next script in order for it to function properly.<br />
<u></u></p>
<p><u><strong>Step 2</strong></u></p>
<p>Now that we have the md5 hash that we need, plug it into the following script.</p>
<blockquote><p>&lt;?php</p>
<p>$url = "URL OF PAGE YOU'RE MONITORING";</p>
<p>$page = file_get_contents($url);</p>
<p>//HASH YOU GOT FROM THE PREVIOUS SCRIPT (STEP1)<br />
$md5_orig = "d41d8cd98f00b204e9800998ecf8427e";</p>
<p>$md5 = md5($page);</p>
<p>if ($md5 == $md5_orig) {<br />
echo "Page content has NOT changed yet...";<br />
}<br />
elseif ($md5 != $md5_orig) {<br />
echo "Page content HAS changed, go check it out!";<br />
}</p>
<p>?&gt;</p></blockquote>
<p>This script will basically go out and grab the page content, compare it to a hash of the old content and if it's changed, it will tell you to go see the changes, otherwise it will tell you there has been no changes in the page.</p>
<p>I understand that this is a fairly simple and primitive approach to the problem, but hey, it works! Now, all you have to do is change the values where it is marked and save the script to your server and you're good to go! This script will check the page everytime you load the script, an alternative to this is to setup a cron job to run the script and have it save the results to a file or email them to you, this is far more convenient and I highly recommend it!</p>
<p>Well, this pretty much concludes this tutorial, go try it out and leave a comment with your experience or any questions you have and I'll try to address them <img src='http://www.techwhiz.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.techwhiz.info/2008/03/24/monitor-websites-for-changes-in-content/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SnapBomb.com - The Next Big Thing?</title>
		<link>http://www.techwhiz.info/2008/03/18/snapbombcom-the-next-big-thing-for-bloggers/</link>
		<comments>http://www.techwhiz.info/2008/03/18/snapbombcom-the-next-big-thing-for-bloggers/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 02:13:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Entertainment]]></category>

		<category><![CDATA[PPP]]></category>

		<category><![CDATA[Services]]></category>

		<category><![CDATA[blog advertising]]></category>

		<category><![CDATA[blog marketing]]></category>

		<category><![CDATA[blogging]]></category>

		<category><![CDATA[bomb]]></category>

		<category><![CDATA[buzz]]></category>

		<category><![CDATA[cash]]></category>

		<category><![CDATA[income]]></category>

		<category><![CDATA[money]]></category>

		<category><![CDATA[next big thing]]></category>

		<category><![CDATA[review]]></category>

		<category><![CDATA[snap]]></category>

		<category><![CDATA[snapbomb]]></category>

		<category><![CDATA[tech]]></category>

		<category><![CDATA[techwhiz]]></category>

		<category><![CDATA[whiz]]></category>

		<guid isPermaLink="false">http://www.techwhiz.info/2008/03/18/snapbombcom-the-next-big-thing-for-bloggers/</guid>
		<description><![CDATA[Today I signed up for snapbomb.com PPP service. I had heard some pretty good reviews and opinions about them and decided to try them out. My first impression was oh crap, another blog advertising and blog marketing service, but I quickly retracted that thought after I saw what they had to offer!
 

First of all, [...]]]></description>
			<content:encoded><![CDATA[<p>Today I signed up for <a href="http://www.snapbomb.com" alt="SnapBomb.com">snapbomb.com</a> PPP service. I had heard some pretty good reviews and opinions about them and decided to try them out. My first impression was oh crap, another blog advertising and blog marketing service, but I quickly retracted that thought after I saw what they had to offer!</p>
<p align="center"> <img src="http://img.photobucket.com/albums/v242/cinnamonsui/snapbomb.png" alt="SnapBomb.com Logo" height="93" width="196" /></p>
<p><span id="more-30"></span></p>
<p>First of all, they are really easy to sign up with. All you need is a user name, password, and email address! After you have signed up you can submit your blogs. What makes <a href="http://www.snapbomb.com" alt="SnapBomb.com" title="SnapBomb.com">SnapBomb</a> different is that they allow you to submit as many blogs as you want instead of submitting one and waiting WEEKS or MONTHS for it to be evaluated and approved before allowing more blogs to be submitted.</p>
<p>Second, I REALLY liked how they approve you blog immediately. My blog, <a href="http://www.techwhiz.info/">TechWhiz.info</a>, has fairly low ranks (PR: 0, Alexa: ~2mil) so I was very suprised when they accepted by blog.</p>
<p>However, even though they allow pretty much any blog to join don't be surprised if you aren't given a price tag that pays the bills ;).  You will be assigned a minimum value that you will make for posts, this is the minimum amount you will be paid to write a post for an advertiser. This process, instead of taking months, weeks, or even days, takes all of about 10 sec! You get your blog value assigned and you can immediately start writing posts!</p>
<p>SnapBomb provides a wonderful blog advertising system that allows advertisers to create buzz about a product or service and allows bloggers to earn a little extra while promoting useful products and services. This just could be the next big thing in blog marketing and blog advertising!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techwhiz.info/2008/03/18/snapbombcom-the-next-big-thing-for-bloggers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DOTD - Norton Antivirus 2008 w/ Free Gift! - $8!</title>
		<link>http://www.techwhiz.info/2008/03/17/dotd-norton-antivirus-2008-w-free-gift-8/</link>
		<comments>http://www.techwhiz.info/2008/03/17/dotd-norton-antivirus-2008-w-free-gift-8/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 17:12:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[DOTD]]></category>

		<category><![CDATA[Microsoft/Windows]]></category>

		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.techwhiz.info/2008/03/17/dotd-norton-antivirus-2008-w-free-gift-8/</guid>
		<description><![CDATA[Todays DOTD (Deal of The Day):

Click To Enlarge

Norton Antivirus 2008 - 3 User Norton AntiVirus 2008 protects your PC against spyware, viruses, and other Internet threats. It works automatically to block harmful software before it penetrates your system. It scans and cleans email and instant messaging attachments and Internet downloads, and includes automatic updates to [...]]]></description>
			<content:encoded><![CDATA[<p>Todays DOTD (Deal of The Day):</p>
<p align="center"><a href="http://ak.buy.com/db_assets/large_images/722/206531722.jpg" rel="lightbox" alt="Norton Anti-Virus 2008 w/ Free Gift for $8!"><img src="http://ak.buy.com/db_assets/large_images/722/206531722.jpg" alt="Norton Anti-Virus 2008 w/ Free Gift for $8!" width="300" /></a><br />
<em>Click To Enlarge</em></p>
<p align="center"><span id="more-29"></span></p>
<p><a href="http://affiliate.buy.com/gateway.aspx?adid=17662&amp;pid=2908892&amp;aid=10391416&amp;sURL=http%3A%2F%2Fwww%2Ebuy%2Ecom%2Fprod%2Fnorton%2Dantivirus%2D2008%2D3%2Duser%2Dwith%2Dfree%2D1gb%2Dkingston%2Ddata%2Dtraveler%2Dusb%2Fq%2Floc%2F105%2F206531722%2Ehtml" title="Norton Antivirus 2008 w/ Free Gift for $8!!!" target="_blank">Norton Antivirus 2008 - 3 User Norton AntiVirus 2008 protects your PC against spyware, viruses, and other Internet threats. It works automatically to block harmful software before it penetrates your system. It scans and cleans email and instant messaging attachments and Internet downloads, and includes automatic updates to keep you protected against newly discovered threats throughout your service subscription. This new version will replace Norton AntiVirus 2007.</a></p>
<p><a href="http://affiliate.buy.com/gateway.aspx?adid=17662&amp;pid=2908892&amp;aid=10391416&amp;sURL=http%3A%2F%2Fwww%2Ebuy%2Ecom%2Fprod%2Fnorton%2Dantivirus%2D2008%2D3%2Duser%2Dwith%2Dfree%2D1gb%2Dkingston%2Ddata%2Dtraveler%2Dusb%2Fq%2Floc%2F105%2F206531722%2Ehtml" title="Norton Antivirus 2008 w/ Free Gift for $8!!!" target="_blank">Kingston 1GB Data Traveler Flash Drive DataTraveler USB Flash drive is ideal for home office, small business, schools and promotions. It is affordable and puts mobile storage in nearly anyone's hands. Now you can store, carry and transfer files quickly in an affordable, convenient device. The DataTraveler from Kingston helps budget-conscious users break storage barriers, allowing you to easily store and move files in a device no bigger than a pocketknife. As easy as click and drag, the DataTraveler can hold just about any file you can think of - reports pictures, spreadsheets or other important documents. It works with virtually any device with a USB port - even cross-platform from Macintosh to PC and vice versa. The DataTraveler also makes a great promotional item for your organization; it's simple to add your logo to increase brand-recognition. Backed by a five-year warranty and Kingston's legendary service and support, the DataTraveler is a reliable, inexpensive solution for carrying files or your next promotion.</a></p>
<p><a href="http://affiliate.buy.com/gateway.aspx?adid=17662&amp;pid=2908892&amp;aid=10391416&amp;sURL=http%3A%2F%2Fwww%2Ebuy%2Ecom%2Fprod%2Fnorton%2Dantivirus%2D2008%2D3%2Duser%2Dwith%2Dfree%2D1gb%2Dkingston%2Ddata%2Dtraveler%2Dusb%2Fq%2Floc%2F105%2F206531722%2Ehtml" title="Norton Antivirus 2008 w/ Free Gift for $8!!!" target="_blank">Price: $8!<br />
Bonus: FREE 1GB USB 2.0 Thumbdrive!!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.techwhiz.info/2008/03/17/dotd-norton-antivirus-2008-w-free-gift-8/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DOTD - Kensington Portable Ipod Speakers - $10</title>
		<link>http://www.techwhiz.info/2008/03/16/dotd-kensington-fx300-portable-ipod-speakers/</link>
		<comments>http://www.techwhiz.info/2008/03/16/dotd-kensington-fx300-portable-ipod-speakers/#comments</comments>
		<pubDate>Sun, 16 Mar 2008 21:03:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[DOTD]]></category>

		<category><![CDATA[Electronics]]></category>

		<category><![CDATA[buy]]></category>

		<category><![CDATA[buy.com]]></category>

		<category><![CDATA[deal]]></category>

		<category><![CDATA[deal of the day]]></category>

		<category><![CDATA[iphone]]></category>

		<category><![CDATA[ipod]]></category>

		<category><![CDATA[kensington]]></category>

		<category><![CDATA[nano]]></category>

		<category><![CDATA[portable]]></category>

		<category><![CDATA[speakers]]></category>

		<category><![CDATA[tech]]></category>

		<category><![CDATA[techwhiz]]></category>

		<category><![CDATA[tools]]></category>

		<category><![CDATA[touch]]></category>

		<category><![CDATA[video]]></category>

		<category><![CDATA[whiz]]></category>

		<guid isPermaLink="false">http://www.techwhiz.info/2008/03/16/dotd-kensington-fx300-portable-ipod-speakers/</guid>
		<description><![CDATA[Todays DOTD (Deal of The Day):

Click To Enlarge
 





Share your favorite tunes anywhere, anytime. FX 300 Speaker To Go is smartly designed into a lightweight, protective case with exterior volume control. Once your MP3 player is safely tucked in, music comes out. Turn it on. Turn it up.


Features






Manufacturer
&#160;
Kensington Computer Products Group



Manufacturer Part Number
&#160;
33388



Interfaces/Ports
&#160;
Docking Connector



Product Name
&#160;
FX [...]]]></description>
			<content:encoded><![CDATA[<p>Todays DOTD (Deal of The Day):<br />
<center><a href="http://affiliate.buy.com/gateway.aspx?adid=17662&amp;pid=2908892&amp;aid=10391416&amp;sURL=http%3A%2F%2Fwww%2Ebuy%2Ecom%2Fprod%2Fkensington%2Dfx%2D300%2Dportable%2Dipod%2Dspeaker%2Dsystem%2Fq%2Floc%2F111%2F202999639%2Ehtml"><img src="http://ak.buy.com/db_assets/prod_lrg_images/639/202999639.jpg" alt="Kensington FX300 Portable Ipod Speaker System" width="250" /></a><br />
<em>Click To Enlarge</em><br />
</center><center> </center><span id="more-28"></span></p>
<table border="0" cellpadding="0" cellspacing="0" height="214" width="868">
<tr>
<td align="left"><span style="font-size: 12px"></span></td>
</tr>
<tr>
<td><a href="http://affiliate.buy.com/gateway.aspx?adid=17662&amp;pid=2908892&amp;aid=10391416&amp;sURL=http%3A%2F%2Fwww%2Ebuy%2Ecom%2Fprod%2Fkensington%2Dfx%2D300%2Dportable%2Dipod%2Dspeaker%2Dsystem%2Fq%2Floc%2F111%2F202999639%2Ehtml" title="Ipod Portable Speakers for $10!" target="_blank">Share your favorite tunes anywhere, anytime. FX 300 Speaker To Go is smartly designed into a lightweight, protective case with exterior volume control. Once your MP3 player is safely tucked in, music comes out. Turn it on. Turn it up.</a></td>
</tr>
<tr>
<td><strong class="productTitle">Features</strong></p>
<table border="0" cellpadding="0" cellspacing="4">
<tr>
<td valign="top">
<table border="0" cellpadding="0" cellspacing="4" height="136" width="496">
<tr>
<td valign="top"><img src="http://ak.buy.com/buy_assets/v6/july/dot2.gif" height="12" width="12" /></td>
<td valign="top" width="200">Manufacturer</td>
<td valign="top" width="15">&nbsp;</td>
<td valign="top">Kensington Computer Products Group</td>
</tr>
<tr>
<td valign="top"><img src="http://ak.buy.com/buy_assets/v6/july/dot2.gif" height="12" width="12" /></td>
<td valign="top" width="200">Manufacturer Part Number</td>
<td valign="top" width="15">&nbsp;</td>
<td valign="top">33388</td>
</tr>
<tr>
<td valign="top"><img src="http://ak.buy.com/buy_assets/v6/july/dot2.gif" height="12" width="12" /></td>
<td valign="top" width="200">Interfaces/Ports</td>
<td valign="top" width="15">&nbsp;</td>
<td valign="top">Docking Connector</td>
</tr>
<tr>
<td valign="top"><img src="http://ak.buy.com/buy_assets/v6/july/dot2.gif" height="12" width="12" /></td>
<td valign="top" width="200">Product Name</td>
<td valign="top" width="15">&nbsp;</td>
<td valign="top">FX 300 Speaker System</td>
</tr>
<tr>
<td valign="top"><img src="http://ak.buy.com/buy_assets/v6/july/dot2.gif" height="12" width="12" /></td>
<td valign="top" width="200">Controls</td>
<td valign="top" width="15">&nbsp;</td>
<td valign="top">Volume<br />
On/Off Switch</td>
</tr>
<tr>
<td valign="top"><img src="http://ak.buy.com/buy_assets/v6/july/dot2.gif" height="12" width="12" /></td>
<td valign="top" width="200">Product Type</td>
<td valign="top" width="15">&nbsp;</td>
<td valign="top">Speaker System</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p><a href="http://affiliate.buy.com/gateway.aspx?adid=17662&amp;pid=2908892&amp;aid=10391416&amp;sURL=http%3A%2F%2Fwww%2Ebuy%2Ecom%2Fprod%2Fkensington%2Dfx%2D300%2Dportable%2Dipod%2Dspeaker%2Dsystem%2Fq%2Floc%2F111%2F202999639%2Ehtml" title="Ipod Portable Speakers for $10!">Price: $10.00<br />
Bonus: FREE SHIPPING!!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.techwhiz.info/2008/03/16/dotd-kensington-fx300-portable-ipod-speakers/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
