⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 astedit.php

📁 asterisk web manager,make in php,run in Linux
💻 PHP
字号:
<?PHP/*  Copyright (C) 2005 Earl C. Terwilliger Email contact: earl@micpc.com Name : astedit.php  Usage: PHP script to edit / save / download a file    This file is part of The Asterisk WEB/PHP Management Interface.    These files are free software; you can redistribute them and/or modify    them under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    These programs are distributed in the hope that they will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with these files (see COPYING); if not, write to the:         Free Software Foundation, Inc.         59 Temple Place         Suite 330         Boston, MA  02111-1307         USA*/ if (isset($_POST['submit'])) {   if ($_POST['submit'] == "DOWNLOAD") {      $fname = $_POST['file'];      $bname = basename($fname);      header("Content-type: application/txt");      header("Content-Disposition: attachment; filename=\"$bname\"");      $file = fopen($fname, 'r');      if ($file == FALSE) {        include('header.php');        echo "<BR>Error opening $fname<BR>";        echo "Make sure the web server has authority to read this file!<BR>";        exit();      }      $contents = fread($file, filesize ($fname));      echo $contents;      fclose($file);      exit();   }   if ($_POST['submit'] == "SAVE") {      include('header.php');      $data=$_POST['data'];      $fname = $_POST['file'];      $file = fopen($fname, 'w');      if ($file != FALSE) {        fwrite($file, $data);        fclose($file);        echo "<BR>SAVED!<BR>";      }      else {        echo "<BR>Error saving $fname<BR>";        echo "Make sure the web server has authority to save this file!<BR>";      }      exit();   } } $fname = $_GET['file']; include('header.php'); $file = fopen($fname, 'r'); if ($file == FALSE) {   echo "<br>Error opening $fname<br>\n";   echo "Make sure the web server has authority to read this file!\n";   exit(0); } $contents = fread($file, filesize ($fname)); fclose($file);?><H1><?php echo $fname; ?></H1><center><form method="post" action="<?php $_SERVER['PHP_SELF']?>"><input type="hidden" name="file"   value=<?php echo "$fname";?>>   </input><input type="submit" name="submit" value="SAVE">   </input>&nbsp;&nbsp;<input type="submit" name="submit" value="DOWNLOAD">   </input><br><br><table border=1><TR><td><textarea name="data" cols=80 rows=20><?php echo htmlentities($contents); //include ($fname); ?></textarea></td></tr></table></form></center>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -