php文件上传类(该类支持单个或者多个文件上传) /** * 类名:upfile * 作用:处理文件上传 * 说明,该类处理单个或者多个文件上传,使用该类时,只需要实列化该类 * 例:
会员注册验证代码(php+mysql+Ajax)
会员注册验证代码(php+myhttp://pic3.phprm.com/2013/09/05/s.jpgql+Ajax)
会员注册验证代码(php教程+mysql教程+ajax)
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="images/css教程.css" rel="stylesheet" type="text/css" />
<title>会员注册验证代码(php+mysql+ajax)</title>
<script language="网页特效" src="网页特效/common.网页特效"></script>
<script language="网页特效" src="js/prototype.js"></script>
<script language="javascript" src="js/passwordstrength.js"></script>
<script language="javascript">
var icon = ;
var ns = ["usr","pwd","repwd","eml"];
function changeusr(){
if($("checkbtn").disabled) $("checkbtn").disabled = false;
}
function checkusr(s){
var ma = ["用户名(4-16位)!","用户名由数字、英文、下划线、中杠线组成!"];
if(!limitlen(s,4,16)){
showinfo("usr",ma[0]);
return false;
}
if(!hasaccountchar(s)){
showinfo("usr",ma[1]);
return false;
}
showinfo("usr");
return true;
}
function checkpwd(s){
var ma = ["密码(6-16位)!","密码不能包含中文或全角符号!","两次输入的密码不一致!"];
ps教程.update(s);
if(!limitlen(s,6,16)){
showinfo("pwd",ma[0]);
return false;
}
if(haschinesechar(s)){
showinfo("pwd",ma[1]);
return false;
}
if(limitlen($f("repwdinput"),6,16)){
if(trim($f("repwdinput")) == trim(s)){
showinfo("pwd");
showinfo("repwd");
return true;
}else{
showinfo("pwd",ma[2]);
return false;
}
}
showinfo("pwd");
return true;
}
function checkpwd2(s){
var ma = ["确认密码(6-16位)!","密码不能包含中文或全角符号!","两次输入的密码不一致!"];
if(!limitlen(s,6,16)){
showinfo("repwd",ma[0]);
return false;
}
if(haschinesechar(s)){
showinfo("repwd",ma[1]);
return false;
}
if(limitlen($f("pwdinput"),6,16)){
if(trim($f("pwdinput")) == trim(s)){
showinfo("pwd");
showinfo("repwd");
return true;
}else{
showinfo("repwd",ma[2]);
return false;
}
}
showinfo("repwd");
return true;
}
function checkeml(s){
var ma = ["请输入常用邮件!","邮件格式不正确!"];
if(s.length < 5){
showinfo("eml",ma[0]);
return false;
}
if(!isemail(s)){
showinfo("eml",ma[1]);
return false;
}
showinfo("eml");
return true;
}
function showinfo(n,s){
var fdo = $(n+"framediv");
var ido = $(n+"infodiv");
if(typeof s == undefined){
fdo.classname = "framedivpass";
ido.innerhtml = "<img src=images/duihao.jpg>";
}else{
fdo.classname = "framedivwarn";
ido.innerhtml = icon + s;
}
}
//======================================================;
function loadcheck(){
if(trim($f(usrinput)).length == 0) return;
$("checkbtn").disabled = true;
var o = $("checkdiv");
o.innerhtml = getloadinfo();
loadajaxdata("reg.php",{usr:$f(usrinput)},successcheck,errorcheck);
}
function successcheck(v){
var o = $("checkdiv");
o.innerhtml = getcheckhtml(v.responsetext);
}
function errorcheck(){
$("checkbtn").disabled = false;
var o = $("checkdiv");
o.innerhtml = geterrorinfo();
}
function getcheckhtml(s){
s = (s == "1")? "恭喜您,用户名可以注册!":"对不起,该用户名已经被注册!";
return s;
}
//======================================================;
function getloadinfo(){
return 正在加载数据...;
}
function geterrorinfo(){
return 数据加载失败!;
}
//======================================================;
function initpage(){
for(var i=0;i<ns.length;i++){
$(ns[i]+"input").value = "";
}
}
function checksignup() {
if ( document.formsignup.reauthnum.value == ) {
window.alert(请输入认证码!!);
document.formsignup.reauthnum.focus();
return false;
}
return true;
}
function isallow_jewellry(){
if(document.formsignup.agree.checked == false){
document.formsignup.submit.disabled = true;
}else if(document.formsignup.agree.checked == true){
document.formsignup.submit.disabled = false;
}
}
php 多个文件上传(给图片加水印实例)
php读取csv数据保存到数组代码
php读取csv数据保存到数组代码csv是常用的excel格式的替代品哦,很多时候我们导出数据是都会导成csv格式的,这样和excel没什么区别,下面的程序是要读取csv数据保存到数组我们要对数据进行操作,所以保存到数据。
验证码生成程序与使用方法
验证码生成程序与使用方法下面这是一款利用php生成验证码程序了,利用了srand随便函数生成并用php gd库的图像函数生成验证图片,再把生成的数据保存到session全局变量。
php 获取用户浏览器版本代码
php 获取用户浏览器版本代码在php中我们有个全局变量$_SERVER[HTTP_USER_AGENT];可以获取用户所有信息,我们要经过处理才可以判断用户浏览器是那种型的,下面的函数就可以准确的用户浏览器版本号代码。
php4如何获取远程文件大小类
php5有get_headers非常好用,因为他可以直接读取远程文件的信息,而不用把整个文件读取到服务器。但是现在很多web服务器都不支持php5,下面我们就来看一个关于php4获取远程服务器文件大小的实例类吧。
php 树型结构操作类代码(1/4)
树型结构是很多程序会员会用到的,上面这款关于树型结构操作类,很好的解决了这个问题哦。
/php教程 树型结构操作类代码
/***************************************************************
* 树型结构操作类(如果可以写成php教程最理想)
*
* ***************************************************************/
jqGrid 导出excel表格代码(php+jqgrid实例)
jqgrid 导出excel表格代码(php教程+jqgrid实例)
require_once ../../../tabs.php;
?>
<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd">
<html>
<head>
<title>jqgrid php demo</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css教程" media="screen" href="../../../themes/redmond/jquery-ui-1.7.1.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="../../../themes/ui.multiselect.css" />
<style type="text">
html, body {
margin: 0; /* remove body margin/padding */
padding: 0;
overflow: hidden; /* remove scroll bars on browser window */
font-size: 75%;
}
</style>
<script src="../../../网页特效/jquery.网页特效" type="text/网页特效"></script>
<script src="../../../js/i18n/grid.locale-en.js" type="text/网页特效"></script>
<script type="text/javascript">
$.jgrid.no_legacy_api = true;
$.jgrid.usejson = true;
</script>
<script src="../../../js/jquery.jqgrid.min.js" type="text/javascript"></script>
<script src="../../../js/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
</head>
<body>
<div>
<?php include ("http://pic1.phprm.com/2013/09/05/grid.jpg");?>
</div>
<br/>
<?php tabs(array("grid.php"));?>
</body>
</html>
php常用正则表达式函数
php常用正则表达式函数我们这里面很多中正则表达式代码,包括有判断中文正则,数字字母正则,字符正则表达试,数字正则表达试,邮箱正则表达式,电话号码正则表达试,手机号码正则表达试,邮编正则表达试,/url正则表达试等哦。
php 分页函数
php自动采集内容中带有图片地址的远程图片保存到本地
php自动采集内容中带有图片地址的远程图片保存到本地
function my_file_get_contents($url, $timeout=30) {
if ( function_exists(curl_init) )
{
$ch = curl_init();
curl_setopt ($ch, curlopt_url, $url);
curl_setopt ($ch, curlopt_returntransfer, 1);
curl_setopt ($ch, curlopt_connecttimeout, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
}
else if ( ini_get(allow_url_fopen/ target=_blank >fopen) == 1 || strtolower(ini_get(allow_url_fopen)) == on )
{
$file_contents = @file_get_contents($url);
}
else
{
$file_contents = ;
}
return $file_contents;
}