22, November 2008

Some small questions ... - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: Some small questions ...
« previous next »
Pages: [1] Print

Author Topic: Some small questions ...  (Read 1236 times)
I love Pokemon
*
Posts: 14
92 credits
Members referred : 0


« on: May 02, 2007, 09:34:42 PM »

Is it a problem if i build up my side with lot's of includes (header/footer/menu/content)? The website always points to index.php but will include other parts if the "id" variable is different (GET method used).

How can i check if a user is logged in?

Can i store the country of the user in thier details and then change the language of the login and also other things on my site based on the country?

Why did olaf choose not to use php documentator or something simular ?

thx for your help guys Wink
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: May 02, 2007, 10:20:47 PM »

Quote
Is it a problem if i build up my side with lot's of includes (header/footer/menu/content)? The website always points to index.php but will include other parts if the "id" variable is different (GET method used).
the same like regular pages. decide which action need to be protected and which not.

Quote
Can i store the country of the user in thier details and then change the language of the login and also other things on my site based on the country?

check the user_profile extension (there is a function a user based language switch)

Quote
Why did olaf choose not to use php documentator or something simular ?

don't know Smiley


Last blog : Just a better Internet portal provided by Google
I love Pokemon
*
Posts: 14
92 credits
Members referred : 0


« Reply #2 on: May 15, 2007, 01:04:06 AM »

Ok i am trying to get this script working. And i tried to find answer to some of the problems i encountered. But i have stumbled upon some strange things.

I put in my script: print_r($_POST);

This returns the post data password login and submit. BUT it only does this if the login is correct. So if i fill in a faulty username+password it will work. When i fill in the right username and password it will return nothing. I like to know about this:
- Is it possible that this is causes by the access_user class script.
- Why does it happen
- Will it only 'delete' the POST from the login form, or all my POST ?

So then i continued, i figured it had to do something with the access_user class script because it only responded that way when the right login was given (as stored in the mysql database). So i found somewhere else on a forum how to do something with user levels.

if ($page_protect->access_level > 1) {
  print("hi<br />\n");
}

But this didn't print anything, it didn't even give a warning.
I'm really confused about all of this, anyone can give me some tips ?
I love Pokemon
*
Posts: 14
92 credits
Members referred : 0


« Reply #3 on: May 15, 2007, 01:07:13 AM »

i just readed tomz his thread. a reply there says the variables are taken out of the POST and stored in session. I really don't understand how and why. I don't really need to know (but if anyone has a link about this please). Just still the thing remains why doesn't it print "hi" ?
I love Pokemon
*
Posts: 14
92 credits
Members referred : 0


« Reply #4 on: May 15, 2007, 01:14:06 AM »

i made a little mistake i see now. $page_protect was not defined. i used:
$my_access = new Access_user(false);

But if i use now:
if ($my_access->access_level > 1) {
  print("hi<br />\n");
}

it still doesn't work ...
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: May 15, 2007, 10:44:45 AM »

i made a little mistake i see now. $page_protect was not defined. i used:
$my_access = new Access_user(false);

But if i use now:
if ($my_access->access_level > 1) {
  print("hi<br />\n");
}

it still doesn't work ...

the access level is default "1" for all new users, will say it can't be visible, I suggest to try first the examples to get a working application. If this application works for 100% start with the mods...


Last blog : Just a better Internet portal provided by Google
I love Pokemon
*
Posts: 14
92 credits
Members referred : 0


« Reply #6 on: May 15, 2007, 01:57:31 PM »

Thx for your reply olaf!
The example files worked, i now at a stage where i want to intergrate it into my website.
I have userlevel 10 i think so it should work ?
Maybe i should use '> 0' to see if anyone has logged in ?
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: May 15, 2007, 03:06:42 PM »

just test if a session exists to check if the use is logged in, the access level is useful to show content for different groups


Last blog : Just a better Internet portal provided by Google
I love Pokemon
*
Posts: 14
92 credits
Members referred : 0


« Reply #8 on: May 19, 2007, 10:41:54 PM »

I see that i have to use this to protect my webpage:
$my_access->access_page($_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'], 5)

But i'm not sure how this works nor how i should intergrate it into my website.
My website (index.php) include for example public.php and private.php
Now public.php must always show (works)
private.php must only been seen if the user is logged in. Else private.php should contain an "access denied" message (when it is included).

The links on my website:
<a href="index.php?id=public">Public part</a>
<a href="index.php?id=private">Private part</a>

I'm sure this class can do it, i just don't know how exactly because i don't know this class very well and the documentation only tells so much. Anyone can help me out? thx
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #9 on: May 20, 2007, 10:58:21 AM »

maybe you give it a try and than show us the code here...


Last blog : Just a better Internet portal provided by Google
I love Pokemon
*
Posts: 14
92 credits
Members referred : 0


« Reply #10 on: May 21, 2007, 03:00:45 AM »

when i try to protect private.php with the access_page function it results in:

/private.php
Code:
Fatal error: Call to a member function on a non-object in private.php on line 3

/index.php?id=private
Code:
Warning: Cannot modify header information - headers already sent by (output started at index.php:28) in /classes/access_user/access_user_class.php on line 201

i guess i could try making a new object (access_user). But what happens if you use more objects troughout your website, doesn't that mix up user data? or cause a failer in the login system?
« Last Edit: May 21, 2007, 03:05:19 AM by Flip »
I love Pokemon
*
Posts: 14
92 credits
Members referred : 0


« Reply #11 on: May 22, 2007, 11:03:01 PM »

i just noticed something odd.
When i open /index.php?id=private it redirects me to login.php but when i visit this adres a second time i get the warning as displayed above.
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6500
Tags : login check Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: Some small questions ...
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Nov 22, 2008, 03:26:44 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.736
Total Topics: 7.650
Total Members: 4.397
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: Janai

40 Guests, 5 Users online :

11 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.