Hi Guys,

Quick question......  I've managed to write a function (thanks to help from
people earlier in the week) which queries an admin table.

There are currently four fields in the table;  id, username, password, and
'site', where the 'site' means a subdirectory of my site that the particular
admin user is allowed acces to change things in....

Now, each 'site' user is allowed access to only their site, but, being the
owner of all the 'sites', my field contains the word "all."  So, I used this
to determine whether the user (when logged in) is firstly an administrator,
and secondly what area of the site they're responsible for:

$sql = "SELECT * FROM table
        WHERE username = '$username' AND password = '$password' AND site =
'theirsite' OR site = 'all'";

Now, as you can probably see, the table is querying whether the table has a
row with fields:

username, password, site OR

Just a row with the field containing "all."

So, without writing some if statements, is there any way of rewriting that
$sql check so that it checks whether the user is an admin of either the
individual subdirectory, or all of the sites?  Like

username: foo  password: bar site: all

or

username: foo  password: bar site: subdirectory

.........  Hope that makes sense, and thanks in advance for any help :)

James.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to