<?
if($page == "chmod"){
$chmod_1_complete = $_POST[1r]+$_POST[1w]+$_POST[1x];
$chmod_2_complete = $_POST[2r]+$_POST[2w]+$_POST[2x];
$chmod_3_complete = $_POST[3r]+$_POST[3w]+$_POST[3x];
echo $chmod_1_complete;
echo $chmod_2_complete;
echo $chmod_3_complete;
echo $_POST[octal];
$chmod_complete = $chmod_1_complete.$chmod_2_complete.$chmod_3_complete;
//$chmod_test = $_POST[chmod_first].$chmod_complete;
$chmod_test = $_POST[octal];
// Herstellen der Basis-Verbindung
$conn_id = ftp_connect("80.190.246.207");
// Einloggen mit Benutzername und Kennwort
$login_result = ftp_login($conn_id, $_SESSION[Name], $_SESSION[Clear]);
// Verbindung überprüfen
if ((!$conn_id) || (!$login_result)) {
echo "Ftp-Verbindung nicht hergestellt!";
echo "Verbindung mit 80.190.246.207 als Benutzer $_SESSION[Name] nicht möglich";
die;
} else {
}
// Upload der Datei
$noweb = preg_replace("/web\d+\/(.*)/i","$1",$dirurl);
$chmod = ftp_site($conn_id, "chmod ".$chmod_test." ".$noweb);
// Upload-Status überprüfen
if (!$chmod) {
} else {
echo "Datei $source_file auf den Server geschrieben geschrieben";
}
// Schließen des FTP-Streams
ftp_quit($conn_id);
//chmod ($dirurl, $chmod_test);
}else{
?>
<form name="form1" method="post" action="<? echo "chmod.php?sid=".session_id()."&page=chmod&dirurl=".$dirurl; ?>">
<?
$chmod = fileperms($dirurl);
$chmod = sprintf('%o', $chmod);
$chmod_out = substr($chmod, 3, 3);
$chmod = substr($chmod, 2, 1);
$chmod_1 = substr($chmod_out, 0, 1);
$chmod_2 = substr($chmod_out, 1, 1);
$chmod_3 = substr($chmod_out, 2, 1);
?>
<input name="Datei" type="text" value="<? echo $dirurl; ?>" readonly="true">
<table width="308" border="1" align="center">
<tr>
<td width="70" align="center"> </td>
<td width="70" align="center">Lesen</td>
<td width="70" align="center">Schreiben</td>
<td width="70" align="center">Ausführen</td>
</tr>
<tr>
<td align="center">Besitzer</td>
<td align="center"><? if($chmod_1 == "4" || $chmod_1 == "5" || $chmod_1 == "6" || $chmod_1 == "7"){ ?><input type="checkbox" name="1r" value="4" onclick="fcSetOctal(this.name);" checked><? }else{ ?><input type="checkbox" name="1r" value="4" onclick="fcSetOctal(this.name);"><? } ?></td>
<td align="center"><? if($chmod_1 == "2" || $chmod_1 == "3" || $chmod_1 == "6" || $chmod_1 == "7"){ ?><input type="checkbox" name="1w" value="2" onclick="fcSetOctal(this.name);" checked><? }else{ ?><input type="checkbox" name="1w" value="2" onclick="fcSetOctal(this.name);"><? } ?></td>
<td align="center"><? if($chmod_1 == "1" || $chmod_1 == "3" || $chmod_1 == "5" || $chmod_1 == "7"){ ?><input type="checkbox" name="1x" value="1" onclick="fcSetOctal(this.name);" checked><? }else{ ?><input type="checkbox" name="1x" value="1" onclick="fcSetOctal(this.name);"><? } ?></td>
</tr>
<tr>
<td align="center">Gruppe</td>
<td align="center"><? if($chmod_2 == "4" || $chmod_2 == "5" || $chmod_2 == "6" || $chmod_2 == "7"){ ?><input type="checkbox" name="2r" value="4" onclick="fcSetOctal(this.name);" checked><? }else{ ?><input type="checkbox" name="2r" value="4" onclick="fcSetOctal(this.name);"><? } ?></td>
<td align="center"><? if($chmod_2 == "2" || $chmod_2 == "3" || $chmod_2 == "6" || $chmod_2 == "7"){ ?><input type="checkbox" name="2w" value="2" onclick="fcSetOctal(this.name);" checked><? }else{ ?><input type="checkbox" name="2w" value="2" onclick="fcSetOctal(this.name);"><? } ?></td>
<td align="center"><? if($chmod_2 == "1" || $chmod_2 == "3" || $chmod_2 == "5" || $chmod_2 == "7"){ ?><input type="checkbox" name="2x" value="1" onclick="fcSetOctal(this.name);" checked><? }else{ ?><input type="checkbox" name="2x" value="1" onclick="fcSetOctal(this.name);"><? } ?></td>
</tr>
<tr>
<td align="center">Andere</td>
<td align="center"><? if($chmod_3 == "4" || $chmod_3 == "5" || $chmod_3 == "6" || $chmod_3 == "7"){ ?><input type="checkbox" name="3r" value="4" onclick="fcSetOctal(this.name);" checked><? }else{ ?><input type="checkbox" name="3r" value="4" onclick="fcSetOctal(this.name);"><? } ?></td>
<td align="center"><? if($chmod_3 == "2" || $chmod_3 == "3" || $chmod_3 == "6" || $chmod_3 == "7"){ ?><input type="checkbox" name="3w" value="2" onclick="fcSetOctal(this.name);" checked><? }else{ ?><input type="checkbox" name="3w" value="2" onclick="fcSetOctal(this.name);"><? } ?></td>
<td align="center"><? if($chmod_3 == "1" || $chmod_3 == "3" || $chmod_3 == "5" || $chmod_3 == "7"){ ?><input type="checkbox" name="3x" value="1" onclick="fcSetOctal(this.name);" checked><? }else{ ?><input type="checkbox" name="3x" value="1" onclick="fcSetOctal(this.name);"><? } ?></td>
</tr>
</table>
<br>
<input name="octal" type="text" value="<? echo $chmod_out; ?>">
<input name="chmod_first" type="hidden" value="<? echo $chmod; ?>">
<br><input name="submit" type="submit" value="Speichern">
</form>
<? } ?>