选择显示字体大小

功能控制完备的php上载程序(1)

 

主控程序 upfile.php

<?

####################################################################

#project name: test

#author : lanf

#home page: http://lanf.yeah.net

#e-mail:imbusy@263.net

#time: 2001 . 9

####################################################################



##
验证身份函数

function getuserright(&#36;username,&#36;user){

if(&#36;username==&#36;user&#39; &#39;&#36;user=="*") return true;

echo "<html>
您没有这个操作id的权限。<a href=javascript:window.history.back()>点这里返回修改</a></html>";

return false;

}

##
验证身份函数结束



##
文件类型验证函数

function getfiletype(&#36;filename,&#36;filetype){

&#36;fileextent=strrchr(&#36;filename, ".");&#36;fileextent=substr(&#36;fileextent,1);

&#36;fileextent=strtolower(&#36;fileextent);&#36;filetype=strtolower(&#36;filetype);

if(strstr(&#36;filetype,"jpg") strstr(&#36;filetype,"gif")&#39; &#39;strstr(&#36;filetype,"png") ){

if(!getimagesize(&#36;imgfile)) {

echo "<html>
这个操作id不允许上传此种类型文件。<a href=javascript:window.history.back()>点这里返回修改</a></html>";

return false;};

};

if(strstr(&#36;filetype,&#36;fileextent )&#39; &#39;&#36;filetype="*") return true;

echo "<html>
这个操作id不允许上传此种类型文件。<a href=javascript:window.history.back()>点这里返回修改</a></html>";

return false;

}

##
文件类型验证函数结束



##
上传站点验证函数

function checkfromsiteerr(&#36;sitefrom,&#36;limitsite){

//
取得站点域名的ip地址;http://202.108.240.75 www.yyy.com

//echo &#36;sitefrom;

&#36;step1=substr(&#36;sitefrom,7);//echo "<br>&#36;step1";

&#36;step2=strpos(&#36;step1, "/");//echo "<br>&#36;step2";

&#36;step3=substr(&#36;step1,0,&#36;step2);//echo "<br>&#36;step3";

//if(eregi("^[0-9]+.[0-9]+.[0-9]+.[0-9]+&#36;",&#36;step3)){;}else{

&#36;referip=gethostbyname(&#36;step3);//echo "<br>ip:&#36;referip<br>";

//}

//
到这里,&#36;referip已经是一个上一个页面的ip地址。



//
匹配相关的内容。

if(strpos(&#36;limitsite,",",1)){

//
说明是一组值

&#36;pieces = explode(",",&#36;limitsite);

while(list(&#36;key,&#36;value) = each(&#36;pieces)){

&#36;limit=gethostbyname(&#36;value);

if(&#36;starpos=strpos(&#36;limit,"*")){

//
*号的ip

&#36;templimit=substr(&#36;limit,0,&#36;starpos);

&#36;tempfromip=substr(&#36;referip,0,&#36;starpos);

if(&#36;templimit==&#36;tempfromip){

return false;

}else{

continue;

};

}else{

//
不带*号的ip

if(&#36;limit==&#36;referip){

return false;

}else{

continue;

};

};

}

echo "<html>
错误的上传站点#16<a href=javascript:window.close()>点这里关闭窗口</a></html>";

return true;

}else{

//
说明只有一个限制

&#36;limit=gethostbyname(&#36;limitsite);

if(&#36;starpos=strpos(&#36;limit,"*")){

//
*号的ip

&#36;templimit=substr(&#36;limit,0,&#36;starpos);

&#36;tempfromip=substr(&#36;referip,0,&#36;starpos);

if(&#36;templimit==&#36;tempfromip){

return false;

}else{

echo "<html>
错误的上传站点。<a href=javascript:window.close()>点这里关闭窗口</a></html>";

return true;

};

}else{

//
不带*号的ip

if(&#36;limit==&#36;referip){

return false;

}else{

echo "<html>
错误的上传站点。<a href=javascript:window.close()>点这里关闭窗口</a></html>";

return true;

};

};

}

};

##
上传站点验证函数结束



##
日志记录函数

function putlog(&#36;actionid,&#36;message,&#36;flag="a"){

if(!file_exists("./log")){

echo "
当前目录没有建立属性为0777log目录,正在尝试建立……";

if(@mkdir("./log",0777)){echo "
建立成功!!!";}else{echo "失败!权限不足,请手动建立 ./log <br> 日志没有被记录……"; return false;}

}

 &#36;logfile="./log/".&#36;actionid.&#36;flag.".log";

 &#36;cmdstr="echo "".&#36;message."" >> ".&#36;logfile;

 if (!file_exists(&#36;logfile)) {passthru("touch ".&#36;logfile); chmod(&#36;logfile,0777);}

 passthru(&#36;cmdstr);

 return true;

};

##
日志记录函数



##
取配置文件参数函数

function get_config(&#36;conf,&#36;actionid="",&#36;actiontype=""){

//&#36;conf
配置文件名,&#36;actionid 操作id &#36;actiontype 操作类型

global &#36;targetdir,&#36;user,&#36;maxlength,&#36;filetype,&#36;checkfile,&#36;limitsite,&#36;callback;



&#36;actionid=trim(&#36;actionid);

if(&#36;actionid=="") return false;

&#36;keylength=strlen(&#36;actionid);



&#36;filearray=file(&#36;conf);



&#36;canshuzoneid=0;



if(&#36;actiontype=="upload"){

//
假如是上传文件的话

while (list(&#36;key,&#36;value) = each(&#36;filearray)) {

&#36;value=trim(&#36;value);

//
判断参数区域,将参数提取限制在上传文件设置区

&#36;zone_temp=substr(&#36;value,0,1);

if(&#36;zone_temp=="["){//
开始一个参数区域

if(strstr(&#36;value, "up")){xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons