Nothing is getting displayed on browser while using open statement


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Nothing is getting displayed on browser while using open statement
# 15  
Old 06-22-2011
I was not closing the tags correctly but its displaying the data onCMD but still not on browser
# 16  
Old 06-22-2011
What if you 'view source' in the browser?

Did you try moving the file to where I suggested?
# 17  
Old 06-23-2011
Okay let me list the problem once again. Below is my code.
Code:
#!c:/perl/bin/perl
use Win32::ODBC;
use CGI ':standard';
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Local User Accounts</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "<TABLE BORDER=2>\n";
print "<TR><TH>User ID</TH><TH>Hosts</TH></TR>\n";
 
my $line;
my @line2;
my @line3;
my %hosthash;
my @templine;
my @acc_user;
my @host_name;
my $count=0;
my $count1=0;
my $check;
my $check2;
my @hostname;
my @filedata;
my $ldapuser;

open(FILE,"Somefile.txt") or die("Unable to open file");
foreach $line3 (<FILE>) 
{
 chomp($line3);
 push(@filedata,$line3);  
}
close(FILE);
open(STDERR, ">&STDOUT");
foreach $line (@filedata) 
{
     chomp($line); 
 @templine=split(/,/ ,$line);
 $count=0;
 $hosthash{$templine[0]} = [] unless exists $hosthash{$templine[0]};  
 foreach $check(@acc_user)
 {
  if($check eq $templine[0])
  {
   $count=1;
   last;
  }
  
 }
 if($count==0)
 {
  push(@acc_user,$templine[0]);
 }
 
 foreach $check2(@acc_user)
 {
  if($check2 eq $templine[0])
  {
        
   push @{ $hosthash{$check2} }, $templine[1];
   #print "Plesae wait Loading Data \n";
   
  }
  
 }
 
 
 
}
foreach $ldapuser(@acc_user)
{
 
 
 @hostname = @{$hosthash{$ldapuser}}; 
 print "<TR><TH>"."$ldapuser"."</TH><TH>"."@hostname"."</TH></TR>\n";
 
 
}

print "</TABLE>\n";
print "</BODY>\n";
print "</HTML>\n";

It gives me NO OUTPUT on broser other than the headings
User ID Hosts

But on the cmd prompt it gives the follwing output
Code:
<HTML>
<HEAD>
<TITLE>Local User Accounts</TITLE>
</HEAD>
<BODY>
<TABLE BORDER=2>
<TR><TH>User ID</TH><TH>Hosts</TH></TR>
<TR><TH>aabano</TH><TH>nis1m3</TH></TR>
<TR><TH>aabukhat</TH><TH>adm7m3 nis1m3</TH></TR>
<TR><TH>aaditi</TH><TH>nis1m3</TH></TR>
<TR><TH>aalekova</TH><TH>dwdev1w88m7</TH></TR>
<TR><TH>aambani</TH><TH>nis1m3</TH></TR>
</TABLE>
</BODY>
</HTML>

Kindly help.

The files have correct permission. One more thing if i remove the pen statement and pront some other things its displayed correctly on the browser

Last edited by Franklin52; 06-23-2011 at 05:07 PM.. Reason: Please use code tags for data and code samples
# 18  
Old 06-23-2011
What makes you think the file has correct permissions when it never works from anything but your own user? Did you actually try moving it to where I suggested?
Code:
open(STDERR, ">&STDOUT");

This should be BEFORE the other open, so you can see its error message.
This User Gave Thanks to Corona688 For This Post:
# 19  
Old 06-23-2011
I have accomplished the task by using a seprate html uploader and then parsing the file using cgi.

Thanks for the responses
# 20  
Old 06-24-2011
Quote:
Originally Posted by neutronscott
What webserver is this? Maybe

Code:
print "Status: 200 OK\nContent-type: text/html\n\n";

or is it "HTTP 200 OK" ? Smilie Haven't needed to use this for awhile
Let me have a try!

---------- Post updated at 10:42 PM ---------- Previous update was at 09:28 PM ----------

Too complex!!
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

0403-016 Cannot find or open the file in If Statement

Hi, I am comparing the number of records in the .bad record from sql loader, if it is higher than the number passed in as an argument, the program should exit. However, I constantly receive the error " 0403-016 Cannot find or open the file." on the line with the if statement "elif ;". The code... (3 Replies)
Discussion started by: MIA651
3 Replies

2. Shell Programming and Scripting

Convert Update statement into Insert statement in UNIX using awk, sed....

Hi folks, I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex. I have a bunch of update statements with all columns in a file which I need to convert into insert statements. UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies

3. Solaris

Can't open netscape web-browser

I am working in solaris 9 and i want to work with web-browser(netscape). but when I am openning it,it shows the message -- An error occurred reading the startup configuration file.Please contact ur administrator./.netscape/preferences.js,line 66:unterminated string literal.t,127.0.0.1 please... (3 Replies)
Discussion started by: smartgupta
3 Replies

4. Shell Programming and Scripting

Password is getting displayed

My shell script which runs on solaris has an execution in it. Contents of shell script BEGIN : Executable_filename username/password@DBinstance parameter2 parameter3 Contents of shell script END : When i launch the shell script, it connects to database to gets few details.. In the... (3 Replies)
Discussion started by: shafi2all
3 Replies

5. HP-UX

swlist is not displayed in HP-UX

Hi swlist command is not displayed in HP-UX ..it displays swlist: Command not found. uname -a HP-UX inccishh B.11.11 U 9000/800 4046719263 unlimited-user license :b: Best Regards vasanthan (4 Replies)
Discussion started by: vasanthan
4 Replies

6. UNIX for Advanced & Expert Users

script to open the specified url in a browser from a text file

Hi All, here i am struc (6 Replies)
Discussion started by: gsp
6 Replies

7. Solaris

How to open Browser

Hi, I am connecting to the remote machine via Xmanger. How can i ope browser from the termilnal. I can open gui from my terminal. (xclock works) Just wondering how to open the browser ? (2 Replies)
Discussion started by: bang_dba
2 Replies

8. Solaris

hostname not displayed

Hi, I posted a problem earlier on on how to change IP addresses on an E450. I was able to work around this and wanna say thanks to all who assisted. But now on my server, I get this error, trying to configure hosts..RPC timed out. Also, when I type on the command line, hostname, nothing is... (7 Replies)
Discussion started by: Ronny
7 Replies
Login or Register to Ask a Question