📄 setup.php
字号:
<?php
//安装程序
$register_globals = @get_cfg_var("register_globals");
if ($register_globals!=1) {
@extract($_SERVER, EXTR_SKIP);
@extract($_COOKIE, EXTR_SKIP);
@extract($_SESSION, EXTR_SKIP);
@extract($_POST, EXTR_SKIP);
@extract($_FILES, EXTR_SKIP);
@extract($_GET, EXTR_SKIP);
@extract($_ENV, EXTR_SKIP);
}
error_reporting(E_ERROR | E_WARNING | E_PARSE);
if (!$step) {
print <<<eot
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>安装程序</title>
<link href="highslide/style.css" type="text/css" rel="stylesheet" />
</head>
<form action="setup.php?step=1" method="post">
<div id="notice" style="margin-top:100px;line-height:22px;">
<div id="notice_message" style="text-align:left;padding-left:26px;">
<font color="red">HighSlide+幻灯相册 安装程序</font><br /><br />
欢迎您选择此相册程序!<br />
当前程序将为您安装相册!<br />
安装后会提交您的网站到我们的数据库,<br />
请放心本程序除您的网址及相册名外不会搜集您的任何资料,我们只借此来统计安装本相册程序的网站数目!<br />
谢谢您的理解和支持!<br />
最后提醒您,安装后请注意阅读帮助!
</div>
<div id="notice_links" style="height:50px;padding-top:12px">
<input type="submit" value=" 开始安装 ">
</div>
</form>
</body>
</html>
eot;
exit();
}
if ($step==1) {
$yourphp=PHP_VERSION;
if ($yourphp<"4.0.0") {
$checkitem1="版本过低,不建议安装";
$cancelset=1;
}
else {
$checkitem1=$yourphp." 可以安装";
}
if (isset($_COOKIE)) $checkitem2="支持";
else {
$checkitem2="不支持,不能安装";
$cancelset=1;
}
if (isset($_GET)) $checkitem3="支持";
else {
$checkitem3="不支持,不能安装";
$cancelset=1;
}
if ($fp=fopen('test.php',"w")) {
$checkitem4="可以写入";
fclose($fp);
@unlink('test.php');
}
else {
$checkitem4="不可写入,请将属性设为777";
$cancelset=1;
}
print <<<eot
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>安装程序</title>
<link href="highslide/style.css" type="text/css" rel="stylesheet" />
</head>
<form action="setup.php?step=2" method="post">
<div id="notice">
<div id="notice_message" style="text-align:left;padding-left:26px;">
<font color="red">HighSlide+幻灯相册 安装程序</font> 第一步<br /><br />
PHP 版本: $checkitem1<br />
COOKIES : $checkitem2 <br />
全局变量: $checkitem3 <br />
目录属性: $checkitem4
</div>
<div id="notice_links" style="height:50px;padding-top:12px">
eot;
if ($cancelset!=1) {
echo " <input type=\"submit\" value=\"下一步\">";
}
else echo " <input type=\"button\" value=\"下一步\">";
print <<<eot
</div>
</form>
</body>
</html>
eot;
exit();
}
if ($step==2) {
print <<< eot
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>安装程序</title>
<link href="highslide/style.css" type="text/css" rel="stylesheet" />
</head>
<script language=javascript>
function checkForm(fm) {
var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
var statcod="'"
for (i=0; i <fm.sessid.value.length; i++){
var checkForm = fm.sessid.value.charAt(i);
checkForm = checkForm.toUpperCase();
if (Letters.indexOf(checkForm) == -1) {
alert ("sessid 必须为纯英文");
fm.sessid.focus();
return false;
}
}
if (fm.picname.value=='') {
alert ("相册名称未填")
fm.picname.focus();
return false
}
if (fm.password.value=='') {
alert ("密码不能为空")
fm.password.focus();
return false
}
if(fm.password.value!==fm.repass.value) {
alert("两次输入密码不一致");
fm.password.focus();
return false;
}
if(fm.password.value.length<6) {
alert("最小密码长度为 6 位!");
fm.password.focus();
return false;
}
if(fm.sessid.value=='') {
alert("session 不能为空!");
fm.password.focus();
return false;
}
if (fm.picurl.value=='') {
alert ("相册网址不能为空")
fm.picurl.focus();
return false
}
for(i=0;i<fm.statco.value.length;i++) {
if(statcod.indexOf(fm.statco.value.substr(i,1))>-1) {
alert("统计代码中不能有 "+fm.statco.value.substr(i,1)+" 单引号!请换为双引号")
fm.statco.focus();
return false;
}
}
}
</script>
<form action="setup.php?step=3" method="post" name="stat" onsubmit="return checkForm(this)">
<div id="notice" style="margin-top:10px;width:500px;">
<div id="notice_message" style="text-align:left;padding-left:26px;">
<font color="red">HighSlide+幻灯相册 安装程序</font> 第二步<br /><br />
设置您的相册资料:<br />
相册名称:<input type="text" name="picname"><br />
设置密码:<input type="password" name="password"> 密码未加密,若忘记到config.php更改!<br />
重复密码:<input type="password" name="repass"> 密码必须为6位以上不同的字符<br />
设置SESS:<input type="text" name="sessid" value=""> 任意英文,以防止他人利用session登录<br />
相册网址:<input type="text" name="picurl"> 输入网址但不要填http://<br />
备案号码:<input type="text" name="miibeian"> 信产部备案号,没有可不填<br />
统计代码:<input type="text" name="statco" value=""> 不能有单引号',支持Html, 可不填<br /><br />
以下为默认值可不改<br /><br />
显示照片:<input type="text" name="EachPageMax" value="20">张 设置每页显示照片数,默认为20<br />
页面宽度:<input type="text" name="PageWidth" value="790">px 设置页面的宽度,默认为790<br />
照片宽度:<input type="text" name="DivWidth" value="189">px 设置照片的宽度,默认为189<br />
照片高度:<input type="text" name="Divheight" value="138">px 设置照片的高度,默认为138<br />
幻灯间隔:<input type="text" name="changetime" value="5">秒 设置播放幻灯时的间隔时间,默认为5<br />
调用张数:<input type="text" name="picnums" value="20">张 设置播放幻灯调用照片张数,默认为20<br />
</div>
<div id="notice_links" style="height:50px;padding-top:12px">
<input type="submit" value="下一步"> <input type="reset" value="重 输">
</div>
</form>
</body>
</html>
eot;
exit();
}
if ($step==3) {
$picname=$_POST['picname'];
$password=$_POST['password'];
$sessid=$_POST['sessid'];
$picurl=$_POST['picurl'];
$miibeian=$_POST['miibeian'];
$statco=$_POST['statco'];
$EachPageMax=$_POST['EachPageMax'];
$PageWidth=$_POST['PageWidth'];
$DivWidth=$_POST['DivWidth'];
$Divheight=$_POST['Divheight'];
$changetime=$_POST['changetime'];
$picnums=$_POST['picnums'];
print <<<eot
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>安装程序</title>
<link href="highslide/style.css" type="text/css" rel="stylesheet" />
</head>
<div id="notice">
<div id="notice_message" style="text-align:left;padding-left:26px;">
<font color="red">HighSlide+幻灯相册 安装程序</font> 完成<br /><br />
eot;
$makeconfig = "<?php
date_default_timezone_set('Asia/Shanghai'); //设置php5时区,若不设置会导致php5 照片时间误差8小时
//基本设置部分
\$configTilte = \"$picname\"; //相册名
\$ThisPicLogined = \"$sessid\"; //非常重要,设置后以防止他人利用session登录,可任意设置值
\$configAdminPass = \"$password\"; //管理员密码
\$weburl = \"$picurl\"; //在页面最下面显示你的网址链接 建议用英文如 OFCN.cn 不要用http://
\$icp = \"$miibeian\"; //您的网站备案号
\$statcode = '$statco';
\$configWantedPass = false; //查看相册是否需要密码 true/false
\$configOpenGzip = true; //是否压缩页面 true/false
\$configShowPicSize = true; //是否显示图片大小 (KB) true/false
\$configExt = array('jpg', 'jpeg', 'gif', 'png'); //图片类型,可根据情况增删
\$strLenMax = 25; //文件名字限制长度 (防止撑破div)
\$configEachPageMax = $EachPageMax; //每页显示照片数目
\$configPageWidth = $PageWidth; //页面宽度,可调整每行照片数(如:988px,每行5张宽屏,[px]不用写)
\$configDivWidth = $DivWidth; //照片宽度
\$configDivHeight = $Divheight; //照片高度
\$configPageMax = 5; //分页前后预览数
\$configDirPWFile = \"password.php\"; //密码文件 设置存贮每个目录的密码文件名
//幻灯片部分
\$picwidth = 768; //图片最大宽度 [以防图片过宽不能全部显示]
\$picHeight = 500; //图片最大高度 [以防图片过高不能全部显示]
\$picchangetime = $changetime; //图片切换时间
\$picnum = $picnums; //设置播放幻灯时最多调用多少张当前相册的图片,以防太多占用内存
?>";
writetofile("config.php", $makeconfig);
rename('setup.php','setup.'.$sessid.'.lock');
print <<<eot
恭喜,所有安装步骤结束。<br />
setup.php 已更名为:<font color="red">setup.$sessid.lock</font><br />
如果服务器不支持操作, 请手动删除 setup.php<br />
再次感谢您选择本程序, 有问题或建议请点击: <a href="http://album.ofcn.cn" target="_blank">Album 网站</a>
eot;
echo "<iframe width=\"0\" height=\"0\" src=\"http://ofcn.cn/count/album/addsite.php?webname=$picname&weburl=$picurl\"></iframe>";
print <<<eot
</div>
<div id="notice_links">
<a href="index.php">访问首页</a>
</div>
</form>
</body>
</html>
eot;
exit;
}
function writetofile($file_name,$data,$method="w") {
global $showtime,$writefilenum;
$filenum=fopen($file_name,$method);
flock($filenum,LOCK_EX);
$file_data=fwrite($filenum,$data);
fclose($filenum);
return $file_data;
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -