标签 PHP 下的文章

php禁止IP访问代码

php禁止IP访问代码<?/*php禁止IP访问代码2008年08月29日 星期五 18:21禁止单个IP*/$banned_ip = array ("127.0.0.1","203.0.0.1","56.12.50.65");if ( in_array( getenv("REMOTE_ADDR"), $banned_ip ) ){die ("Your IP is block to c...

JinYon 2012 年 12 月 28 日 暂无评论

php导出excel

直接在网页里输出为excel和导出excel到本地两种格式.直接用excel打开<?phpheader("Content-type:application/vnd.ms-excel");header("Content-Disposition:filename=test.xls");?><table width="300" border="0"><tr>&l...

JinYon 2012 年 12 月 28 日 暂无评论

php导入.sql代码

一段PHP导入.sql备份文件的代码.要先删除数据库再建立,如果没有删除的权限可能不行.有空再验证.<?php$file_name="bbs.sql"; //要导入的SQL文件名$dbhost="localhost"; //数据库主机名$dbuser="root"; //数据库用户名$dbpass=""; //数据库密码$dbname="bbs"; //数据库名set_time_lim...

JinYon 2012 年 12 月 28 日 暂无评论

php验证码

php验证码,可设置线条,躁点干扰。<?phpsession_start();for($i=0;$i<4;$i++){$rand.=dechex(rand(1,15));}$_SESSION[check_pic]=$rand;//新建一个真色彩图像$im = @imagecreatetruecolor (100, 30) or die ("Cannot Initialize ne...

JinYon 2012 年 12 月 28 日 暂无评论

php备份mysql的代码

测试有效,可以把指定的数据库保存为日期.sql的格式<?php$host="localhost";$user="root";$password="";$dbname="";mysql_connect($host,$user,$password);mysql_select_db($dbname);$mysql= "set charset utf8;rn";$q1=mysql_query(...

JinYon 2012 年 12 月 28 日 暂无评论