By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

How to capture and valid user session

P: n/a
Hi,

I just build a website and need to somehow trap the user logon and

1) display 'welcome! so and so' at the left hand corner of the page.
2) valid whether the user exists in my MySQL database, user table.

How do I do that?

Thanks for your help!
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 2003-12-08, xo55ox <xo****@hotmail.com> wrote:
Hi,

I just build a website and need to somehow trap the user logon and

1) display 'welcome! so and so' at the left hand corner of the page.
2) valid whether the user exists in my MySQL database, user table.


You could start with reading the manual at http://www.php.net/manual/nl

Looking at the source-code of phpmyadmin will give you an example howto
code this. Buf if you have read, and understood the manual, i think
you'll be able to come up with this basic stuff yourself.

--
verum ipsum factum
Jul 17 '05 #2

P: n/a
xo55ox wrote:
Hi,

I just build a website and need to somehow trap the user logon and

1) display 'welcome! so and so' at the left hand corner of the page.
2) valid whether the user exists in my MySQL database, user table.


You could see the section in the manual on 'HTTP authentication with
PHP', but I think that method is clunky and annoying, especially if you
are testing a script and need to login and logout of different accounts.

Instead, I use cookies to store the username and password. It's not
secure, but my ISP does not offer SSL, so nothing I run will be secure.
However, make sure to offer an option of session-only logins by setting
no expiry date for the cookie. That way, once the browser is closed, the
cookie is deleted (or marked for deletion). Supposedly. The problem with
cookies is their client-side nature - you have to rely on the browser to
do its job properly.

You seem very new to PHP, and your questions can't easily be answered in
a usenet group. I recommend you go and find as many example PHP scripts
as you can, and see how they handle authentication of users.
--
Bob
London, UK
echo Mail fefsensmrrjyaheeoceoq\! | tr "jefroq\!" "@obe.uk"
Jul 17 '05 #3

P: n/a
Hi,

Easiest way is to set a cookie when the user has logged on. When he
returns (or after logon) check the logon information (and retrieve the
name) in the mysql database by doing a query on your user table.
xo****@hotmail.com (xo55ox) wrote in message news:<ab**************************@posting.google. com>...
Hi,

I just build a website and need to somehow trap the user logon and

1) display 'welcome! so and so' at the left hand corner of the page.
2) valid whether the user exists in my MySQL database, user table.

How do I do that?

Thanks for your help!

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.