944,103 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 2726
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Jul 5th, 2007
0

getting user info

Expand Post »
hello all. i am writing a php / mysql script that does various things, but in addition to those things i need it to get the username of whoever is using the front end. any help is greatly appreciated! also i can post some code snippets if you want a feel for what im doing.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
sickly_man is offline Offline
42 posts
since Jun 2007
Jul 5th, 2007
0

Re: getting user info

Do you mean you need the user to submit their name?

If so you could just use and HTML form and post it to your php page for processing.
Reputation Points: 27
Solved Threads: 14
Junior Poster
Cerberus is offline Offline
162 posts
since Sep 2006
Jul 5th, 2007
0

Re: getting user info

no. everyone in my office (like 9 people total) has a Unix username they have to use to log into our company website. the website has stuff like a calendar of events, technical info, various forms for things, and it will have the IP database front end i am writing for it. when a user uses this new front end i want it to get his or her username because it will go into a row in the IP table (telling other users who inserted that row of data). does that clear it up a little bit? thanksa.
Reputation Points: 10
Solved Threads: 0
Light Poster
sickly_man is offline Offline
42 posts
since Jun 2007
Jul 5th, 2007
0

Re: getting user info

You could possibly store the username in the session variable after a successful login and then insert that value in the table.
Reputation Points: 27
Solved Threads: 14
Junior Poster
Cerberus is offline Offline
162 posts
since Sep 2006
Jul 5th, 2007
0

Re: getting user info

ok. they will only be using my front end if they've logged in successfully, so we can assume that all logins were successful. how would i go about doing that? thanks!!
Reputation Points: 10
Solved Threads: 0
Light Poster
sickly_man is offline Offline
42 posts
since Jun 2007
Jul 5th, 2007
0

Re: getting user info

Post (method="post") the html control data e.g. txtusername, txtpassword to your php page. Then on your php page you need to start_session() (or something like that) and then assign a value to the session variable e.g. $_SESSION['varUserName'] = $_POST[txtusername].

Now you can access that variable while the session is live.

e.g.
PHP Syntax (Toggle Plain Text)
  1. <?php
  2. echo $_SESSION['varUserName'] //output user name
  3. ?>

My php is a bit rusty so it might not be exact.
Reputation Points: 27
Solved Threads: 14
Junior Poster
Cerberus is offline Offline
162 posts
since Sep 2006
Jul 5th, 2007
0

Re: getting user info

ok i think i understand the second part of what you said. but how do i post the php control data (txtusername, txtpassword) to my php page? i really am new to php and appreciate all the help.
Reputation Points: 10
Solved Threads: 0
Light Poster
sickly_man is offline Offline
42 posts
since Jun 2007
Jul 5th, 2007
0

Re: getting user info

It's not too difficult. Say you had a login page with two text areas (username and password) and a button (submit) you would use an HTML form like this...

<form method="post" action="authenticate.php">
username
<input type="text" name="txtusername">
password:
<input type="password" name="txtpassword">
<input type="submit" value="submit" name="btnsubmit">
</form>

When you click submit the text box input is sent to authenticate.php.
Reputation Points: 27
Solved Threads: 14
Junior Poster
Cerberus is offline Offline
162 posts
since Sep 2006
Jul 5th, 2007
0

Re: getting user info

i really dont wanna do that because when the user is using my IP database front end they will already have logged in to the server (//gothics). im asking how i can get that information that they've already given the server so i can identify who is making what modifications to the IP database. is there a way to do that? sorry if im being a pain.
Reputation Points: 10
Solved Threads: 0
Light Poster
sickly_man is offline Offline
42 posts
since Jun 2007
Jul 5th, 2007
0

Re: getting user info

There might be another way but i only know the method that i've explained above.
Reputation Points: 27
Solved Threads: 14
Junior Poster
Cerberus is offline Offline
162 posts
since Sep 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Warning: Cannot modify header information - headers already sent by (output started a
Next Thread in PHP Forum Timeline: SMF 1.1.1





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC