Re: looking 4 a php script that edits selected pages of my site
Just change the $path to your files directory
PHP Code:
<?php
$path="your/path/to/files/";
$dp=opendir($path);
while($file=readdir($dp)){
if (stristr($file,".php")){
$filearray[]=$file;
}
}
closedir($dp);
if($_POST['Submit']=="Get File"){
$filename=$_POST['selectfile'];
}
if($_POST['Submit']=="Submit"){
$fp=fopen($path.$_POST['filename'],"w");
fwrite($fp,$_POST['data']);
fclose($fp);
}
?>
<form action="" method="post" name="fileform">
<select name="selectfile">
<?php
foreach ($filearray as $key=>$value){
?>
<option <?php if($filename==$value) echo " selected='selected'"?>><?php echo $value?></option>
<?php } ?>
</select>
<input name="Submit" type="submit" value="Get File" />
</form>
<?php
if ($filename){?>
<form method="post" name="editform">
<textarea name="data" cols="100" rows="20"><?php echo(file_get_contents($path.$filename))?></textarea><br />
<input name="filename" type="hidden" value="<?php echo $filename ?>" />
<input name="Submit" type="submit" value="Submit" />
</form>
<?php }?>
Quote:
Originally Posted by SIMONR85
if anybody can write me script to do this then name me a price!!!
|
£50 
__________________
They came for my 404 and I said nothing
|