<script language="网页特效">
function startrequestusingpost() {
if(checktitle()==false)
{
return;
}
var title = document.getelementbyid("title").value;
createxmlhttprequest();
xmlhttp.open("post","checkntype",true);
xmlhttp.onreadystatechange = processresponse;
xmlhttp.setrequestheader("content-type","application/x-www-form-urlencoded");
xmlhttp.send("title=" + title);
}
function processresponse() {
if(xmlhttp.readystate == 4) {
if(xmlhttp.status == 200) {
var result = xmlhttp.responsetext;
if(result==1){
document.getelementbyid("message").style.display="inline";
document.getelementbyid("btnadd").disabled="disabled";
}else
{
document.getelementbyid("message").style.display="none";
document.getelementbyid("btnadd").disabled="";
}
}
}
}
function checktitle()
{
var title=document.getelementbyid("title").value;
if(title=="")
{
document.getelementbyid("lbltitle").style.display="inline";
return false;
}else
{
document.getelementbyid("lbltitle").style.display="none";
return true;
}
}
PHP删除数组元素与删除重复数组函数
$a=array("red", "green", "blue", "yellow");
count($a); //得到4
unset($a[1]); //删除第二个元素
count($a); //得到3
echo $a[2]; //数组中仅有三个元素,本想得到最后一个元素,但却得到blue,
echo $a[1]; //无值
php 遍历二维数组与多维数组代码
//php遍历多维数组
//实例三,遍历二维数组
php access 留言板程序
*/
error_reporting(0);
$conn = new com("adodb.connection");
$conn->open("driver={microsoft access driver (*.mdb)}; dbq=" . realpath("db.mdb "));
$rs=new com("adodb.recordset");
php 过滤html标签的函数代码
//最直接过滤html方法
strip_tags();
ajax php 聊天室实例代码
php删除目录及目录下所有文件子目录
<?php教程
set_time_limit(0);
$filenum=0;
function deldir($dir){
global $filenum;
$dh=opendir($dir);
while ($file=readdir($dh)){
if($file!="."&&$file!=".."){
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)){
unlink($fullpath);
if(($filenum %100)==0){
echo "*";
}
$filenum=$filenum+1;
}else{
deldir($fullpath);
}
}
}
closedir($dh);
}
deldir("/www.phprm.com/");
echo "delete cache file success. total:".$filenum;
?>
php生成随机密码函数(四款)
方法一
function generate_password( $length = 8 ) {
// 密码字符集,可任意添加你需要的字符
$chars = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|';
获取当前页面的url地址php代码
<?php
// 说明:获取无参数url
function curpageurl()
{
$pageurl = 'http';
php判断远程图片是否存在
function img_exits($http://pic2.phprm.com/2010/08/24/url.jpg)
{
$ch = curl_init();
curl_setopt($ch, curlopt_url,$url);
curl_setopt($ch, curlopt_nobody, 1); // 不下载
curl_setopt($ch, curlopt_failonerror, 1);
curl_setopt($ch, curlopt_returntransfer, 1);
php jquery 验证码代码
<?php
//调用此页面,如果下面的式子成立,则生成验证码图片
if($_get['action']=='verifycode'){
rand_create();
}
//验证码图片生成
php mysql数据库操作教程
//连接mysql数据库
//查询mysql字段名