请帮忙解决,图随机上传,不限量,定位置,与文章进库同步完成

发布文章、或者新闻、或者产品说明,这一类的图片、文字均有的资料,要求的是,根据文章的需要随时插入图片、并且由其自己指定对齐方式。文字进库,图片上传,理论上是采取 UBB 跟 JS 配合,请各位不吝赐教,本人给分绝对爽快。

CSDN 论坛助手 Ver 1.0 B0402提供下载。 改进了很多,功能完备!

★ 浏览帖子速度极快![建议系统使用ie5.5以上]。 ★ 多种帖子实现界面。
★ 保存帖子到本地[html格式]★ 监视您关注帖子的回复更新。
★ 可以直接发贴、回复帖子★ 采用XML接口,可以一次性显示4页帖子,同时支持自定义每次显示帖子数量。可以浏览历史记录!
★ 支持在线检测程序升级情况,可及时获得程序更新的信息。

★★ 签名 ●
可以在您的每个帖子的后面自动加上一个自己设计的签名哟。

Http://www.ChinaOK.net/csdn/csdn.zip
Http://www.ChinaOK.net/csdn/csdn.rar
Http://www.ChinaOK.net/csdn/csdn.exe [自解压]

---------------------------------------------------------------

adddata.php文件的代码:

  1<html>
  2<head>
  3<title>增加数据</title>
  4<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
  5</head>
  6<body bgcolor="#FFFFFF">
  7<?   
  8@$link=mysql_pconnect("localhost","root","rpass007") or   
  9die ("登陆服务器失败,请稍候再试");   
 10mysql_select_db($db);   
 11$date=date('Y-m-d H:i:s');   
 12if((($db=="foltyx"&&$tb=="wlg_master") ¦ ¦($db=="foljrbd"&&$tb=="tpxw")) ¦ ¦($db=="foljrxt"&&($tb=="shpx" ¦ ¦$tb=="tswl")))//for tyx jrbd jrxt   
 13{   
 14if(chop($imagein)!="none")   
 15{   
 16$picuppath="/home/fol/php/admin/"; //define up pic path   
 17$dirname="picup";   
 18if(!(chdir($picuppath)))   
 19{   
 20die("can not change path!");   
 21}   
 22if(!(file_exists("$dirname")))   
 23{   
 24if(!(mkdir($dirname,0777))) die("can not make dir!");   
 25if(!(chmod($dirname,0777))) die("can not change dir mode!");   
 26}   
 27if(!(chdir($dirname))) die("can not change dir!");   
 28$dirpath=$dirname."/";   
 29$imagepath=$picuppath.$dirpath; //path end   
 30  
 31$image="";   
 32$imagename="";   
 33$imagetype="";   
 34$nowtime=time();   
 35  
 36$imagename=$imagein_name ; //old pic name for db   
 37$imagetail=strrchr($imagename,"."); //get pic name type name   
 38$imagename=$nowtime.$imagetail;   
 39if(!copy($imagein,$imagepath.$imagename)) die("up pic false"); //up pic end   
 40$size=getimagesize($imagename); //get size array,for now in uppic,so just imagename else dirpaht   
 41$imgwidth=$size[0];   
 42$imgheight=$size[1];   
 43$imgsize=$size[3];   
 44unlink($imagename); //delete pic in remote   
 45  
 46$image=base64_encode(fread(fopen($imagein,"r"),10000000)); //inset db begin   
 47$imagetype=$imagein_type ;   
 48$imgtype=$imagetype;   
 49unlink($imagein);   
 50  
 51$imgoldname=$imagename;   
 52$imgname=$imagename;   
 53$imgbody=$image;   
 54if($db=="foljrbd"&&tb=="tpxw"){//there is no summary in tpxw of foljrbd,so ...   
 55$result =mysql_query("insert into $tb (title,content,date,author,origin,imgoldname,imgtype,imgname,imgwidth,imgheight,imgsize,imgbody) values('$title','$content','$date','$author','$origin','$imgoldname','$imgtype','$imgname','$imgwidth','$imgheight','$imgsize','$imgbody')",$link);   
 56}   
 57else{//tpxw of foljrbd   
 58$result =mysql_query("insert into $tb (title,summary,content,date,author,origin,imgoldname,imgtype,imgname,imgwidth,imgheight,imgsize,imgbody) values('$title','$summary','$content','$date','$author','$origin','$imgoldname','$imgtype','$imgname','$imgwidth','$imgheight','$imgsize','$imgbody')",$link);   
 59}   
 60}   
 61else die("请上传图片");   
 62}//end of pic or pic with no summary   
 63elseif($db=="foljrbd"&&$tb=="cjzt"){//beggin of cjzt of fol jrbd   
 64$result =mysql_query("insert into $tb (title,content,date,author,origin,topic) values('$title','$content','$date','$author','$origin','$topic')",$link);   
 65}//end of cjzt of fol jrbd   
 66elseif($db=="foljrsx"&&$tb=="pshzl")//for jrsx   
 67{   
 68if(chop($imagein)!="none")   
 69{   
 70$picuppath="/home/fol/php/jrsx/"; //define up pic path   
 71$dirname="article";   
 72if(!(chdir($picuppath)))   
 73{   
 74die("can not change path!");   
 75}   
 76if(!(file_exists("$dirname")))   
 77{   
 78if(!(mkdir($dirname,0777))) die("can not make dir!");   
 79if(!(chmod($dirname,0777))) die("can not change dir mode!");   
 80}   
 81if(!(chdir($dirname))) die("can not change dir!");   
 82$dirpath=$dirname."/";   
 83$imagepath=$picuppath.$dirpath; //path end   
 84  
 85$image="";   
 86$imagename="";   
 87$imagetype="";   
 88$nowtime=time();   
 89  
 90$imagename=$imagein_name ; //old pic name for db   
 91$imagetail=strrchr($imagename,"."); //get pic name type name   
 92$imagename=$nowtime.$imagetail;   
 93if(!copy($imagein,$imagepath.$imagename)) die("up pic false"); //up pic end   
 94//unlink($imagename); //delete pic in remote   
 95  
 96//$image=base64_encode(fread(fopen($imagein,"r"),10000000)); //inset db begin   
 97$imagetype=$imagein_type ;   
 98$imgtype=$imagetype;   
 99unlink($imagein);   
100  
101$imgoldname=$imagename;   
102$imgname=$imagename;   
103$imgbody=$image;   
104$result =mysql_query("insert into $tb (title,content,date,author,origin,artcloldname,artcltype,artclname) values('$title','$content','$date','$author','$origin','$imgoldname','$imgtype','$imgname')",$link);   
105}   
106else die("请上传论文");   
107}//end of art   
108elseif($db=="foljrxt"&&($tb=="ztjz" ¦ ¦$tb=="alfx")){   
109$result =mysql_query("insert into $tb (title,summary,content,date,author,origin) values('$title','$summary','$content','$date','$author','$origin')",$link);   
110}   
111else{   
112$result =mysql_query("insert into $tb (title,content,date,author,origin) values('$title','$content','$date','$author','$origin')",$link);   
113}   
114if (mysql_affected_rows()==1)   
115{   
116?>   
117添加成功,请返回!   
118<p><a href="add.php?db=&lt;? echo $db ?&gt;&amp;tb=&lt;? echo $tb ?&gt;">返回</a> </p>
119<?   
120}   
121else   
122{   
123?>   
124添加不成功,请稍候再试!   
125<p><a href="add.php?db=&lt;? echo $db ?&gt;&amp;tb=&lt;? echo $tb ?&gt;">返回</a> </p>
126<?   
127}   
128?>
129</body>
130</html>
Published At
Categories with Web编程
comments powered by Disqus