Forum Moderators: coopster

Message Too Old, No Replies

Help with PHP question

         

associates

1:52 am on Sep 28, 2005 (gmt 0)

10+ Year Member



Hi, all

I have recently decided to set up an intranet for my own use only. I have a webserver using apache and also have php installed. What i have done so far is i use a basic authentication, simply asking for username and password before entering to the intranet homepage. Now what i'd like to do is to be able to retrieve whoever enter the site and be able to show it on the intranet homepage. In another word, i'd like a welcome message on the homepage, something like Welcome, Samuel... (a simple message like that).

What do i need to do to be able to get that working using php script?

Thank you in advance and look forward to hearing from you.

lobo235

2:01 am on Sep 28, 2005 (gmt 0)

10+ Year Member



Do you store the usernames and passwords in a database?

associates

4:19 am on Sep 28, 2005 (gmt 0)

10+ Year Member



Thanks for your reply.

No, I don't store them in a database. Is there any other way apart from using the database?

Thank you in advance

lobo235

12:31 pm on Sep 28, 2005 (gmt 0)

10+ Year Member



You could hard-code the usernames and passwords into your script using variables and you could also create some variables to hold the first names of all the users. Arrays will probably work best for something like this because you can link everything together by using the same array key for each user's data.

tomda

1:32 pm on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just register the username that the person has typed in the authentification form for login in a session and retrieve the name using a simple $_session['username'].

associates

12:34 am on Sep 29, 2005 (gmt 0)

10+ Year Member



hi,

Thanks to both Tomda and Lobo235 for your reply.

Yes, i'm more interested in using the session than array. However, as i am still learning about PHP script, I think i can find some lesson about using session. Apart from that, i need to ask about the authentication. When a user types in his/her username and password in the authentication form, i was wondering how i could get the value of the username. In another word, how do i know what username the user has typed in so that i can register it in the session. I am sure there must be a way of finding it out. I searched for it in the apache webpage but could not find it.

I was wondering if you could give me some ideas if you could help me with.

Thank you in advance and look forward to hearing from you

tomda

6:57 pm on Sep 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Google for "tutorial membership php" and go to the first result (phpfr**ks.com) and see all their tutorials. There is a membership tutorial which is great to start up and learn.