<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1039025" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1039025</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/cookies-and-sessions#comment-1221811</link>
    <description> &lt;p&gt;You can use it for whatever you want, but that&#039;s what it&#039;s used for in this case.&lt;/p&gt;
&lt;p&gt;A few things though, you should enclose string indexes in single or double quotes.  For example, change $_SESSION[logged] to $_SESSION[&#039;logged&#039;].  Also, $_SESSION[logged] = &quot;true&quot;; should be $_SESSION[logged] = true; because &quot;true&quot; is a string with quotes, and a boolean without them.&lt;/p&gt;
 </description>
     <pubDate>Wed, 18 Jul 2007 15:29:51 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1221811 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/cookies-and-sessions#comment-1221810</link>
    <description> &lt;p&gt;This is abit of a long question but I think I almost understand how to use sessions!&lt;/p&gt;
&lt;p&gt;Am I right in guessing that I should set $_SESSION[username] as the one entered in the login textbox and then use the username session variable on all the pages that require the logged in users&#039; information? something like&lt;/p&gt;
&lt;p&gt;$query = &quot;SELECT * FROM users WHERE user_name=&#039;$user&#039;&quot;;&lt;br /&gt;
$sql = mysql_query($query);&lt;/p&gt;
&lt;p&gt;$sqlinfo = mysql_fetch_array($sql);&lt;br /&gt;
$username = $sqlinfo[username];&lt;/p&gt;
&lt;p&gt;$_SESSION[username] = $username&lt;/p&gt;
&lt;p&gt;I have the following code which is part of the process login script, the logged session variable can&#039;t be used for anything other than checking to see if the user is logged in, is that right?&lt;/p&gt;
&lt;p&gt;session_start();&lt;br /&gt;
session_register(logged);&lt;br /&gt;
$_SESSION[logged] = &quot;true&quot;;&lt;br /&gt;
header(&quot;Location: index.php&quot;);&lt;/p&gt;
 </description>
     <pubDate>Wed, 18 Jul 2007 15:05:24 +0000</pubDate>
 <dc:creator>drew22299</dc:creator>
 <guid isPermaLink="false">comment 1221810 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/cookies-and-sessions#comment-1221806</link>
    <description> &lt;p&gt;Cookies and sessions are almost identical when trying to access then in PHP.&lt;/p&gt;
&lt;p&gt;For example, to access a saved cookie called &#039;logged&#039;, the variable would be $_COOKIE[&#039;logged&#039;].  If it was in the session, it would be $_SESSION[&#039;logged&#039;].&lt;/p&gt;
&lt;p&gt;Personally, I would use the session because then the information is stored on the server and not the user&#039;s computer.  The only thing that is stored on the user&#039;s computer is the session id, or SID.&lt;/p&gt;
&lt;p&gt;Assigning information to the session is easy.  Just treat $_SESSION like an array and assign variables to it accordingly.  The same array will be waiting for you on the next page to be read.&lt;/p&gt;
&lt;p&gt;Cookies are set using the &lt;a href=&quot;http://us2.php.net/manual/en/function.setcookie.php&quot; class=&quot;bb-url&quot;&gt;setcookie()&lt;/a&gt; function.&lt;/p&gt;
 </description>
     <pubDate>Wed, 18 Jul 2007 14:16:39 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1221806 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
