CHMOD-Rechner
CHMOD-Rechner online
Arbeitsblatt
Code
- chmod-rechner.php
<?php ini_set('error_reporting',E_ALL); ini_set('display_errors', '1'); $octal = "000"; $oct_u = 0; $oct_g = 0; $oct_o = 0; $cb_ur = ''; $cb_uw = ''; $cb_ux = ''; $cb_gr = ''; $cb_gw = ''; $cb_gx = ''; $cb_or = ''; $cb_ow = ''; $cb_ox = ''; $c = " checked "; if (isset($_GET['ur'])) { $oct_u = $oct_u + 4; $cb_ur = $c; } if (isset($_GET['uw'])) { $oct_u = $oct_u + 2; $cb_uw = $c; } if (isset($_GET['ux'])) { $oct_u = $oct_u + 1; $cb_ux = $c; } if (isset($_GET['gr'])) { $oct_g = $oct_g + 4; $cb_gr = $c; } if (isset($_GET['gw'])) { $oct_g = $oct_g + 2; $cb_gw = $c; } if (isset($_GET['gx'])) { $oct_g = $oct_g + 1; $cb_gx = $c; } if (isset($_GET['or'])) { $oct_o = $oct_o + 4; $cb_or = $c; } if (isset($_GET['ow'])) { $oct_o = $oct_o + 2; $cb_ow = $c; } if (isset($_GET['ox'])) { $oct_o = $oct_o + 1; $cb_ox = $c; } $octal = "$oct_u" . "$oct_g" . "$oct_o"; ?> <!doctype html> <html> <head> <meta charset='utf-8'> <title>CHMOD-Rechner</title> <style> body {font-family: sans-serif; font-size:150%} td { border: 1px solid #ccc; width:120px; padding: 5px; text-align:center} h1 {color: blue} </style> </head> <body> <h1>CHMOD-Rechner</h1> <form method='get'> <table> <tr><td>User</td><td>Group</td><td>other</td></tr> <tr><td>r w x</td><td>r w x</td><td>r w x</td></tr> <tr> <td> <input type='checkbox' name='ur' <?php echo $cb_ur;?>> <input type='checkbox' name='uw' <?php echo $cb_uw;?>> <input type='checkbox' name='ux' <?php echo $cb_ux;?>> </td> <td> <input type='checkbox' name='gr' <?php echo $cb_gr;?>> <input type='checkbox' name='gw' <?php echo $cb_gw;?>> <input type='checkbox' name='gx' <?php echo $cb_gx;?>> </td> <td> <input type='checkbox' name='or' <?php echo $cb_or;?>> <input type='checkbox' name='ow' <?php echo $cb_ow;?>> <input type='checkbox' name='ox' <?php echo $cb_ox;?>> </td> </tr> <tr> <td colspan='3'> <?php echo "Oktalzahl: " . $octal; ?> </td> </tr> <tr> <td colspan='3'> <input type='submit' value='Rechne'> </td> </tr> </table> </form> </body> </html>
— Walter Hermanns 2017/08/08 07:44