国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.2KB

  1. <?php
  2. /**
  3. * 友情链接添加
  4. *
  5. * @version $Id: friendlink_add.php 1 10:59 2010年7月13日Z tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2007 - 2019, DesDev, Inc.
  8. * @license http://help.dedecms.com/usersguide/license.html
  9. * @link http://www.dedecms.com
  10. */
  11. require(dirname(__FILE__)."/config.php");
  12. CheckPurview('plus_友情链接模块');
  13. if(empty($dopost)) $dopost="";
  14. if($dopost=="add")
  15. {
  16. $dtime = time();
  17. if(is_uploaded_file($logoimg))
  18. {
  19. $names = split("\.", $logoimg_name);
  20. $shortname = ".".$names[count($names)-1];
  21. if(!preg_match("#(jpg|gif|png)$#", $shortname))
  22. {
  23. $shortname = '.gif';
  24. }
  25. $filename = MyDate("ymdHis", time()).mt_rand(1000,9999).$shortname;
  26. $imgurl = $cfg_medias_dir."/flink";
  27. if(!is_dir($cfg_basedir.$imgurl))
  28. {
  29. MkdirAll($cfg_basedir.$imgurl, $cfg_dir_purview);
  30. CloseFtp();
  31. }
  32. $imgurl = $imgurl."/".$filename;
  33. move_uploaded_file($logoimg,$cfg_basedir.$imgurl) or die("复制文件到:".$cfg_basedir.$imgurl."失败");
  34. @unlink($logoimg);
  35. }
  36. else
  37. {
  38. $imgurl = $logo;
  39. }
  40. //强制检测用户友情链接分类是否数据结构不符
  41. if(empty($typeid) || preg_match("#[^0-9]#", $typeid))
  42. {
  43. $typeid = 0;
  44. $dsql->ExecuteNoneQuery("ALTER TABLE `#@__flinktype` CHANGE `ID` `id` MEDIUMINT( 8 ) UNSIGNED DEFAULT NULL AUTO_INCREMENT; ");
  45. }
  46. $query = "INSERT INTO `#@__flink`(sortrank,url,webname,logo,msg,email,typeid,dtime,ischeck)
  47. VALUES('$sortrank','$url','$webname','$imgurl','$msg','$email','$typeid','$dtime','$ischeck'); ";
  48. $rs = $dsql->ExecuteNoneQuery($query);
  49. $burl = empty($_COOKIE['ENV_GOBACK_URL']) ? "friendlink_main.php" : $_COOKIE['ENV_GOBACK_URL'];
  50. if($rs)
  51. {
  52. ShowMsg("成功增加一个链接!",$burl,0,500);
  53. exit();
  54. }
  55. else
  56. {
  57. ShowMsg("增加链接时出错,请向官方反馈,原因:".$dsql->GetError(),"javascript:;");
  58. exit();
  59. }
  60. }
  61. include DedeInclude('templets/friendlink_add.htm');