LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   php combine wth scp (https://www.linuxquestions.org/questions/linux-newbie-8/php-combine-wth-scp-876430/)

athrin 04-21-2011 10:08 PM

php combine wth scp
 
hi,
i just want ask. can php pass ip or password to scp? example the user enter ip and password of server and those ip and password been sent inside bash and scp receive the input. can it work?

stickman 04-21-2011 11:54 PM

Yes you can pass data from PHP as arguments to scp or any other program. You might find it a bit more efficient to look through the PEAR modules for something that does scp.

athrin 04-22-2011 12:04 AM

oh really?? how to do it?
do you got any suitable link that related to this?
if dont have post the command here..

athrin 04-24-2011 10:28 PM

hello.. does anyone here know how to solve this?

athrin 04-24-2011 10:56 PM

this is php code on how i pass the ip and pword
Code:

<html><head><title>Enter Details
</title></head><body>

<form name="detailfrm" method="post" action="">
<table>
<tr>
    <td>Enter Ip</td>
    <td>:</td>
    <td><input type="text" name="ip1"></td>
</tr>
<tr>
    <td>Enter password</td>
    <td>:</td>
    <td><input type="text" name="ip2"></td>
</tr>
<tr>
    <td><input type="submit" value="Submit" name="detailbtn"></td>
</tr>
</table>
</form>

</body></html>

<?php

if(isset($_POST["detailbtn"]))
{
$ip1=$_POST["ip1"];
$ip2=$_POST["ip2"];
putenv("IP1=$ip1");
putenv("IP2=$ip2");
system("/var/www/cgi-bin/script.sh $ip2 $ip1");
}

in my sh file it receive the ip and pword but i just dont know how to store my pword there.


All times are GMT -5. The time now is 07:50 AM.