getting user info

Reply

Join Date: Jun 2007
Posts: 42
Reputation: sickly_man is an unknown quantity at this point 
Solved Threads: 0
sickly_man's Avatar
sickly_man sickly_man is offline Offline
Light Poster

getting user info

 
0
  #1
Jul 5th, 2007
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.
Henry Phillips
Web Programmer
Adirondack Area Network, LLC
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 162
Reputation: Cerberus is an unknown quantity at this point 
Solved Threads: 14
Cerberus Cerberus is offline Offline
Junior Poster

Re: getting user info

 
0
  #2
Jul 5th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 42
Reputation: sickly_man is an unknown quantity at this point 
Solved Threads: 0
sickly_man's Avatar
sickly_man sickly_man is offline Offline
Light Poster

Re: getting user info

 
0
  #3
Jul 5th, 2007
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.
Henry Phillips
Web Programmer
Adirondack Area Network, LLC
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 162
Reputation: Cerberus is an unknown quantity at this point 
Solved Threads: 14
Cerberus Cerberus is offline Offline
Junior Poster

Re: getting user info

 
0
  #4
Jul 5th, 2007
You could possibly store the username in the session variable after a successful login and then insert that value in the table.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 42
Reputation: sickly_man is an unknown quantity at this point 
Solved Threads: 0
sickly_man's Avatar
sickly_man sickly_man is offline Offline
Light Poster

Re: getting user info

 
0
  #5
Jul 5th, 2007
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!!
Henry Phillips
Web Programmer
Adirondack Area Network, LLC
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 162
Reputation: Cerberus is an unknown quantity at this point 
Solved Threads: 14
Cerberus Cerberus is offline Offline
Junior Poster

Re: getting user info

 
0
  #6
Jul 5th, 2007
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.
  1. <?php
  2. echo $_SESSION['varUserName'] //output user name
  3. ?>

My php is a bit rusty so it might not be exact.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 42
Reputation: sickly_man is an unknown quantity at this point 
Solved Threads: 0
sickly_man's Avatar
sickly_man sickly_man is offline Offline
Light Poster

Re: getting user info

 
0
  #7
Jul 5th, 2007
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.
Henry Phillips
Web Programmer
Adirondack Area Network, LLC
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 162
Reputation: Cerberus is an unknown quantity at this point 
Solved Threads: 14
Cerberus Cerberus is offline Offline
Junior Poster

Re: getting user info

 
0
  #8
Jul 5th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 42
Reputation: sickly_man is an unknown quantity at this point 
Solved Threads: 0
sickly_man's Avatar
sickly_man sickly_man is offline Offline
Light Poster

Re: getting user info

 
0
  #9
Jul 5th, 2007
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.
Henry Phillips
Web Programmer
Adirondack Area Network, LLC
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 162
Reputation: Cerberus is an unknown quantity at this point 
Solved Threads: 14
Cerberus Cerberus is offline Offline
Junior Poster

Re: getting user info

 
0
  #10
Jul 5th, 2007
There might be another way but i only know the method that i've explained above.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC