deal_class.php

来自「一个很好的同学录,PHP+TXT,没有数据库的网友的最好选择」· PHP 代码 · 共 58 行

PHP
58
字号
<?
session_start();
if($_SESSION['power']<2) {$error="你没有管理班级的权限";include("inc_error.php");die();}
if(!$_CLASS_CONF) include("conf_class.php");
function warn(){
	$error='<font color=#FF0033>警告</font>你不要乱来哦!!!';
	include("inc_error.php");
	die();
}
$trans=array("\n"=>"\\n","\r"=>"","\\'"=>"'");
$class_name=addslashes($class_name);
$alumni_brief=addslashes($alumni_brief);
$album_brief=addslashes($album_brief);
switch($_GET['a']){		//'a' short for "action"
	case "cb":			//change class brief
		$alumni_brief=$_POST['brief'];
		break;
	case "ab":			//change album brief
		$album_brief=$_POST['brief'];
		break;
	case "cn":			//change class name
		$class_name=$_POST['name'];
		break;
	default:
		warn();
		break;
}
$s_fmt='<?
//--------alumni configure start--------
$class_name="%s";
$alumni_brief="%s";
//--------alumni constant--------
$class_year=%d;
$alumni_initor="%s";
$alumni_time="%s";
$guestbook_url="%s";	//过客友情留言的留言簿URL地址
$words_per_page=%d;		//leaveword.php里一页的留言数
$mems_per_page=%d;		//addrbook.php里每页显示成员数
//--------alumni configure end--------

//--------album configure start--------
$album_brief="%s";
//--------album constant--------
$album_volumn=%d;		//单位为MB
$pix_per_page=%d;		//5的倍数
//--------album configure end--------

$_CLASS_CONF=1;
?>';
$newconf=sprintf($s_fmt,strtr($class_name,$trans),strtr($alumni_brief,$trans),$class_year,$alumni_initor,
					$alumni_time,$guestbook_url,$words_per_page,$mems_per_page,strtr($album_brief,$trans),
					$album_volumn,$pix_per_page);

$fp=fopen("conf_class.php","w");
fwrite($fp,$newconf);
fclose($fp);
header("location: ".$_SERVER['HTTP_REFERER']);
?>

⌨️ 快捷键说明

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