/    Sign up×
Community /Pin to ProfileBookmark

Calling include files depending on users status

? Yet another dumb question…

Calling include files depending on users status.

Hello again all, another in my list of oh so basic questions… My apologies.

Normally I look at the source of a site that uses a similar script to see where to start… I admit it my PHP skills are duff.

The task I need to perform is that depending on if the user is logged in, and if so their membership level, whether an include script is called.

i.e. if the user is not a member of my site (or just not signed in) they get a “join now” invitation called from an include file, and if they are a logged in member they get a page with the full content… from another include file.

How do I set the code up… pretty please.

Any ideas?

Many thanks

Mouse

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYNov 25.2005 — hi,

do you mean something like that?

Normally I look at the source of a site[/QUOTE]
btw, you cant see php in the source of a site, and thats the point, it's server side language
[code=php]
<?php
# first check if user is logged in
if(isset($_SESSION['logged']) && $_SESSION['logged'] == true){

if(isset($_SESSION['rank']){
# membership level
$rank = $_SESSION['rank'];
switch($rank){
case "admin":
include "page_admin.php";
break;
case "whatever":
include "page_whatever.php";
break;
# etc...
case default:
include "page_default";
break;
}
}

}else{
# user is not logged in
# join or login page
include "join.php";
}
?>
[/code]
Copy linkTweet thisAlerts:
@Mouse77eauthorNov 26.2005 — i'll now spend my weekend playing with that.... thanks for the head start

Mouse ?
Copy linkTweet thisAlerts:
@SheldonNov 26.2005 — i'll now spend my weekend playing with that.... thanks for the head start

Mouse ?[/QUOTE]


That is the code done, there no looking at source that will help you mod it further.

You do have to edit your login script though and if you use the ranking system and add another feild in your database.
×

Success!

Help @Mouse77e spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...