Webhilfe.info/board

Normale Version: Online Edit
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Seiten: 1 2 3
Hallo.

Ich möchte gerne auch wenn ich wo anders bin meine Scripte bearbeiten können(falls Langweile). Was muss ich tun, damit er nicht, wenn im script einmal </textarea> vorkommt, die zum anzeigen schließt? Hier ma mein Script(pw-safe):

PHP-Code:
Hauptpath = /var/www/web21/html/

<
form action="" method="post">
Path:<input type="text" name="path" style="width:600px;">
PW:<input type="password" name="pw" style="width:200px;">
<
input type="submit" name="sub" value="show">
</
form>

<?
php if(isset($_POST["sub"]))
        {
        if(
$_POST["pw"] == "************")
          {
?>
          <textarea name="inhalt_dat" style="width:900px;height:400px;" ><?php readfile($_POST['path']);?></textarea >
        <?}else{echo "Och nöööööööööö. Nicht rumspielen ;-).Bitte das <u>richtige</u> Passwort angeben :P";}
        }
?>

Jemand ne Idee?

MfG
htmlspecialchars
htmlentities
so mach ich das jedenfalls bei meinen online editor(en)...
dann wird doch aber das in der textarea auch mit &lg; usw ausgegeben, oder nicht*kann grad nicht testen
Ne wirds nich...
jo..schon hinbekommen^^..hatte heute früh nur wenig zeit es eben auszuprobieren^^
Lass doch bei einem </textarea> automatisch ein < /textarea> draus machen. Somit wäre das Problem doch gelöst?!
Naja. Mit htmlentities geht es ja auch insofern^^

MfG
Hallo.

hab jetzt das Script hier:

PHP-Code:
Hauptpath = /var/www/web21/html/

<
form action="" method="post">
Path:<input type="text" name="path" style="width:600px;">
PW:<input type="password" name="pw" style="width:200px;">
<
input type="submit" name="sub" value="show">
</
form>

<?
php if(isset($_POST["sub"]))
        {
        if(
$_POST["pw"] == "******")
          {
$script file_get_contents($_POST['path']);
          
?>
          <form method="post" action="" name="source"><textarea name="inhalt_dat" style="width:900px;height:400px;" ><?php echo htmlentities($script); ?></textarea><br /><input type="submit" name="edit_dat" value="speichern"><input type="hidden" name="dateipath" value="<?php echo $_POST['path'];?>"></form>
        <?}else{echo "Och nöööööööööö. Nicht rumspielen ;-).Bitte das <u>richtige</u> Passwort angeben :P";}
        }



      if(isset(
$_POST["edit_dat"]))
        {
  
$daten="$_POST[inhalt_dat]";
  
$datenbank="$_POST[dateipath]";
  
$dateii fopen($datenbank,"w");
  
fwrite($dateii$daten);
  
fclose($dateii);
        }
?>

Natürlich zeigt er jetzt die Fehlermeldung,

Warning: fopen(/var/www/web21/html/edit/test.php): failed to open stream: Permission denied in /var/www/web21/html/edit/edit.php on line 24

Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/web21/html/edit/edit.php on line 25

Warning: fclose(): supplied argument is not a valid stream resource in /var/www/web21/html/edit/edit.php on line 26

da die Datei keine 777 Rechte hat sondern "Standart" 644.

Jetzt will ich aber nicht allen Datein 777 geben. Wie kann ich das machen? (oder white...könntest du mir dein geben? :-D)

Danke - MfG
kannst dich ja mal im icq an mich richten,meine rist noch etwas umfangreicher...
ansonsten vllt so:
PHP-Code:
<form action="" method="post">
Path:<input type="text" name="path" style="width:600px;">
PW:<input type="password" name="pw" style="width:200px;">
<
input type="submit" name="sub" value="show">
</
form>

<?
php 

    $error 
false;
    
    if(isset(
$_POST['sub'])) {
        if(
$_POST['pw'] == "******") {
            
$script file_get_contents($_POST['path']);
        } else {
            
$error true;
        }
    }
    
    if(!
$error) {
        if(isset(
$_POST['edit_dat'])) {
            
$daten trim($_POST['inhalt_dat']);
            
$file $_POST['dateipath'];
            
$handle fopen($file,"w+");
            
fwrite($handle$daten);
            
fclose($handle);
        }
    }
 
?>
 
<?php
    
if(!$error) {
?>
<form method="post" action="" name="source">
<input type="hidden" name="dateipath" value="<?php echo $_POST['path'];?>">
<textarea name="content" style="width:900px;height:400px;" >
<?php echo htmlentities($script); ?>
</textarea>
<br />
<input type="submit" name="edit_dat" value="speichern">
</form>
<?
    
} else if($error) {
        echo 
"Och nöööööööööö. Nicht rumspielen ;-).Bitte das <u>richtige</u> Passwort angeben :P";
    }
?>
ungetestet Redface

edit:
und eigentlich sollten alle dateien die chmod 777 haben Wink
PHP-Code:
Hauptpath = /var/www/web21/html/

<
form action="" method="post">
Path:<input type="text" name="path" style="width:600px;">
PW:<input type="password" name="pw" style="width:200px;">
<
input type="submit" name="sub" value="show">
</
form>

<?
php if(isset($_POST["sub"]))
        {
        if(
$_POST["pw"] == "*******")
          {
$script file_get_contents($_POST['path']);
          
?>
          <form method="post" action="" name="source"><textarea name="inhalt_dat" style="width:900px;height:400px;" ><?php echo htmlentities($script); ?></textarea><br /><input type="submit" name="edit_dat" value="speichern"><input type="hidden" name="dateipath" value="<?php echo $_POST['path'];?>"></form>
        <?}else{echo "Och nöööööööööö. Nicht rumspielen ;-).Bitte das <u>richtige</u> Passwort angeben :P";}
        }



      if(isset(
$_POST["edit_dat"]))
        {
  
$daten="$_POST[inhalt_dat]";
  
$rechte fileperms("$_POST[dateipath]");
  
$rechte substr(sprintf("%o",$rechte),3,6);
  
chmod("$_POST[dateipath]"0777);
  
$datenbank="$_POST[dateipath]";
  
$dateii fopen($datenbank,"w");
  
fwrite($dateii$daten);
  
fclose($dateii);
  
$s_chmod "0".$rechte;
  
chmod("$_POST[dateipath]",$s_chmod );
        }
?>

So sieht mein Script bis jetzt aus.
Doch dann kommt dies:
Zitat:Warning: chmod(): Operation not permitted in /var/www/web21/html/edit/edit.php on line 25

Warning: fopen(/var/www/web21/html/index.php): failed to open stream: Permission denied in /var/www/web21/html/edit/edit.php on line 27

Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/web21/html/edit/edit.php on line 28

Warning: fclose(): supplied argument is not a valid stream resource in /var/www/web21/html/edit/edit.php on line 29

Warning: chmod(): Operation not permitted in /var/www/web21/html/edit/edit.php on line 31

Virus meinte, ich sollte es mit ftp connecten usw versuchen.
Ist zwar grad im Mom zu umfangreich, aber ok. Blt weiss ja jemand noch was anderes.
Seiten: 1 2 3
Referenz-URLs