LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 10: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 10:36 PM.
 
Old 04-21-2011, 11:54 PM   #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, 12: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 03:13 AM.
 
Old 04-24-2011, 10: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, 10: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



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 08:03 AM
scp does not work and gives the following error message: scp: FATAL: Executing ssh1 i akay Linux - Networking 16 09-28-2008 11:41 PM
PHP - how can you combine two images into one? BrianK Programming 4 06-03-2007 08:59 AM
PHP & GD Library - Combine Two Images wh33t Programming 1 11-29-2005 09:12 AM
Errr, WTH is going on with this???? fatgod Linux - General 5 09-10-2003 05:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:22 AM.

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
Open Source Consulting | Domain Registration