国内流行的内容管理系统(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.

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