<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1031332" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1031332</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/using-cookies-enforce-terms-service-agreement#comment-1183430</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;Quote: 1) Where do both of these JavaScripts go?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Only one is a javascript. The second code is just a forum that calls the javascript.&lt;/p&gt;
&lt;p&gt;Put the first bit of code anywhere in your html. It&#039;s customary to put javascript like this into the head section of the page (somewhere after  and before ) but that just being tidy.&lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;Quote: 2) What is &quot;Untitled-5.php&quot; supposed to be? My TOS page, or perhaps a form script, or...?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Untitled-5.php is just the name of the file I used when testing the code. If your case you would substitue the url of your forum&#039;s index page.&lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;Quote: 3) Are these two snippets of code to be used in conjunction with the PHP you gave me earlier?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;The javascript replaces the php for the tos page. You still require the first bit of php I posted to do the checks on the other pages and the redirect if such is needed.&lt;/p&gt;
&lt;p&gt;Again, test on blank pages firt to understand the operation of these scripts before adding to your forum. Ather the script progressivly. Get the basics working, make a single modification. Test again. Make another mod. Test again. It&#039;s slow but it works.&lt;/p&gt;
 </description>
     <pubDate>Tue, 25 Oct 2005 02:33:46 +0000</pubDate>
 <dc:creator>Rincewind</dc:creator>
 <guid isPermaLink="false">comment 1183430 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/using-cookies-enforce-terms-service-agreement#comment-1183263</link>
    <description> &lt;p&gt;Rincewind,&lt;/p&gt;
&lt;p&gt;Thanks again so much for your reply!  I&#039;ve got a couple more dumb questions for you:&lt;/p&gt;
&lt;p&gt;1) Where do both of these JavaScripts go?&lt;/p&gt;
&lt;p&gt;2) What is &quot;Untitled-5.php&quot; supposed to be?  My TOS page, or perhaps a form script, or...?&lt;/p&gt;
&lt;p&gt;3) Are these two snippets of code to be used in conjunction with the PHP you gave me earlier?&lt;/p&gt;
&lt;p&gt;I apologize for my ignorance here, I honestly do.  I know this is a relatively simple problem and my questions are pretty dumb, so I&#039;m sorry for annoying you.  I&#039;m trying to learn this as I go, but the necessity that brings me here bars me the luxury of time to hack it out on my own.  See, one of my users was threatened with a libel suit.  He didn&#039;t commit libel at all since he backed his statements up with facts and clearly said that other than the facts he presented, the post was his opinion.  Anyway, the threat opened my eyes a bit, so I&#039;m trying to get this new policy in place ASAP, hence the near urgency.&lt;/p&gt;
&lt;p&gt;So again, I sincerely apologize for all my questions.  I&#039;m a mere civil servant, not a programmer.  &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Thanks again for your time!&lt;/p&gt;
 </description>
     <pubDate>Mon, 24 Oct 2005 01:03:54 +0000</pubDate>
 <dc:creator>Recoil</dc:creator>
 <guid isPermaLink="false">comment 1183263 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/using-cookies-enforce-terms-service-agreement#comment-1183260</link>
    <description> &lt;p&gt;The form button and javascript is again just an titsy bitsy few lines of code to set the cookie.&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot; type=&amp;quot;text/JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;function setcookiescript() {&lt;br /&gt;document.cookie = &amp;quot;tos=seen&amp;quot;;&lt;br /&gt;return true;&lt;br /&gt;}&lt;br /&gt;//--&amp;gt;&lt;br /&gt;&amp;amp;lt;/script&amp;amp;gt;&lt;/code&gt;&lt;/div&gt;&#039;&lt;br /&gt;
Your form might look something like this&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;form action=&amp;quot;Untitled-5.php&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;textarea name=&amp;quot;tos&amp;quot; cols=&amp;quot;30&amp;quot; rows=&amp;quot;10&amp;quot;&amp;gt;Your Terms and conditions &amp;lt;/textarea&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;input name=&amp;quot;Submit&amp;quot; type=&amp;quot;submit&amp;quot; onClick=&amp;quot;setcookiescript()&amp;quot; value=&amp;quot;I do Agree&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;WRT your page sending you repeatedly back to the tos page. Check that your cookie is being set by looking for the cookie in your browsers temp files (in FF do &quot;tools - options - privacy&quot; then expand &quot;cookies&quot; and click on &quot;view cookies&quot;. If that&#039;s working then check the value is being passed by commenting out the headers line and put an echo &quot;$tos&quot;; to see that the cookie is be read properly. I have tested the code above and it does work for me, though I&#039;m not complicating it with a forum scipt. Try it on some blank pages first.&lt;/p&gt;
 </description>
     <pubDate>Sun, 23 Oct 2005 23:48:02 +0000</pubDate>
 <dc:creator>Rincewind</dc:creator>
 <guid isPermaLink="false">comment 1183260 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/using-cookies-enforce-terms-service-agreement#comment-1183171</link>
    <description> &lt;p&gt;Rincewind,&lt;/p&gt;
&lt;p&gt;Thank you very much for your reply!&lt;/p&gt;
&lt;p&gt;I apologize for not being more specific as to which language; you guessed PHP correctly, and I did indeed forsee needing to use JavaScript for the &quot;I Agree/I Decline&quot; selection.  As previously with the cookie code though, I have little clue how to go about that either.  &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Anyway, I have implemented the code you gave and it does indeed send me to the TOS when I arrive at the site.  Thanks!  However, the TOS is all I can view.  I experimented by adding the code to index.php for my forum.  When I attempt to go to the index after I&#039;m directed to the TOS, I am returned promptly back to the TOS.  Am I missing something?&lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;Rincewind wrote:&lt;/strong&gt; You can add an expiry time if you want but this one will close when the user closes the browser. So each visit they are reminded of the tos.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I set an expiration time by adding time()+60*60*24*30.&lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;Rincewind wrote:&lt;/strong&gt; You might prefer to only set the cookie when they actually click the &quot;agree&quot; button or something. Again this is simple but you would use javascript for the setting rather than php.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Yeah, as I mentioned above, that&#039;s exactly what I&#039;m looking for.  As I also mentioned above, I&#039;ve not a clue how to write that code.  Any suggestions there?  Or perhaps a website I can copy some code from?&lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;Rincewind wrote:&lt;/strong&gt; One problem you may encounter, is that a small number of people don&#039;t have cookies enabaled and you would effetivly block them form your site. But I supose your forum is already dependant on cookies for it&#039;s login system so your probably not going to worry about that much.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;That is correct.  I&#039;m using phpBB for the forum and thus am not concerned about my users not having cookies enabled.&lt;/p&gt;
&lt;p&gt;For the website however, that might be a problem for that afformentioned small number of people.  Is there a way to direct those whose browsers don&#039;t accept cookies to a page on the site explaining the situation and why they can&#039;t continue without accepting said cookies?&lt;/p&gt;
&lt;p&gt;Again, I really appreciate your help!  Have a good day!&lt;/p&gt;
 </description>
     <pubDate>Sun, 23 Oct 2005 07:38:45 +0000</pubDate>
 <dc:creator>Recoil</dc:creator>
 <guid isPermaLink="false">comment 1183171 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/using-cookies-enforce-terms-service-agreement#comment-1183159</link>
    <description> &lt;p&gt;Setting and checking for the cookie or session is a relativly simple thing to do. However, you didn&#039;t mension what language you want the instructions for? PHP, ASP, javascript, other...&lt;/p&gt;
&lt;p&gt;In php you could do something like this. On all that pages of the site, start with this code at the very top of the file before anything else:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;$tos &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_COOKIE&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;tos&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;];&lt;br /&gt;if(!isset(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$tos&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)){&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;//user has no cookie so send them to the TOS.&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;header &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;Location:http://www.example.com/tos_page.php&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
On the tos page put this code&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;setcookie&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;tos\&quot;, \&quot;seen\&quot;);&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
You can add an expiry time if you want but this one will close when the user closes the browser. So each visit they are reminded of the tos. You might prefer to only set the cookie when they actually click the &quot;agree&quot; button or something. Again this is simple but you would use javascript for the setting rather than php.&lt;/p&gt;
&lt;p&gt;One problem you may encounter, is that a small number of people don&#039;t have cookies enabaled and you would effetivly block them form your site. But I supose your forum is already dependant on cookies for it&#039;s login system so your probably not going to worry about that much.&lt;/p&gt;
 </description>
     <pubDate>Sun, 23 Oct 2005 03:30:56 +0000</pubDate>
 <dc:creator>Rincewind</dc:creator>
 <guid isPermaLink="false">comment 1183159 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
