/    Sign up×
Community /Pin to ProfileBookmark

problem with user session

Hi!
I have a very big problem in creation of user session.
I must create login for my user.
So I have a first function that take data from form and a second function that control if user is administator (and return 1) or not (and return 0).
If user is administrator I must make session for this user.
So I use:

if($user=adminitrator){
$_SESSION[‘user’]=$user
return 1
}
else{
return 0
}

now how can use $_SESSION[‘user’] in my html file to understand that the session form my user is on?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@cybertocDec 24.2008 — You can change the extension of your html file to .php and use the if syntax to get rid of the problem. I guess it will be the easiest solution.

Hope it will help
Copy linkTweet thisAlerts:
@MindzaiDec 24.2008 — Also that code will not work as you expect. To check for equality the correct operator is ==. A singlle = is used for assignment, so you if line currently means, take the value of administrator and assign it to $user, then if user is true...

Also 'administrator' as you have written it can only be a constant or an object which i'm not sure is your intention.
×

Success!

Help @ojal__ 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.18,
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,
)...