Posts mit dem Label php werden angezeigt. Alle Posts anzeigen
Posts mit dem Label php werden angezeigt. Alle Posts anzeigen

Donnerstag, 14. August 2014

stop linux process from website with php

content for html-file:

<html>
<body>
<?php
if ($_GET['run']) {
  # This code will run if ?run=true is set.
  exec("sudo /home/pi/kill.sh", $output2);
}
?>
<!-- This link will add ?run=true to your URL, myfilename.php?run=true -->
<a href="?run=true"><img src="stop-button.png" width="200" 0height="160" border="0" alt="stop"></a>
</body>
</html>


content for shell script:

sudo killall capture_endless

start linux shell script from website with php

html code:

<html>
<body>
<?php
if ($_GET['run']) {
  # This code will run if ?run=true is set.
  exec("/home/YOUR_USER/YOUR_SCRIPT.sh", $output);
}
?>
<a href="?run=true">START</a>
</body>
</html>

show linux process status on a website with php

html code:

<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<center>
<?php
  exec("ps ax | grep PROCESS_NAME | grep -v grep 2>&1", $output, $ret);
?>
<table>
<tr>
<td align="undefined" valign="undefined">
<h2>
<?php if ($ret == "0") { echo "PROCESS IS RUNNING..."; } else {echo "PROCESS IS STOPPED"; } ?> </td>
</h2>
</tr>
</table>
</body>
</html>

show datetime from JPG exif data with php

php-code:


<?php
$exif = exif_read_data('IMAGE.JPG', 'IFD0', 0);
$edate = $exif['DateTime'];
if (strlen($edate) > 0) echo "<h2>Date/Time $edate</h2>";
?>



read complete exif data from JPG with php

php-code:


<?php
echo "IMAGE.JPG:<br />\n";
$exif = exif_read_data('IMAGE.JPG', 'IFD0');
echo $exif===false ? "Keine Headerdaten gefunden.<br />\n" : "Bild beinhaltet Header<br />\n";

$exif = exif_read_data('IMAGE.JPG', 0, true);
echo "IMAGE.JPG:<br />\n";
foreach ($exif as $key => $section) {
    foreach ($section as $name => $val) {
        echo "$key.$name: $val<br />\n";
    }
}
?>