<?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>v-nessa.net &#187; uncategorized</title>
	<atom:link href="http://www.v-nessa.net/category/uncategorized/feed" rel="self" type="application/rss+xml" />
	<link>http://www.v-nessa.net</link>
	<description>pink is the new black</description>
	<lastBuildDate>Tue, 20 Jul 2010 13:48:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Simple PHP Script for RBL Checking</title>
		<link>http://www.v-nessa.net/2010/07/16/simple-php-script-for-rbl-checking</link>
		<comments>http://www.v-nessa.net/2010/07/16/simple-php-script-for-rbl-checking#comments</comments>
		<pubDate>Fri, 16 Jul 2010 20:43:59 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/?p=368</guid>
		<description><![CDATA[It&#8217;s useful for ISP&#8217;s and email service providers to run occasional RBL checks against their IPs to know when they are being blacklisted by populate CBL services. I&#8217;ve written a simple script that utilizes the DNSBL pear library to check against common blacklists, when given a list of IPs in a file. First, you need [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F07%2F16%2Fsimple-php-script-for-rbl-checking"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F07%2F16%2Fsimple-php-script-for-rbl-checking&amp;source=nessa421&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>It&#8217;s useful for ISP&#8217;s and email service providers to run occasional RBL checks against their IPs to know when they are being blacklisted by populate CBL services. I&#8217;ve written a simple script that utilizes the DNSBL pear library to check against common blacklists, when given a list of IPs in a file.</p>
<p>First, you need to download or install the <a href="http://pear.php.net/package/Net_DNSBL" target="_blank">NET_DNSBL</a> pear module. (Command: <strong>pear install NET_DNSBL</strong>)</p>
<p><code>&lt;?php<br />
require_once('Net/DNSBL.php');</code></p>
<p><code>$iplist = file("/path/to/iplist");</code></p>
<p><code>foreach ($iplist as $ip){</code></p>
<p><code>$dnsbl = new Net_DNSBL();</code></p>
<p><code>$dnsbl-&gt;setBlacklists(array(<br />
'sbl-xbl.spamhaus.org',<br />
'dnsbl.sorbs.net',<br />
'bl.spamcop.net',<br />
'dnsbl-1.uceprotect.net',<br />
'dnsbl-2.uceprotect.net',<br />
'dnsbl-3.uceprotect.net',<br />
'isps.spamblocked.com',<br />
'zen.spamhaus.org'<br />
));</code></p>
<p><code>if ($dnsbl-&gt;isListed($ip)) {</code></p>
<p><code>echo "IP $ip is blacklisted!\n";</code></p>
<p><code>}</code></p>
<p><code>else {<br />
echo "IP $ip not listed\n";<br />
}<br />
}</code></p>
<p><code>?&gt;</code></p>
<p>Of course, this script can be very easily modified to pull IPs from a database, or assign the $ip variable from a GET or POST request (like from a form or API).  Here&#8217;s an exclusive list of some RBL&#8217;s you can check against using this script, by adding them to the array shown:</p>
<blockquote><p>asiaspam.spamblocked.com<br />
bl.deadbeef.com<br />
bl.emailbasura.org<br />
bl.spamcop.net<br />
blackholes.five-ten-sg.com<br />
blacklist.woody.ch<br />
bogons.cymru.com<br />
cbl.abuseat.org    cdl.anti-spam.org.cn<br />
combined.abuse.ch<br />
combined.rbl.msrbl.net<br />
db.wpbl.info<br />
dnsbl-1.uceprotect.net<br />
dnsbl-2.uceprotect.net<br />
dnsbl-3.uceprotect.net<br />
dnsbl.abuse.ch<br />
dnsbl.ahbl.org<br />
dnsbl.cyberlogic.net<br />
dnsbl.inps.de<br />
dnsbl.njabl.org<br />
dnsbl.sorbs.net<br />
drone.abuse.ch<br />
duinv.aupads.org<br />
dul.dnsbl.sorbs.net<br />
dul.ru<br />
dyna.spamrats.com<br />
dynip.rothen.com<br />
eurospam.spamblocked.com<br />
fl.chickenboner.biz<br />
http.dnsbl.sorbs.net<br />
images.rbl.msrbl.net<br />
ips.backscatterer.org<br />
isps.spamblocked.com<br />
ix.dnsbl.manitu.net<br />
korea.services.net<br />
lacnic.spamblocked.com<br />
misc.dnsbl.sorbs.net<br />
noptr.spamrats.com<br />
ohps.dnsbl.net.au<br />
omrs.dnsbl.net.au<br />
orvedb.aupads.org<br />
osps.dnsbl.net.au<br />
osrs.dnsbl.net.au<br />
owfs.dnsbl.net.au<br />
owps.dnsbl.net.au<br />
pbl.spamhaus.org<br />
phishing.rbl.msrbl.net<br />
probes.dnsbl.net.au<br />
proxy.bl.gweep.ca<br />
proxy.block.transip.nl<br />
psbl.surriel.com<br />
rbl.interserver.net<br />
rdts.dnsbl.net.au<br />
relays.bl.gweep.ca<br />
relays.bl.kundenserver.de<br />
relays.nether.net<br />
residential.block.transip.nl<br />
ricn.dnsbl.net.au<br />
rmst.dnsbl.net.au<br />
sbl.spamhaus.org<br />
short.rbl.jp<br />
smtp.dnsbl.sorbs.net<br />
socks.dnsbl.sorbs.net<br />
spam.dnsbl.sorbs.net<br />
spam.rbl.msrbl.net<br />
spam.spamrats.com<br />
spamlist.or.kr<br />
spamrbl.imp.ch<br />
t3direct.dnsbl.net.au<br />
tor.ahbl.org<br />
tor.dnsbl.sectoor.de<br />
torserver.tor.dnsbl.sectoor.de<br />
ubl.lashback.com<br />
ubl.unsubscore.com<br />
virbl.bit.nl<br />
virus.rbl.jp<br />
virus.rbl.msrbl.net<br />
web.dnsbl.sorbs.net<br />
wormrbl.imp.ch<br />
xbl.spamhaus.org<br />
zen.spamhaus.org</p></blockquote>
<p><map name='google_ad_map_368_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/368?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_368_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=368&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2010%2F07%2F16%2Fsimple-php-script-for-rbl-checking' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=368&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2010/07/16/simple-php-script-for-rbl-checking/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using PHP to Perform DNS Lookups</title>
		<link>http://www.v-nessa.net/2010/06/30/using-php-to-perform-dns-lookups</link>
		<comments>http://www.v-nessa.net/2010/06/30/using-php-to-perform-dns-lookups#comments</comments>
		<pubDate>Wed, 30 Jun 2010 16:29:44 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/?p=365</guid>
		<description><![CDATA[PHP has a couple DNS functions you can use to perform record lookups. Most of us are familiar with the two basic ones &#8211; gethostbyname() and gethostbyaddr(), both of which perform a single function &#8211; returning a hostname or IP address. Here&#8217;s an example of both: &#60;?php $ip = gethostbyname("v-nessa.net"); $host = gethostbyaddr("69.174.114.71"); echo "v-nessa.net [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F06%2F30%2Fusing-php-to-perform-dns-lookups"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F06%2F30%2Fusing-php-to-perform-dns-lookups&amp;source=nessa421&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>PHP has a couple DNS functions you can use to perform record lookups.</p>
<p>Most of us are familiar with the two basic ones &#8211; <a href="http://us4.php.net/gethostbyname" target="_blank">gethostbyname()</a> and <a href="http://us4.php.net/gethostbyname" target="_blank">gethostbyaddr()</a>, both of which perform a single function &#8211; returning a hostname or IP address. Here&#8217;s an example of both:</p>
<p><code>&lt;?php</code></p>
<p><code>$ip = gethostbyname("v-nessa.net");<br />
$host = gethostbyaddr("69.174.114.71");</code></p>
<p><code>echo "v-nessa.net has the IP $ip, which reverses to $host";</code><br />
<code>?&gt;</code></p>
<p>The above will return:</p>
<blockquote><p>v-nessa.net has the IP 69.174.114.71, which has a PTR of server.v-nessa.net</p></blockquote>
<p>Similarly to gethostbyname, there&#8217;s <a href="http://us2.php.net/manual/en/function.gethostbynamel.php" target="_blank">gethostbynamel</a> which is useful for hostnames with multiple A records:</p>
<p><code>$ips = gethostbynamel("test.v-nessa.net");<br />
foreach ($ips as $ip =&gt; $value){<br />
echo $value . "\n";<br />
}</code></p>
<p>Will return:</p>
<blockquote><p>69.174.114.71<br />
69.174.115.243</p></blockquote>
<p>A more advanced function is <a href="http://us2.php.net/manual/en/function.dns-get-record.php" target="_blank">dns_get_record</a>, which can pull any valid record for a hostname or IP.  Think about the dig command you use in Unix to find DNS records:</p>
<blockquote><p>nessa@nessa-desktop:~$ dig +short v-nessa.net A<br />
69.174.114.71</p></blockquote>
<p>The dns_get_record function works in a similar way, and can obtain the following DNS record types:</p>
<p><strong><tt>DNS_A</tt></strong>, <strong><tt>DNS_CNAME</tt></strong>,        <strong><tt>DNS_HINFO</tt></strong>, <strong><tt>DNS_MX</tt></strong>,        <strong><tt>DNS_NS</tt></strong>, <strong><tt>DNS_PTR</tt></strong>,        <strong><tt>DNS_SOA</tt></strong>, <strong><tt>DNS_TXT</tt></strong>,        <strong><tt>DNS_AAAA</tt></strong>, <strong><tt>DNS_SRV</tt></strong>,        <strong><tt>DNS_NAPTR</tt></strong>, <strong><tt>DNS_A6</tt></strong>,        <strong><tt>DNS_ALL</tt></strong> or <strong><tt>DNS_ANY</tt></strong>.</p>
<p>The following will give you a similar result:</p>
<p><code>$recs = dns_get_record("v-nessa.net", DNS_A);<br />
print_r($recs);</code></p>
<p>Will return:</p>
<blockquote><p>Array<br />
(<br />
[0] =&gt; Array<br />
(<br />
[host] =&gt; v-nessa.net<br />
[type] =&gt; A<br />
[ip] =&gt; 69.174.114.71<br />
[class] =&gt; IN<br />
[ttl] =&gt; 13728<br />
)<br />
)</p></blockquote>
<p>If you want to obtain multiple DNS types, you can do so by separating the record types with a plus sign:</p>
<p><code>$recs = dns_get_record("v-nessa.net", DNS_A + DNS_MX);</code></p>
<p>Will return:</p>
<blockquote><p>Array<br />
(<br />
[0] =&gt; Array<br />
(<br />
[host] =&gt; v-nessa.net<br />
[type] =&gt; A<br />
[ip] =&gt; 69.174.114.71<br />
[class] =&gt; IN<br />
[ttl] =&gt; 13736<br />
)</p>
<p>[1] =&gt; Array<br />
(<br />
[host] =&gt; v-nessa.net<br />
[type] =&gt; MX<br />
[pri] =&gt; 0<br />
[target] =&gt; v-nessa.net<br />
[class] =&gt; IN<br />
[ttl] =&gt; 14145<br />
)</p>
<p>)</p></blockquote>
<p>You&#8217;ll notice that the output is a double array, so to call individual values you can do either of the following:</p>
<p><code>// will return the IP for array 0 ( A record)</code></p>
<p><code>echo $recs[0]['ip'];</code></p>
<p><code>// will return results for common records</code></p>
<p><code>foreach ($recs as $type =&gt; $value){<br />
echo $value[ip] . "\n";<br />
}</code></p>
<p>Similar to the example above, you can use the DNS_ALL type to show any records available for the hostname, and use a minus sign to exclude certain record types. For example, the below code will return all DNS results for v-nessa.net, but exclude NS records:</p>
<p><code>$recs = dns_get_record("v-nessa.net", DNS_ALL - DNS_NS );</code></p>
<p><code>foreach ($recs as $type =&gt; $value){<br />
echo $value[type] . "\n";<br />
}</code></p>
<p>The following records were returned:</p>
<blockquote><p>A<br />
SOA<br />
MX<br />
TXT</p></blockquote>
<p>Here&#8217;s a more practical example &#8211; a simple PHP DNS lookup script. Say you have a form on your site that allows a user to type in a hostname and select a type of record: A, MX, NS, and TXT. The passed form values are $host and $type, and the below script will accept the variables and output the results according to the record type:</p>
<p>HTML Form:</p>
<p><code>&lt;form action="dns.php" method="POST"&gt;<br />
Hostname: &lt;input type="text" name="host" /&gt;<br />
Type: &lt;select name="type"&gt;<br />
&lt;option value="a"&gt;A&lt;/option&gt;<br />
&lt;option value="mx"&gt;MX&lt;/option&gt;<br />
&lt;option value="ns"&gt;NS&lt;/option&gt;<br />
&lt;option value="txt"&gt;TXT&lt;/option&gt; &lt;/select&gt;<br />
&lt;/form&gt;</code></p>
<p>PHP Script (dns.php):</p>
<pre>&lt;?php

if(!empty($_POST['host']) &amp;&amp; !empty($_POST['type'])){

    // Grab variable from form and define valid types

    $host = $_POST['host'];
    $type = strtoupper($_POST['type');
    $validtypes=array("A","MX","NS","TXT");

    // Check that dns type is defined or allowed

    if(!defined("DNS_" . $type) or !in_array($type,$validtypes)){
       echo "Invalid DNS Type!";
    }else{

       $type = constant("DNS_" . $type);
       $rec = dns_get_record($host, $type);

       // Set result types - can be modified by using available elements from $rec array

       switch($type){
             case DNS_A:
                    $recvals=array("Hostname" =&gt; "host","Type" =&gt; "type", "IP" =&gt; "ip");
                    break;
             case DNS_MX:
                    $recvals=array("Hostname" =&gt; "host","Type" =&gt; "type", "Target" =&gt; "target", "Priority" =&gt; "pri");
                    break;
             case DNS_NS:
                    $recvals=array("Hostname" =&gt; "host","Type" =&gt; "type", "Target" =&gt; "target");
                    break;
             case DNS_TXT:
                    $recvals=array("Hostname" =&gt; "host","Type" =&gt; "type", "Record" =&gt; "txt");
                    break;
        }

      // Output results

      foreach ($rec as $arr =&gt; $num){
             foreach ($recvals as $title =&gt; $value){
                    echo $title . " : " . $num[$value] . "\n";
             }
      }

    }
} else {

     echo "Either hostname or record type is missing";
}</pre>
<p>It&#8217;s of course easy to modify the above code accordingly, and I&#8217;m sure there may be better ways to do this. Feel free to post your own code snippets or comments.</p>
<p><map name='google_ad_map_365_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/365?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_365_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=365&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2010%2F06%2F30%2Fusing-php-to-perform-dns-lookups' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=365&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2010/06/30/using-php-to-perform-dns-lookups/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>This Week&#8217;s Sexy Articles</title>
		<link>http://www.v-nessa.net/2010/06/04/this-weeks-sexy-articles-2</link>
		<comments>http://www.v-nessa.net/2010/06/04/this-weeks-sexy-articles-2#comments</comments>
		<pubDate>Fri, 04 Jun 2010 14:41:55 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[sexy sites]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/?p=346</guid>
		<description><![CDATA[The Developer Obsession with Code Names &#8211; Pingdom Website feeling overweight? Slim it down with Smush.it &#8211; Diary of a Ninja Really Useful Tutorials You Should Have Read in May 2010 &#8211; W3 Avenue Beautiful and Useful 404 Error Pages for Inspiration &#8211; 6 Revisions 15 Great Content Management Systems for Designers &#8211; Design Tutorials [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F06%2F04%2Fthis-weeks-sexy-articles-2"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F06%2F04%2Fthis-weeks-sexy-articles-2&amp;source=nessa421&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://royal.pingdom.com/2010/05/27/the-developer-obsession-with-code-names-114-interesting-examples/" target="_blank">The Developer Obsession with Code Names</a> &#8211; Pingdom</p>
<p><a href="http://www.diaryofaninja.com/blog/2010/05/29/website-feeling-overweight-slim-it-down-with-smushit" target="_blank">Website feeling overweight? Slim it down with Smush.it</a> &#8211; Diary of a Ninja</p>
<p><a href="http://www.w3avenue.com/2010/05/31/tutorials-2010-may/">Really Useful Tutorials You Should Have Read in May 2010</a> &#8211; W3 Avenue</p>
<p><a title="Permanent Link to Beautiful and Useful 404 Error Pages for Inspiration" rel="bookmark" href="http://sixrevisions.com/design-showcase-inspiration/beautiful-and-useful-404-error-pages-for-inspiration/" target="_blank">Beautiful and Useful 404 Error Pages for Inspiration</a> &#8211; 6 Revisions<a title="Permanent Link to Beautiful and Useful 404 Error Pages for Inspiration" rel="bookmark" href="http://sixrevisions.com/design-showcase-inspiration/beautiful-and-useful-404-error-pages-for-inspiration/"></a></p>
<p><a href="http://designtutorials4u.com/15-great-content-management-systems-for-designers/" target="_blank">15 Great Content Management Systems for Designers</a> &#8211; Design Tutorials 4 U</p>
<p><a href="http://phpbuilder.com/columns/Jason_Gilmore060210.php3" target="_blank">10 Easy Solutions for PHP String Manipulation</a> &#8211; PHP Builder</p>
<p><a href="http://webhostinghelpguy.inmotionhosting.com/r2j" target="_blank">12 Cross-Browser Compatibility Tools for Designers</a> &#8211; Web Hosting Help Guy</p>
<p><map name='google_ad_map_346_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/346?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_346_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=346&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2010%2F06%2F04%2Fthis-weeks-sexy-articles-2' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=346&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2010/06/04/this-weeks-sexy-articles-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Fine Line Between Spam and Email Marketing</title>
		<link>http://www.v-nessa.net/2010/06/03/the-fine-line-between-spam-and-email-marketing</link>
		<comments>http://www.v-nessa.net/2010/06/03/the-fine-line-between-spam-and-email-marketing#comments</comments>
		<pubDate>Thu, 03 Jun 2010 19:26:38 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[annoyances]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/?p=354</guid>
		<description><![CDATA[If I had a Viagra pill for every time I confronted a spammer who pulled the &#8220;email marketing&#8221; excuse&#8230; There&#8217;s no debate, no exceptions, and no justification. If you&#8217;re sending out massive amounts of unsolicited email, you&#8217;re a spammer. Period.  You&#8217;re not running a legitimate or respected marketing campaign, you&#8217;re not helping anyone with their [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F06%2F03%2Fthe-fine-line-between-spam-and-email-marketing"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F06%2F03%2Fthe-fine-line-between-spam-and-email-marketing&amp;source=nessa421&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>If I had a Viagra pill for every time I confronted a spammer who pulled the &#8220;email marketing&#8221; excuse&#8230;</p>
<p>There&#8217;s no debate, no exceptions, and no justification. If you&#8217;re sending out massive amounts of unsolicited email, you&#8217;re a spammer. Period.  You&#8217;re not running a legitimate or respected marketing campaign, you&#8217;re not helping anyone with their emotional or erectile dysfunction problems, and in reality, no one cares to read what you have to say.</p>
<p>A lot of hosting providers are cracking down on spammers &#8211; and from experience, I can tell you why:  Spammers are an inconvenience to <em>everyone</em> &#8211; even themselves. They are an inconvenience to me, the system administrator that has to sift through spam complaints and spend hours every week tracking them down.  They are an inconvenience to our customers, who find their email being blacklisted because of a spammer on their network. And finally, they are an inconvenience to you, the Internet user, that has to deal with getting spam on a daily basis because <em>some</em> people have nothing better to do.</p>
<p>And here&#8217;s how you know if you&#8217;re one of those <em>some</em> people:</p>
<ul>
<li>You purposely find ways to circumvent your ISP or host&#8217;s mailing limits instead of simply asking</li>
<li>You&#8217;re harvesting or purchasing email addresses off of websites, other mailing lists, or third parties to compose your recipient base</li>
<li>You&#8217;re sending those people [unsolicited] email advertising yourself, a product, or a website</li>
<li>You use spoofing or other tactics to hide your email address or server information</li>
<li>You don&#8217;t give your <span style="text-decoration: line-through;">victims</span> recipients a way to opt out of your torturous email campaigns</li>
<li>You hide behind the <a href="http://www.ftc.gov/bcp/edu/pubs/business/ecommerce/bus61.shtm" target="_blank">CAN SPAM</a> law to justify your behavior</li>
<li>You get the slight inkling that people hate you for what you do</li>
</ul>
<p><strong>So what&#8217;s the fine line between spam and email marketing? </strong></p>
<p>It&#8217;s all about honesty and consent.  If I contact a fellow blog owner requesting a link exchange, I wouldn&#8217;t technically consider that spam. If I send the same email to 40 other people, I&#8217;m crossing the line.  A legitimate, non-spammy email campaign would consist of a database of opted-in users, and email content consistent with what those users requested to be in the loop for.  If any of those users decide they don&#8217;t want to participate anymore, they are given a quick and easy way to remove themselves from the list.  The fine line between spamming and email marketing is the concept of opting in. Simply put, <strong>email marketers use opt-in lists, spammers don&#8217;t</strong>.</p>
<p>And no, I&#8217;m not talking about purchasing opt-in lists that other people have compiled.</p>
<p>Spammers have ruined the concept of email marketing enough to where now even legitimate email marketers are being accused of spamming, and many hosts won&#8217;t even work with them.  That&#8217;s not all hosts are doing to fight back, either.  Many larger hosting providers are so tired of dealing with spammers on their network that they impose mailing limitations that tend to inconvenience other users. Here are just a few:</p>
<ul>
<li>Limiting the number of emails sent per minute, hour, or day</li>
<li>Limiting the number of recipients that can exist in a single email or BCC field</li>
<li>Locking outbound SMTP connections so scripts can&#8217;t send email from remote servers</li>
<li>Blocking email sent from certain system users (like the Apache user), requiring the use of authenticated mail sessions</li>
</ul>
<p>For everyone else, here are a few tips on dealing with SPAM:</p>
<ul>
<li>Delete it &#8211; it takes two seconds</li>
<li>Learn what a <a href="http://www.spamfighter.com/" target="_blank">spam filter</a> is, and use it</li>
<li>Stop trying to play Internet police. Feel free to report spam to the ISP or host, but don&#8217;t start spouting off with legal threats. It&#8217;s not going to change the fact that millions of spam emails are sent every day, and no court is going to waste their time on you</li>
<li>Don&#8217;t assume that the ISP or host can read minds &#8211; do you think they would have intentionally allowed a spammer to sign up for their service?</li>
</ul>
<p>And for ISP&#8217;s and hosts, you have responsibilities as well:</p>
<ul>
<li>Don&#8217;t be afraid to impose the aforementioned limitations on your servers. Your goal should be to look out for the best interests of your customers as a whole</li>
<li>Require justification from users that want to send large mailing lists, asking them how much email they are sending, who they are sending to, and whether they have an opt-in/out method</li>
<li>Set up abuse@ and postmaster@ email addresses, which will usually be where complaints are sent to. This way you&#8217;re aware of users that may be abusing your network, even if</li>
<li>Sign up for feedback loops, so automated spam reports from various email providers are sent to you to review</li>
<li>Deal with spammers ASAP. Not doing so can end up causing your network to get blacklisted, or have complaints escalated to cancellations from your customers &#8211; or even legal threats</li>
</ul>
<p><map name='google_ad_map_354_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/354?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_354_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=354&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2010%2F06%2F03%2Fthe-fine-line-between-spam-and-email-marketing' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=354&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2010/06/03/the-fine-line-between-spam-and-email-marketing/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Programming Tip: Assume Your Users are Idiots</title>
		<link>http://www.v-nessa.net/2010/05/30/programming-tip-assume-your-users-are-idiots</link>
		<comments>http://www.v-nessa.net/2010/05/30/programming-tip-assume-your-users-are-idiots#comments</comments>
		<pubDate>Mon, 31 May 2010 03:52:50 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[annoyances]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/?p=348</guid>
		<description><![CDATA[Any programmer knows the golden rule of programming &#8211; no matter how well you&#8217;ve coded an application, there&#8217;s always going to be something wrong with it. I&#8217;ve done enough development work to have a lasting suspicion that if there&#8217;s a bug or hole to be found, someone will stumble upon it and rub it in [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F30%2Fprogramming-tip-assume-your-users-are-idiots"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F30%2Fprogramming-tip-assume-your-users-are-idiots&amp;source=nessa421&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>Any programmer knows the golden rule of programming &#8211; no matter how well you&#8217;ve coded an application, there&#8217;s always going to be something wrong with it. I&#8217;ve done enough development work to have a lasting suspicion that if there&#8217;s a bug or hole to be found, someone will stumble upon it and rub it in your face.</p>
<p>Here&#8217;s an interesting fact:</p>
<p><strong>There&#8217;s no such thing as a bug-free application.<br />
</strong></p>
<p>No amount of poking, prodding, testing, slurping, or caressing is going to find every possible fault that can exist in an application. Somewhere along the line, one of your users is going to trigger a problem and cause you to spend a few hours patching code.  It&#8217;s like <a href="http://www.v-nessa.net/2007/01/28/im-so-smart" target="_blank">idiot-proofing a microwave</a> &#8211; you can&#8217;t reasonably predict every possible thing that a user can do, you just do what you can and hope for the best.</p>
<p>The good thing about these idiots is that they make us better programmers.  To be a better programmer, you have to think like an idiot and apply some basic principles:<a href="http://www.v-nessa.net/wp-content/uploads/2010/05/idiot-picture.jpg" rel="lightbox"><img class="alignright size-full wp-image-349" title="idiot-picture" src="http://www.v-nessa.net/wp-content/uploads/2010/05/idiot-picture.jpg" alt="" width="375" height="325" /></a></p>
<p><strong>1. Validation</strong></p>
<p>Check and maybe even double-check all types of input and assume the worst. Sure, maybe that user didn&#8217;t know that Sex referred to gender, but you should have thought of that.  Always take into account blank, malformed, incorrect, malicious, and duplicate data.</p>
<p><strong>2. Default Actions</strong></p>
<p>Any time you use conditionals, always combine validation with a default action, in case something unexpected happens. Do you know what your application is going to do if a specified condition isn&#8217;t met?</p>
<p><strong>3. User behavior</strong></p>
<p>Some people do things you don&#8217;t want them to, but you have to be ready for it anyways.  Does your application work correctly if people hit the &#8220;back&#8221; or &#8220;refresh&#8221; buttons? Is it going to cause a problem if someone bypasses your lightbox and opens a link in a new tab instead? Or bookmarks a page that was meant to be accessed from a login screen?</p>
<p><strong>4. Acceptance</strong></p>
<p>Accept the fact that no matter what advice I give, you&#8217;re still never going to make it perfect.</p>
<p>And don&#8217;t forget &#8211; testing, testing, testing. While some people I deal with like to believe that I don&#8217;t actually test <em>anything</em>, I do &#8211; I just also know the golden rule of programming and that there&#8217;s no way around it.  Testing is an ongoing process and requires both automated and manual work. Don&#8217;t knowingly leave a bug or security flaw in place and assume it will go unnoticed &#8211; trust me, it won&#8217;t.  If there&#8217;s one thing idiots are good at, it&#8217;s making <em>you</em> look like an idiot.</p>
<p><map name='google_ad_map_348_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/348?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_348_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=348&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F30%2Fprogramming-tip-assume-your-users-are-idiots' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=348&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2010/05/30/programming-tip-assume-your-users-are-idiots/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ReviewMe Had an Oopsie</title>
		<link>http://www.v-nessa.net/2010/05/29/reviewme-had-an-oopsie</link>
		<comments>http://www.v-nessa.net/2010/05/29/reviewme-had-an-oopsie#comments</comments>
		<pubDate>Sat, 29 May 2010 14:59:07 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[oops]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/?p=341</guid>
		<description><![CDATA[There&#8217;s a common understanding in the developer community that when you&#8217;re testing code, don&#8217;t do it on a live site. And if you do, make sure it&#8217;s transparent to the user.  This faux pas tends to be unforgivable when you&#8217;re a major review site getting thousands of hits per day. I hope I don&#8217;t get [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F29%2Freviewme-had-an-oopsie"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F29%2Freviewme-had-an-oopsie&amp;source=nessa421&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>There&#8217;s a common understanding in the developer community that when you&#8217;re testing code, don&#8217;t do it on a live site. And if you do, make sure it&#8217;s transparent to the user.  This faux pas tends to be unforgivable when you&#8217;re a major review site getting thousands of hits per day.</p>
<p>I hope I don&#8217;t get sued for this.</p>
<p>The other night I was logged into my ReviewMe account to add one of my sites, and upon addition some code popped up that probably shouldn&#8217;t have:</p>
<p style="text-align: center;"><a href="../wp-content/uploads/2010/05/reviewme.png"><a href="http://www.v-nessa.net/wp-content/uploads/2010/05/reviewme.png" rel="lightbox"><img class="aligncenter size-full wp-image-342" title="reviewme" src="http://www.v-nessa.net/wp-content/uploads/2010/05/reviewme.png" alt="" width="500" height="283" /></a><br />
</a></p>
<p><a href="http://www.v-nessa.net/wp-content/uploads/2010/05/reviewme.png"><br />
</a>It looks like someone was doing some testing and was echoing out some post variables as an array, and forgot to remove it.  This goes to show: don&#8217;t test this kind of stuff on a live site where your users will be able to see it.</p>
<p><map name='google_ad_map_341_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/341?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_341_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=341&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F29%2Freviewme-had-an-oopsie' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=341&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2010/05/29/reviewme-had-an-oopsie/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>This Week&#8217;s Sexy Articles</title>
		<link>http://www.v-nessa.net/2010/05/28/this-weeks-sexy-articles</link>
		<comments>http://www.v-nessa.net/2010/05/28/this-weeks-sexy-articles#comments</comments>
		<pubDate>Fri, 28 May 2010 18:32:56 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[sexy sites]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/?p=339</guid>
		<description><![CDATA[How to Design a Clean and Minimal Business Website :: Voosh Themes 10+1 Things they Never Teach In College About Programming :: Making Good Software 10 Free Web Hosting Control Panels to Manage Servers Easier :: Web Resources Depot How to Fix PHP Vulnerabilities (So Your Site Won&#8217;t Get Hacked) :: Code Diesel How to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F28%2Fthis-weeks-sexy-articles"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F28%2Fthis-weeks-sexy-articles&amp;source=nessa421&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://www.vooshthemes.com/blog/design-tutorial/how-to-design-a-clean-and-minimal-business-website/" target="_blank">How to Design a Clean and Minimal Business Website</a> :: Voosh Themes</p>
<p><a href="http://www.makinggoodsoftware.com/2010/05/27/10-things-they-never-teach-in-college-about-programming/" target="_blank">10+1 Things they Never Teach In College About Programming</a> :: Making Good Software</p>
<p><a href="http://www.webresourcesdepot.com/10-free-web-hosting-control-panels-to-manage-servers-easier" target="_blank">10 Free Web Hosting Control Panels to Manage Servers Easier</a> :: Web Resources Depot</p>
<p><a href="http://www.codediesel.com/php/how-to-fix-php-vulnerabilities/" target="_blank">How to Fix PHP Vulnerabilities (So Your Site Won&#8217;t Get Hacked)</a> :: Code Diesel</p>
<p><a href="http://php-security.org/2010/05/26/mops-submission-10-how-to-manage-a-php-applications-users-and-passwords/index.html" target="_blank">How to manage a PHP application’s users and passwords</a> :: PHP Security</p>
<p><a href="http://www.webdesign-spot.com/2010/how-to-create-a-captcha-system-with-php/" target="_blank">How to Create a Captcha System with PHP</a> :: Webdesign Spot</p>
<p><a href="http://www.catswhocode.com/blog/best-practices-for-coding-html-emails" target="_blank">Best Practices for Coding HTML Emails</a> :: Cats Who Code</p>
<p><map name='google_ad_map_339_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/339?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_339_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=339&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F28%2Fthis-weeks-sexy-articles' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=339&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2010/05/28/this-weeks-sexy-articles/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 5.3: Why We&#8217;re All Late to the Party</title>
		<link>http://www.v-nessa.net/2010/05/27/php-5-3-why-were-all-late-to-the-party</link>
		<comments>http://www.v-nessa.net/2010/05/27/php-5-3-why-were-all-late-to-the-party#comments</comments>
		<pubDate>Thu, 27 May 2010 18:59:13 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/?p=334</guid>
		<description><![CDATA[It&#8217;s been almost a year since the PHP 5.3 branch was released to the PHP community, and yet we&#8217;re all still in the shadow of PHP 5.2.  If you&#8217;re just a faithful customer wondering why your host isn&#8217;t getting with the times, I&#8217;ll tell you exactly why: We don&#8217;t stock enough diapers to keep up [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F27%2Fphp-5-3-why-were-all-late-to-the-party"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F27%2Fphp-5-3-why-were-all-late-to-the-party&amp;source=nessa421&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>It&#8217;s been <a href="http://www.php.net/archive/2009.php#id2009-06-30-1" target="_blank">almost a year</a> since the PHP 5.3 branch was released to the PHP community, and yet we&#8217;re all still in the shadow of PHP 5.2.  If you&#8217;re just a faithful customer wondering why your host isn&#8217;t getting with the times, I&#8217;ll tell you exactly why: <em>We don&#8217;t stock enough diapers to keep up with that ish.</em></p>
<p>Let me talk about <em>you</em>, the common website owner, that runs a simple Drupal or WordPress site.  You didn&#8217;t sign up with your host to go around in circles over compatibility problems that could have been avoided by your host doing a little research. As a programmer, I would hold it to any site owner to check their site&#8217;s requirements and the offerings of their host before they unnecessarily waste a lot of time and money, but as a system administrator I frown upon shared hosting providers offering software with known <a href="http://www.v-nessa.net/wp-content/uploads/2010/05/party-hat2.jpg" rel="lightbox"><img class="alignright size-full wp-image-338" title="party-hat" src="http://www.v-nessa.net/wp-content/uploads/2010/05/party-hat2.jpg" alt="" width="100" height="143" /></a>compatibility issues just to be able to advertise as the &#8220;latest and greatest&#8221;. The latest isn&#8217;t always the greatest, and it won&#8217;t be until the community catches up with what the greatest has to offer.</p>
<p>I&#8217;ve had numerous discussions with my superiors about whether to upgrade to PHP 5.3, and the end result is pretty much the same &#8211; <em>we&#8217;re just not ready.</em> And neither are our customers, or the developers of the applications they use.  And trust me &#8211; this is normal. We all went through the same thing when PHP 4.2 came out, and again with PHP 5, and <em>again</em> with PHP 5.2.  That being said, this is why all the good hosts are now also holding off jumping on the PHP 5.3 bandwagon:</p>
<ul>
<li>Lack of compatibility:  Many open source applications and frameworks (such as Drupal, Joomla, Magento, and even parts of WordPress) are not fully compatible with PHP 5.3 yet</li>
<li>No Zend Optimizer or Zend Guard support</li>
<li>It&#8217;s not required for PCI compliance yet, which is one of the main reasons why hosts upgrade PHP on their servers</li>
</ul>
<p>PHP 5.3 does have a lot of new features and functions to offer, and it will eventually wiggle its way into mainstream hosting -  it&#8217;s just not ready for the shared hosting population yet until everyone else catches up.  Most hosts (including <a href="http://inmotionhosting.com" target="_blank">IMH</a>) will still offer PHP 5.3 as an optional upgrade for customers on VPS or Dedicated servers, or as an optional move to a server that has that version. In the meantime, start upgrading your applications and keep tabs on your softwares&#8217; developers to find out when php 5.3 support will be available.  PHP 5.2 will likely become obscure near the end of 2010 or early 2011 in favor of 5.3, and you should be ready when it is.</p>
<p><map name='google_ad_map_334_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/334?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_334_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=334&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F27%2Fphp-5-3-why-were-all-late-to-the-party' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=334&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2010/05/27/php-5-3-why-were-all-late-to-the-party/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Guest Post: Is the Internet Getting Too Cluttered?</title>
		<link>http://www.v-nessa.net/2010/05/26/guest-post-is-the-internet-getting-too-cluttered</link>
		<comments>http://www.v-nessa.net/2010/05/26/guest-post-is-the-internet-getting-too-cluttered#comments</comments>
		<pubDate>Wed, 26 May 2010 17:46:43 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[guest posts]]></category>
		<category><![CDATA[internet]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/?p=333</guid>
		<description><![CDATA[I wrote a guest post today on Associated Content &#8211; my first ever post on this media site. Have a look! http://www.associatedcontent.com/article/5418390/is_the_internet_getting_too_cluttered.html?cat=15]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F26%2Fguest-post-is-the-internet-getting-too-cluttered"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F26%2Fguest-post-is-the-internet-getting-too-cluttered&amp;source=nessa421&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I wrote a guest post today on <a href="http://associatedcontent.com" target="_blank">Associated Content</a> &#8211; my first ever post on this media site. Have a look!</p>
<p><a href="http://www.associatedcontent.com/article/5418390/is_the_internet_getting_too_cluttered.html?cat=15" target="_blank">http://www.associatedcontent.com/article/5418390/is_the_internet_getting_too_cluttered.html?cat=15</a></p>
<p><map name='google_ad_map_333_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/333?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_333_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=333&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F26%2Fguest-post-is-the-internet-getting-too-cluttered' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=333&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2010/05/26/guest-post-is-the-internet-getting-too-cluttered/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Command Line PHP: Part 3</title>
		<link>http://www.v-nessa.net/2010/05/25/command-line-php-part-3</link>
		<comments>http://www.v-nessa.net/2010/05/25/command-line-php-part-3#comments</comments>
		<pubDate>Tue, 25 May 2010 14:38:49 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/?p=331</guid>
		<description><![CDATA[This is part third and final part in my PHP command line tutorial series. If you didn&#8217;t see parts 1 and 2: Command Line PHP: Part 1 Command Line PHP: Part 2 More File and Disk Functions Getting Disk Space and Usage The disk_total_size and disk_free_space functions can tell you how much disk space you [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F25%2Fcommand-line-php-part-3"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F25%2Fcommand-line-php-part-3&amp;source=nessa421&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>This is part third and final part in my PHP command line tutorial series. If you didn&#8217;t see parts 1 and 2:</p>
<p><a href="http://www.v-nessa.net/2010/05/18/command-line-php-part-1" target="_blank">Command Line PHP: Part 1</a></p>
<p><a href="http://www.v-nessa.net/2010/05/21/command-line-php-part-2" target="_blank">Command Line PHP: Part 2</a></p>
<p><span id="more-331"></span></p>
<h2>More File and Disk Functions</h2>
<h3>Getting Disk Space and Usage</h3>
<p>The <a href="http://us2.php.net/manual/en/function.disk-total-space.php" target="_blank">disk_total_size</a> and <a href="http://us2.php.net/manual/en/function.disk-free-space.php" target="_blank">disk_free_space</a> functions can tell you how much disk space you have and how much is available, respectively:</p>
<p><code>$disksize = disk_total_space("/");<br />
$size = round(number_format($disksize / 1024 / 1024 / 1024, 2));</code></p>
<p><code>$diskfree = disk_free_space("/");<br />
$freesize = round(number_format($diskfree / 1024 / 1024 / 1024, 2));</code></p>
<p><code>echo "Total Disk Size: $size GB\n";<br />
echo "Free Disk Space: $freesize GB";</code></p>
<h3>Finding Files</h3>
<p>A little-known function called glob works sort of like the locate command, in that it will find files that match a certain string, but it only looks in the current folder and is not recursive. For example, the below code will search for all files in the current folder that end with .txt:</p>
<p><code>foreach (glob("*.txt") as $file) {<br />
echo "$file size " . filesize($file) . "\n";<br />
}</code></p>
<p>You can also use something like <a href="http://snippets.dzone.com/posts/show/4147" target="_blank">this example</a> to run as a loop and recursively search through folders.</p>
<h3>Getting File Path Information</h3>
<p>The famous <a href="http://php.net/pathinfo" target="_blank">pathinfo</a> function can give you information about a file on your system:</p>
<p><code>$file = "/etc/php5/cli/php.ini";<br />
if(file_exists($file)){<br />
$info = pathinfo($file);<br />
print_r($info);<br />
}</code></p>
<p>This will print out an array like below:</p>
<p><code>Array<br />
(<br />
[dirname] =&gt; /etc/php5/cli<br />
[basename] =&gt; php.ini<br />
[extension] =&gt; ini<br />
[filename] =&gt; php<br />
)</code></p>
<p>Which you can echo out values to and use in your scripts, for example:</p>
<p><code>$file = "/etc/php5/cli/php.ini";<br />
if(file_exists($file)){<br />
$info = pathinfo($file);<br />
$dir = $info[dirname];<br />
chdir($dir);<br />
echo "Changed directory to" . getcwd();<br />
}</code></p>
<p>There are also similar functions that will provide the same information, individually:</p>
<p><code>$file = "/etc/php5/cli/php.ini";</code><br />
<code><br />
echo "Absolute File Name: " . <strong>realpath</strong>($file) . "\n";<br />
echo "File Name: " . <strong>basename</strong>($file) . "\n";<br />
echo "File path: " . <strong>dirname</strong>($file) . "\n";</code></p>
<p>This will return:</p>
<p><code>Absolute File Name: /etc/php5/cli/php.ini<br />
File Name: php.ini<br />
File path: /etc/php5/cli</code></p>
<h2>Some Random Script Fragments and Functions</h2>
<p><strong>Prompt a user for input:</strong></p>
<p><code><strong>fwrite</strong>(<strong>STDOUT</strong>, "Hello...\nWhat is your name? ");<br />
$name = trim(<strong>fgets</strong>(<strong>STDIN</strong>));<br />
fwrite(STDOUT, "Hello, $name!\n");</code></p>
<p><strong>Print out your username and date:</strong></p>
<p><code>$me = exec('whoami');<br />
echo "Hello, " . $me . " The time is currently " .date("r") . "\n";</code></p>
<p><strong>Generate random strings and passwords:</strong></p>
<p><code>echo <strong>crypt</strong>("mypassword","randomsalt");<br />
echo <strong>md5</strong>("mypassword");</code></p>
<p><strong>Random password, variable length:</strong></p>
<p><code>function randomPass($length) {</code></p>
<p><code>$chars = "abcdefghijkmnopqrstuvwxyz023456789";<br />
srand((double)microtime()*1000000);<br />
$i = 0;<br />
$pass = '' ;</code></p>
<p><code>while ($i &lt;= $length) {<br />
$num = rand() % 33;<br />
$tmp = substr($chars, $num, 1);<br />
$pass = $pass . $tmp;<br />
$i++;<br />
}</code></p>
<p><code>return $pass;<br />
}</code></p>
<p><code>$password = randomPass(10);</code></p>
<p><code>echo "Your random password is: $password";</code></p>
<p><strong>List loaded PHP extensions, check is specific extension is loaded:</strong></p>
<p><code>$extensions = <strong>get_loaded_extensions</strong>();<br />
foreach ($extensions as &amp;$value) {<br />
echo $value . "\n";<br />
}</code></p>
<p><code>if (!<strong>extension_loaded</strong>('gd')) {<br />
echo "GD extension is not loaded";<br />
exit;<br />
}</code></p>
<p><strong>Get Server&#8217;s CPU Load:</strong></p>
<p><code>$load = <strong>sys_getloadavg</strong>();<br />
echo "Current: " . $load[0] . "\n";<br />
echo "5-min: " . $load[1] . "\n";<br />
echo "15-min: " . $load[2] . "\n";</code></p>
<p><strong>Get PHP memory limit and convert to human-readable format:</strong><br />
<code><br />
function convert($size)<br />
{<br />
$unit=array('b','kb','mb','gb','tb','pb');<br />
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];<br />
}<br />
echo convert(memory_get_usage(true));</code></p>
<h2>Some Useful Links/Tutorials</h2>
<p><a href="http://articles.sitepoint.com/article/php-command-line-1" target="_blank">Command Line PHP Tutorial</a><br />
<a title="Simple System Maintenance with PHP-CLI" href="http://www.developertutorials.com/tutorials/php/simple-system-maintenance-with-php-cli-8-01-17/" target="_blank">Simple System Maintenance with PHP-CLI &#8211; Simple System Maintenance with PHP-CLI</a><br />
<a href="http://www.ibm.com/developerworks/opensource/library/os-php-command/index.html" target="_blank">Command Line PHP (IBM)</a><br />
<a href="http://kevin.vanzonneveld.net/techblog/article/create_daemons_in_php/" target="_blank">Running Daemons in PHP</a><br />
<a href="http://www.if-not-true-then-false.com/2010/php-class-for-coloring-php-command-line-cli-scripts-output-php-output-colorizing-using-bash-shell-colors/" target="_blank">PHP Class for Coloring Command Line Output</a><br />
<a href="http://brian.moonspot.net/php-progress-bar" target="_blank">PHP Command Line Progress Bar</a></p>
<p><map name='google_ad_map_331_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/331?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_331_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=331&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2010%2F05%2F25%2Fcommand-line-php-part-3' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=331&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2010/05/25/command-line-php-part-3/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
