how to redirect to a web-page by shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to redirect to a web-page by shell script
# 1  
Old 05-18-2009
how to redirect to a web-page by shell script

Dear all,
I am calling a korn shell script(CGI script) by a web-page. This shell script do some checking in a unix file and return true or false. Now within the same script, If it returns true then I want to redirect to another web-page stored in htdocs directory.
Example: Login page sends a username and password which is authenticated by a shell script. If the authentication is successful the shell script redirect to a next page which is stored in htdocs directory of apache web-server.
Thanks.
# 2  
Old 05-18-2009
Send either an HTTP code 301 or 302. Or send an HTML page containing
Code:
<meta http-equiv="refresh" content="0; url=http://www.yourdomain.com/whatever.ext"/>

somewhere in the <head>er. Or open the file yourself and just stream it through.
# 3  
Old 05-18-2009
Dear Pludi,
In this case the web-page which I am calling through the script can be open directly if someone knows the name of the web-page.
The web-page is in htdocs directory, if there is a method so that I can block the page to be opened directly by writing in url and can be opened only when I call it through script. It will solve my problem.
Thanks
# 4  
Old 05-18-2009
You'll probably have to
  • write a wrapper script that checks the authorization and only then serves the page OR
  • have your script set a cookie that an embedded JavaScript reads and then hides/unhides the content
By the way, most of the functionality you've asked for so far could be done using HTTP Basic authentication (plus a script if the user wants to change his/her password)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Web Development

Simple Vue.js Component to Redirect to External Web Page Using Vue Router

Vue Router has some quirks and on of the quirks is that it is not reliable when adding external links using the vue-router library. After struggling with many solutions, I have found that creating a simple Vue.js component like this one seems to work the best (so far): Component Example: ... (0 Replies)
Discussion started by: Neo
0 Replies

2. Shell Programming and Scripting

Refresh web page in bash script

hello, I am trying to refresh my web page which is created in bash script. I have a HTML page which when press a button calls a bash script. this bash script created the same page with dynamic data. When pressing the button I am calling to a function that set time out of 7 seconds and and after... (1 Reply)
Discussion started by: SH78
1 Replies

3. UNIX for Dummies Questions & Answers

How to switch the user before executing a shell script from web page??

hi, i want to execute a shell script as a different user. the flow is like this. there is a html web page from which i have to call a shell script. web server is apache. to call the shell script from html page, a perl script is required. so the html page calls the perl script and the perl... (2 Replies)
Discussion started by: Little
2 Replies

4. AIX

How to Use a UNIX Shell Script to Create an HTML Web Page?

dear friends , in my work i have to monitor some system performance in hourly basis by runing some commands , for example (lpstat) to know that all the queue is ready how can i create webpage and connect it with the server (AIX operating system) and make this page refreshed every 10 second and... (12 Replies)
Discussion started by: rami abusweilei
12 Replies

5. HP-UX

Help running a unix script from a web page

First, let me state that I am completely out of my realm with this. I have a server running HPUX. I'm not even sure if this can be considered a UNIX question and for that let me apologize in advance. I need to create a web page where a client can input 2 variables (i.e. date and phone number).... (0 Replies)
Discussion started by: grinds
0 Replies

6. Shell Programming and Scripting

How to input a number in a web page and pass to a script?

I am working on an embedded linux router and trying to make a webpage where the user can input a desired number of CPE and have a script update that number on the router. I have a CLI where I can log in and type the following to change that number echo "20">/proc/net/dbrctl/maxcpe which then... (7 Replies)
Discussion started by: BobTheBulldog
7 Replies

7. Web Development

Call shell script from HTML page - without web server

Hi, I have html page in my unix machine(server), which I will open with firefox or mozilla available in unix machine. Firefox or mozilla will be opened using x windows. Since I have access to unix machien(like other users) and this HTML page is for user having access to Unix machine, I see no... (7 Replies)
Discussion started by: vamanu9
7 Replies

8. UNIX and Linux Applications

How to redirect to squid login web page when internet access

Hi , I am new user. As you know when acl is defined in /etc/squid/squid.conf file according to its http_access users are able to access internet. Before that .htaccess asks them to access internet. It is fine. I saw in some customised linux servers in place of .htaccess login ,html web page... (1 Reply)
Discussion started by: sandeepvson
1 Replies

9. Shell Programming and Scripting

Executing shell program from a web page

Hi, I am looking for a cgi-script which runs a shell script from a web page. When I click "Run" from a web page it should run the shell commands in an textarea and results should get back to web page. Thanks Venkat (5 Replies)
Discussion started by: venkatritch
5 Replies

10. Shell Programming and Scripting

running shell script thru WEB page ....

....passing variable via list... here 's the HTML code extract : **************** <form method=post action=http://servername/cgi-bin/cgi-comptage_diff.ksh> <table border...........> .............. </table> <table bgcolor=#FFFFFF width="980"> ... (6 Replies)
Discussion started by: Nicol
6 Replies
Login or Register to Ask a Question