LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-21-2011, 11:08 PM   #1
athrin
Member
 
Registered: Mar 2011
Posts: 135

Rep: Reputation: 1
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?

Last edited by athrin; 04-21-2011 at 11:36 PM.
 
Old 04-22-2011, 12:54 AM   #2
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
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.
 
Old 04-22-2011, 01:04 AM   #3
athrin
Member
 
Registered: Mar 2011
Posts: 135

Original Poster
Rep: Reputation: 1
oh really?? how to do it?
do you got any suitable link that related to this?
if dont have post the command here..

Last edited by athrin; 04-22-2011 at 04:13 AM.
 
Old 04-24-2011, 11:28 PM   #4
athrin
Member
 
Registered: Mar 2011
Posts: 135

Original Poster
Rep: Reputation: 1
hello.. does anyone here know how to solve this?
 
Old 04-24-2011, 11:56 PM   #5
athrin
Member
 
Registered: Mar 2011
Posts: 135

Original Poster
Rep: Reputation: 1
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SCP a file to diff directory/change filename using PHP or call sh script fm PHP nuebelhor Red Hat 1 11-05-2009 09:03 AM
scp does not work and gives the following error message: scp: FATAL: Executing ssh1 i akay Linux - Networking 16 09-29-2008 12:41 AM
PHP - how can you combine two images into one? BrianK Programming 4 06-03-2007 09:59 AM
PHP & GD Library - Combine Two Images wh33t Programming 1 11-29-2005 10:12 AM
Errr, WTH is going on with this???? fatgod Linux - General 5 09-10-2003 06:30 PM


All times are GMT -5. The time now is 09:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration