<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1022325" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1022325</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/question-access-checking#comment-1137754</link>
    <description> &lt;p&gt;logic will getcha every time. you have to really watch what you want to do.&lt;/p&gt;
&lt;p&gt;i.e. use comments and ALWAYS have an else for if statements. I find expanding it out helps me with flaws in logic.&lt;/p&gt;
&lt;p&gt;// if you&#039;re access level 1, 2 or 3 &amp;lt;-- if any of these things is true, go forward&lt;br /&gt;
// allow entry&lt;br /&gt;
// else prohibit entry&lt;/p&gt;
&lt;p&gt;or alternatively what you were doing:&lt;/p&gt;
&lt;p&gt;// if you&#039;re NOT access level 1&lt;br /&gt;
// prohibit entry &amp;lt;-- will terminate prematurely if access level 2 or 3&lt;br /&gt;
// elseif you&#039;re NOT access level 2&lt;br /&gt;
// prohibit entry &amp;lt;-- will terminate prematurely if access level 3&lt;br /&gt;
// elseif you&#039;re NOT access level 3&lt;br /&gt;
// prohibit entry&lt;br /&gt;
// else allow entry&lt;/p&gt;
 </description>
     <pubDate>Sat, 13 Sep 2003 13:02:24 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1137754 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/question-access-checking#comment-1137734</link>
    <description> &lt;p&gt;apparently &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;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if((&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$variable_from_db&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$access_level_in_include1&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)||(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$variable_from_db&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$access_level_in_include2&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&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; gets triggered if either one is true because ONE is true. what i needed was &amp;amp;&amp;amp; or to pull the ! so that it&#039;s either &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;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if((&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$variable_from_db&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$access_level_in_include1&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)&amp;amp;&amp;amp;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$variable_from_db&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$access_level_in_include2&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&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; or &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;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if(!((&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$variable_from_db&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$access_level_in_include1&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)||(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$variable_from_db&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$access_level_in_include2&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&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;when i moved the ! i realized what had happened. one of them was bieng true and the other false for me. inface, no one would ever get anyting BUT the error as a result. that&#039;s when i realized the &amp;amp;&amp;amp; in place of || would have worked too&lt;/p&gt;
 </description>
     <pubDate>Sat, 13 Sep 2003 04:32:52 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1137734 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/question-access-checking#comment-1137705</link>
    <description> &lt;p&gt;i got that feeling too, which is why i was wondering if anyone knew if the first wat was valid, and why the second would blow up even though my site access does echo out to be in the group allowed in&lt;/p&gt;
 </description>
     <pubDate>Fri, 12 Sep 2003 15:10:31 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1137705 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/question-access-checking#comment-1137694</link>
    <description> &lt;p&gt;I think you have a larger problem. Try logging in as one of the other access levels and then try to access manually a higher access page.&lt;/p&gt;
 </description>
     <pubDate>Fri, 12 Sep 2003 11:56:44 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1137694 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/question-access-checking#comment-1137680</link>
    <description> &lt;p&gt;actually i pull it out of the db at the begining of each function when i double check everyone is authorized (by username and pw which is in cookies)&lt;/p&gt;
&lt;p&gt;and i already echoed out to make sure that&lt;br /&gt;
1: $sa is being set right&lt;br /&gt;
2: the variables i check against are set right&lt;/p&gt;
&lt;p&gt;and i found in all instances that they were, php was just being funky about letting me through. in some cases it acted as if if($sa==($jra||$adm||$wbm)) correctly, in other times it didn&#039;t (the check to see if you can do that function does == and theone to see which level you have within the function is !=)&lt;/p&gt;
&lt;p&gt;so i don&#039;t understand why it seems to work sometimes (most of the ==) and not others (some of the == and all of the !=) and when i change it to (($sa==$jra)||($sa==$adm)||($sa==$wbm)) is echos out right yet tells me i don&#039;t have access, and when i switch that back i have to mae the other one (== or !=) to be individual to work right (instead of just doing the first one regaurdless of if that&#039;s right)&lt;/p&gt;
 </description>
     <pubDate>Fri, 12 Sep 2003 03:27:52 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1137680 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/question-access-checking#comment-1137656</link>
    <description> &lt;p&gt;And so it is... &lt;/p&gt;
&lt;p&gt;Okay then... I *think* you should be using the cookie or session variables there. Unless you have $sa  = $_COOKIE[sa]; or something?&lt;/p&gt;
&lt;p&gt;Also, while this is awfully vague, I found I had to be really careful to get all the information in the right order. I didn&#039;t use variables for the check, but rather actual things.&lt;/p&gt;
&lt;p&gt;So:&lt;/p&gt;
&lt;p&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;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;adminaccess&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;] != (&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;admin&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;||&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;moderator&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&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;/p&gt;
&lt;p&gt;Check to make sure your $a1 et cetera variables make sense, too. (I&#039;m not saying you can&#039;t use variables, I don&#039;t know.) And make sure that $sa is really being passed along in the cookie or session by doing this:&lt;/p&gt;
&lt;p&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;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if (isset(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$sa&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$sa&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit;&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;/p&gt;
&lt;p&gt;And then you&#039;ll know for sure.&lt;/p&gt;
 </description>
     <pubDate>Thu, 11 Sep 2003 19:28:11 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1137656 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/question-access-checking#comment-1137655</link>
    <description> &lt;p&gt;Umm I think you confusing youself here&lt;/p&gt;
&lt;p&gt;You comment says to check to see if they have that access level, but your IF statment is checking if it is NOT EQUAL (!=) to check the value for being equal do what Suzanne said (==)&lt;/p&gt;
&lt;p&gt;Little background:&lt;br /&gt;
 = : sets the varible on the left to the value on the right&lt;br /&gt;
== : compares the value on the right against the value on the left for equality&lt;br /&gt;
!= : compares the value on the right against the value on the left to make sure they are NOT EQUAL&lt;/p&gt;
&lt;p&gt;There are more, like &amp;gt;, &amp;lt;, &amp;lt;= , &amp;gt;=, === but I dont want to confuse you.&lt;/p&gt;
&lt;p&gt;The next part you need to understand is the IF structure.&lt;/p&gt;
&lt;p&gt;IF (comparison here) { //if the value on the comparison was TRUE continue in the braces&lt;/p&gt;
&lt;p&gt;CODE TO EXECUTE IF CHECK IS TRUE&lt;br /&gt;
} // IF FALSE WE START FROM HERE&lt;/p&gt;
&lt;p&gt;How to code for a false....&lt;br /&gt;
IF (comparison){&lt;br /&gt;
   //true code&lt;br /&gt;
}else{&lt;br /&gt;
 //OK the above failed now lets work in here because we failed&lt;br /&gt;
} //Now we are done the FALSE part, and are code continues from here.&lt;/p&gt;
 </description>
     <pubDate>Thu, 11 Sep 2003 19:22:19 +0000</pubDate>
 <dc:creator>ShaneS</dc:creator>
 <guid isPermaLink="false">comment 1137655 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/question-access-checking#comment-1137651</link>
    <description> &lt;p&gt;the ! must not have translated over. i thought there was a ! in there&lt;br /&gt;
i don&#039;t know why it didn&#039;t show up when i sent it to myself.&lt;/p&gt;
&lt;p&gt;the = are != in the code that&#039;s executing&lt;/p&gt;
 </description>
     <pubDate>Thu, 11 Sep 2003 18:50:02 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1137651 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/question-access-checking#comment-1137610</link>
    <description> &lt;p&gt;You are SETTING the variable values, not evaluating them.&lt;/p&gt;
&lt;p&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;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// set $variable to &#039;value&#039;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$variable &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;value&#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: #FF8000&quot;&gt;// check if $variable is equal to &#039;value&#039;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$variable &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;== &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;value&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&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;/p&gt;
 </description>
     <pubDate>Thu, 11 Sep 2003 03:10:21 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1137610 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
