=-=-=-=–=
Quick explanation:
This php form gathers a variable from a form, which in exchange performs a couple of shell scripts …
1.- Includes the name of the unit for an ssh connection command to gather Available space on Disks (df -h) and save the output into a text file.
2.- Performs a secure copy of the text file into the server to display its result. (scp [source] [target])
The issues I am facing are…
1.- I have no way to know what is going on while the scripts are running…(maybe a way to add a progress bar?)
2,- The Site takes way too long to display the results
3.- The Data displayed is the previous player’s information… (The output.txt file displayed downloads, but the site displays the information of the previous time the commands were run)
What do you guys recommend I do in order to improve the the code and preformance of the site
=-=-=-=-=-=-=-==
CODE:=-=-=-=-=-=
=-=-=-=-=-=-=-==
<?php $Mplayer1 = $_GET["Mplayer1"]; $subset1 = "sed -e 's/localhost/"; $subset2 = "/g' "; $final = $subset1.$Mplayer1.$subset2."result_test.sh > result_test1.sh"; $finalLink= "./result_test1.sh"; $getResult = file_get_contents("output.txt"); $outputfix1 = "sed -e 's/player/"; shell_exec($finalLink); exec($outputfix1.$Mplayer1.$subset2."gather_output.sh > gather_output1.sh"); $importOutput = "./gather_output1.sh"; exec($final); sleep (3); exec($importOutput); echo $Mplayer1; function output($getResult){ echo "
"; print_r($getResult); echo ""; }
output ($getResult);
?>