<?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>PHP Magic Book - Free PHP Scripts, Tutorials and Downloads &#187; Cookies</title>
	<atom:link href="http://www.phpmagicbook.com/category/cookies/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpmagicbook.com</link>
	<description>PHP AtoZ Reloaded, free php tutorials, free php downloads, php scripts, PHP tips</description>
	<lastBuildDate>Tue, 15 Jun 2010 13:22:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Find Screen Resolution With PHP</title>
		<link>http://www.phpmagicbook.com/find-screen-resolution-with-php/</link>
		<comments>http://www.phpmagicbook.com/find-screen-resolution-with-php/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 18:47:56 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Checks]]></category>
		<category><![CDATA[Cookies]]></category>
		<category><![CDATA[Tricks]]></category>
		<category><![CDATA[Useful Scripts]]></category>
		<category><![CDATA[php screen resolution]]></category>
		<category><![CDATA[Resolution]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[useful]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=202</guid>
		<description><![CDATA[I think there is no way yet to find out screen resolution with PHP. hehehe. If I am wrong please correct me. But yet we can trick it to be happen ;-) If not then how can we be developers. Right! With javascript we find out screen resolution of PC. Store it in a cookie [...]<p><a href="http://www.phpmagicbook.com/find-screen-resolution-with-php/">Find Screen Resolution With PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I think there is no way yet to find out screen resolution with PHP. hehehe.<br />
If I am wrong please correct me.<br />
But yet we can trick it to be happen ;-)<br />
If not then how can we be developers. Right!</p>
<p>With javascript we find out screen resolution of PC. Store it in a cookie and display it with PHP.<br />
Coool&#8230;eh! Fine, lets just do it.</p>
<p><span id="more-260"></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script LANGUAGE<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;javascript&quot;</span><span style="color: #339933;">&gt;</span>
width <span style="color: #339933;">=</span> screen.<span style="color: #660066;">width</span><span style="color: #339933;">;</span>
height <span style="color: #339933;">=</span> screen.<span style="color: #660066;">height</span><span style="color: #339933;">;</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;b&gt;You're set to &quot;</span><span style="color: #339933;">+</span>width<span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;X&quot;</span> <span style="color: #339933;">+</span>height<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/b&gt;&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$yo</span><span style="color: #339933;">=</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'width'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$yo</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>For head section of webpage.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$HTTP_COOKIE_VARS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;users_resolution&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000088;">$screen_res</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$HTTP_COOKIE_VARS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;users_resolution&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">else</span> <span style="color: #666666; font-style: italic;">//means cookie is not found set it using Javascript</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script language<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;!--</span>
writeCookie<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> writeCookie<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #003366; font-weight: bold;">var</span> today <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> the_date <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;December 31, 2023&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> the_cookie_date <span style="color: #339933;">=</span> the_date.<span style="color: #660066;">toGMTString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> the_cookie <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;users_resolution=&quot;</span><span style="color: #339933;">+</span> screen.<span style="color: #660066;">width</span> <span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;x&quot;</span><span style="color: #339933;">+</span> screen.<span style="color: #660066;">height</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> the_cookie <span style="color: #339933;">=</span> the_cookie <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;;expires=&quot;</span> <span style="color: #339933;">+</span> the_cookie_date<span style="color: #339933;">;</span>
document.<span style="color: #660066;">cookie</span><span style="color: #339933;">=</span>the_cookie
location <span style="color: #339933;">=</span> <span style="color: #3366CC;">'screen.php'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #006600; font-style: italic;">//--&gt;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Body section of webpage. Display the screen resolution.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Your screen resolution is set at &quot;</span><span style="color: #339933;">.</span> <span style="color: #000088;">$screen_res</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Enjoy!!! &#8230;Chill Pill&#8230;</p>
<p><a href='http://www.phpmagicbook.com/wp-content/uploads/2008/08/screen.rar' class="download">Download Script</a></p>
<p><a href="http://www.phpmagicbook.com/find-screen-resolution-with-php/">Find Screen Resolution With PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/php-file-upload-script-globals-off/" title="PHP File Upload Script &#8211; Globals Off">PHP File Upload Script &#8211; Globals Off</a></li><li><a href="http://www.phpmagicbook.com/date-difference-in-php-find-date-difference/" title="Date Difference In PHP &#8211; Find Date Difference">Date Difference In PHP &#8211; Find Date Difference</a></li><li><a href="http://www.phpmagicbook.com/find-file-path-at-server-using-php/" title="Find File Path At Server Using PHP">Find File Path At Server Using PHP</a></li><li><a href="http://www.phpmagicbook.com/find-page-url-php/" title="Find Page URL With PHP &#8211; File Path">Find Page URL With PHP &#8211; File Path</a></li><li><a href="http://www.phpmagicbook.com/browser-check-with-php/" title="Browser Check With PHP">Browser Check With PHP</a></li><li><a href="http://www.phpmagicbook.com/function-existence-check/" title="Function Existence Check Using PHP">Function Existence Check Using PHP</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/find-screen-resolution-with-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Creating And Retrieving Cookies In PHP</title>
		<link>http://www.phpmagicbook.com/php-cookies-create/</link>
		<comments>http://www.phpmagicbook.com/php-cookies-create/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 04:04:30 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Cookies]]></category>
		<category><![CDATA[isset]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[store]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=189</guid>
		<description><![CDATA[Cookies were invented to allow webmaster&#8217;s to store information about the user and their visit or other information on the user&#8217;s computer. Cookies are not privacy risk. All of the &#8220;trustworthy&#8221; websites use cookies. Creating Cookie &#8211; Last Visit Script &#60;?php //Calculate 60 days in the future //seconds * minutes * hours * days + [...]<p><a href="http://www.phpmagicbook.com/php-cookies-create/">Creating And Retrieving Cookies In PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Cookies were invented to allow webmaster&#8217;s to store information about the user and their visit or other information on the user&#8217;s computer. Cookies are not privacy risk. All of the &#8220;trustworthy&#8221; websites use cookies.</p>
<p><span id="more-253"></span></p>
<h4>Creating Cookie &#8211; Last Visit Script</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//Calculate 60 days in the future</span>
<span style="color: #666666; font-style: italic;">//seconds * minutes * hours * days + current time</span>
<span style="color: #000088;">$inTwoMonths</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">60</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">60</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">24</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">60</span> <span style="color: #339933;">+</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">setcookie</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'lastVisit'</span><span style="color: #339933;">,</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;G:i - m/d/y&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$inTwoMonths</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h4>Retrieving Cookie</h4>
<p>If your cookie hasn&#8217;t expired yet, you can retrieve it from the user&#8217;s PC using the named $_COOKIE associative array. The name of your stored cookie is the key and will let you retrieve your stored cookie value!</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_COOKIE</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lastVisit'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #000088;">$visit</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_COOKIE</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lastVisit'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">else</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;You've got some stale cookies!&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Your last visit was - &quot;</span><span style="color: #339933;">.</span> <span style="color: #000088;">$visit</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><a href="http://www.phpmagicbook.com/php-cookies-create/">Creating And Retrieving Cookies In PHP</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/php-do-while-loop/" title="PHP Do While Loop">PHP Do While Loop</a></li><li><a href="http://www.phpmagicbook.com/php-explode/" title="PHP &#8211; Explode">PHP &#8211; Explode</a></li><li><a href="http://www.phpmagicbook.com/php-script-not-working-solution/" title="PHP Script Not Working &#8211; Solution">PHP Script Not Working &#8211; Solution</a></li><li><a href="http://www.phpmagicbook.com/local-and-remote-ip-address/" title="Local And Remote IP Address">Local And Remote IP Address</a></li><li><a href="http://www.phpmagicbook.com/text-to-image-using-php/" title="Text To Image Using PHP">Text To Image Using PHP</a></li><li><a href="http://www.phpmagicbook.com/image-gallery/" title="Auto Create Image Gallery from Folder Using PHP">Auto Create Image Gallery from Folder Using PHP</a></li><li><a href="http://www.phpmagicbook.com/show-a-part-of-string-substr/" title="Show A Part Of String &#8211; substr in PHP">Show A Part Of String &#8211; substr in PHP</a></li><li><a href="http://www.phpmagicbook.com/if-statement/" title="PHP If Statement">PHP If Statement</a></li><li><a href="http://www.phpmagicbook.com/elseif-conditions/" title="Elseif Conditions in PHP">Elseif Conditions in PHP</a></li><li><a href="http://www.phpmagicbook.com/comments-in-php/" title="Comments In PHP">Comments In PHP</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/php-cookies-create/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change Color Theme With PHP &#8211; CSS Switch</title>
		<link>http://www.phpmagicbook.com/change-color-theme-with-php-css-switch/</link>
		<comments>http://www.phpmagicbook.com/change-color-theme-with-php-css-switch/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 00:29:47 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Cookies]]></category>
		<category><![CDATA[Switch]]></category>
		<category><![CDATA[css switch]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=133</guid>
		<description><![CDATA[Concept is to change the CSS file of website for user to give website new color look. It is done by creating a cookie in user&#8217;s system. One switch file, other pages and css files are used in this example. Switch file change CSS applied at website, creates a cookie, saves it and after that [...]<p><a href="http://www.phpmagicbook.com/change-color-theme-with-php-css-switch/">Change Color Theme With PHP &#8211; CSS Switch</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Concept is to change the CSS file of website for user to give website new color look. It is done by creating a cookie in user&#8217;s system.<br />
One switch file, other pages and css files are used in this example. Switch file change CSS applied at website, creates a cookie, saves it and after that redirects the page back at URL from where it was triggered.</p>
<p><span id="more-206"></span></p>
<h4>Switcher.php Code &#8211; Setting Cookie</h4>
<p>[<strong>UPDATE</strong>] Request variable <strong>set</strong> in switcher.php file.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$set</span><span style="color: #339933;">=</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;set&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">setcookie</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sitestyle'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$set</span><span style="color: #339933;">,</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">31536000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: <span style="color: #006699; font-weight: bold;">$HTTP_REFERER</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h4>PHP Pages Code For Style Sheets &#038; Links</h4>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;head&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; title=&quot;default&quot; href=&quot;&lt;?php echo
(!$sitestyle)?'defaultstyle':$sitestyle ?&gt;.css&quot;&gt;
&lt;link rel=&quot;alternate stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; title=&quot;blue&quot; href=&quot;blue.css&quot;&gt;
&lt;link rel=&quot;alternate stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; title=&quot;pink&quot; href=&quot;pink.css&quot;&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;a href=&quot;switcher.php?set=default&quot;&gt;Default&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;switcher.php?set=blue&quot;&gt;Blue&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;switcher.php?set=pink&quot;&gt;Pink&lt;/a&gt;
&lt;br /&gt;
&lt;a href=&quot;change.php&quot;&gt;page 1&lt;/a&gt; &amp;nbsp;&amp;nbsp; &lt;a href=&quot;change2.php&quot;&gt;page 2&lt;/a&gt;
&lt;/body&gt;</pre></div></div>

<p><a href='http://www.phpmagicbook.com/wp-content/uploads/2008/06/php_css_switcher.rar' class="download">PHP CSS Switcher Download</a></p>
<p><a href="http://www.phpmagicbook.com/change-color-theme-with-php-css-switch/">Change Color Theme With PHP &#8211; CSS Switch</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/change-blog-forum-theme-color-scheme-online-live-tool/" title="Change Your Blog or Forum Theme Color Scheme Online Live">Change Your Blog or Forum Theme Color Scheme Online Live</a></li><li><a href="http://www.phpmagicbook.com/change-prosilver-header-logo-phpbb/" title="Change Prosilver Header and Logo in PHPBB &#8211; Working Solution">Change Prosilver Header and Logo in PHPBB &#8211; Working Solution</a></li><li><a href="http://www.phpmagicbook.com/switch-examples/" title="PHP Switch Statement Examples">PHP Switch Statement Examples</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/change-color-theme-with-php-css-switch/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 1.898 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-07-30 16:30:53 -->
