############################################################################### # Squid Console - Version 0.0.1 ############################################################################### # # Program: squidcon.php # # Programmer: Void Main # # Date: 22 July 2003 # # Description: Manage Squid ACLs # # Notes: - Your ACL file must be writable by the apache user # - If you want squid to automatically be reloaded when # you save your ACL you'll need to incorporate the # /etc/sudoer information similar to my "squidcon.sudoers" # example. # - You will probably want to restrict this PHP script # with htaccess authentication. # - If someone would like to expand on this please, for the # love of God, put it under the GPL. Thanks! # # History: # - 22/07/03 Initial and extremely limited release # ############################################################################### #****************************************************************************** # configuration section start #****************************************************************************** $acldir = "/etc/squid/acl"; $aclname = "banned.sites"; $acl = "$acldir/$aclname"; #****************************************************************************** # configuration section end #****************************************************************************** if (isset($_POST[aclsave])) { $sites=preg_replace("/\r\n/","\n",$_POST[sites]); $sitearr=explode("\n",$sites); sort($sitearr); reset($sitearr); $sites=implode("\n",$sitearr); $sites=ltrim($sites); $sites=rtrim($sites); $sites="$sites\n"; if (!$fp=fopen($acl,"w")) {print "Can't open $acl!\n"; exit;} fwrite($fp,$sites); fclose($fp); unset($_POST[aclsave]); system("/usr/bin/sudo /sbin/service squid reload"); $squidmsg = "Squid Reloaded!"; } else { $sitearr = file($acl); sort($sitearr); reset($sitearr); $sites = implode("",$sitearr); $squidmsg = "Edit $aclname ACL"; } ?>
/* Void Main's Beautiful Squid Console */ |
#include <stddisclaimer.h>
=$squidmsg?> |
| by Void Main |