<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1032758" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1032758</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/redirect-if-no-cookie-set#comment-1192580</link>
    <description> &lt;p&gt;Some of us have no choice about using dial up&lt;/p&gt;
 </description>
     <pubDate>Sat, 04 Feb 2006 22:05:30 +0000</pubDate>
 <dc:creator>Busy</dc:creator>
 <guid isPermaLink="false">comment 1192580 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/redirect-if-no-cookie-set#comment-1192576</link>
    <description> &lt;p&gt;I just said use full address in header because mine only worked that way, may be different for others.  And yea I didn&#039;t think about dial-up, its so old I forgot people use it.&lt;/p&gt;
 </description>
     <pubDate>Sat, 04 Feb 2006 21:29:22 +0000</pubDate>
 <dc:creator>Nicholas</dc:creator>
 <guid isPermaLink="false">comment 1192576 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/redirect-if-no-cookie-set#comment-1192542</link>
    <description> &lt;p&gt;Were you able to find a solution?&lt;/p&gt;
&lt;p&gt;For the record you don&#039;t need the full url in Header, header(&quot;Location: index1.php&quot;); would work just fine.&lt;/p&gt;
&lt;p&gt;And storing IP isn&#039;t fool proof either as proxy hosts (dialup etc) can use random IP range (within a range).&lt;br /&gt;
Just remember if you use time() it&#039;s the server&#039;s time not your local time.&lt;/p&gt;
 </description>
     <pubDate>Sat, 04 Feb 2006 09:34:57 +0000</pubDate>
 <dc:creator>Busy</dc:creator>
 <guid isPermaLink="false">comment 1192542 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/redirect-if-no-cookie-set#comment-1192525</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;MyFreeCounter wrote:&lt;/strong&gt; some info:&lt;/p&gt;
