The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
check user id before running script cpolikowsky UNIX for Dummies Questions & Answers 3 06-06-2008 09:02 AM
AIX:creating user with username more than 8 chars anuafs84 UNIX for Dummies Questions & Answers 0 04-14-2007 01:00 AM
find the server name a script is running on shellburger UNIX for Dummies Questions & Answers 3 08-30-2006 08:15 PM
Running script from other user rather than login user rawatds Shell Programming and Scripting 2 08-25-2006 12:51 AM
running a script under different user Gary Dunn Shell Programming and Scripting 4 12-13-2004 02:17 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-09-2008
Registered User
 

Join Date: Apr 2006
Posts: 89
Find username of user running the script

Hello All,

If I have a simple cgi script and want to find the name of the person accessing the page, is it possible? How do I get the name of this user? Please help.


I was trying a vague method but it doesn't seem to work with all browsers and versions ...
Code:
$val=$ENV{'HTTP_COOKIE'};
$name = (split ('=',(split(';',$val))[1]))[1];
print "$name";
Regards,
garric

Last edited by Yogesh Sawant; 06-09-2008 at 04:01 AM. Reason: added code tags
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-10-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,084
This information is not transmitted over HTTP/CGI. If you mean the local user executing the CGI script on behalf of the visitor, then that should be whatever user is running the HTTP daemon, and will not change from one invocation to the next.

If you are setting cookies, then whatever is in those cookies is of course accessible to you, but if you don't know a user in the first place, you cannot get their name into a cookie.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:25 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0