<?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>Free script resoure online - WP theme - Joomla theme - VBB theme - Graphic theme &#187; PHP</title>
	<atom:link href="http://www.w3code.net/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.w3code.net</link>
	<description>WP theme - Joomla theme - VBB theme - Graphic theme</description>
	<lastBuildDate>Wed, 01 Feb 2012 08:55:44 +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>How to automated backups your database ?</title>
		<link>http://www.w3code.net/how-to-automated-backups-your-database/</link>
		<comments>http://www.w3code.net/how-to-automated-backups-your-database/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 14:21:33 +0000</pubDate>
		<dc:creator>Script</dc:creator>
				<category><![CDATA[PHP script]]></category>
		<category><![CDATA[Automated backup]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP code]]></category>

		<guid isPermaLink="false">http://www.w3code.net/?p=606</guid>
		<description><![CDATA[Here is a php script that will create a compressed backup of your website files, creating a different file each day for a month (then start over) so you have 30 days of backups. It will email you with a backup confirmation. Run it every night using cron to kick it off. You should download [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a php script that will create a compressed backup of your website files, creating a different file each day for a month (then start over) so you have 30 days of backups.  It will email you with a backup confirmation.  Run it every night using cron to kick it off.  You should download the backup files from the server on a regular basis. Remember to rename the file as a .php file.</p>
<p style="padding-left: 30px;">&lt;?php<br />
$emailaddress = &#8220;XXXXXX@yourdomain.com&#8221;;<br />
$path = &#8220;/full_server_path_to_file_goes_here&#8221;; // full server path to the directory where you want the backup files (no trailing slash)<br />
// modify the above values to fit your environment<br />
$target = $path . &#8220;/backup&#8221; . date(d) . &#8220;.tar.gz&#8221;;<br />
if (file_exists($target)) unlink($target);<br />
system(&#8220;tar &#8211;create &#8211;preserve &#8211;gzip  &#8211;file=&#8221;.$target.&#8221; ~/public_html ~/mail&#8221;,$result);<br />
$size = filesize($target);<br />
switch ($size) {<br />
case ($size&gt;=1048576): $size = round($size/1048576) . &#8221; MB&#8221;; break;<br />
case ($size&gt;=1024);    $size = round($size/1024) . &#8221; KB&#8221;; break;<br />
default:               $size = $size . &#8221; bytes&#8221;; break;<br />
}<br />
$message = &#8220;The website backup has been run.\n\n&#8221;;<br />
$message .= &#8220;The return code was: &#8221; . $result . &#8220;\n\n&#8221;;<br />
$message .= &#8220;The file path is: &#8221; . $target . &#8220;\n\n&#8221;;<br />
$message .= &#8220;Size of the backup: &#8221; . $size . &#8220;\n\n&#8221;;<br />
$message .= &#8220;Server time of the backup: &#8221; . date(&#8221; F d h:ia&#8221;) . &#8220;\n\n&#8221;;<br />
mail($emailaddress, &#8220;Website Backup Message&#8221; , $message, &#8220;From: Website &lt;&gt;&#8221;);<br />
?&gt;</p>
<p>If you want to exclude a directory, add the &#8211;exclude parm to the tar command as shown in the example below (which will exlcude the public_html/audio directory):</p>
<p style="padding-left: 30px;">system(&#8220;tar &#8211;create &#8211;preserve &#8211;gzip &#8211;file=&#8221;.$target.&#8221; &#8211;exclude ~/public_html/audio ~/public_html ~/mail&#8221;,$result);</p>
<p>Please note that this script is very resource intensive.  Do not run it more than once a day, and do not run it at peak times.  If you have a large site the script may timeout depending on the server settings, but the backup may still be created.</p>
<ol>
<li>Before using cron, run the script from your browser to make sure it works as anticipated.</li>
<li>Set a cron job to run the script once a day (at an odd time &#8211; like 4:23am &#8211; to minimize server load issues).</li>
<li>This example backs up the public_html and mail directories. The backup file (named backup.day.tar.gz) will be created in your root directory (above public_html).</li>
<li>When you run this script you will likely get the message &#8220;tar: Removing leading `/&#8217; from member names&#8221;.</li>
</ol>
<p>This is normal, the script is using the settings that most people would want to use.  You can read more about this message, what it means, and alternatives here</p>
  ]]></content:encoded>
			<wfw:commentRss>http://www.w3code.net/how-to-automated-backups-your-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Ban or allow IP Addresses</title>
		<link>http://www.w3code.net/php-ban-or-allow-ip-addresses/</link>
		<comments>http://www.w3code.net/php-ban-or-allow-ip-addresses/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 14:15:48 +0000</pubDate>
		<dc:creator>Script</dc:creator>
				<category><![CDATA[PHP script]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[How to BAN IP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP code]]></category>

		<guid isPermaLink="false">http://www.w3code.net/?p=601</guid>
		<description><![CDATA[While a .htaccess file can be used to ban or allow, it cannot be selective by function. This is something you can easily do with a script. In these examples the IP Addresses are in a file called IP.dat (in the same directory as the script) with one address per line. These scripts can also [...]]]></description>
			<content:encoded><![CDATA[<p>While a <strong><a href="http://www.w3code.net/using-htaccess-to-rewrite-your-url/">.htaccess</a></strong> file can be used to ban or allow, it cannot be selective by function.  This is something you can easily do with a script.</p>
<p>In these examples the IP Addresses are in a file called IP.dat (in the same directory as the script) with one address per line.  These scripts can also ban or allow based on partial IP Addresses.  The code in these scripts must be placed before any other output to the browser (for this page) as they use the header() function for the redirection.</p>
<p>This first script can be used to ban an IP Address from any function on your site. Remember to rename the file as a .php file.</p>
<p style="padding-left: 30px;">&lt;?php<br />
$ip = $_SERVER['REMOTE_ADDR'];<br />
$ipArray = preg_replace(&#8220;#\r\n?|\n#&#8221;,&#8221;",file(&#8216;IP.dat&#8217;));  // read the file into an array and remove new line breaks (should cover all OS)<br />
foreach ($ipArray as $ipTest) {<br />
if (substr_count($ip, $ipTest) != &#8220;0&#8243;) {<br />
header(&#8216;location: /banned.htm&#8217;);  // the banned display page<br />
die();<br />
}<br />
}<br />
?&gt;</p>
<p>For the opposite function, the below script can be used to only allow the specified IP Addresses. Remember to rename the file as a .php file.</p>
<p style="padding-left: 30px;">&lt;?php<br />
$ip = $_SERVER['REMOTE_ADDR'];<br />
$ipArray = preg_replace(&#8220;#\r\n?|\n#&#8221;,&#8221;",file(&#8216;IP.dat&#8217;));  // read the file into an array and remove new line breaks (should cover all OS)<br />
unset($allowed);<br />
foreach ($ipArray as $ipTest) if (substr_count($ip, $ipTest) != &#8220;0&#8243;) $allowed = &#8220;yes&#8221;;<br />
if ($allowed != &#8220;yes&#8221;) {<br />
header(&#8216;location: /banned.htm&#8217;);  // the banned display page<br />
die();<br />
}<br />
?&gt;</p>
  ]]></content:encoded>
			<wfw:commentRss>http://www.w3code.net/php-ban-or-allow-ip-addresses/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google PageRank status display on your page</title>
		<link>http://www.w3code.net/google-pagerank-status-display-page/</link>
		<comments>http://www.w3code.net/google-pagerank-status-display-page/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 08:59:03 +0000</pubDate>
		<dc:creator>Script</dc:creator>
				<category><![CDATA[Ebooks - Tips]]></category>
		<category><![CDATA[PHP script]]></category>
		<category><![CDATA[Google PageRank]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP code]]></category>
		<category><![CDATA[Theme Layout]]></category>

		<guid isPermaLink="false">http://www.w3code.net/?p=546</guid>
		<description><![CDATA[What is Google PageRank?: PageRank is a numeric value that represents how important a page is on the web. It is Google&#8217;s way of measuring the importance of web site. Here is how Google explains PageRank: PageRank relies on the uniquely democratic nature of the web by using its vast link structure as an indicator [...]]]></description>
			<content:encoded><![CDATA[<p><strong>What is Google PageRank?:</strong></p>
<blockquote><p><strong></strong>PageRank is a numeric value that represents how important a page is on the web. It is Google&#8217;s way of measuring the importance of web site.</p></blockquote>
<p><strong>Here is how Google explains PageRank:</strong></p>
<blockquote><p>PageRank relies on the uniquely democratic nature of the web by using its vast link structure as an indicator of an individual page&#8217;s value. Google interprets a link from page A to page B as a vote, by page A, for page B. But Google looks at more than the sheer volume of votes, or links a page receives; it also analyzes the page that casts the vote. Votes cast by pages that are themselves &#8220;important&#8221; weigh more heavily and help to make other pages &#8220;important.&#8221;</p></blockquote>
<p>Firstly, Open Notepad &#8211; Copy &#8211; Paste and save File name:  pagerank.php</p>
<p style="padding-left: 30px;">&lt;?php<br />
define(&#8216;GOOGLE_MAGIC&#8217;, 0xE6359A60);<br />
class pageRank{<br />
var $pr;<br />
function zeroFill($a, $b){<br />
$z = hexdec(80000000);<br />
if ($z &amp; $a){<br />
$a = ($a&gt;&gt;1);<br />
$a &amp;= (~$z);<br />
$a |= 0&#215;40000000;<br />
$a = ($a&gt;&gt;($b-1));<br />
}else{<br />
$a = ($a&gt;&gt;$b);<br />
}<br />
return $a;<br />
}</p>
<p>function mix($a,$b,$c) {<br />
$a -= $b; $a -= $c; $a ^= ($this-&gt;zeroFill($c,13));<br />
$b -= $c; $b -= $a; $b ^= ($a&lt;&lt;8);<br />
$c -= $a; $c -= $b; $c ^= ($this-&gt;zeroFill($b,13));<br />
$a -= $b; $a -= $c; $a ^= ($this-&gt;zeroFill($c,12));<br />
$b -= $c; $b -= $a; $b ^= ($a&lt;&lt;16);<br />
$c -= $a; $c -= $b; $c ^= ($this-&gt;zeroFill($b,5));<br />
$a -= $b; $a -= $c; $a ^= ($this-&gt;zeroFill($c,3));<br />
$b -= $c; $b -= $a; $b ^= ($a&lt;&lt;10);<br />
$c -= $a; $c -= $b; $c ^= ($this-&gt;zeroFill($b,15));<br />
return array($a,$b,$c);<br />
}</p>
<p>function GoogleCH($url, $length=null, $init=GOOGLE_MAGIC) {<br />
if(is_null($length)) {<br />
$length = sizeof($url);<br />
}<br />
$a = $b = 0x9E3779B9;<br />
$c = $init;<br />
$k = 0;<br />
$len = $length;<br />
while($len &gt;= 12) {<br />
$a += ($url[$k+0] +($url[$k+1]&lt;&lt;8) +($url[$k+2]&lt;&lt;16) +($url[$k+3]&lt;&lt;24));<br />
$b += ($url[$k+4] +($url[$k+5]&lt;&lt;8) +($url[$k+6]&lt;&lt;16) +($url[$k+7]&lt;&lt;24));<br />
$c += ($url[$k+8] +($url[$k+9]&lt;&lt;8) +($url[$k+10]&lt;&lt;16)+($url[$k+11]&lt;&lt;24));<br />
$mix = $this-&gt;mix($a,$b,$c);<br />
$a = $mix[0]; $b = $mix[1]; $c = $mix[2];<br />
$k += 12;<br />
$len -= 12;<br />
}<br />
$c += $length;<br />
switch($len){<br />
case 11: $c+=($url[$k+10]&lt;&lt;24);<br />
case 10: $c+=($url[$k+9]&lt;&lt;16);<br />
case 9 : $c+=($url[$k+8]&lt;&lt;8);<br />
/* the first byte of c is reserved for the length */<br />
case 8 : $b+=($url[$k+7]&lt;&lt;24);<br />
case 7 : $b+=($url[$k+6]&lt;&lt;16);<br />
case 6 : $b+=($url[$k+5]&lt;&lt;8);<br />
case 5 : $b+=($url[$k+4]);<br />
case 4 : $a+=($url[$k+3]&lt;&lt;24);<br />
case 3 : $a+=($url[$k+2]&lt;&lt;16);<br />
case 2 : $a+=($url[$k+1]&lt;&lt;8);<br />
case 1 : $a+=($url[$k+0]);<br />
}<br />
$mix = $this-&gt;mix($a,$b,$c);<br />
/* report the result */<br />
return $mix[2];<br />
}</p>
<p>//converts a string into an array of integers containing the numeric value of the char</p>
<p>function strord($string) {<br />
for($i=0;$i&lt;strlen($string);$i++) {<br />
$result[$i] = ord($string{$i});<br />
}<br />
return $result;<br />
}</p>
<p>function printrank($url){<br />
$ch = &#8220;6&#8243;.$this-&gt;GoogleCH($this-&gt;strord(&#8220;info:&#8221; . $url));</p>
<p>$fp = fsockopen(&#8220;www.google.com&#8221;, 80, $errno, $errstr, 30);<br />
if (!$fp) {<br />
echo &#8220;$errstr ($errno)&lt;br /&gt;\n&#8221;;<br />
} else {<br />
$out = &#8220;GET /search?client=navclient-auto&amp;ch=&#8221; . $ch .  &#8220;&amp;features=Rank&amp;q=info:&#8221; . $url . &#8221; HTTP/1.1\r\n&#8221; ;<br />
$out .= &#8220;Host: www.google.com\r\n&#8221; ;<br />
$out .= &#8220;Connection: Close\r\n\r\n&#8221; ;<br />
fwrite($fp, $out);<br />
while (!feof($fp)) {<br />
$data = fgets($fp, 128);<br />
$pos = strpos($data, &#8220;Rank_&#8221;);<br />
if($pos === false){<br />
}else{<br />
$pagerank = substr($data, $pos + 9);<br />
$this-&gt;pr_image($pagerank);<br />
}<br />
}<br />
fclose($fp);<br />
}<br />
}<br />
//display pagerank image. Create your own or download images I made for this script. If you make your own make sure to call them pr0.gif, pr1.gif, pr2.gif etc.<br />
function pr_image($pagerank){<br />
if($pagerank == 0){<br />
$this-&gt;pr = &#8220;&lt;img src=\&#8221;images/pr0.gif\&#8221; alt=\&#8221;PageRank &#8221; .$pagerank. &#8221; out of 10\&#8221;&gt;&#8221; ;<br />
}elseif($pagerank == 1){<br />
$this-&gt;pr = &#8220;&lt;img src=\&#8221;images/pr1.gif\&#8221; alt=\&#8221;PageRank &#8221; .$pagerank. &#8221; out of 10\&#8221;&gt;&#8221; ;<br />
}elseif($pagerank == 2){<br />
$this-&gt;pr = &#8220;&lt;img src=\&#8221;images/pr2.gif\&#8221; alt=\&#8221;PageRank &#8221; .$pagerank. &#8221; out of 10\&#8221;&gt;&#8221; ;<br />
}elseif($pagerank == 3){<br />
$this-&gt;pr = &#8220;&lt;img src=\&#8221;images/pr3.gif\&#8221; alt=\&#8221;PageRank &#8221; .$pagerank. &#8221; out of 10\&#8221;&gt;&#8221; ;<br />
}elseif($pagerank == 4){<br />
$this-&gt;pr = &#8220;&lt;img src=\&#8221;images/pr4.gif\&#8221; alt=\&#8221;PageRank &#8221; .$pagerank. &#8221; out of 10\&#8221;&gt;&#8221; ;<br />
}elseif($pagerank == 5){<br />
$this-&gt;pr = &#8220;&lt;img src=\&#8221;images/pr5.gif\&#8221; alt=\&#8221;PageRank &#8221; .$pagerank. &#8221; out of 10\&#8221;&gt;&#8221; ;<br />
}elseif($pagerank == 6){<br />
$this-&gt;pr = &#8220;&lt;img src=\&#8221;images/pr6.gif\&#8221; alt=\&#8221;PageRank &#8221; .$pagerank. &#8221; out of 10\&#8221;&gt;&#8221; ;<br />
}elseif($pagerank == 7){<br />
$this-&gt;pr = &#8220;&lt;img src=\&#8221;images/pr7.gif\&#8221; alt=\&#8221;PageRank &#8221; .$pagerank. &#8221; out of 10\&#8221;&gt;&#8221; ;<br />
}elseif($pagerank == 8){<br />
$this-&gt;pr = &#8220;&lt;img src=\&#8221;images/pr8.gif\&#8221; alt=\&#8221;PageRank &#8221; .$pagerank. &#8221; out of 10\&#8221;&gt;&#8221; ;<br />
}elseif($pagerank == 9){<br />
$this-&gt;pr = &#8220;&lt;img src=\&#8221;images/pr9.gif\&#8221; alt=\&#8221;PageRank &#8221; .$pagerank. &#8221; out of 10\&#8221;&gt;&#8221; ;<br />
}else{<br />
$this-&gt;pr = &#8220;&lt;img src=\&#8221;images/pr10.gif\&#8221; alt=\&#8221;PageRank &#8221; .$pagerank. &#8221; out of 10\&#8221;&gt;&#8221; ;<br />
}<br />
}<br />
function get_pr(){<br />
return $this-&gt;pr;<br />
}<br />
}<br />
?&gt;</p>
<p><strong>Do following:</strong></p>
<p>Copy this code anh paste into any place on your website to view on:</p>
<p style="padding-left: 30px;">&lt;?php<br />
include(&#8220;pagerank.php&#8221;);<br />
$gpr = new pageRank();<br />
$gpr-&gt;printrank(&#8220;http://www.yahoo.com&#8221;);<br />
//display image<br />
echo $gpr-&gt;get_pr();<br />
?&gt;</p>
  ]]></content:encoded>
			<wfw:commentRss>http://www.w3code.net/google-pagerank-status-display-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP script clock for your website</title>
		<link>http://www.w3code.net/php-script-clock-for-your-website/</link>
		<comments>http://www.w3code.net/php-script-clock-for-your-website/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 19:18:35 +0000</pubDate>
		<dc:creator>Script</dc:creator>
				<category><![CDATA[Java script]]></category>
		<category><![CDATA[PHP script]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP code]]></category>

		<guid isPermaLink="false">http://www.w3code.net/?p=198</guid>
		<description><![CDATA[Keep save as this code with filename.php &#60;? // Binary Clock // script copyright© 2002 Andreas Tscharnuter // questions? contact: psychodad@psychodad.at &#124;&#124; [url=http://www.psychodad.at/clock/]http://www.psychodad.at/clock/[/url] // free to use, copy and modify but leave comments untouched;) // just include this file where your binary clock should appear // version 1.2 03 September 2003 // below you can [...]]]></description>
			<content:encoded><![CDATA[<p>Keep save as this code with <strong>filename.php</strong></p>
<blockquote><p>&lt;?<br />
// Binary Clock<br />
// script copyright© 2002 Andreas Tscharnuter<br />
// questions? contact: psychodad@psychodad.at || [url=http://www.psychodad.at/clock/]http://www.psychodad.at/clock/[/url]<br />
// free to use, copy and modify but leave comments untouched;)<br />
// just include this file where your binary clock should appear<br />
// version 1.2   03 September 2003</p>
<p>// below you can change different settings<br />
// and remember to drink m000re milk!</p>
<p>$size =  &#8220;40&#8243;;  //size of one square in pixel (height &amp; width)<br />
$hourdiff =  &#8220;0&#8243;;  //difference between server time and local time + or -<br />
$bgon =  &#8220;#cc0000&#8243;; //set color in hex for on (#cc0000 = darkred); check google.com for &#8220;hex color table&#8221; if you dont know how to use hex colors<br />
$bgoff =  &#8220;#000000&#8243;; //set color in hex for off (#000000 = black); check google.com for &#8220;hex color table&#8221; if you dont know how to use hex colors<br />
$enableclock = &#8220;1&#8243;;  //switch the &#8220;real clock&#8221; beneath binary clock on(1) or off(0)</p>
<p>/*************************************<br />
nothing needs to be changed below here<br />
*************************************/<br />
$std = str_pad((date(&#8220;H&#8221;) + $hourdiff + 24) % 24,2,&#8221;0&#8243;,STR_PAD_LEFT);<br />
$min = date(&#8220;i&#8221;);<br />
$sec = date(&#8220;s&#8221;);</p>
<p>if ($std &gt; 24 || $std &lt; 0) {<br />
die(&#8220;&lt;b&gt;&lt;font color=\&#8221;#cc0000\&#8221;&gt;$std:$min no way&#8230; =)&lt;/font&gt;&lt;/b&gt;&#8221;);<br />
}<br />
$std1 = decbin(substr($std,0,1));<br />
$std2 = decbin(substr($std,1,1));<br />
$min1 = decbin(substr($min,0,1));<br />
$min2 = decbin(substr($min,1,1));<br />
$sec1 = decbin(substr($sec,0,1));<br />
$sec2 = decbin(substr($sec,1,1));<br />
function reihe($kette,$anfang,$ende) {  //background output<br />
global $size,$bgon,$bgoff;<br />
$pad = str_pad($kette,4,&#8221;0&#8243;,STR_PAD_LEFT);<br />
if(substr($pad,$anfang,$ende)==1) {<br />
echo &#8220;&lt;td width=\&#8221;$size\&#8221; height=\&#8221;$size\&#8221; bgcolor=\&#8221;$bgon\&#8221;&gt;&amp;nbsp;&lt;/td&gt;&#8221;;<br />
} else {<br />
echo &#8220;&lt;td width=\&#8221;$size\&#8221; height=\&#8221;$size\&#8221; bgcolor=\&#8221;$bgoff\&#8221;&gt;&amp;nbsp;&lt;/td&gt;&#8221;;<br />
}<br />
}<br />
?&gt;<br />
&lt;table cellpadding=&#8221;0&#8243; cellspacing=&#8221;1&#8243; border=&#8221;0&#8243; bgcolor=&#8221;#000000&#8243;&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;<br />
&lt;table cellpadding=&#8221;0&#8243; cellspacing=&#8221;1&#8243; border=&#8221;0&#8243; bgcolor=&#8221;#cccccc&#8221;&gt;<br />
&lt;tr&gt;<br />
&lt;td colspan=&#8221;2&#8243; align=&#8221;center&#8221;&gt;&lt;i&gt;&lt;font face=&#8221;verdana&#8221; size=&#8221;1&#8243;&gt;hour&lt;/font&gt;&lt;/i&gt;&lt;/td&gt;<br />
&lt;td colspan=&#8221;2&#8243; align=&#8221;center&#8221;&gt;&lt;i&gt;&lt;font face=&#8221;verdana&#8221; size=&#8221;1&#8243;&gt;min&lt;/font&gt;&lt;/i&gt;&lt;/td&gt;<br />
&lt;td colspan=&#8221;2&#8243; align=&#8221;center&#8221;&gt;&lt;i&gt;&lt;font face=&#8221;verdana&#8221; size=&#8221;1&#8243;&gt;sec&lt;/font&gt;&lt;/i&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;&lt;?<br />
reihe($std1,0,1);<br />
reihe($std2,0,1);<br />
reihe($min1,0,1);<br />
reihe($min2,0,1);<br />
reihe($sec1,0,1);<br />
reihe($sec2,0,1);<br />
?&gt;&lt;/tr&gt;<br />
&lt;tr&gt;&lt;?<br />
reihe($std1,1,1);<br />
reihe($std2,1,1);<br />
reihe($min1,1,1);<br />
reihe($min2,1,1);<br />
reihe($sec1,1,1);<br />
reihe($sec2,1,1);<br />
?&gt;&lt;/tr&gt;<br />
&lt;tr&gt;&lt;?<br />
reihe($std1,2,1);<br />
reihe($std2,2,1);<br />
reihe($min1,2,1);<br />
reihe($min2,2,1);<br />
reihe($sec1,2,1);<br />
reihe($sec2,2,1);<br />
?&gt;&lt;/tr&gt;<br />
&lt;tr&gt;&lt;?<br />
reihe($std1,3,1);<br />
reihe($std2,3,1);<br />
reihe($min1,3,1);<br />
reihe($min2,3,1);<br />
reihe($sec1,3,1);<br />
reihe($sec2,3,1);<br />
?&gt;<br />
&lt;/tr&gt;<br />
&lt;?<br />
if ($enableclock == 1) { //disables,enables bottom clock<br />
?&gt;<br />
&lt;tr&gt;<br />
&lt;td align=&#8221;center&#8221; colspan=&#8221;2&#8243;&gt;&lt;font face=&#8221;verdana&#8221; size=&#8221;1&#8243;&gt;&lt;? echo $std ?&gt;&lt;/font&gt;&lt;/td&gt;<br />
&lt;td align=&#8221;center&#8221; colspan=&#8221;2&#8243;&gt;&lt;font face=&#8221;verdana&#8221; size=&#8221;1&#8243;&gt;&lt;? echo $min ?&gt;&lt;/font&gt;&lt;/td&gt;<br />
&lt;td align=&#8221;center&#8221; colspan=&#8221;2&#8243;&gt;&lt;font face=&#8221;verdana&#8221; size=&#8221;1&#8243;&gt;&lt;? echo $sec ?&gt;&lt;/font&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;? } ?&gt;<br />
&lt;/table&gt;<br />
&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;</p></blockquote>
<p><strong><br />
Short php code clock any where on your site: </strong></p>
<p>This display <strong> infomartion data/time:</strong></p>
<blockquote><p><strong> </strong></p></blockquote>
  ]]></content:encoded>
			<wfw:commentRss>http://www.w3code.net/php-script-clock-for-your-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic Image / Signature Generator</title>
		<link>http://www.w3code.net/dynamic-image-signature-generator/</link>
		<comments>http://www.w3code.net/dynamic-image-signature-generator/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 18:49:24 +0000</pubDate>
		<dc:creator>Script</dc:creator>
				<category><![CDATA[Ebooks - Tips]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[PHP script]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP code]]></category>
		<category><![CDATA[Script code]]></category>
		<category><![CDATA[Source code]]></category>

		<guid isPermaLink="false">http://www.w3code.net/?p=199</guid>
		<description><![CDATA[The file need create: Code 1: dynamic_sig.php (you can rename this to index.php and you&#8217;ll see at the end why) Code 2: a simple text file named anything (I will call it name.txt). &#60;?php header(&#8220;Content-type: image/png&#8221;); $image = imagecreatefrompng(&#8220;../path/sotw_background.png&#8221;); //imagecolorallocate($image, R, G, B) in HEX values $font_black = imagecolorallocate($image, 2, 1, 8); $font_blue = imagecolorallocate($image, [...]]]></description>
			<content:encoded><![CDATA[<p>The file need create:</p>
<p><em>Code 1</em>:<strong> dynamic_sig.php</strong> (you can rename this to index.php and you&#8217;ll see at the end why)<br />
<em>Code 2</em>: a simple text file named anything (I will call it<strong> name.txt</strong>).</p>
<blockquote><p>&lt;?php<br />
header(&#8220;Content-type: image/png&#8221;);</p>
<p>$image = imagecreatefrompng(&#8220;../<strong>path/sotw_background.pn</strong>g&#8221;);</p>
<p>//imagecolorallocate($image, R, G, B) in HEX values<br />
$font_black = imagecolorallocate($image, 2, 1, 8);<br />
$font_blue = imagecolorallocate($image, 25, 0, 255);</p>
<p>$List = &#8220;<strong>name.txt</strong>&#8220;;<br />
$string = trim(file_get_contents($List));;</p>
<p>//($image, fontsize, rightindent, downindent, data, txtcolour)<br />
imagestring($image, 3, 12, 3, &#8220;Welcome to&#8221;, $font_blue);<br />
imagestring($image, 1, 86, 6, &#8220;Hello world&#8221;, $font_black);<br />
imagestring($image, 1, 110, 6, $string, $font_black);</p>
<p>imagepng($image);<br />
imagedestroy($image);</p>
<p>?&gt;</p></blockquote>
<p>You can trans it to dynamic signature by:</p>
<p>Find: <strong>$string = trim(file_get_contents($List));;</strong></p>
<p>Replay for:</p>
<blockquote><p>$select = rand(1,7);<br />
if($select==1)$string = &#8220;text 1&#8243;;<br />
if($select==2)$string = &#8220;text 2&#8243;;<br />
if($select==3)$string = &#8220;text 3&#8243;;<br />
if($select==4)$string = &#8220;text 4&#8243;;<br />
if($select==5)$string = &#8220;text 5&#8243;;<br />
if($select==6)$string = &#8220;text 6&#8243;;<br />
if($select==7)$string = &#8220;text 7&#8243;;</p></blockquote>
<p>With: $List = &#8220;<strong>name.txt</strong>&#8220;; have contents:</p>
<blockquote><p>$string = &#8220;your text 1&#8243;;<br />
$string = &#8220;your text 2&#8243;;</p>
<p>$string = &#8220;your text 3&#8243;;<br />
$string = &#8220;your text 4&#8243;;</p>
<p>$string = &#8220;your text 5&#8243;;<br />
$string = &#8220;your text 6&#8243;;</p>
<p>$string = &#8220;your text 7&#8243;;</p></blockquote>
<p>Done.</p>
  ]]></content:encoded>
			<wfw:commentRss>http://www.w3code.net/dynamic-image-signature-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP script: Watermark your images</title>
		<link>http://www.w3code.net/php-script-watermark-your-images/</link>
		<comments>http://www.w3code.net/php-script-watermark-your-images/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 18:31:24 +0000</pubDate>
		<dc:creator>Script</dc:creator>
				<category><![CDATA[Ebooks - Tips]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[PHP script]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP code]]></category>
		<category><![CDATA[Script code]]></category>
		<category><![CDATA[Watermark script]]></category>

		<guid isPermaLink="false">http://www.w3code.net/?p=196</guid>
		<description><![CDATA[When you want to publish a lot images, so you want to have copyright on images, what should you do for this solution. Now, i want to introduce the way to do that perfectly. Firstly, Open notepad, copy this code below, paste into watermark.php. &#60;?php // this script creates a watermarked image from an image [...]]]></description>
			<content:encoded><![CDATA[<p>When you want to publish a lot images, so you want to have copyright on images, what should you do for this solution.</p>
<p>Now, i want to introduce the way to do that perfectly.</p>
<p>Firstly, Open notepad, copy this code below, paste into <strong>watermark.php.</strong></p>
<blockquote><p><strong>&lt;?php<br />
// this script creates a watermarked image from an image file &#8211; can be a .jpg .gif or .png file<br />
// where watermark.gif is a mostly transparent gif image with the watermark &#8211; goes in the same directory as this script<br />
// where this script is named watermark.php<br />
// call this script with an image tag<br />
// &lt;img src=&#8221;watermark.php?path=imagepath&#8221;&gt; where path is a relative path such as subdirectory/image.jpg<br />
$imagesource =  $_GET['path'];<br />
$watermarkPath = $_GET['watermark'];<br />
$filetype = substr($imagesource,strlen($imagesource)-4,4);<br />
$filetype = strtolower($filetype);<br />
$watermarkType = substr($watermarkPath,strlen($watermarkPath)-4,4);<br />
$watermarkType = strtolower($watermarkType);</p>
<p>if($filetype == &#8220;.gif&#8221;)<br />
$image = @imagecreatefromgif($imagesource);<br />
else<br />
if($filetype == &#8220;.jpg&#8221; || $filetype == &#8220;jpeg&#8221;)<br />
$image = @imagecreatefromjpeg($imagesource);<br />
else<br />
if($filetype == &#8220;.png&#8221;)<br />
$image = @imagecreatefrompng($imagesource);<br />
else<br />
die();</p>
<p>if(!$image)<br />
die();</p>
<p>if($watermarkType == &#8220;.gif&#8221;)<br />
$watermark = @imagecreatefromgif($watermarkPath);<br />
else<br />
if($watermarkType == &#8220;.png&#8221;)<br />
$watermark = @imagecreatefrompng($watermarkPath);<br />
else<br />
die();</p>
<p>if(!$watermark)<br />
die();</p>
<p>$imagewidth = imagesx($image);<br />
$imageheight = imagesy($image);<br />
$watermarkwidth =  imagesx($watermark);<br />
$watermarkheight =  imagesy($watermark);<br />
$startwidth = (($imagewidth &#8211; $watermarkwidth)/2);<br />
$startheight = (($imageheight &#8211; $watermarkheight)/2);<br />
imagecopy($image, $watermark,  $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight);<br />
imagejpeg($image);<br />
imagedestroy($image);<br />
imagedestroy($watermark);<br />
?&gt;</strong></p></blockquote>
<p><strong> </strong>It can be accessed by using:</p>
<blockquote><p>&lt;img src=&#8221;<strong>watermark.php</strong>?path=your_image.*&amp;watermark=watermarkPath.gif&gt;<br />
or<br />
&lt;img src=&#8221;<strong>watermark.php</strong>?path=your_image.*&amp;watermark=watermarkPath.png&gt;</p></blockquote>
<p>Its working well on all OS hosting. Done</p>
  ]]></content:encoded>
			<wfw:commentRss>http://www.w3code.net/php-script-watermark-your-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BAN IP with php script</title>
		<link>http://www.w3code.net/ban-ip-with-php-script/</link>
		<comments>http://www.w3code.net/ban-ip-with-php-script/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 18:22:17 +0000</pubDate>
		<dc:creator>Script</dc:creator>
				<category><![CDATA[Ebooks - Tips]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[PHP script]]></category>
		<category><![CDATA[IP BANNNER]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP code]]></category>
		<category><![CDATA[Script code]]></category>

		<guid isPermaLink="false">http://www.w3code.net/?p=194</guid>
		<description><![CDATA[This first script can be used to ban an IP Address from any function on your site. 1. Make a file name banner.w3 to add IP need to BAN 2. Copy this code below, Open Notepad paste this code into, save as your filename as index.php. &#60;?php $ip = $_SERVER['REMOTE_ADDR']; $ipArray = preg_replace(&#8220;#\r\n?&#124;\n#&#8221;,&#8221;",file(&#8216;banner.w3&#8216;)); foreach ($ipArray [...]]]></description>
			<content:encoded><![CDATA[<p>This first script can be used to ban an IP Address from any function on your site.</p>
<p>1. Make a file name <strong>banner.w3</strong> to add IP need to BAN</p>
<p>2. Copy this code below, Open Notepad paste this code into, save as your filename as <strong>index.php.</strong></p>
<blockquote><p>&lt;?php<br />
$ip = $_SERVER['REMOTE_ADDR'];<br />
$ipArray = preg_replace(&#8220;#\r\n?|\n#&#8221;,&#8221;",file(&#8216;<strong>banner.w3</strong>&#8216;));<br />
foreach ($ipArray as $ipTest) {<br />
if (substr_count($ip, $ipTest) != &#8220;0&#8243;) {<br />
header(&#8216;location: /<strong>alert.html</strong>&#8216;);<br />
die();<br />
}<br />
}<br />
?&gt;</p></blockquote>
<p><strong> Upload in your server and test  it. It work well. Done !</strong></p>
  ]]></content:encoded>
			<wfw:commentRss>http://www.w3code.net/ban-ip-with-php-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto add Watermark on your images</title>
		<link>http://www.w3code.net/auto-add-watermark-on-your-images/</link>
		<comments>http://www.w3code.net/auto-add-watermark-on-your-images/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 16:19:41 +0000</pubDate>
		<dc:creator>Script</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Others]]></category>
		<category><![CDATA[PHP script]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP code]]></category>
		<category><![CDATA[Source code]]></category>

		<guid isPermaLink="false">http://www.w3code.net/?p=177</guid>
		<description><![CDATA[Hi, Everybody here ! The best way to protect your images is to watermark them. But that can be a real hassle. This script will take any image and automatically add a watermark before it is delivered from the server to the person&#8217;s browser. The instructions for using this script are in the comment lines [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Hi, Everybody here !</strong></p>
<p>The best way to protect your images is to watermark them. But that can be a real hassle. This script will take any image and automatically add a watermark before it is delivered from the server to the person&#8217;s browser. The instructions for using this script are in the comment lines at the top of the script. You can see a sample below. You can download the sample (mostly transparent) watermark gif image here.</p>
<p>Very easy for do it: Copy and paste this code into your source code</p>
<blockquote><p>&lt;?php<br />
// this script creates a watermarked image from an image file &#8211; can be a .jpg .gif or .png file<br />
// where watermark.gif is a mostly transparent gif image with the watermark &#8211; goes in the same directory as this script<br />
// where this script is named watermark.php<br />
// call this script with an image tag<br />
// &lt;img src=&#8221;watermark.php?path=imagepath&#8221;&gt; where path is a relative path such as subdirectory/image.jpg<br />
$imagesource =  $_GET['path'];<br />
$filetype = substr($imagesource,strlen($imagesource)-4,4);<br />
$filetype = strtolower($filetype);<br />
if($filetype == &#8220;.gif&#8221;)  $image = @imagecreatefromgif($imagesource);<br />
if($filetype == &#8220;.jpg&#8221;)  $image = @imagecreatefromjpeg($imagesource);<br />
if($filetype == &#8220;.png&#8221;)  $image = @imagecreatefrompng($imagesource);<br />
if (!$image) die();<br />
$watermark = @imagecreatefromgif(&#8216;watermark.gif&#8217;);<br />
$imagewidth = imagesx($image);<br />
$imageheight = imagesy($image);<br />
$watermarkwidth =  imagesx($watermark);<br />
$watermarkheight =  imagesy($watermark);<br />
$startwidth = (($imagewidth &#8211; $watermarkwidth)/2);<br />
$startheight = (($imageheight &#8211; $watermarkheight)/2);<br />
imagecopy($image, $watermark,  $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight);<br />
imagejpeg($image);<br />
imagedestroy($image);<br />
imagedestroy($watermark);<br />
?&gt;</p></blockquote>
<p>The script centers the watermark, but can easily be modified to place it along any edge if you would prefer a different location. For example removing the &#8220;/2&#8243; in the $startwidth and $startheight variable calculations will put the watermark in the lower right corner.</p>
<p>You can then make the original images inaccessible if you put the following lines in a <strong>.htaccess</strong> file in the directory with the images:</p>
<blockquote><p>RewriteEngine On<br />
RewriteCond %{REQUEST_URI} !error.gif$ RewriteRule \.(gif|jpg|png)$ /error.gif [L]</p></blockquote>
  ]]></content:encoded>
			<wfw:commentRss>http://www.w3code.net/auto-add-watermark-on-your-images/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to create contact page with PHP</title>
		<link>http://www.w3code.net/how-to-create-contact-page-with-php/</link>
		<comments>http://www.w3code.net/how-to-create-contact-page-with-php/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 15:43:00 +0000</pubDate>
		<dc:creator>Script</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[PHP script]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP code]]></category>

		<guid isPermaLink="false">http://www.w3code.net/?p=103</guid>
		<description><![CDATA[To view the contact nquan of a member of the Web site can not be flippant contact (Feed-back). I would like to introduce messages by MCR with PHP basic. 1. First you create a file contact.php content: &#60;form method=&#8221;post&#8221; action=&#8221;send.php&#8221;&#62; &#60;input TYPE=&#8221;TEXT&#8221; value=&#8221; you@domainname.com&#8221; NAME=&#8221;email&#8221; size=20&#62; &#60;br&#62; &#60;input TYPE=&#8221;TEXT&#8221; value=&#8221;Title mail&#8221; NAME=&#8221;subject&#8221; size=20&#62; &#60;br&#62; &#60;TEXTAREA [...]]]></description>
			<content:encoded><![CDATA[<p>To view the contact nquan of a member of the Web site can not be flippant contact (Feed-back). I would like to introduce messages by MCR with PHP basic.</p>
<p>1. First you create a file <strong>contact.php</strong> content:</p>
<blockquote><p>&lt;form method=&#8221;post&#8221; action=&#8221;send.php&#8221;&gt;<br />
&lt;input TYPE=&#8221;TEXT&#8221; value=&#8221; y<strong>ou@domainname.com</strong>&#8221; NAME=&#8221;email&#8221; size=20&gt; &lt;br&gt;<br />
&lt;input TYPE=&#8221;TEXT&#8221; value=&#8221;Title mail&#8221; NAME=&#8221;subject&#8221; size=20&gt; &lt;br&gt;<br />
&lt;TEXTAREA NAME=&#8221;comments&#8221; value=&#8221;Your Message Here&#8221; ROWS=5 COLS=20&gt; your message &lt;/ textarea&gt; &lt;br&gt;<br />
&lt;input type=&#8221;submit&#8221; name=&#8221;submit&#8221; value=&#8221;Send now&#8221;&gt; &lt;input type=&#8221;reset&#8221; name=&#8221;reset&#8221; value=&#8221;Try again&#8221;&gt; &lt;br&gt;<br />
&lt;/ form&gt;</p></blockquote>
<p>2. Create <strong>send.php</strong> file with contents:</p>
<blockquote><p>&lt;? php<br />
mail ( &#8220;<strong>you@yourdomain.com</strong>&#8220;, &#8220;$ subject&#8221;, &#8220;$ email&#8221;, &#8220;$ comments&#8221;);<br />
echo ( &#8220;$ email Thank you! &lt;br&gt; \ n  I will try to read and respond in the shortest time &lt;br&gt; &lt;br&gt; \ nSubject: $ subject &lt;br&gt;<br />
Email: $ email<br />
\ nMessage: $ comments &#8220;);<br />
?&gt;</p></blockquote>
<p>4. Note: Change &#8220;<strong>you@yourdomain.com</strong>&#8221; in the file <strong>send.php</strong> with your email.</p>
  ]]></content:encoded>
			<wfw:commentRss>http://www.w3code.net/how-to-create-contact-page-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto watermark all images for WordPress</title>
		<link>http://www.w3code.net/auto-watermark-all-images-for-wordpress/</link>
		<comments>http://www.w3code.net/auto-watermark-all-images-for-wordpress/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 15:12:47 +0000</pubDate>
		<dc:creator>Script</dc:creator>
				<category><![CDATA[Ebooks - Tips]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[PHP script]]></category>
		<category><![CDATA[Wordpress template]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Auto watermark]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP code]]></category>
		<category><![CDATA[Script code]]></category>
		<category><![CDATA[Source code]]></category>

		<guid isPermaLink="false">http://www.w3code.net/?p=201</guid>
		<description><![CDATA[How many of you have wanted to have a watermark on all of your images? Lets say you are just starting your blog and you will just fire up Adobe Photoshop or any other image editing program and you will add a watermark on each image you have. It is time consuming but it will [...]]]></description>
			<content:encoded><![CDATA[<p>How many of you have wanted to have a watermark on all of your images?<br />
Lets say you are just starting your blog and you will just fire up Adobe Photoshop or any other image editing program and you will add a watermark on each image you have. It is time consuming but it will work.</p>
<p>But what if you have a blog for a really long time and you just decided you want to watermark all your images. You would have to copy every image on your blog to your computer, open all of them up and add a watermark.</p>
<p>But what about the original images? What if you ever need them without the watermark?<br />
Here is my solution. I have been using this on a number of blogs and it work for me.<br />
I must worn you do that it is for some what advanced users.</p>
<p>What we are going to do is fake the display of an image. What we are actually going to display instead of the image is a php file that processes the image and ads a watermark to it. The url of the image stays the same, the watermark get put on and best of all the image on the server doesn&#8217;t get modified at all.</p>
<p>All you need is a bit of code in the .htaccess file, a php watermark processing file and a watermark image (png preferably).</p>
<p><strong> The first</strong>: Add this code in your <strong>.htaccess</strong> file:</p>
<blockquote><p>RewriteRule ^(.*)<strong>wp-content/uploads</strong>/(.*) $1<strong>watermark.php?src=wp-content/uploads/$2</strong></p></blockquote>
<p><strong>The second</strong>:  Create a new file in the root of your directory(where wp-admin, wp-content and wp-include is) and name that file <strong>watermark.php</strong>. After that copy and paste the code below in that file and save it.</p>
<blockquote><p>$src = $_GET['src'];</p>
<p>header(&#8216;Content-type: image/jpeg&#8217;);</p>
<p>//this will prevent the watermark from showing up in the thumbnail images<br />
if (eregi(&#8220;150&#215;150&#8243;, $src)) {<br />
$watermark = imagecreatefrompng(&#8216;empty.png&#8217;);<br />
} else {<br />
$watermark = imagecreatefrompng(&#8216;watermark.png&#8217;);<br />
}<br />
$watermark_width = imagesx($watermark);<br />
$watermark_height = imagesy($watermark);<br />
$image = imagecreatetruecolor($watermark_width, $watermark_height);<br />
if(eregi(&#8216;.gif&#8217;,$src)) {<br />
$image = imagecreatefromgif($src);<br />
}<br />
elseif(eregi(&#8216;.jpeg&#8217;,$src)||eregi(&#8216;.jpg&#8217;,$src)) {<br />
$image = imagecreatefromjpeg($src);<br />
}<br />
elseif(eregi(&#8216;.png&#8217;,$src)) {<br />
$image = imagecreatefrompng($src);<br />
}<br />
else {<br />
exit(&#8220;Your image is not a gif, jpeg or png image. Sorry.&#8221;);<br />
}<br />
$size = getimagesize($src);<br />
$dest_x = $size[0] &#8211; $watermark_width &#8211; 0;<br />
$dest_y = $size[1] &#8211; $watermark_height &#8211; 0;<br />
imagecolortransparent($watermark,imagecolorat($watermark,0,0));<br />
imagecopyresampled($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $watermark_width, $watermark_height);</p>
<p>imagejpeg($image, &#8220;&#8221;, 95);<br />
imagedestroy($image);<br />
imagedestroy($watermark);</p></blockquote>
<p>Use any image editor you like and create a png file that will be your watermark image. Save that image with the name &#8220;<strong>watermark.png</strong>&#8221; and put it in your root directory.<br />
Also create a png image which is 1×1pixels and it must be transparent. Name that file &#8220;<strong>empty.png</strong>&#8221; and save it also in your root directory.</p>
<p>That 1×1px image is meant to be displayed on the thumbnail images. The thumbnails are to small to but a watermark on them, it wouldn&#8217;t look too good.</p>
  ]]></content:encoded>
			<wfw:commentRss>http://www.w3code.net/auto-watermark-all-images-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

