Why username is always empty


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Why username is always empty
# 1  
Old 10-30-2011
Why username is always empty

i have a html file with uploads a file and sends the username to a .cgi file using post method.

the part of code in the cgi file is as below. i am able to get the filename but not able to get the username thats getting posted to the file how to know the value of username. i am trying to store the username in the variable pxuser but when i print its value is blank. can somebody help username is coming in as p_user from the html file
Code:
foreach $key (sort {$a <=> $b} $query->param()) {
   # rearrange:
   next if ($query->param($key) =~ /^\s*$/);
   next if ($key !~ /^filetoupload_(\d+)$/);

   # next condition is a subset of the previous condition
   # i.e., $key cannot be empty AND match filetoupload_\d+
   #next if ($key =~ /^\s*$/);

   $Number = $1;

   # only one matching group:  (        )   
   if ($query->param($key) =~ /([^\/\\]+)$/) {
      $Filename = $1;
      $Filename =~ s/^\.+//;

      # hence, no $2
      #$pxuser = $2;
      #$pxuser =~ s/^\.+//;

      $files{$Number} = $Filename;
      $File_Handle = $query->param($key);

   if (!$ALLOW_INDEX && $Filename =~ /^index/i) {
       print header;


Last edited by Scott; 10-30-2011 at 03:54 PM.. Reason: Code tags
# 2  
Old 11-12-2011
Sorry, but "username is coming in as p_user from the html file" doesn't make sense exactly.

You have an HTML file and somewhere in there you've defined a form. And within this form, you have a hidden variable or something which is named p_user?

Second,
Code:
next if ($key !~ /^filetoupload_(\d+)$/);

ensures that if the variable is not named filetoupload..., that variable will be ignored.

Maybe you want
Code:
 $pxuser = $query->param("p_user");

and then the rest of your script.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Why does "ps -[u|U] username" not list processes when username is numeric?

Greetings, The title pretty much says it all. I've snooped everywhere and can't find anything on this. Since our organization went to numeric usernames, using the u|U option for ps returns no processes. Example passwd entry: 320074:DjZAJKXun8HBs:10129:6006:Joe Y:/cadhome/analysis/jy:/bin/bash... (4 Replies)
Discussion started by: crimso
4 Replies

2. Solaris

Su -i username not working why

Hi all, System is Solaris10 There is one script which i was able to execute with following entry:- su user1 -c "/u01/scripts/mfg/_db-start.all" But when I do this, which asked to do with -i option su -i user1 -c "/u01/scripts/mfg/_db-start.all" It gives following message:-... (1 Reply)
Discussion started by: manalisharmabe
1 Replies

3. Post Here to Contact Site Administrators and Moderators

Change username

Hi.. I want to change my username, is there any way by which I can do it? Thanks in advance.. (3 Replies)
Discussion started by: laxmi Sharma
3 Replies

4. Post Here to Contact Site Administrators and Moderators

username

Is it possible to change my username in this site or is thre a way to delete my account and then create a new one with a diffrent user name (2 Replies)
Discussion started by: floresr
2 Replies

5. UNIX for Dummies Questions & Answers

Getting same exit status for empty and non empty file

Hi All, I am checking for a empty input file to do some further action , but I am getting exit status 0 in both the cases , for empty and non empty file both. The value of $? is coming 0 in if part also and else part too. #!/bin/ksh if ]; then echo "data" # exit 0 echo "$?" else... (4 Replies)
Discussion started by: mavesum
4 Replies

6. AIX

Username with more than 8 Characters

Hey, i'm using AIX 5.3 which authenticates against a Microsoft Active Directory. Everything works fine but like everytime there's a problem. I created users with usernames with more than 8 characters. Now i tried do login on AIX with these users, which didn't work. The login-window... (3 Replies)
Discussion started by: damn-86
3 Replies

7. UNIX for Dummies Questions & Answers

how to find empty folders without using -empty

hi all: my solaris FIND does not support find myFolder -type d -empty how can i find the empty folders? thanks! (7 Replies)
Discussion started by: lasse
7 Replies

8. Post Here to Contact Site Administrators and Moderators

changing my username?

Hello Mods, is it possible to change my username to different username and retain the posts and registration details of this account instead of registering a new account? Best Regards, (4 Replies)
Discussion started by: Bashar
4 Replies

9. UNIX for Dummies Questions & Answers

Username creation

Hi, There was a problem when creating a username. which was to be mapped in nis. but we encountered a problem and decided to delete the username. So instead of using the userdel command we acidentally deleted the username entry in the passwd file, which does not have backup. So upon recreating... (1 Reply)
Discussion started by: vivek_scv
1 Replies

10. UNIX for Dummies Questions & Answers

How do I Create a New Username

Hi I am new at Unix and need to setup a username and password, I currently login as root and use the password saturn. I wish to change this password and create more.....help (7 Replies)
Discussion started by: kimjones142001
7 Replies
Login or Register to Ask a Question