<?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>Ali's Blog &#187; php</title>
	<atom:link href="http://almahdi.cc/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://almahdi.cc</link>
	<description>Made from the best stuff on earth</description>
	<lastBuildDate>Sun, 15 Aug 2010 22:31:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ZenCrypt &#8212; PHP Encoder</title>
		<link>http://almahdi.cc/programming/zencrypt-php-encoder/</link>
		<comments>http://almahdi.cc/programming/zencrypt-php-encoder/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 20:01:36 +0000</pubDate>
		<dc:creator>Ali</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ali]]></category>
		<category><![CDATA[Ali Almahdi]]></category>
		<category><![CDATA[Ali Encoder]]></category>
		<category><![CDATA[Almahdi]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[PHP Encoder]]></category>
		<category><![CDATA[ZenCrypt]]></category>

		<guid isPermaLink="false">http://almahdi.cc/?p=399</guid>
		<description><![CDATA[Last night, I was searching the internet for PHP Encoders, I always knew that ZendGuard and IONCUBE are the best. However, I thought of giving others a chance. While searching I came across ZenCrypt. One of the good things about it that it doesn&#8217;t need a loader on the server-side. Thus, the scripts are self-decodable. [...]]]></description>
			<content:encoded><![CDATA[<p>Last night, I was searching the internet for PHP Encoders, I always knew that ZendGuard and IONCUBE are the best. However, I thought of giving others a chance. While searching I came across <a href="http://www.zencrypt.com/" target="_blank">ZenCrypt</a>. One of the good things about it that it doesn&#8217;t need a loader on the server-side. Thus, the scripts are self-decodable. But this makes it easy to decrypt. On thier website, they have two scripts. One is the source, and the other is the encoded script.</p>
<p>My Attempt to understand its way of encoding to see if it worth the USD45.</p>
<p><a href="http://www.zencrypt.com/INFO/test_plain.php.txt" target="_blank">Source PHP Code</a>:</p>
<blockquote>
<pre>&lt;?php
/* -------------------------------------------------
               www.ZenCrypt.com
             ZenCrypt simple demo

User Manual: http://www.zencrypt.com/INFO/ZenCrypt_PHP_Encoder.pdf
------------------------------------------------- */

//{{{PHP_INSERT_a1}}}
// Encoded chunk of code will be inserted here by ZenCrypt
// Encoded version - test_encoded.php was generated by running ZenCrypt with this command:
//    php -f zencrypt.php infile=test_plain.php outfile=test_encoded.php enccycles=10 stripcomments=yes
//{{{/PHP_INSERT_a1}}}

// This code client will see
$encrypted_number = 52728;

$resulted_number = ZEN_encrypt ($encrypted_number);
echo "\nEncrypted number=$resulted_number";
$resulted_number = ZEN_decrypt ($resulted_number);
echo "\nDecrypted number=$resulted_number";

//{{{PHP_ENCODE_a1}}}
// This part will be encoded and moved above (in between PHP_INSERT tags).
// We do not want to expose these "super secret" encryption functions to the clients.
function ZEN_encrypt ($input)
{
return ($input+5432);
}

function ZEN_decrypt ($input)
{
return ($input-5432);
}
//{{{/PHP_ENCODE_a1}}}

?&gt;
</pre>
</blockquote>
<p><a href="http://www.zencrypt.com/INFO/test_encoded.php.txt" target="_blank">Encoded Code:</a></p>
<blockquote>
<pre>&lt;?php
/* -------------------------------------------------
               www.ZenCrypt.com
             ZenCrypt simple demo

User Manual: http://www.zencrypt.com/INFO/ZenCrypt_PHP_Encoder.pdf
------------------------------------------------- */

$juTSvfNAGsrLGell='=ch/5z/T/fd3E73dPj+i+/rRNYcW/rz/sr6zjSNreaXN+nf/W876jLfWtd9fYXR5F3mtYCRhWNW7dOXGPsM19c920z3acnzSfxYMLFxg/Lz0nIz1FfpnLVdf/xksrTZ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';$LoMOYHmyNmPlxD=strrev($QynVyKBtA_laXYfjkJ);$lUETluMevSaLCDV=str_rot13($LoMOYHmyNmPlxD);eval($lUETluMevSaLCDV);

// This code client will see
$encrypted_number = 52728;

$resulted_number = ZEN_encrypt ($encrypted_number);
echo "\nEncrypted number=$resulted_number";
$resulted_number = ZEN_decrypt ($resulted_number);
echo "\nDecrypted number=$resulted_number";

?&gt;
</pre>
</blockquote>
<p>My Attempt to Decode the Code:</p>
<blockquote><p>&lt;?php<br />
/* &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
www.ZenCrypt.com<br />
ZenCrypt simple demo</p>
<p>User Manual: http://www.zencrypt.com/INFO/ZenCrypt_PHP_Encoder.pdf<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- */</p>
<p>$juTSvfNAGsrLGell=&#8217;=ch/5z/T/fd3E73dPj+i+/rRNYcW/rz/sr6zjSNreaXN+nf/W876jLfWtd9fYXR5F3mtYCRhWNW7dOXGPsM19c920z3acnzSfxYMLFxg/Lz0nIz1FfpnLVdf/xksrTZqs55rpk///93fz27zHki6/oWYz1+9boz693v+vwQE52qDxffRSPNxjIf7xOfHb07GgxXHS/CawCIAXw9xuOY/EVs2KuqrxeJFCMTjEENA0ny6gTRUnndy30KTE/uyY77Pa0TWPVyHmqmYQ98Vf+dgq80ne2FgRkZzz1I103xrDgFjbVdXrcq4coJhOlJwGfXOMVavufyVOwpoIna3qQ5ldM+cVFUwoIHxuEbp3t6HEKKHnhi8rDY6aBfCxM9HkjSCeDP5gWj8GO2zaLsMsrsmLaLw605dRJDxFQZcyTe/X5RDaN9pJ0JTlyEzs0b6ds4cIeRg0uf7/INtfOgFECfah6aJz5Z8WbW5XorpGJZQAk/0H4sxB6GZiXZT44QtxETrhcqSgW5rtxHBxfD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fd2RPIidVbrIPo/bDjFH5JNbWGTZiwCpi3LZAZ2Jh7CQyiL6qCKyJRMU2mC1KapSxqxZzoZ1IDI5j+ZjJzdyb/N82DRWQ5TKP9GYWLiB6m9Jmku3I31DNv0Wfs0uVuqXFU3kNM3ejaeXtT2ZolhmEhuiYS6fpTXEmym65ITt646EAEfnnSTDy9Ybt7L5xukkRuaHG3DKRJm/I48XOQkubAcY3ZuRHKIl8OcQeyd2jIY06sMvd5Ud8wiqvTtxHuyJV+S9cTmo2NsL/LZV/c19kmOMpKd0N1d62IdjeeufMxGxM42QFe+NS+rZeD5jY9KOe6c4adcJMToZDt7F8mEN4isP9okCSxpN1Wvr8cpj+Rwn6xFslssE60hp54EwDmogCfgu1xz9dLGUCP4hk8BQAEPxCJ3+8KALk/4ry59SEHgAsPZW3QeuBJ1xQWsQQHnvphTU/hFcFApGOYgiqw+P2bHPAtahgbhG4g5twGhSmwIIAggBccUccjnrn9Z2wn+ZbQAB1eN9CTMBQMBEE98OApvjbJ2EAYeui/+/PE0n78g542p9K1FhlIIT7xFwOvff919+OIkX675p2SBB7YNRuCWYXBZyvDISuj3SVb&#8217;;$QynVyKBtA_laXYfjkJ=&#8217;;))))yyrTYefTNAsiFGhw$(ireegf(rqbprq_46rfno(rgnysavmt(ynir&#8217;;$LoMOYHmyNmPlxD=strrev($QynVyKBtA_laXYfjkJ);$lUETluMevSaLCDV=str_rot13($LoMOYHmyNmPlxD);eval($lUETluMevSaLCDV);</p>
<p>//print  gzinflate(base64_decode(strrev($juTSvfNAGsrLGell)));</p>
<p>$str=str_replace(&#8220;eval&#8221;,&#8221;\$str=&#8221;, gzinflate(base64_decode(strrev($juTSvfNAGsrLGell))));<br />
eval($str);<br />
print $str.&#8221;\n&#8211;\n&#8221;;<br />
//print &#8220;&#8211;\n&#8221;;<br />
for($icount=0; $icount&lt;17; $icount++) {<br />
$str=str_replace(&#8220;eval&#8221;,&#8221;\$str=&#8221;, $str);<br />
print $str.&#8221;\n$icount&#8211;\n&#8221;;<br />
eval($str);<br />
print $str.&#8221;\n$icount&#8211;\n&#8221;;<br />
}</p>
<p>// This code client will see<br />
$encrypted_number = 52728;</p>
<p>$resulted_number = ZEN_encrypt ($encrypted_number);<br />
echo &#8220;\nEncrypted number=$resulted_number&#8221;;<br />
$resulted_number = ZEN_decrypt ($resulted_number);<br />
echo &#8220;\nDecrypted number=$resulted_number&#8221;;<br />
?&gt;</p></blockquote>
<p>Conclusion:</p>
<p>What I see that it doesn&#8217;t worth the the USD45. Maybe if it was encoded with ZendGuard or ionCube and produces a file that requires a PHP Loader. Just like PHPCipher.<br />
However, from this attempt. I thought that I will write my own encoder. It will be using the same method, however, the output will be encoded in both ZendGuard and ionCube. Stay tuned!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://almahdi.cc/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://almahdi.cc/programming/zencrypt-php-encoder/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setup unixODBC on Linux for Oracle and Sybase</title>
		<link>http://almahdi.cc/linux/setup-unixodbc-on-linux-for-oracle-and-sybase/</link>
		<comments>http://almahdi.cc/linux/setup-unixodbc-on-linux-for-oracle-and-sybase/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 12:09:21 +0000</pubDate>
		<dc:creator>Ali</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[odbc linux]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sybase]]></category>
		<category><![CDATA[unixodbc]]></category>

		<guid isPermaLink="false">http://almahdi.cc/?p=353</guid>
		<description><![CDATA[I have been working this week on configuring a Linux server to connect to Oracle and Sybase using unixODBC to be used by a System running on PHP. So, I thought of sharing my /etc/odbc.ini and /etc/odbcinst.ini since I had a bit of hard time writing them. It may help someone who is trying to [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working this week on configuring a Linux server to connect to Oracle and Sybase using unixODBC to be used by a System running on PHP.</p>
<p>So, I thought of sharing my /etc/odbc.ini and /etc/odbcinst.ini since I had a bit of hard time writing them. It may help someone who is trying to figure out how to connect using ODBC on Linux.</p>
<p>Packages Required on CentOS</p>
<blockquote><p>httpd php unixODBC</p></blockquote>
<p>Manually Install Oracle Instant Client 11.1 RPM Packages and Install Sybase ASE from the TGZ File.</p>
<p>For Oracle you need to copy all the libs to /usr/lib</p>
<blockquote><p>cp /usr/lib/oracle/11.1/client/lib /usr/lib/</p></blockquote>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 108px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/usr/lib/oracle/11.1/client/lib</div>
<p>/etc/odbcinst.ini Contents:</p>
<blockquote>
<p>[Oracle]<br />
Description     = Oracle ODBC Connection<br />
Driver          = /usr/lib/oracle/11.1/client/lib/libsqora.so.11.1<br />
Setup           =<br />
FileUsage<span style="white-space:pre"> </span>=<br />
CPTimeout<span style="white-space:pre"> </span>=<br />
CPReuse         =</p>
<p>[Sybase]<br />
Description = Sybase ODBC Driver<br />
Driver = /opt/sybase/DataAccess/ODBC/lib/libsybdrvodb.so<br />
FileUsage = -1</p></blockquote>
<p>/etc/odbc.ini Contents:</p>
<blockquote><p>[Oracle]<br />
Application Attributes = T<br />
Attributes = W<br />
BatchAutocommitMode = IfAllSuccessful<br />
CloseCursor = F<br />
DisableDPM = F<br />
DisableMTS = T<br />
Driver = Oracle<br />
EXECSchemaOpt =<br />
EXECSyntax = T<br />
Failover = T<br />
FailoverDelay = 10<br />
FailoverRetryCount = 10<br />
FetchBufferSize = 64000<br />
ForceWCHAR = F<br />
Lobs = T<br />
Longs = T<br />
MetadataIdDefault = F<br />
QueryTimeout = T<br />
ResultSets = T<br />
ServerName = //serverip:port/dbname<br />
SQLGetData extensions = F<br />
Translation DLL =<br />
Translation Option = 0<br />
UserID =</p>
<p>[Sybase]<br />
Driver = Sybase<br />
Server = serverip<br />
Port = serverport<br />
Database = dbname</p></blockquote>
<p>PHP Script to Test ODBC Connectivity:</p>
<blockquote><p>&lt;?php</p>
<p>$query = &#8220;select * from table_name&#8221;;</p>
<p>$conn = odbc_pconnect(&#8220;DSN&#8221;, &#8220;username&#8221;, &#8220;password&#8221;);</p>
<p>if(!$conn) die(&#8220;Connection failed&#8221;);</p>
<p>if($result = odbc_exec($conn, $query)) {</p>
<p><span style="white-space: pre;"> </span>echo &#8220;Query returned : &#8221; . odbc_num_rows($result) . &#8220;rows&#8221;;</p>
<p><span style="white-space: pre;"> </span>odbc_result_all($result);</p>
<p><span style="white-space: pre;"> </span>}</p>
<p>?&gt;</p></blockquote>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://almahdi.cc/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://almahdi.cc/linux/setup-unixodbc-on-linux-for-oracle-and-sybase/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
