易截截图软件、单文件、免安装、纯绿色、仅160KB

PHP安装程序制作

<?php
header("Content-type:text/html;charset=gb2312"); //看你用的是什么编码,要保持一致。
$files="config.php"; //要写入的配置文件。
if(!is_writable($files)){ //判断是否有可写的权限,linux操作系统要注意这一点,windows不必注意。
echo "<font color=red>文件不可写</font>";
exit();
}
if($_POST['install']){ //获取用户提交的数据。
$host=$_POST['host'];
$user=$_POST['user'];
$password=$_POST['password'];
$dbname=$_POST['dbname'];

$config="<?php "; //$config的内容就是要写入配置文件的内容。
$config.="\n"; // \n是用来换行的。
$config.="\$host='".$host."';";
$config.="\n";
$config.="\$user='".$user."';";
$config.="\n";
$config.="\$password='".$password."';";
$config.="\n";
$config.="\$dbname='".$dbname."';";
$config.="\n";
$config.="?>";

$file = fopen($files, "w"); //以写入的方式打开config.php这个文件。
fwrite($file,$config); //将配置信息写入config.php文件。
fclose($file);
include_once("config.php"); //导入配置信息.
if(!$conn=@mysql_connect($host,$user,$password)){
echo "连接数据库失败!请返回上一页检查连接参数 <a href="javascript:history.go(-1)" mce_href="javascript:history.go(-1)"><font color=#ff0000>返回修改</font></a>";
exit();
}else{
mysql_query("set names gb2312"); //设置数据库的编码,注意要与前面一致。
if(!mysql_select_db($dbname,$conn)){ //如果数据库不存在,我们就进行创建。
$dbsql="CREATE DATABASE `$dbname`";
if(!mysql_query($dbsql)){
echo "创建数据库失败,请确认是否有足够的权限!<a href="javascript:history.go(-1)" mce_href="javascript:history.go(-1)"><font color=#ff0000>返回修改</font></a>";
exit();
}
}
//下面根据你实际的表的结构跟初始化表的数据来写,这些sql语句,我们在导出时可以找到。
//新建一个表test1
$sql_query[] = "CREATE TABLE `test1` (
`id` int(4) NOT NULL auto_increment,
`name` varchar(


相关文档:

PHP查询显示SqlServer中的中文

因为工作需要,数据库使用的MS SQL Server2005,而默认的排序规则是SQL_Latin1_General_CP1_CI_AS。创建了一个表,因为需要存储中文信息,Address字段的类型是nvarchar(255)。
此时使用php来连接sql server,页面的编码和文件的编码都是UTF-8,查询此Address字段,显示在页面上是???之类的。怎么解决?
使用
iconv('iso- ......

PHP中的常用的25个MYSQL函数


1、mysql_connect()-建立数据库连接
格式:
resource mysql_connect([string hostname [:port] [:/path/to/socket] [, string username] [, string password]])
例:
$conn = @mysql_connect(”localhost”, “username”, “password”) or dir(”不能连接到Mysql Server” ......

解决PHP file_exists 函数不支持中文文件

今天想使用这一句php来判断一个文件是否存在: echo is_file('/var/downloads/donkey/incoming/[当地球停止转动].The.Day.The.Earth.Stood.Still.DVDRip.XviD-DMT.avi')?"true":"false"; 
echo is_file('/var/downloads/donkey/incoming/[当地球停止转动].The.Day.The.Earth.Stood.Still.DVDRip.XviD-DMT.avi')?"t ......

判断php变量是否定义,是否为空

isset() 【1】
Returns TRUE if var
exists and has value other
than NULL, FALSE otherwise.
输入可以是多个变量,只有所有的变量为真的时候,返回真
empty()【2】
Returns FALSE if var
has a non-empty
and non-zero value.

The following things are considered to be empty:

"" (an em ......

PHP用邮件取回忘记密码功能?

wangjimima.php
<form id="form1" name="form1" method="post" action="mailto.php" onSubmit="return CheckForm()">
<input name="username" type="text" class="in" id="username" size="30" onmouseover="fEvent('mouseover',this)" onfocus="fEvent('focus',this)" onblur="fEvent('blur',this)" onmouseout ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号