⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cgi_add_topic_comment.cpp

📁 分块通用CACHE 分块通用CACHE
💻 CPP
字号:
/*
发表对某个专题的评论
author: guoshiwei@xunlei.com
date: 2006-11-06
*/
#include "api.h"
#include "cmycgi.h"
#include "dirty.h"
#include "session_define.h"
#include "api_total_usrinfor.h"
#include "session_client_api.h"
#include "coin.h"

class CAddTopicComment: public CMyCgi
{
public:
	CAddTopicComment (const char* szLogFileName);
	~CAddTopicComment ();

	bool DealInput (map<string, string> &Params);

private:
	CMysql m_clsDBConn;
	CDirty m_clsDirty;
};

CAddTopicComment:: CAddTopicComment(const char* szLogFileName): CMyCgi(szLogFileName)
{	
}

CAddTopicComment:: ~CAddTopicComment()
{	
}

bool CAddTopicComment:: DealInput (map<string, string> &Params)
{		
	string sTime, sKey, sUin, sReason, sContent;
	char szUrl[512], szErrMsg[256];
	STotalUsrInfor_Api stUserInfo;
	int iRetCode, iCommentID;
	map<string, string> mConfig;
	
	m_clsDirty.DirtyInit(CN_DIRTY, ENG_DIRTY);
	m_clsDirty.DirtyCheck(Params["cmt_title"].c_str(), Params["cmt_content"].c_str(), NULL);

	sContent = Params["cmt_content"] + ";" + Params["cmt_title"];
	LogMsg("%s", sContent.c_str());
	if(API_AdvFilter(sContent)) //过滤标题和内容的广告词汇
	{
		GoBackWithAlert("发表评论成功!!");
		return false;
	}
	
	m_clsDBConn.Connect("RES_IP", "RES_USER", "RES_PASSWD");

	CTopicComment::AddComment(m_clsDBConn, atoi(Params["topicid"].c_str()), sUin, Params["cmt_title"], Params["cmt_content"]);//往数据库插入一条评论记录
		
	sprintf(szUrl, "http://dynamic.topic.xunlei.com/fcg-bin/cgi_comment_topic4.fcg");
	RedirectWithAlert(szUrl, "发表评论成功!");
		
	return true;
}


int main()
{	
	try {
		CAddTopicComment theApp("CAddTopicComment");
		theApp.CgiGetMappedParams("cmt_title", "topicid","cmt_content", NULL);
		theApp.Run(NULL);
	}
	catch (CCgiException &e)
	{
		CMyCgi::InfoInWeb(e.GetErrMsg());
	}	
	catch (CMysqlException &e)
	{
		CMyCgi::InfoInWeb(e.GetErrMsg());
	}
	catch (CCommonException &e)
	{
		CMyCgi::InfoInWeb(e.GetErrMsg());
	}

	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -