$path ="d:pdoSpiderResult.db3";
$conn = new PDO("sqlite:$path");
$array=array('','','');
if( $conn )
{
//echo ('connection pdo success');
}
else
{
echo ('cnnection pdo fail ,plase check database server!');
}
$count=0;
$sp = new SplitWord();
foreach ($conn->query('SELECT * FROM content limit 160,80') as $row)
{
// baise info
$softtitle = mysql教程_escape_string(mb_convert_encoding($row[3],'gbk','auto')).'-js相册';//title
//file title
$softcontent = str_replace('Image/','http://g.111cn.net/javascript教程/Image/',mb_convert_encoding($row
[4],'gbk','auto'));
//file size of size
$softsize = '未知';
// file downurl
$softurl = str_replace('.zip','',$row['address']);
$filetype='.rar';
$softpath='http://g.111cn.net/javascript/'.$softurl.$filetype;
$view ='<br />效果预览地址<a href=http://g.111cn.net/javascript/'.$softurl.'
target=_blank>'.$softtitle.'</a>';//效果预览地址
preg_match_all("/(src|SRC)=["|'| ]{0,}((.*).(gif|jpg|jpeg|png|bmp))/isU",$softcontent,$img_array);
$thum = str_replace("'",'',str_replace('"','',$img_array[2][0]));
$softlinks = mysql_escape_string("{dede:link islocal='1' text='$localhost'}".$softpath."{/dede:link}");
$a = strip_tags($softcontent);
$b = $sp->SplitRMM($softtitle);
$keywords = str_replace(' ',',',$b);
$desciption = '';//desc + split word
$introduce =$softcontent.$desciption.$view;
$os ='Win2003,WinXP,Win2000,Win9X';
//call out link descript
$addsoft = "Insert into d_addonsoft(typeid,filetype,language,softtype,accredit,
os,softrank,officialUrl,officialDemo,softsize,softlinks,introduce,templet,userip,redirecturl)";
$addsoft .=" values
('$typeid','$filetype','$language','','','$os','3','','','$softsize','".$softlinks."','$introduce','','222.103.69.94','')";
mysql_query( $addsoft ) or die('addsoft'.$addsoft.mysql_error());//.$addsoft
$newid = mysql_insert_id();
// Read insert new id
$sortrank = time();
//Read the minutes and seconds when the system is currently
$click = mt_rand(1000,10000);
// Random Clicks 1000 , 10000 btween
$archives = "Insert into d_archives
(id,typeid,typeid2,sortrank,flag,ismake,channel,arcrank,click,money,title,litpic,writer,source,pubdate,senddate,mid,descripti
on,keywords)";
$archives.=" values
('$newid','$typeid','0','$sortrank','p','1','3','0','$click','0','$softtitle','$thum','$write','unkown','$sortrank','$sortran
k',1,'$desciption','$keywords')";
mysql_query($archives) or die('archives '.$archives.'|'.mysql_error()); //$archives.
$arctiny = "Insert into d_arctiny(id,typeid,typeid2,arcrank,channel,senddate,sortrank,mid) values
($newid,$typeid,0,0,3,'$sortrank','$sortrank',1)";
mysql_query( $arctiny) or die( 'arctiny'.$arctiny.mysql_error());//$arctiny.
}
echo '总共有多条',$count,"不存地的";
本站原创转载注明来源www.111cn.net
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ajax+php 无刷新数据调用经典实例</title>
<script>
function G(id){
return document.getElementById(id);
}
function createXMLHttpRequest(){//创建XMLHttpRequest对象
if(window.ActiveXObject){//IE
try {
return new ActiveXObject("Microsoft.XMLHTTP");
} catch(e){
return;
}
}else if(window.XMLHttpRequest){//Mozilla,firefox
try {
return new XMLHttpRequest();
} catch(e){
return;
}
}
}
function returnCity(Value,divId,at,pid){//主调函数
var xmlHttp=createXMLHttpRequest();
var url = "s.php?cid="+Value+"&at="+at+"&pid="+pid+"&mt="+Math.random(100);
//alert(url);
if (Value==""){
return false ;
}
if (xmlHttp){
callback = getReadyStateHandler(xmlHttp,divId);
xmlHttp.onreadystatechange = callback;
xmlHttp.open("GET", url,true);
xmlHttp.send(null);
}
}
function getReadyStateHandler(xmlHttp,divId){//服务器返回后处理函数
return function (){
if(xmlHttp.readyState == 4){
if(xmlHttp.status == 200){
if (xmlHttp.responseText){
G(divId).innerHTML=xmlHttp.responseText;
}else{
G(divId).innerHTML="";
}
}
}
}
}
function ajaxData(inputName,divId,action,cpid)
{
//alert(inputName);
var cityid = G(inputName).value;
var pid = G(cpid).value;
returnCity(cityid,divId,action,pid);
}
</script>
</head>
<body>
<input name="" type="text" onMouseOver="ajaxData('city_type','cityareaid','c','borough_type');" />
<div id="ajaxHtml">
</div>
</body>
</html>
//s.php文件
$Db = new Db();
$type = ( $action=='esfPice')?1:2;
$sql = "Select * from cn_loupan_city_price where city_id ='$cid' and price_type='$type'";
$query = $Db->query( $sql );
$str ='';
if( $Db->rows( $query ) )
{
$result = $Db->fetch( $query ,0);
foreach( $result as $_v => $v )
{
$str .= "<LI><A onClick="switchprop('price2_Value','".$v['city_price_show']."','price2_List','price','".$v['city_price']."')" href="javascript教程:void(0);" target=_self>".$v['city_price_show']."</A></LI>";
}
echo $str;
}
else
{
exit('可不选!');
}
//这里只讲ajax不讲数据库教程连接
www.111cn.net原他
<?php
//fsocket模拟post提交
$purl = "http://localhost/netphp/test2.php?uu=rrrrrrrrrrrr";
print_r(parse_url($url));
sock_post($purl,"uu=55555555555555555");
//fsocket模拟get提交
function sock_get($url, $query)
{
$info = parse_url($url);
$fp = fsockopen($info["host"], 80, $errno, $errstr, 3);
$head = "GET ".$info['path']."?".$info["query"]." HTTP/1.0 ";
$head .= "Host: ".$info['host']." ";
$head .= " ";
$write = fputs($fp, $head);
while (!feof($fp))
{
$line = fread($fp,4096);
echo $line;
}
}
sock_post($purl,"uu=rrrrrrrrrrrrrrrr");
function sock_post($url, $query)
{
$info = parse_url($url);
$fp = fsockopen($info["host"], 80, $errno, $errstr, 3);
$head = "POST ".$info['path']."?".$info["query"]." HTTP/1.0 ";
$head .= "Host: ".$info['host']." ";
$head .= "Referer: http://".$info['host'].$info['path']." ";
$head .= "Content-type: application/x-www-form-urlencoded ";
$head .= "Content-Length: ".strlen(trim($query))." ";
$head .= " ";
$head .= trim($query);
$write = fputs($fp, $head);
while (!feof($fp))
{
$line = fread($fp,4096);
echo $line;
}
}
?>
php教程 中文与英语正则表达式
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>php 中文与英语正则表达式</title>
</head>
<body>
<form id="111cnNet" name="111cnNet" method="post" action="">
<input name="url" type="text" />
<input name="" type="submit" value="提交 "/>
</form>
</body>
</html>
<?
function funcChinese($str,$num1='',$num2='')//判断中文正则
{
if($num1!='' and $num2!=''){
return (preg_match("/^([x81-xfe][x40-xfe])
{".$num1.",".$num2."}$/",$str))?true:false;
}else{
return (!eregi("[^x80-xff]","$str"))?
true:false;
}
}
if( $_POST)
{
if( funcChinese( $_POST['url'] ) )
{
echo '是中文';
}
else
{
exit('不是有效中文');
}
}
//这个只能一个个字符判断哦,你可以用foreach来处理
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>电话号码 手机号码 正则表达式实例</title>
</head>
<body>
<form id="111cnNet" name="111cnNet" method="post" action="">
<input name="url" type="text" />
<input name="" type="submit" value="提交 "/>
</form>
输入13875998850
输出有效联系方式
输入0136986+9557
输出 联系方式有问题
</body>
</html>
<?
function funcPhone($str)//电话号码正则表达试
{
return (preg_match("/^(((d{3}))|(d{3}-))?((0d{2,3})|0d{2,3}-)?[1-9]d{6,8}$/",$str))?true:false;
}
function funcMtel($str)//手机号码正则表达试
{
return (preg_match("/(?:13d{1}|15[03689])d{8}$/",$str))?true:false;
}
if( $_POST)
{
if( funcPhone( $_POST['url'] ) || funcMtel( $_POST['url'] ) )
{
echo '有效联系方式';
}
else
{
exit('联系方式有问题');
}
}
?>