Help need in CGI script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help need in CGI script
# 1  
Old 05-09-2014
Help need in CGI script

Hello All,

first of all please forgive me if I have brocken some rule of this forum and this is not a homework Smilie.

Could you please help me as I have created a new apache service in a server by creating a new httpd.conf for the new service. Now in the httpd.conf file I have studied by google and tried to put the values correct for configuration like I have put Document root, Alias, Listen and Script Alias etc and I am able to hit the link successfully, but when I have put a simple cgi script(which is nothing but a simple html code) in the same link and in spite of reading echo, !#/usr/ksh commands it is simply putting echo in IE.

What I think is it is taking file as a text file, could you please let me know how I can fix this.

Here is the CGI.

Code:
#!/usr/bin/ksh
echo "Content-Type: text/html"
echo "<HTML>"
echo "<HEAD>"
echo "<TITLE>Singh test</TITLE>"
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"
echo "<SCRIPT TYPE=\"text/javascript\">"
echo "<!--"
echo "window.focus();"
echo "//-->"
echo "</SCRIPT>"
echo "</HEAD>"
echo "<BODY>"
echo "</HEAD>"
echo "<BODY  TEXT vlink="black" link="blue" alink="white" >"
echo "<CENTER><STRONG> status form</STRONG></CENTER>"
echo "<FORM METHOD=POST ACTION=/opt/hd/test/test.cgi>"
echo "</FORM>"
echo "</BODY>"
echo "</HTML>"


Thanks,
R. Singh
# 2  
Old 05-09-2014
try adding:
Code:
echo ""

after Content-type line
# 3  
Old 05-09-2014
Thank you rdrtx1 but it is not working. I am still getting below in IE.

Code:
#!/usr/bin/ksh echo "Content-Type: text/html" echo "" echo "" echo "" echo "" echo "" echo " " echo "" echo "" echo "" echo "" echo " 
Singh test" echo " " echo "" echo "" echo ""

Thanks,
R. Singh
# 4  
Old 05-09-2014
The body text line was not properly quoted. Instead of using echo and quotes, can't you do something like (not tested):

Code:
#!/usr/bin/ksh

/bin/cat << EOF
Content-Type: text/html

<HTML>
<HEAD>
<TITLE>Singh test</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT TYPE="text/javascript">
<!--
window.focus();
//-->
</SCRIPT>
</HEAD>
<BODY>
</HEAD>
<BODY TEXT vlink="black" link="blue" alink="white" >
<CENTER><STRONG> status form</STRONG></CENTER>
<FORM METHOD=POST ACTION=/opt/hd/test/test.cgi>
</FORM>
</BODY>
</HTML>
EOF

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cgi script please help!

ok so for the project i had to log in amazon node to submitted and create a captcha using cgi scripts its for a unix project this is my amazon node address ss. but first i have to create a .ht access to set the master password. can someone please help me??? in public_html, create a file... (1 Reply)
Discussion started by: jr44
1 Replies

2. Shell Programming and Scripting

Perl cgi pages out of cgi-bin folder in WINDOWS

Hi team, I have a typical problem with cgi pages in apache webserver in WINDOWS I am able to execute(display) the pages that are saved in cgi-bin folder. But I am not able to execute the pages stored in htdocs or other folder other than cgi-bin folder. Could anyone please let me know how... (1 Reply)
Discussion started by: scriptscript
1 Replies

3. Programming

CGI Perl script to execute bash script- unable to create folder

Hi I have a bash script which takes parameters sh /tmp/gdg.sh -b BASE-NAME -n 1 -s /source/data -p /dest/data/archive -m ARC gdg.sh will scan the /source/data and will move the contents to /dest/data/archive after passing through some filters. Its working superb from bash I have... (0 Replies)
Discussion started by: rakeshkumar
0 Replies

4. Web Development

problem with exporting vairable from one perl cgi to another perl cgi script while redirecting.

Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect. Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is redirected to welcome page. My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies

5. Shell Programming and Scripting

Perl cgi script to call bash script?

Novice to perl here. I have created a simple web page in perl, with only one submit button. I would like to execute a bash script on the same server when this button is clicked on. Is this possible in perl? I have spent a few days researching this and am unable to find any useful information.... (0 Replies)
Discussion started by: pleonard
0 Replies

6. Shell Programming and Scripting

call shell script from perl cgi script problem

hi,, i have perl scipt with line : system('./try.sh $t $d $m'); in shell scipt try.sh i have the line: echo $1 its not printing value of $t that i hav passed..y is it so..i am running it from apache web server (2 Replies)
Discussion started by: raksha.s
2 Replies

7. UNIX for Advanced & Expert Users

How to capture STDOut of script in a CGI script?

Hi Perl Experts, I am invoking a shell script thru a perl script and the perl script is cgi script.I need to capture the STDOUT of the shell script in the html page where I am invoking the script .?The shell script takes couple of mintutes to complete its execution .Mean while my html page does... (1 Reply)
Discussion started by: kittu1979
1 Replies

8. Shell Programming and Scripting

Invoke shell script in cgi script

Hi, I just tried to call a simple shell script from a cgi script writing in c programming.But,it is not working.i will be grateful if anyone can show me the problems going on as i m new to c and oso shell script.Thanks. -Here is my shell script of call the 'pc shut down' system command in... (1 Reply)
Discussion started by: carolline
1 Replies

9. OS X (Apple)

cgi script

Hello, we have an extranet where every user has a password and a username. Some powerusers must have the possibility to access data of all the users without knowing their password. The powerusers must know the username. We want to use a form for this where a poweruser just gives the username. Then... (0 Replies)
Discussion started by: Vincent
0 Replies

10. Shell Programming and Scripting

CGI passing arrays/hashes to another CGI script

If I have a Perl CGI script (script01), which fills an array(s) with information and outputs a HTML page with a link to another CGI page (script02); is there anyway to pass the array(s) from "script01" to "script02" when the page visitor clicks the link? Hope that makes sense! :) (2 Replies)
Discussion started by: WIntellect
2 Replies
Login or Register to Ask a Question