HELP!
| From: | Armando Cerna | Date: | Wed, 03 Oct 2001 02:07:38 +0000 |
| Subject: | HELP! | ||
| Groups: | php.db php.general | ||
| Request: | Send a blank email to php-db+get-12948@lists.php.net to get a copy of this message | ||
I have the following script does anyone see anything wrong with this as to
why it wouldn't be working
It should su to mp then execute the command but I may have missed something
is \n ok for a carrige return? I did it like this because as nobody the
command couldn't be executed and failed and it won't let me su to nobody.
Well anyway here is the script
<?PHP
$permission = popen ("su mp -c grabdb","w+");
sleep(2);
fwrite($permission,"secret\n");
pclose($permission);
if ($permission) {
print "All done Sir. Shall I <a href=index.html>return</a> you?";
} else {
print "$files";
print "It's ok you'll get it working. =)";
}
?>
It calls the bash script grabdb which contains the following:
updatemp ; importmp ; echo "All Complete Sir"
Now updatetemp contains the following
smbclient //machine/c -I 192.168.0.4 -U armando%secret -D a1 -c 'lcd /tmp/dbf
; prompt ; mget cus.dbf ; quit'
Once that is done it moves on to importmp
cd /tmp/dbf ; dbf2mysql -d maria -t customers -s ID=row_id -c -P secret-U
user CUS.DBF
And then quits. Now mind you this works beautiful in a shell on its own but
once PHP tries to do it with the script mentioned above it doesn't work
Thanks for any help,
Armando