AOA,
Dear LP members,
I am writing a PHP script, which will take input from users. As soon as the users press enter, the input from the script should become a variable of a bash script that will run some commands.
like if a user enter "bla bla"
a variable should be created and this "bla bla" should be stored in that varialbe, which can be used in a bash script.
As the bash script will be completed, it should be redirected to a HTML or a PHP page with the output of the BASH script.
Looking forward for your help.
PHP + Bash script
PHP + Bash script
Kind Regards
Mudasir Mirza (RHCE)
(+971)55-1045754
http://www.crystalnetworks.org
http://www.diglinux.com
Mudasir Mirza (RHCE)
(+971)55-1045754
http://www.crystalnetworks.org
http://www.diglinux.com
-
- Site Admin
- Posts: 5132
- Joined: Fri May 02, 2003 10:24 am
- Location: Karachi
- Contact:
AOA,
Dear Farrukh bhai,
THe PHP script that will take the inpu from user is complete, no i dont know how to convert that input in a bash variable, and start the bash script as the php script starts to work.
Dear Farrukh bhai,
THe PHP script that will take the inpu from user is complete, no i dont know how to convert that input in a bash variable, and start the bash script as the php script starts to work.
Kind Regards
Mudasir Mirza (RHCE)
(+971)55-1045754
http://www.crystalnetworks.org
http://www.diglinux.com
Mudasir Mirza (RHCE)
(+971)55-1045754
http://www.crystalnetworks.org
http://www.diglinux.com
-
- Site Admin
- Posts: 5132
- Joined: Fri May 02, 2003 10:24 am
- Location: Karachi
- Contact:
Re:
Dear mudasir,
Salam,
Best Regards.
Salam,
Can you post your php script ?mudasir wrote:THe PHP script that will take the inpu from user is complete, no i dont know how to convert that input in a bash variable, and start the bash script as the php script starts to work.
Best Regards.
Farrukh Ahmed
Dear Farrukh bhai,
<html><head><title>Directory Search</title></head>
<body><form action="index.php" method="post" name="form1">
Search: <input type="text" name="user">
<BR><input type="submit" value="submit">
</form></body></html>
this is the simple php script that i am trying to write.
Now what ever the user will input, must be processed by a bash script. thats what i want.
<html><head><title>Directory Search</title></head>
<body><form action="index.php" method="post" name="form1">
Search: <input type="text" name="user">
<BR><input type="submit" value="submit">
</form></body></html>
this is the simple php script that i am trying to write.
Now what ever the user will input, must be processed by a bash script. thats what i want.
Kind Regards
Mudasir Mirza (RHCE)
(+971)55-1045754
http://www.crystalnetworks.org
http://www.diglinux.com
Mudasir Mirza (RHCE)
(+971)55-1045754
http://www.crystalnetworks.org
http://www.diglinux.com
that's the web page (all html), not the php code.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
-
- Naik
- Posts: 75
- Joined: Mon Oct 13, 2003 5:06 am
- Location: Karachi, Pakistan
- Contact:
Don't know either you are not going at right way with PHP coding (as you posted just html code), or don't want to post your php code.
Anyway, you don't need to send your variables toward bash script to execute, you can also execute your php variable directly.
i.e.
moreover, what I guess you are trying to write front end for MT. isn't it?
if yes, see below this will give you some clues:
Although I finished PHP/MySql based front end for MT database year ago, but I can not post those as they includes some blocks of copyright material.
Best of luck
Anyway, you don't need to send your variables toward bash script to execute, you can also execute your php variable directly.
i.e.
Code: Select all
exec("echo $php-variable");
if yes, see below this will give you some clues:
Code: Select all
$output = "/ip hotspot user add name=".$values["Login"]." "."password=".$values["Password"]." "."mac-address=".$values["MAC"]." "."profile=".$values["Package"]." "."disabled=".$values["Status"];
exec("/usr/bin/ssh $user@$mt-ip $output 'comment=\"$comments\"'");
Best of luck
what if i wrote "blah; rm /etc/passwd" in the text field?
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
-
- Naik
- Posts: 75
- Joined: Mon Oct 13, 2003 5:06 am
- Location: Karachi, Pakistan
- Contact:
I love your witty replylambda wrote:what if i wrote "blah; rm /etc/passwd" in the text field?
httpd.log > Permission Denied
Nothing happen, with default http configuration, as none of http server running as root by default, and in case http server is running with root permissions (not recommended in any way), its gone!
TIP: There is backup of passwd file with "passwd-" or "opasswd".
Although lambda made a fun, but I like to clarify for beginners that PHP permissions laid under http server, all execution's through PHP also execute as a user, with which your httpd is running.