|
Posted by Matt on 08/26/07 21:01
Hey everyone,
This is a pretty silly one, I just can't get my head around it.
I have a table of artices, with a row "isPremium", meaning it's
content available only to paid users. In my corresponding user table I
have a row "user_group" with various levels signifying access rights.
In my file displayarticle.php I'm trying to process this. What I want
is for the system to check the article ID, if it's premium, check the
user's credentials (and if they're not okay, print some kind of
error), and if it's not premium, just display it as normal.
My efforts to do this have given errors due to my nested if statements
and I can't seem to think of a solution that doesn't involve my (200
line) display article code being repeated for both possible outcomes
(eg, isPremium = true or false). Can anyone point out the blindingly
obvious solution I'm missing?
Matt
[Back to original message]
|