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

php user greeting

P: 27
i have a login database which has got usernames and passwords.NOw when i logs in i want a geetings from the server side like "Welcome $user" and also a logout link. i am talking abt the way bytes forum greets the user.
LIke when the user logsin the forum page 's top the username (logout) appears.I need a php script.
Anyone plz help me.
Thanx in advance
Oct 22 '08 #1
Share this Question
Share on Google+
5 Replies

Expert 5K+
P: 5,058

What have you tried so far?

We are always happy to help, but we are not about to do your work for you. You are at least going to have to try it yourself, and if you run into something you need help with, we will need to know what you are doing and how it isn't working. Error messages and code samples are very helpful to.
Oct 22 '08 #2

Expert 5K+
P: 6,050
1. You get the data from the database and display it.

2. When a user logs in, you must be setting a session or cookie. Therefore, to log the user out, simply destroy the cookie or session.
Oct 22 '08 #3

P: 3
sreenisha, what you're asking is a rather complicated question and requires a rather complicated answer.

Markus is right, you're going to need to interact with a database to compare user name and password against. If the information matches, you'll want to save a piece of authentication information in their browser called a cookie.

Next, on the pages you want to display this welcome block, you'll check for the cookie, make sure it's valid (by comparing it with the database,) and then display the block.

If you want me to give you a simply example just get a hold of me and I'll write up something simple for you to get you on your way! :)
Oct 23 '08 #4

Expert 5K+
P: 5,058
If you want me to give you a simply example just get a hold of me and I'll write up something simple for you to get you on your way! :)

Please do not offer programming help through emails or private messages. Help offered on the forum is better because it benefits everyone else facing similar problems. (See How To Respond To A Question).

Having said that, I actually wrote an example as a part of my PHP Session HowTo that might help. It's very simple but might help point in the right direction.
Oct 23 '08 #5

P: 27
Thank u all.
I got the output the way i want.I prepared a detailed note abt sessions and cookies and learnt that.Then i managed to get the output.Once again thanks for all necessary informations provided for me.
Oct 25 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.