<?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; scripts</title>
	<atom:link href="http://www.v-nessa.net/tag/scripts/feed" rel="self" type="application/rss+xml" />
	<link>http://www.v-nessa.net</link>
	<description>pink is the new black</description>
	<lastBuildDate>Thu, 31 Mar 2011 21:13:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Simple Way to Parse an x509 Certificate with PHP</title>
		<link>http://www.v-nessa.net/2010/11/03/simple-way-to-parse-an-x509-certificate-with-php</link>
		<comments>http://www.v-nessa.net/2010/11/03/simple-way-to-parse-an-x509-certificate-with-php#comments</comments>
		<pubDate>Wed, 03 Nov 2010 15:07:29 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/?p=385</guid>
		<description><![CDATA[PHP has a nifty little function for parsing an x.509 SSL certificate into an array to easily pull out the elements: openssl_x509_parse .Essentially, all you need to do is load up the contents of the certificate, either through a file or POST value, and enclose it in the array. Here&#8217;s a simple script: &#60;?php $sslcert [...]]]></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%2F11%2F03%2Fsimple-way-to-parse-an-x509-certificate-with-php"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2010%2F11%2F03%2Fsimple-way-to-parse-an-x509-certificate-with-php&amp;source=nessa421&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>PHP has a nifty little function for parsing an x.509 SSL certificate into an array to easily pull out the elements: <a href="http://us3.php.net/openssl_x509_parse" target="_blank">openssl_x509_parse</a> .Essentially, all you need to do is load up the contents of the certificate, either through a file or POST value, and enclose it in the array. Here&#8217;s a simple script:<br />
<code><br />
&lt;?php<br />
$sslcert = file_get_contents("/etc/ssl/certs/secure.v-nessa.net");<br />
$sslcert = array(openssl_x509_parse($sslcert,TRUE));<br />
//print_r($sslcert);<br />
foreach ($sslcert as $name =&gt; $arrays){<br />
foreach ($arrays as $title =&gt; $value){<br />
if(is_array($value)){<br />
echo $value . "\n";<br />
foreach($value as $subtitle =&gt; $subvalue){<br />
echo $subtitle . " : " . $subvalue . "\n";<br />
}<br />
}else{<br />
echo $title .  "\n";<br />
}<br />
}<br />
}<br />
?&gt;</code></p>
<p>The results are several multidimensional arrays, so depending on the data you need, you may need to keep adding foreach loops to get that data.</p>
<p><map name='google_ad_map_385_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/385?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_385_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=385&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2010%2F11%2F03%2Fsimple-way-to-parse-an-x509-certificate-with-php' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=385&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2010/11/03/simple-way-to-parse-an-x509-certificate-with-php/feed</wfw:commentRss>
		<slash:comments>4</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&amp;b=2" 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>8</slash:comments>
		</item>
		<item>
		<title>WHM APF Plugin</title>
		<link>http://www.v-nessa.net/2008/06/05/whm-apf-plugin</link>
		<comments>http://www.v-nessa.net/2008/06/05/whm-apf-plugin#comments</comments>
		<pubDate>Fri, 06 Jun 2008 04:48:09 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/?p=157</guid>
		<description><![CDATA[I&#8217;m happy to announce my first ever perl-written plugin for WebHost Manager, which was developed by myself and one of my fellow sysadmins at InMotion Hosting. The first release is available here: Download v.1.05 To explain a little bit of background here, many hosting companies that give some sort of **** about security will leave [...]]]></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%2F2008%2F06%2F05%2Fwhm-apf-plugin"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2008%2F06%2F05%2Fwhm-apf-plugin&amp;source=nessa421&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I&#8217;m happy to announce my first ever perl-written plugin for WebHost Manager, which was developed by myself and one of my fellow sysadmins at <a href="http://inmotionhosting.com" target="_blank">InMotion Hosting</a>.  The first release is available here:</p>
<p>Download v.1.05</p>
<p style="text-align: center;"><a href="http://v-nessa.net/index.php?dl=apfadd_whm_1.05.tar.gz"><img class="alignleft" style="margin: 5px; float: left;" src="http://v-nessa.net/images/download.jpg" alt="Download Now" width="97" height="99" /></a></p>
<p>To explain a little bit of background here, many hosting companies that give some sort of **** about security will leave SSH port 22 closed except for specified IPs.  Us being one of them, requests from customers for us to add their IPs to their firewalls is rather redundant when we host over 900 V-dedicated systems and 100 Dedicated boxes where customers can opt for SSH access.  Therefore, I decided that it would be well worth our efforts to create a WHM plugin to allow customers to add their own IPs without ever having to contact us.  I am aware that some plugin developer already has a more sophisticated APF plugin for WHM but you have to pay for it.</p>
<p><strong>Requirements:</strong></p>
<p>- cPanel/WHM (tested on version 11.18)</p>
<p>- APF 0.9 (tested on 0.9.6)</p>
<p>- iptables enabled and working (if you are able to restart APF without any errors, it&#8217;s probably fine)</p>
<p>Note:  default privileges will allow anyone with WHM/reseller access to use this plugin.  You can manually change this in the addon_add2apf.cgi file if you want.</p>
<p><strong>Installation:</strong></p>
<blockquote><p>cd /usr/local/cpanel/whostmgr/docroot/cgi<br />
wget http://v-nessa.net/wp-content/scripts/apfadd_whm_1.05.tar.gz<br />
tar -xvzf apfadd_whm_1.05.tar.gz<br />
rm -f apfadd_whm_1.05.tar.gz</p></blockquote>
<p>Simple enough?</p>
<p>From there, load up WHM and on the left side you&#8217;ll see an option to &#8220;Add IP to Firewall&#8221; and the plugin page will give you examples of what you can add.  The script is set up to allow:</p>
<p><em>Hostname &#8211; v-nessa.net<br />
Single IP &#8211; 205.134.252.71<br />
IP CIDR &#8211; 205.134.252.71/24<br />
Port/IP &#8211; d=22:s=205.134.252.71<br />
Port/CIDR &#8211; d=22:s=205.134.252.71/24</em></p>
<div style="display: none;"><a href="http://johnquiggin.com?cerrone_s_paradise">cerrone s paradise.mp3</a></div>
<p>Of course, the error checking is not perfect, so just be aware of what you&#8217;re adding or you might unintentionally &#8216;break&#8217; your firewall, which usually results in blocked traffic.</p>
<p>Eventually I&#8217;m sure I&#8217;ll end up adding the ability to manage ports and remove IPs for users with a certain access level, but currently I don&#8217;t see a need to do so because I don&#8217;t believe that non-root users should have that type of access.  Note that per the readme, you can edit the addon file to limit access to users with a certain reseller ACL privilege.</p>
<p><map name='google_ad_map_157_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/157?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_157_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=157&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2008%2F06%2F05%2Fwhm-apf-plugin' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=157&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2008/06/05/whm-apf-plugin/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Convert Database to UTF-8</title>
		<link>http://www.v-nessa.net/2007/12/06/convert-database-to-utf-8</link>
		<comments>http://www.v-nessa.net/2007/12/06/convert-database-to-utf-8#comments</comments>
		<pubDate>Fri, 07 Dec 2007 03:25:18 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/2007/12/06/convert-database-to-utf-8</guid>
		<description><![CDATA[We seriously see a ton of customers coming in with the type of databases that are a nightmare to move over. When you&#8217;re dealing with special characters in a database, you have to make sure that the charset and collation are dumped *with* the database, so that when you move it to another server the [...]]]></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%2F2007%2F12%2F06%2Fconvert-database-to-utf-8"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2007%2F12%2F06%2Fconvert-database-to-utf-8&amp;source=nessa421&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>We seriously see a ton of customers coming in with the type of databases that are a nightmare to move over.  When you&#8217;re dealing with special characters in a database, you have to make sure that the charset and collation are dumped *with* the database, so that when you move it to another server the tables and data create properly.  The biggest annoyance so far is converting tables back to UTF-8, as when this is done through the MySQL shell or phpmyadmin is had to be done table-by-table.  So, I wrote this simple PHP script to do it all at once:</p>
<p><code><font color="#ff66cc">  &lt;?php<br />
// Database info</font></code></p>
<p><code><font color="#ff66cc">     $dbhost      = 'localhost';<br />
$dbuser      = 'db_user';<br />
$dbpass      = 'password';<br />
$dbname    = 'db_name';<br />
</font></code></p>
<p><code><font color="#ff66cc">   //---------------</font></code></p>
<p><code><font color="#ff66cc">    header('Content-type: text/plain');</font></code></p>
<p><code><font color="#ff66cc">$dbconn = mysql_connect($dbhost, $dbuser, $dbpass) or die( mysql_error() );<br />
$db = mysql_select_db($dbname) or die( mysql_error() );</font></code><br />
<code><br />
<font color="#ff66cc">$sql = 'SHOW TABLES';<br />
$result = mysql_query($sql) or die( mysql_error() );</font></code></p>
<p><code><font color="#ff66cc">while ( $row = mysql_fetch_row($result) )<br />
{<br />
$table = mysql_real_escape_string($row[0]);<br />
$sql = "ALTER TABLE $table DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci";<br />
mysql_query($sql) or die( mysql_error() );<br />
print "$table changed to UTF-8.\n";<br />
}</font></code><br />
<code><br />
<font color="#ff66cc">mysql_close($dbconn);<br />
?&gt;</font></code></p>
<p>If course, you can adjust the ALTER TABLE statement to any character set and  collation that you need.</p>
<p><map name='google_ad_map_128_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/128?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_128_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=128&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2007%2F12%2F06%2Fconvert-database-to-utf-8' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=128&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2007/12/06/convert-database-to-utf-8/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>MX Validation in PHP</title>
		<link>http://www.v-nessa.net/2007/12/01/mx-validation-in-php</link>
		<comments>http://www.v-nessa.net/2007/12/01/mx-validation-in-php#comments</comments>
		<pubDate>Sat, 01 Dec 2007 05:16:38 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/2007/12/01/mx-validation-in-php/</guid>
		<description><![CDATA[Hosting companies have all kinds of tactics to keep spam away from their customers, but one very common complaint I get is the amount of spam coming in through contact forms. Even though we don&#8217;t allow &#8216;nobody&#8217; mail through the php mail() function and we provide the best server-side spam filters available, local mail cannot [...]]]></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%2F2007%2F12%2F01%2Fmx-validation-in-php"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2007%2F12%2F01%2Fmx-validation-in-php&amp;source=nessa421&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hosting companies have all kinds of tactics to keep spam away from their customers, but one very common complaint I get is the amount of spam coming in through contact forms.  Even though we don&#8217;t allow  &#8216;nobody&#8217; mail through the php mail() function and we provide the best server-side spam filters available, local mail cannot be filtered or limited.  In other words, no spam filter in the world is going to save you from your shitty contact form.</p>
<p>I started recommending to our customers to implement MX checks in their forms as spam bots nowadays can easily get past things like captcha and textual confirmations.  Spammers rarely send email from valid mail hosts so it&#8217;s very easy to filter these out with just a few lines of code:</p>
<pre><font><font color="#ff66cc">&lt;?php
list($user, $domain) = split(“@”, $email);
if (checkdnsrr($domain, “MX”)) {
} else {
}

?&gt;</font></font></pre>
<p>To explain the code a little bit, you&#8217;re basically taking your stored email address variable (<em>$email</em>) and using the <strong>split() </strong>function to single out the domain name into one variable, <em>$domain</em>.  When you pass the domain through the checkdnsrr() function, PHP will return either a &#8217;1&#8242; or &#8217;0&#8242; result, which is interpreted as either true or false.  The above is just the basic code, but you can have it spit out errors as well:</p>
<pre><font><font><font><font color="#ff66cc">if (checkdnsrr($domain, “MX”)) {
} else {</font></font></font></font></pre>
<pre><font><font><font><font color="#ff66cc">echo "Invalid email";
}</font></font></font></font></pre>
<p>The checkdnsrr() function can also be used to check for other records as well, like A, CNAME, NS, etc.</p>
<p><!--adsense#img_banner--></p>
<p><map name='google_ad_map_115_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/115?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_115_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=115&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2007%2F12%2F01%2Fmx-validation-in-php' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=115&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2007/12/01/mx-validation-in-php/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Mass-Moving cPanel Accounts</title>
		<link>http://www.v-nessa.net/2007/10/22/mass-moving-cpanel-accounts</link>
		<comments>http://www.v-nessa.net/2007/10/22/mass-moving-cpanel-accounts#comments</comments>
		<pubDate>Mon, 22 Oct 2007 15:32:50 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/2007/10/22/mass-moving-cpanel-accounts/</guid>
		<description><![CDATA[If you&#8217;ve ever needed to move a ton of cPanel accounts from one server to another, you probably know the following: The multiple account move feature in WHM fails miserably It takes forever to do them one by one, esp. when you have other things to do I figure the best way to mass-move accounts [...]]]></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%2F2007%2F10%2F22%2Fmass-moving-cpanel-accounts"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2007%2F10%2F22%2Fmass-moving-cpanel-accounts&amp;source=nessa421&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>If you&#8217;ve ever needed to move a ton of cPanel accounts from one server to another, you probably know the following:</p>
<ol>
<li>The multiple account move feature in WHM fails miserably</li>
<li>It takes forever to do them one by one, esp. when you have other things to do</li>
</ol>
<p>I figure the best way to mass-move accounts is by listing all the accounts in a file, then using a simple bash script to repetitively package all the accounts to they can be moved to another server.</p>
<p>First, you need to create a file (like users.txt) to list all the users you wish to move.  If you&#8217;re only doing a few you can just go ahead and list the users in there manually, but if you&#8217;re doing like a whole server, you can get all the users in one file like so:</p>
<blockquote><p> ls /var/cpanel/users &gt; users.txt</p></blockquote>
<p>You&#8217;ll then need to manually edit the users file and remove the &#8216;.&#8217; and &#8221;..&#8217; entries, and any others that should not be included.   The users.txt file should also be in a format like this:</p>
<blockquote><p>user1<br />
user2<br />
user3<br />
&#8230;</p></blockquote>
<p>Next, you may want to set up an SSH key between servers so all the cpmove files and be transferred automatically.  If you don&#8217;t know how to do this, <a href="http://w3.pppl.gov/cppg/seminars/papers/linux_talk/node11.html" target="_blank">here</a> is a simple and straight-through tutorial.</p>
<p>Create a bash script called &#8216;cpbackup.sh&#8217; with the following lines:<br />
<font color="#ff66cc"><br />
<code>#! /bin/bash<br />
for i in `cat users.txt`; do /scripts/pkgacct $i; done<br />
scp -r /home/cpmove* root@server:/home<br />
echo "Account backups done" &gt; email.txt<br />
mail -vv -s "Account backups done"  your@emailaddress.com &lt; email.txt</code><br />
</font><br />
This will run cPanel backups up all the accounts listed in users.txt, scp them over to the new server, then email you when it&#8217;s done.  Note that if you do not have SSH keys installed, you will have to manually type in the new server&#8217;s password when the script is ready to transfer the accounts over.</p>
<p>The on the new server you can use the same script and users.txt file, just change it around:<br />
<font color="#ff66cc"><br />
<code>#! /bin/bash<br />
for i in `cat users.txt`; do /scripts/restorepkg $i; done</code></font></p>
<p>This will restore all the user accounts that you copied over.  From there, you&#8217;re all done!<br />
One simple note: I&#8217;m not a shell programmer so I&#8217;m sure there are a lot better ways to accomplish this..if so, you can post them in a comment.  The downside of using this method to move accounts is that all of the accounts are backed up in order so if you have a hundred some users, the backup files might be sitting on the server for hours until they are moved and restored, so you&#8217;ll want to make sure that your users are not making changes to their sites during the move process.  Also, since the backup files are stored on the server it&#8217;s a good idea to figure out how much disk space you are going to need to avoid going over.  You may be able to modify the script to do groups of 10-20 then delete the cpmove files if disk space is a concern.</p></blockquote>
</blockquote>
<p><map name='google_ad_map_99_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/99?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_99_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=99&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2007%2F10%2F22%2Fmass-moving-cpanel-accounts' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=99&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2007/10/22/mass-moving-cpanel-accounts/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Using PHP to Display Version Info &#8211; Part II</title>
		<link>http://www.v-nessa.net/2007/10/17/using-php-to-display-version-info-part-ii</link>
		<comments>http://www.v-nessa.net/2007/10/17/using-php-to-display-version-info-part-ii#comments</comments>
		<pubDate>Wed, 17 Oct 2007 15:18:20 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/2007/10/17/using-php-to-display-version-info-part-ii/</guid>
		<description><![CDATA[Earlier I showed some examples of commands you can use to pull software versions into a simple PHP script. In the next example I&#8217;ll show how to do the distro and kernel versions. I&#8217;m sure that there&#8217;s a much simpler way to do this (i.e. a simple cat command on the /proc/version file), but I [...]]]></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%2F2007%2F10%2F17%2Fusing-php-to-display-version-info-part-ii"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2007%2F10%2F17%2Fusing-php-to-display-version-info-part-ii&amp;source=nessa421&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Earlier I showed some examples of commands you can use to pull software versions into a simple PHP script.  In the next example I&#8217;ll show how to do the distro and kernel versions.  I&#8217;m sure that there&#8217;s a much simpler way to do this (i.e. a simple cat command on the /proc/version file), but I figured I&#8217;d use a more advanced example in the form of a function.  I did the distro as a variable to show how easy this is:</p>
<p><font color="#ff66cc"><code><br />
&lt;?php<br />
function kernelinfo () {<br />
$buf = exec( 'cat /proc/version');<br />
if ( $buf == "ERROR" ) {<br />
$result = "N.A.";<br />
} else {<br />
if (preg_match('/version (.*?) /', $buf, $ar_buf)) {<br />
$result = $ar_buf[1];</code></font><br />
<code><br />
<font color="#ff66cc">if (preg_match('/SMP/', $buf)) {<br />
$result .= ' (SMP)';<br />
}<br />
}<br />
}<br />
return $result;<br />
}</font></code><br />
<code><br />
<font color="#ff66cc">$distro = exec('cat /etc/redhat-release');</font></code><br />
<code><br />
<font color="#ff66cc">$kernel = kernelinfo();</font></code><br />
<code><br />
<font color="#ff66cc">echo $distro;</font></code><br />
<code><br />
<font color="#ff66cc">echo "&lt;html&gt;&lt;br&gt;&lt;/html&gt;";</font></code><br />
<code><br />
<font color="#ff66cc">echo $kernel;</font><br />
<code><br />
<font color="#ff66cc">?&gt;<br />
</font></code></code></p>
<p>This will show a result of the following, obviously various depending on your platform:</p>
<blockquote><p>CentOS release 4.5 (Final)<br />
2.6.9-023stab033.9-enterprise (SMP)</p></blockquote>
<p>Keep in mind that this script (as the last) requires the ability to pass shell commands through PHP.  So, you would need to be able to the <a href="http://www.php.net/function.exec" target="_blank">exec</a> function, or replace it with <a href="http://www.php.net/function.system" target="_blank">system</a>, <a href="http://www.php.net/function.passthru" target="_blank">passthru</a>, <a href="http://www.php.net/manual/en/function.escapeshellcmd.php" target="_blank">escapeshellcmd</a>, or <a href="http://www.php.net/function.shell_exec" target="_blank">shell_exec</a> if those are allowed in your php.ini configuration.  Also, if you run PHP as an Apache module, this will not work if you have open_basedir protection enabled.</p>
<p><map name='google_ad_map_97_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/97?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_97_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=97&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2007%2F10%2F17%2Fusing-php-to-display-version-info-part-ii' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=97&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2007/10/17/using-php-to-display-version-info-part-ii/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using PHP to Display Version Info</title>
		<link>http://www.v-nessa.net/2007/10/15/using-php-to-display-version-info</link>
		<comments>http://www.v-nessa.net/2007/10/15/using-php-to-display-version-info#comments</comments>
		<pubDate>Mon, 15 Oct 2007 14:38:11 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/2007/10/15/using-php-to-display-version-info/</guid>
		<description><![CDATA[I&#8217;ve been working on this application for work that does some simple server reporting, part of which involves displaying the versions of major software running on the machines. The importance of this to me personally is that since we have over 30 shared servers hosting multiple customers, we are continually moving websites between servers. Some [...]]]></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%2F2007%2F10%2F15%2Fusing-php-to-display-version-info"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2007%2F10%2F15%2Fusing-php-to-display-version-info&amp;source=nessa421&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I&#8217;ve been working on this application for work that does some simple server reporting, part of which involves displaying the versions of major software running on the machines.  The importance of this to me personally is that since we have over 30 shared servers hosting multiple customers, we are continually moving websites between servers.  Some of our older generation servers are still running MySQL 4.0 and PHP 4.3, so I need to be aware of this to make sure that customers are being moved to servers with compatible versions.  It&#8217;s also good in tracking and planning upgrades.</p>
<p>I find it best to use the <strong><a href="http://www.php.net/function.exec" target="_blank">exec()</a> </strong>function since it&#8217;s not blocked by most hosts.  However, if you are on a shared host it&#8217;s very likely that certain PHP functions are disallowed in the php.ini.  In that case you may be able to subsitute exec with <a href="http://www.php.net/function.system" target="_blank">system</a>, <a href="http://www.php.net/function.passthru" target="_blank">passthru</a>, <a href="http://www.php.net/manual/en/function.escapeshellcmd.php" target="_blank">escapeshellcmd</a>, or <a href="http://www.php.net/function.shell_exec" target="_blank">shell_exec</a>&#8230;unless those are blocked too.  Then I guess you&#8217;re out of luck.</p>
<p>Start by creating some variables to store ordinary shell commands.  If you wanted to find the php version from command line, you would usually type:</p>
<blockquote><p>php -v</p></blockquote>
<p>This will give a huge chunk of crap that you really don&#8217;t need if you&#8217;re making a simple version display script.  In this case, you can use <strong>grep</strong>, <strong>awk</strong>,<strong> sed</strong>, and <strong>cut</strong> to trim down the output into a one-liner:</p>
<blockquote><p>php -v |grep built |awk {&#8216;print $2&#8242;}</p></blockquote>
<p>The awk command prints out columns, so in the above example I&#8217;m printing out the second column of the line that contains the word &#8216;built&#8217;.   Once the desired output is figured out, you simply assign it to a variable passed through exec() or a similar function:</p>
<p><font color="#ff66cc"><br />
<code>$phpver = exec("php -v |grep built |awk {'print $2'}");</code><br />
</font><br />
Then you can call the variable <strong>$phpver</strong> anywhere in your script:<br />
<font color="#ff66cc"><br />
<code>echo "PHP Version: $phpver";</code><br />
</font></p>
<p>You can probably go through and figure out the commands to show other software versions on your server.   In my script I&#8217;m showing the perl, php, mysql, apache, python, cpanel, and ruby versions.  Here are the commands I used:<br />
<font color="#ff66cc"><br />
<code></code></font></p>
<p><font color="#ff66cc"><code>&lt;?php</code></font></p>
<p><font color="#ff66cc"><code>$perlver = exec("perl -v |grep linux |awk {'print $4'}|sed -e 's/v//'");<br />
$phpver = exec("php -v |grep built |awk {'print $2'}");<br />
$mysqlver = exec("mysql -V |awk {'print $5'} | sed -e 's/,//'");<br />
$apachever = exec("apachectl -v |grep version |awk {'print $3 $4'}|sed -e 's/Apache\///'");<br />
$pythonver = exec("python -V 2&gt;&amp;1 | sed -e 's/Python //'");<br />
$cpanelver = exec("cat /usr/local/cpanel/version");<br />
$rubyver = exec("ruby -v |awk {'print $2'}"); ?&gt;</code><br />
</font></p>
<p>Then I just echoed out all the variables  to display my version numbers:</p>
<p><a href="http://v-nessa.net/wp-content/scripts/versions.php" title="Version Info" target="_blank">See here</a> .</p>
<p><!--adsense--></p>
<p><map name='google_ad_map_96_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/96?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_96_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=96&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2007%2F10%2F15%2Fusing-php-to-display-version-info' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=96&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2007/10/15/using-php-to-display-version-info/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ugh&#8230;.CIDR</title>
		<link>http://www.v-nessa.net/2007/08/28/ughcidr</link>
		<comments>http://www.v-nessa.net/2007/08/28/ughcidr#comments</comments>
		<pubDate>Tue, 28 Aug 2007 07:23:49 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/2007/08/28/ughcidr/</guid>
		<description><![CDATA[I kinda wish I paid attention in class when the professor was talking about CIDR notations and shit&#8230;because it would have come in handy tonight. But being that I&#8217;m lazy I did some looking around and found that there&#8217;s a perl module out there that will convert an IP range to CIDR for you with [...]]]></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%2F2007%2F08%2F28%2Fughcidr"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2007%2F08%2F28%2Fughcidr&amp;source=nessa421&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I kinda wish I paid attention in class when the professor was talking about CIDR notations and shit&#8230;because it would have come in handy tonight.  But being that I&#8217;m lazy I did some looking around and found that there&#8217;s a perl module out there that will convert an IP range to CIDR for you with a simple 4-line script.  You&#8217;ll need to install the Net::CIDR module for this to work<br />
If you&#8217;re on cPanel just type:<br />
<font color="#ff66cc"><br />
<code># /scripts/perlinstaller Net::CIDR<br />
</code></font><br />
Here&#8217;s the script:<br />
<font color="#ff66cc"><code><br />
</code></font></p>
<blockquote><p><font color="#ff66cc"><code> #!/usr/bin/perl</code></font></p>
<p><font color="#ff66cc"><code></code></font><font color="#ff66cc">use Net::CIDR;</font></p>
<p><font color="#ff66cc">$range = shift;</font></p>
<p><font color="#ff66cc">print (join(&#8220;\n&#8221;, Net::CIDR::range2cidr(&#8220;$range&#8221;)) . &#8220;\n&#8221; );</font></p></blockquote>
<p><font color="#ff66cc"> </font><br />
Usage:<br />
<font color="#ff66cc"><br />
root@vps [~]# perl convert.pl 192.168.0.1-192.168.1.1<br />
192.168.0.1/32<br />
192.168.0.2/31<br />
192.168.0.4/30<br />
192.168.0.8/29<br />
192.168.0.16/28<br />
192.168.0.32/27<br />
192.168.0.64/26<br />
192.168.0.128/25<br />
192.168.1.0/31</font></p>
<p><map name='google_ad_map_95_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/95?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_95_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=95&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2007%2F08%2F28%2Fughcidr' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=95&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2007/08/28/ughcidr/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>b2Evolution SMTP Patch</title>
		<link>http://www.v-nessa.net/2007/08/08/b2evolution-smtp-patch</link>
		<comments>http://www.v-nessa.net/2007/08/08/b2evolution-smtp-patch#comments</comments>
		<pubDate>Wed, 08 Aug 2007 11:06:05 +0000</pubDate>
		<dc:creator>Nessa</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[b2evolution]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.v-nessa.net/2007/08/08/b2evolution-smtp-patch/</guid>
		<description><![CDATA[Update (4/21/09) &#8211; This plugin is obsolete and is probably never going to be updated&#8230;use at your own risk! I was debating whether or not to publish this since I wrote it mainly to target our customers, but I figured it might help someone who needs it. Many hosting companies block PHP mail coming from [...]]]></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%2F2007%2F08%2F08%2Fb2evolution-smtp-patch"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.v-nessa.net%2F2007%2F08%2F08%2Fb2evolution-smtp-patch&amp;source=nessa421&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><strong>Update (4/21/09) &#8211; This plugin is obsolete and is probably never going to be updated&#8230;use at your own risk!</strong></p>
<p>I was debating whether or not to publish this since I wrote it mainly to target our customers, but I figured it might help someone who needs it.</p>
<p>Many hosting companies block PHP mail coming from the user &#8216;nobody&#8217;, which is a default if your host runs PHP as an Apache module.  At the time of my writing, b2evolution does not support STMP, so I created a simple patch that will allow you to use phpMailer to send mail through SMTP instead of the send_mail() function that b2 uses.</p>
<p>Download  <a href="http://v-nessa.net/index.php?dl=b2evo_phpMailer-1.03.tar.gz">b2evo_phpMailer-1.03.tar.gz</a> (76k)</p>
<p><strong>Requirements:</strong></p>
<ul>
<li>b2evolution 1.9.x or higher (tested with 1.9.3, but may work with other versions)</li>
<li>php 4.3.1 or higher (required by b2)</li>
<li>Valid SMTP server</li>
</ul>
<p><strong>Usage:</strong></p>
<p>The instructions are specifically outlined in the readme.txt file within the archive, but it&#8217;s basically as simple as:</p>
<ol>
<li>Edit the &#8216;settings.php&#8217; file in htsrv/phpmailer</li>
<li>Upload the patched files to their corresponding locations on your webserver</li>
</ol>
<p>And yea&#8230;that&#8217;s it.</p>
<p><strong>Notes:</strong></p>
<p>- This script was tested on a Linux platform running on cPanel, so the actual email setting and port numbers could be different on your server.  If you are unsure about this, please ask your host.</p>
<p>- phpMailer does not explicity support SSL or TLS connections yet, so neither does this patch.  You can essentially connect through any port as long as 1) your server runs SMTP on it and 2) it doesn&#8217;t require SSL or TLS.</p>
<p>I am not affiliated with b2evolution, so please do not contact me with questions about the software that do not pertain to the usage of this patch.  This patch was mainly written to make b2evolution functional on some of our servers that block php mailing, and is not meant to be a major project.  That being said, if you&#8217;re having difficulty getting my patch to work with your installation I would love to know about it, but please do not make your expectations too high.  I have a life too =)</p>
<p><!--adsense--></p>
<p><map name='google_ad_map_92_7fa65e237551a74a'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/92?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_92_7fa65e237551a74a' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=92&amp;url= http%3A%2F%2Fwww.v-nessa.net%2F2007%2F08%2F08%2Fb2evolution-smtp-patch' /></p><img src="http://www.v-nessa.net/?ak_action=api_record_view&id=92&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.v-nessa.net/2007/08/08/b2evolution-smtp-patch/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