&lt;p&gt;setting cookies - &lt;a href=&quot;http://us3.php.net/manual/en/function.setcookie.php&quot; class=&quot;bb-url&quot;&gt;http://us3.php.net/manual/en/function.setcookie.php&lt;/a&gt;&lt;br /&gt;
to delete them, simply reset the cookie only without a value or with an expiration time in the past.&lt;/p&gt;
&lt;p&gt;retrieving cookies - &lt;a href=&quot;http://us3.php.net/manual/en/reserved.variables.php#reserved.variables.cookies&quot; class=&quot;bb-url&quot;&gt;http://us3.php.net/manual/en/reserved.variables.php#reserved.variables.cookies&lt;/a&gt;&lt;br /&gt;
gets the value - $_COOKIE[&#039;Cookie_Name&#039;]&lt;/p&gt;
&lt;p&gt;so basically, you need to have on index 2 a segment that checks for the cookie:&lt;/p&gt;
&lt;p&gt;if ($_COOKIE[&#039;your_cookie_name&#039;]!=&#039;some_value&#039;) {&lt;br /&gt;
  header(&quot;Location: index1.php&quot;);&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;then on index 1, you need to have something that sets your cookie:&lt;/p&gt;
&lt;p&gt;setcookie(&quot;your_cookie_name&quot;,&quot;some_value&quot;,time()+100000000);&lt;/p&gt;
&lt;p&gt;it should work, let me know.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Your code is flawed...in the line&lt;br /&gt;
&lt;code&gt;&amp;nbsp; header(&amp;quot;Location: index1.php&amp;quot;); &lt;/code&gt;&#039;&lt;br /&gt;
you need to have the exact location of the file, atleast it was that way in my experience.  For example, instead of index1.php, it would have to be&lt;br /&gt;
&lt;code&gt; header(&amp;quot;Location: &lt;a href=&quot;http://www.yoursite.com/index1.php&amp;quot;&quot; title=&quot;http://www.yoursite.com/index1.php&amp;quot;&quot;&gt;http://www.yoursite.com/index1.php&amp;quot;&lt;/a&gt;); &lt;/code&gt;&#039;&lt;/p&gt;
&lt;p&gt;Also, I wouldn&#039;t bother with cookies, because they wear off or get deleted eventually.  I would use an SQL database to store ip&#039;s and scan the list for the person&#039;s ip address and if it&#039;s not there have it redirect and add their ip address to the list.&lt;/p&gt;
&lt;p&gt;Once again, another easier way to tell how long a cookie will last is to use, in the cookie set line, the following  format,  &quot;time() +60*60*24*7*52&quot;  60 seconds times 60 minutes times 24 hours times 7 days times 52 weeks, obviously this is one year, instead of using 10000000000 and not being able to tell by simply looking at it how long it is.&lt;/p&gt;
 </description>
     <pubDate>Fri, 03 Feb 2006 23:52:21 +0000</pubDate>
 <dc:creator>Nicholas</dc:creator>
 <guid isPermaLink="false">comment 1192525 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/redirect-if-no-cookie-set#comment-1192324</link>
    <description> &lt;p&gt;Can you use a session variable? for those who except cookies the session becomes a cookie, for those who dont it remains a session&lt;/p&gt;
 </description>
     <pubDate>Wed, 01 Feb 2006 20:41:52 +0000</pubDate>
 <dc:creator>Busy</dc:creator>
 <guid isPermaLink="false">comment 1192324 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/redirect-if-no-cookie-set#comment-1192323</link>
    <description> &lt;p&gt;I have tried something like that, but it wont redirect. I had also added in a small extra code that would tell me if the cookie did get set (for testing)&lt;br /&gt;
I got it to set one time (cookie set on a 1 minute expier time again for testing) I got the cookie to set one time (though I had to manually go to index1,) but after that one time it wont set again.&lt;/p&gt;
&lt;p&gt;I&#039;ve used cookies before so I do know how to work with them.. but never tried to do something like this, so it&#039;s really baffleing me.&lt;/p&gt;
 </description>
     <pubDate>Wed, 01 Feb 2006 20:39:04 +0000</pubDate>
 <dc:creator>Saeru</dc:creator>
 <guid isPermaLink="false">comment 1192323 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/redirect-if-no-cookie-set#comment-1191810</link>
    <description> &lt;p&gt;some info:&lt;/p&gt;
&lt;p&gt;setting cookies - &lt;a href=&quot;http://us3.php.net/manual/en/function.setcookie.php&quot; class=&quot;bb-url&quot;&gt;http://us3.php.net/manual/en/function.setcookie.php&lt;/a&gt;&lt;br /&gt;
to delete them, simply reset the cookie only without a value or with an expiration time in the past.&lt;/p&gt;
&lt;p&gt;retrieving cookies - &lt;a href=&quot;http://us3.php.net/manual/en/reserved.variables.php#reserved.variables.cookies&quot; class=&quot;bb-url&quot;&gt;http://us3.php.net/manual/en/reserved.variables.php#reserved.variables.cookies&lt;/a&gt;&lt;br /&gt;
gets the value - $_COOKIE[&#039;Cookie_Name&#039;]&lt;/p&gt;
&lt;p&gt;so basically, you need to have on index 2 a segment that checks for the cookie:&lt;/p&gt;
&lt;p&gt;if ($_COOKIE[&#039;your_cookie_name&#039;]!=&#039;some_value&#039;) {&lt;br /&gt;
  header(&quot;Location: index1.php&quot;);&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;then on index 1, you need to have something that sets your cookie:&lt;/p&gt;
&lt;p&gt;setcookie(&quot;your_cookie_name&quot;,&quot;some_value&quot;,time()+100000000);&lt;/p&gt;
&lt;p&gt;it should work, let me know.&lt;/p&gt;
&lt;p&gt;Matt Pegler&lt;br /&gt;
MyFreeCounter Owner/Operator&lt;br /&gt;
&lt;a href=&quot;http://www.MyFreeCounter.net&quot; class=&quot;bb-url&quot;&gt;http://www.MyFreeCounter.net&lt;/a&gt; - free hit, realtime, and click counters, as well as statistics&lt;/p&gt;
 </description>
     <pubDate>Fri, 27 Jan 2006 21:02:26 +0000</pubDate>
 <dc:creator>MyFreeCounter</dc:creator>
 <guid isPermaLink="false">comment 1191810 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
