1. The actual reason why the output file test.txt is empty is because the URL contains some special symbols, such as "&", which breaks the issued command. This can be fixed with proper quoting:
2. The syntax looks good, apart from the mentioned quoting. The interpretor/hashbang/shebang is not needed. It's outside the php section and is treated as plain text, so you can remove it. Inside the php section it would be a comment.
3. You write you get a blank page, but what did you expect? Due to echo'ing a string and redirecting it to a file there is no output to be returned. Add this to your php script to see some output:
4. Breaking down the URL is not a good idea. Try to figure out why.
Complete demo incl. shell script for processing the form data:
html file: unchanged
php file (script.php):
PHP Code:
<?php $field1 = $_GET["sdate"]; $field2 = $_GET["edate"]; $field3 = $_GET["adress"]; echo "$field1$field2$field3"; //Obviously, this is a temporary location :D $output = shell_exec("/tmp/process-fields.sh '$field1' '$field2' '$field3'"); echo "<pre>$output</pre>"; ?>
shell script (process-fields.sh):
output:
All in all it's nice to play with and stuff, but from the security point of view it's a big disaster, imho.
Learn the difference between GET and POST method, implement some form validation etc etc
These 2 Users Gave Thanks to junior-helper For This Post:
Here's a question I have for anyone that might be able to help me:
I can write a html script that will allow the user to return to the previous page using the back button, and I can write a script that will allow the user to return to the previous page using the close button, but...is there a... (1 Reply)
Hi all. I need to use excel macro at my desktop to launch a csh script which is in a solaris environment. What is the code that i can use in macro to help me with that ? Basically, the code need to telnet or ftp to the solaris environment and just run the script and the macro will output in an... (1 Reply)
Hi, I'm a pretty big fan of BASH scripting. I've got a bunch I use for random things and lately a couple issues have been plaguing me.
Both are somewhat related, in that they deal with filenames with spaces and "escaped" characters and with launching a program with command line arguements... (5 Replies)
Hey guys,
I got a issue here...
we have a development box and a UAT box that our webmasters use, they do the webpage development on the development box and and save changed files to a particular directory on the dev machine.
At a certain time of the day a cronjob kicks off and the... (3 Replies)
Hi All,
OS:AIX 64 bits
Would like to know what is the command to launch vnc session from unix shell script so that Reports server is started from vnc session which should be launched from within the shell script.
Thanks for your time!
Regards, (0 Replies)
Hi there, im new too shell scripting and was wondering if it is possible to create a shell script to take in a variable and load a c program.
My C program is a file monitor, and is started by using the terminal and using to following code
./monitor FileToBeMonitored
is it possible to have... (12 Replies)
Hello Guys,
I would like to know how can I create a radio button on that its possible to return to the last page, using a ksh CGI shell script.
Can someone help ?
Thanks so much !!!:b:
I tried this, but it is a javascript code !
<INPUT TYPE="button"
VALUE="BACK"
... (2 Replies)
Hey experts,
I am trying to read a webpage and want to search for a text patter (case insensitive). Please help me acquire this.
If the text is found i will receive a mail which can be hardcoded in the script.
I am not a big fan of using PERL script.
Please help.
Machine: AIX... (15 Replies)
Hello ,
I am trying to execute a small shell script from a PHP Webpage.
Below is the shell script : 1.sh
$ cat /home/oracle/rahul/1.sh
#!/bin/ksh
echo "`date` : Report generation in progress" > /home/oracle/rahul/report.txt
echo "Run successfully script";
Below is the PHP... (1 Reply)