帝国cms怎么搭建python环境_用python 发 帝国cms 文章

  • A+
所属分类:Python

在e\extent下面放一个jiekou.php

$kv['classname'],'cid'=>$kv['classid'],'pid'=>$kv['bclassid']);

}

}

if(empty($_POST))

{

//这里刷新列表

echo ""; #echo maketree($cates,0,''); foreach($ar as $k=>$v){ $pid=$v['pid']; $cname=$v['cname']; $cid=$v['cid']; if($pid==$id) { $ids.="{$pre}{$cname}"; foreach($ar as $kk=>$vv) { $pp=$vv['pid']; if($pp==$cid) { $ids.=maketree($ar,$cid,$pre."  "); break; } } } } echo '';

exit();

}

$link=db_connect();

$empire=new mysqlquery();

//验证用户

$loginin=$_POST['username'];

$lur=$empire->fetch1("select * from {$dbtbpre}enewsuser where `username`='$loginin'");

if(!$lur) exit('不存在的用户名'.$loginin);

$logininid=$lur['userid'];

$loginrnd=$lur['rnd'];

$loginlevel=$lur['groupid'];

$loginadminstyleid=$lur['adminstyleid'];

$incftp=0;

if($public_r['phpmode'])

{

include("../class/ftp.php");

$incftp=1;

}

require("../class/hinfofun.php");

$navtheid=(int)$_POST['filepass'];

AddNews($_POST,$logininid,$loginin);

$arturl=$empire->fetch1("select titleurl from {$dbtbpre}ecms_news where `classid`='$classid' order by id desc limit 1");

db_close();

$empire=null;

exit($arturl)

/***生成目录的一个遍历算法***/

?>

#!/usr/bin/env python3

# -*- coding: utf-8 -*-

import time

import urllib.request

import urllib.parse

def post(title, content, catid):

query = "http://127.0.0.1/emcms/e/extend/jiekou.php?pw=123456"

data_form = {

"enews": "AddNews",

"classid": catid, # 栏目id

"bclassid": 0, # 父栏目id

"id": 0,

"filepass": int(time.time()), # 发布文章的时间戳

"username": "admin",

"oldchecked": 1,

"ecmsnfrom": 1,

"ecmscheck": 0,

"havetmpic": 0,

"title": title,

"checked": 1,

"isgood": 0,

"firsttitle": 0,

"newstime": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),

"writer": "admin",

"befrom": "",

"newstext": content,

"dokey": 1,

"copyimg": 1,

"autosize": 5000,

"istop": 0,

"newstempid": 0,

"groupid": 0,

"userfen": 0,

"onclick": 0,

"totaldown": 0,

"addnews": "提 交",

}

data = urllib.parse.urlencode(data_form).encode(encoding='utf-8')

req = urllib.request.Request(query, data=data)

res = urllib.request.urlopen(req, timeout=10)

result = res.read().decode('utf-8')

print(result)

if __name__ == "__main__":

content_list = [line.strip() for line in open("duanwenxue.txt")]

for wz in content_list[:5]:

text = wz.split("####")

title = text[0]

content = text[1]

print("开始发布:", title)

post(title, content, 1)

参考:

来源:http://www.icode9.com/content-1-26341.html

  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin