<?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>Denover &#187; php</title>
	<atom:link href="http://denover.com/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://denover.com</link>
	<description>Блог для всех и обо всём</description>
	<lastBuildDate>Fri, 30 Mar 2012 05:40:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>php print page break</title>
		<link>http://denover.com/php-print-page-break/223?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-print-page-break</link>
		<comments>http://denover.com/php-print-page-break/223#comments</comments>
		<pubDate>Wed, 22 Apr 2009 14:13:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Компьютеры]]></category>
		<category><![CDATA[page break]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[word]]></category>
		<category><![CDATA[word document]]></category>

		<guid isPermaLink="false">http://www.denover.com/?p=223</guid>
		<description><![CDATA[Use this code for php print page break in word document. &#60;br style=&#187;page-break-before:always&#187; /&#62;]]></description>
			<content:encoded><![CDATA[<p>Use this code for php print page break in word document.</p>
<blockquote><p>&lt;br style=&raquo;page-break-before:always&raquo; /&gt;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://denover.com/php-print-page-break/223/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Список IP адресов серверов, с которых производились рассылки СПАМа</title>
		<link>http://denover.com/%d1%81%d0%bf%d0%b8%d1%81%d0%be%d0%ba-ip-%d0%b0%d0%b4%d1%80%d0%b5%d1%81%d0%be%d0%b2-%d1%81%d0%b5%d1%80%d0%b2%d0%b5%d1%80%d0%be%d0%b2-%d1%81-%d0%ba%d0%be%d1%82%d0%be%d1%80%d1%8b%d1%85-%d0%bf%d1%80/188?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25d1%2581%25d0%25bf%25d0%25b8%25d1%2581%25d0%25be%25d0%25ba-ip-%25d0%25b0%25d0%25b4%25d1%2580%25d0%25b5%25d1%2581%25d0%25be%25d0%25b2-%25d1%2581%25d0%25b5%25d1%2580%25d0%25b2%25d0%25b5%25d1%2580%25d0%25be%25d0%25b2-%25d1%2581-%25d0%25ba%25d0%25be%25d1%2582%25d0%25be%25d1%2580%25d1%258b%25d1%2585-%25d0%25bf%25d1%2580</link>
		<comments>http://denover.com/%d1%81%d0%bf%d0%b8%d1%81%d0%be%d0%ba-ip-%d0%b0%d0%b4%d1%80%d0%b5%d1%81%d0%be%d0%b2-%d1%81%d0%b5%d1%80%d0%b2%d0%b5%d1%80%d0%be%d0%b2-%d1%81-%d0%ba%d0%be%d1%82%d0%be%d1%80%d1%8b%d1%85-%d0%bf%d1%80/188#comments</comments>
		<pubDate>Wed, 04 Feb 2009 16:34:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Компьютеры]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[dnsbl]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.denover.com/?p=188</guid>
		<description><![CDATA[DNSBL — это динамически обновляющийся список IP адресов серверов, с помощью которых производились рассылки СПАМа. Скрипт проверки: /* * Check DNSBL &#8211; WIN also &#8211; DD */ function blacklisted($ip) { $dnsbl_lists = array(&#171;bl.spamcop.net&#187;, &#171;list.dsbl.org&#187;, &#171;sbl.spamhaus.org&#187;); if ($ip &#38;&#38; preg_match(&#8216;/^([0-9]{1, 3})\.([0-9]{1, 3})\.([0-9]{1, 3})\.([0-9]{1, 3})/&#8217;, $ip)) { $reverse_ip = implode(&#171;.&#187;, array_reverse(explode(&#171;.&#187;, $ip))); $on_win = substr(PHP_OS, 0, 3) [...]]]></description>
			<content:encoded><![CDATA[<p><strong>DNSBL</strong> — это динамически обновляющийся список IP адресов серверов, с помощью которых производились рассылки СПАМа.</p>
<p><span id="more-188"></span>Скрипт проверки:</p>
<p>/*<br />
* Check DNSBL &#8211; WIN also &#8211; DD<br />
*/<br />
function blacklisted($ip) {<br />
$dnsbl_lists = array(&laquo;bl.spamcop.net&raquo;, &laquo;list.dsbl.org&raquo;, &laquo;sbl.spamhaus.org&raquo;);<br />
if ($ip &amp;&amp; preg_match(&#8216;/^([0-9]{1, 3})\.([0-9]{1, 3})\.([0-9]{1, 3})\.([0-9]{1, 3})/&#8217;, $ip)) {<br />
$reverse_ip = implode(&laquo;.&raquo;, array_reverse(explode(&laquo;.&raquo;, $ip)));<br />
$on_win = substr(PHP_OS, 0, 3) == &laquo;WIN&raquo; ? 1 : 0;<br />
foreach ($dnsbl_lists as $dnsbl_list){<br />
if (function_exists(&laquo;checkdnsrr&raquo;)) {<br />
if (checkdnsrr($reverse_ip . &laquo;.&raquo; . $dnsbl_list . &laquo;.&raquo;, &laquo;A&raquo;)) {<br />
return $reverse_ip . &laquo;.&raquo; . $dnsbl_list;<br />
}<br />
} else if ($on_win == 1) {<br />
$lookup = &laquo;&raquo;;<br />
@exec(&laquo;nslookup -type=A &raquo; . $reverse_ip . &laquo;.&raquo; . $dnsbl_list . &laquo;.&raquo;, $lookup);<br />
foreach ($lookup as $line) {<br />
if (strstr($line, $dnsbl_list)) {<br />
return $reverse_ip . &laquo;.&raquo; . $dnsbl_list;<br />
}<br />
}<br />
}<br />
}<br />
}<br />
return false;<br />
}<br />
?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://denover.com/%d1%81%d0%bf%d0%b8%d1%81%d0%be%d0%ba-ip-%d0%b0%d0%b4%d1%80%d0%b5%d1%81%d0%be%d0%b2-%d1%81%d0%b5%d1%80%d0%b2%d0%b5%d1%80%d0%be%d0%b2-%d1%81-%d0%ba%d0%be%d1%82%d0%be%d1%80%d1%8b%d1%85-%d0%bf%d1%80/188/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP function for make JSON</title>
		<link>http://denover.com/php-function-for-make-json/166?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-function-for-make-json</link>
		<comments>http://denover.com/php-function-for-make-json/166#comments</comments>
		<pubDate>Fri, 07 Nov 2008 03:01:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Новости]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[array function]]></category>
		<category><![CDATA[foreach]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.denover.com/?p=166</guid>
		<description><![CDATA[PHP function for make JSON from array function cff_php2js($a) { if (is_null($a)) return 'null'; if ($a === false) return 'false'; if ($a === true) return 'true'; if (is_scalar($a)) { $a = addslashes($a); $a = str_replace("\n", '\n', $a); $a = str_replace("\r", '\r', $a); $a = preg_replace('{(&#60;/)(script)}i', "$1'+'$2", $a); if (is_numeric($a)) return "$a"; else return "'$a'"; } [...]]]></description>
			<content:encoded><![CDATA[<p>PHP function for make JSON from array</p>
<p><span id="more-166"></span></p>
<p><code> function cff_php2js($a)<br />
{<br />
if (is_null($a)) return 'null';<br />
if ($a === false) return 'false';<br />
if ($a === true) return 'true';<br />
if (is_scalar($a)) {<br />
$a = addslashes($a);<br />
$a = str_replace("\n", '\n', $a);<br />
$a = str_replace("\r", '\r', $a);<br />
$a = preg_replace('{(&lt;/)(script)}i', "$1'+'$2", $a);<br />
if (is_numeric($a))<br />
return "$a";<br />
else<br />
return "'$a'";<br />
}<br />
$isList = true;<br />
for ($i=0, reset($a); $i&lt;count($a); $i++, next($a))<br />
if (key($a) !== $i) { $isList = false; break; }<br />
$result = array();<br />
if ($isList) {<br />
foreach ($a as $v) $result[] = cff_php2js($v);<br />
return '[ ' . implode(', ', $result) . ' ]'."\n";<br />
} else {<br />
foreach ($a as $k=&gt;$v)<br />
$result[] = cff_php2js($k) . ': ' . cff_php2js($v);<br />
return '{ ' . implode(", ", $result) . ' }'."\n";<br />
}<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://denover.com/php-function-for-make-json/166/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting real IP address in PHP</title>
		<link>http://denover.com/getting-real-ip-address-in-php/105?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-real-ip-address-in-php</link>
		<comments>http://denover.com/getting-real-ip-address-in-php/105#comments</comments>
		<pubDate>Thu, 17 Jul 2008 05:41:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Компьютеры]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.denover.com/?p=105</guid>
		<description><![CDATA[Are you using $_SERVER['REMOTE_ADDR'] to find the the client’s IP address in PHP? Well dude, you might be amazed to know that it may not return the true IP address of the client at all time. If your client is connected to the Internet through Proxy Server then $_SERVER['REMOTE_ADDR'] in PHP just returns the the [...]]]></description>
			<content:encoded><![CDATA[<p>Are you using $_SERVER['REMOTE_ADDR'] to find the the client’s IP address in PHP? Well dude, you might be amazed to know that it may not return the true IP address of the client at all time. If your client is connected to the Internet through Proxy Server then $_SERVER['REMOTE_ADDR'] in PHP just returns the the IP address of the proxy server not of the client’s machine.  So here is a simple function in PHP to find the real IP address of the client’s machine. <span id="more-105"></span>There are extra Server variable which might be available to determine the exact IP address of the client’s machine in PHP, they are HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR.</p>
<p><strong><a title="getting real ip address in php" href="http://www.denover.com/getting-real-ip-address-in-phpgetting-real-ip-address-in-php/" target="_self">Function to find real IP address in PHP</a></strong></p>
<blockquote><p>function getRealIpAddr()<br />
{<br />
if (!empty($_SERVER['HTTP_CLIENT_IP']))<br />
//check ip from share internet<br />
{<br />
$ip=$_SERVER['HTTP_CLIENT_IP'];<br />
}<br />
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))<br />
//to check ip is pass from proxy<br />
{<br />
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];<br />
}<br />
else<br />
{<br />
$ip=$_SERVER['REMOTE_ADDR'];<br />
}<br />
return $ip;<br />
}</p></blockquote>
<p>In this PHP function, first attempt is to get the direct IP address of client’s machine, if not available then try for forwarded for IP address using HTTP_X_FORWARDED_FOR. And if this is also not available, then finally get the IP address using REMOTE_ADDR.</p>
]]></content:encoded>
			<wfw:commentRss>http://denover.com/getting-real-ip-address-in-php/105/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>foreach in JavaScript</title>
		<link>http://denover.com/foreach-in-javascript/104?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=foreach-in-javascript</link>
		<comments>http://denover.com/foreach-in-javascript/104#comments</comments>
		<pubDate>Tue, 08 Jul 2008 08:22:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Компьютеры]]></category>
		<category><![CDATA[foreach]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.denover.com/?p=104</guid>
		<description><![CDATA[Actually that&#8217;s not true at all. As all javascript objects are really just associative arrays, there is a foreach like syntax for the &#8216;for&#8217; construct. Without it it would be very hard to work with many common javascript objects. It&#8217;s actually very simple to use and incredibly useful if you like associative arrays. You just [...]]]></description>
			<content:encoded><![CDATA[<p>Actually that&#8217;s not true at all.<br />
As all javascript objects are really just associative arrays, there is a foreach like syntax for the &#8216;for&#8217; construct.<br />
Without it it would be very hard to work with many common javascript objects.<br />
It&#8217;s actually very simple to use and incredibly useful if you like associative arrays.</p>
<p>You just have to make sure to use it on an associative array and not an object.<br />
Example below</p>
<p><span id="more-104"></span></p>
<p><strong><em>Good (assuming Object has not been overloaded or extended):</em></strong></p>
<blockquote><p>var array = new Object(); //this is safe only if you can assure object has not been extended.<br />
//use the below if Object has been extended<br />
var array;</p>
<p>//everything below here works fine regardless of the two above cases<br />
array['something'] = &#8216;yay&#8217;;<br />
array['somethingelse'] = &#8216;more&#8217;;</p>
<p>for ( keyVar in array ) {<br />
alert(array[keyVar]);<br />
}</p></blockquote>
<p><strong><em>Bad:</em></strong></p>
<blockquote><p>var array = new Array(); //uh oh, array is an object which means it&#8217;s an associative array</p>
<p>//the below loop will actually give you results, despite never putting &laquo;values&raquo; into<br />
//the array variable. This is because array has functions defined from the Array() object<br />
//which will be grabbed by the keyVar since objects are really associative arrays<br />
for ( keyVar in array ) {<br />
alert(array[keyVar]);<br />
}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://denover.com/foreach-in-javascript/104/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert a Webpage to Plain Text</title>
		<link>http://denover.com/convert-a-webpage-to-plain-text/60?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=convert-a-webpage-to-plain-text</link>
		<comments>http://denover.com/convert-a-webpage-to-plain-text/60#comments</comments>
		<pubDate>Tue, 25 Mar 2008 22:15:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Новости]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.denover.com/convert-a-webpage-to-plain-text/60</guid>
		<description><![CDATA[This function takes a URL and returns a plain-text version of the page. It uses cURL to retrieve the page and a combination of regular expressions to strip all unwanted whitespace. This function will even strip the text from STYLE and SCRIPT tags, which are ignored by PHP functions such as strip_tags (they strip only [...]]]></description>
			<content:encoded><![CDATA[<p>This function takes a URL and returns a plain-text version of the page. It uses cURL to retrieve the page and a combination of regular expressions to strip all unwanted whitespace. This function will even strip the text from STYLE and SCRIPT tags, which are ignored by PHP functions such as strip_tags (they strip only the tags, leaving the text in the middle intact).</p>
<p>Regular expressions were split in 2 stages, to avoid deleting single carriage returns (also matched by \s) but still delete all blank lines and multiple linefeeds or spaces, trimming operations took place in 2 stages.<span id="more-60"></span></p>
<p>function webpage2txt($url)<br />
{<br />
$user_agent = &laquo;Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)&raquo;;<br />
$ch = curl_init(); // initialize curl handle<br />
curl_setopt($ch, CURLOPT_URL, $url); // set url to post to<br />
curl_setopt($ch, CURLOPT_FAILONERROR, 1); // Fail on errors<br />
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable<br />
curl_setopt($ch, CURLOPT_PORT, 80); //Set the port number<br />
curl_setopt($ch, CURLOPT_TIMEOUT, 15); // times out after 15s<br />
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);<br />
$document = curl_exec($ch);<br />
$search = array(&#8216;@&lt;script[^&gt;]*?&gt;.*?&lt;/script&gt;@si&#8217;, // Strip out javascript<br />
&#8216;@&lt;style[^&gt;]*?&gt;.*?&lt;/style&gt;@siU&#8217;, // Strip style tags properly<br />
&#8216;@&lt;[\/\!]*?[^&lt;&gt;]*?&gt;@si&#8217;, // Strip out HTML tags<br />
&#8216;@&lt;![\s\S]*?–[ \t\n\r]*&gt;@&#8217;, // Strip multi-line comments including CDATA<br />
&#8216;/\s{2,}/&#8217;,<br />
);<br />
$text = preg_replace($search, &laquo;\n&raquo;, html_entity_decode($document));<br />
$pat[0] = &laquo;/^\s+/&raquo;;<br />
$pat[2] = &laquo;/\s+\$/&raquo;;<br />
$rep[0] = &laquo;&raquo;;<br />
$rep[2] = &raquo; &laquo;;<br />
$text = preg_replace($pat, $rep, trim($text));<br />
return $text;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://denover.com/convert-a-webpage-to-plain-text/60/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP5 OOP</title>
		<link>http://denover.com/php5-oop/45?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php5-oop</link>
		<comments>http://denover.com/php5-oop/45#comments</comments>
		<pubDate>Thu, 06 Mar 2008 16:58:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Новости]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.denover.com/?p=45</guid>
		<description><![CDATA[Object oriented &#38; design patterns &#8211; php5 [hebrew] Overview about object-oriented programming, using objects in php5 and design patterns examples for php5. [for php-israel community] MVC example: http://www.denover.com/uploads/mvc-sample.tar.gz]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.denover.com/uploads/oo-php5-hebrew.pdf">Object oriented &amp; design patterns &#8211; php5 [hebrew]</a><br />
Overview about object-oriented programming, using objects in php5 and design patterns examples for php5. [for php-israel community]</p>
<p>MVC example:</p>
<p>http://www.denover.com/uploads/mvc-sample.tar.gz</p>
]]></content:encoded>
			<wfw:commentRss>http://denover.com/php5-oop/45/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

