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

📄 postdlg.cpp

📁 往新浪论坛sina:tech?richwin上加帖子的程序
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*
	版权所有:周田鼠
	          http://www.geocities.com/zhoutianshu
			  zhoutianshu@yahoo.com
	感谢空心菜。
*/
#include "stdafx.h"
#include "mfcapp.h"
#include "PostDlg.h"
#include "crobotinternet.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define TRYNUM 3
//#define SETMESSAGE

/////////////////////////////////////////////////////////////////////////////
// PostDlg dialog


PostDlg::PostDlg(CWnd* pParent /*=NULL*/)
	: CDialog(PostDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(PostDlg)
	m_author = _T("");
	m_body = _T("");
	m_subject = _T("");
	m_urlname = _T("");
	m_copyfrom = _T("");
	m_pass = _T("");
	m_refimg = _T("");
	m_refurl = _T("");
	m_newORreply = -1;
	m_newORreply=0;
	m_refid = _T("");
	//}}AFX_DATA_INIT
}


void PostDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(PostDlg)
	DDX_Text(pDX, IDC_AUTHOR, m_author);
	DDX_Text(pDX, IDC_BODY, m_body);
	DDX_Text(pDX, IDC_TITLE, m_subject);
	DDX_Text(pDX, IDC_URLNAME, m_urlname);
	DDX_Text(pDX, IDC_COPYFROM, m_copyfrom);
	DDX_Text(pDX, IDC_PASS, m_pass);
	DDX_Text(pDX, IDC_REFIMG, m_refimg);
	DDX_Text(pDX, IDC_REFURL, m_refurl);
	DDX_Radio(pDX, IDC_RADIO1, m_newORreply);
	DDX_Text(pDX, IDC_REFID, m_refid);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(PostDlg, CDialog)
	//{{AFX_MSG_MAP(PostDlg)
	ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// PostDlg message handlers

void PostDlg::OnOK() 
{
	PostRichwin();
	//CDialog::OnOK();
}

void PostDlg::PostRichwin()
{

	UpdateData();
	
	//convert abnormal characters
	TransformString(m_author);
	TransformString(m_body);
	TransformString(m_copyfrom);
	TransformString(m_pass);
	TransformString(m_refimg);
	TransformString(m_refurl);
	TransformString(m_subject);
	TransformString(m_urlname);

	CRobotInternet internet;
	CString sURL, sData, sResponse, sErrMsg;
	int nResult;
	int i = 0;
	internet.m_sUserAgent = "Mozilla/4.0 (compatible; MSIE4.0; windows95)";

	//首先进行登陆
	sURL = "http://bbs2.sina.com.cn/newfbin/add.pl";
	sData = "forumid=71&type=login&loginname="+m_author+"&password="+m_pass;
	internet.httpPost(sURL,sData, sResponse, nResult, sErrMsg);

	if(!m_newORreply) //加新帖
	{
		sURL = "http://bbs2.sina.com.cn/newfbin/post.pl?forumid=71";
		sData = "post=new&forumid=71&subject=" + m_subject +
			"&copyfrom=" +  m_copyfrom +
			"&body=" + m_body ;
			"&urlname=" +	m_urlname +
			"&refurl=" + m_refurl +
			"&refimg=" + m_refimg;
		if(internet.httpPost(sURL,sData, sResponse, nResult, sErrMsg))
			::MessageBox(NULL,sResponse,"返回信息",MB_OK);
	}
	else			//回帖
	{
		sURL = "http://bbs2.sina.com.cn/newfbin/post.pl?forumid=71";
		sData = "post=reply&forumid=71&subject=" + m_subject +
			"&postid=" + m_refid +
		    "&copyfrom=" +  m_copyfrom +
			"&body=" + m_body ;
			"&urlname=" +	m_urlname +
			"&refurl=" + m_refurl +
			"&refimg=" + m_refimg;
		if(internet.httpPost(sURL,sData, sResponse, nResult, sErrMsg))
			::MessageBox(NULL,sResponse,"返回信息",MB_OK);
	}
}
void PostDlg::TransformString(CString &s)
{
	CString t = "";
	int i;
	for(i = 0; i < s.GetLength(); i++) {
		switch (s.GetAt(i)) {
		case '&': 
			t = t + "%26";
			break;
		case '%':
			t = t + "%25";
			break;
		case '<':
			t = t + "%3c";
			break;
		case '>':
			t = t + "%3e";
			break;
		case '=':
			t = t + "%3d";
			break;
		default:
			t = t + s.GetAt(i);
			break;
		}
	}
	s = t;
}


void trash()
{
/*
//1LLFC
	sURL = "http://www.bbsland.com/cgi-bin/post_rm.cgi";
	sData = "name=" + sName + 
			"&usrpwd=" + 
			"&sender=" + sName +
			"&email=" + 
			"&subject=" + sTitle +
			"&body=" + sBody +
			"&url=" + sUrl +
			"&url_title=" + sUrlTitle;
	for (i = 0; i < TRYNUM; i++) 
		if (internet.httpPost(sURL,sData, sFile, nResult, sErrMsg)) break;
#ifdef SETMESSAGE
	if (i <= TRYNUM)
		MessageBox(NULL, sFile, "LLFC", MB_OK);
#endif
//2自助移名加拿大   not
	sURL = "http://yangyang.virtualave.net/canada/mainboard.pl";
	sData = "name=" + sName + 
			"&usrpwd=" + 
			"&email=" + 
			"&subject=" + sTitle +
			"&body=" + sBody +
			"&url=" + sUrl +
			"&url_title=" + sUrlTitle +
			"&img=";
	for (i = 0; i < TRYNUM; i++) 
		if (internet.httpPost(sURL,sData, sFile, nResult, sErrMsg)) break;
#ifdef SETMESSAGE
	if (i <= TRYNUM)
	MessageBox(NULL, sFile, "自助移名加拿大", MB_OK);
#endif


//3海阔天空论坛
	sURL = "http://www.toptoday.com/cgi-freebbs/freeforum.cgi?corydon";
	sData = "name=" + sName + 
			"&password=" + 
			"&email=" + 
			"&subject=" + sTitle +
			"&body=" + sBody +
			"&url=" + sUrl +
			"&url_title=" + sUrlTitle +
			"&img=";
	for (i = 0; i < TRYNUM; i++) 
		if (internet.httpPost(sURL,sData, sFile, nResult, sErrMsg)) break;
#ifdef SETMESSAGE
	if (i <= TRYNUM)
	MessageBox(NULL, sFile, "海阔天空论坛", MB_OK);
#endif


//4统独论坛http://omniboard.hypermart.net/ui/mainpage.pl
	sURL = "http://omniboard.hypermart.net/ui/mainboard.pl";
	sData = "name=" + sName + 
			"&usrpwd=" + 
			"&email=" + 
			"&subject=" + sTitle +
			"&body=" + sBody +
			"&url=" + sUrl +
			"&url_title=" + sUrlTitle +
			"&img=";
	for (i = 0; i < TRYNUM; i++) 
		if (internet.httpPost(sURL,sData, sFile, nResult, sErrMsg)) break;
#ifdef SETMESSAGE
	if (i <= TRYNUM)
	MessageBox(NULL, sFile, "统独论坛", MB_OK);
#endif


//5万维读者论坛 http://www.creaders.org/cgi-bin/mainpage.cgi
	sURL = "http://www.creaders.org/cgi-bin/post_pol.cgi";
	sData = "name=" + sName + 
			"&usrpwd=" + 
			"&sender=" + sName +
			"&email=" + 
			"&subject=" + sTitle +
			"&body=" + sBody +
			"&url=" + sUrl +
			"&url_title=" + sUrlTitle +
			"&img=";
	for (i = 0; i < TRYNUM; i++) 
		if (internet.httpPost(sURL,sData, sFile, nResult, sErrMsg)) break;
#ifdef SETMESSAGE
	if (i <= TRYNUM)
	MessageBox(NULL, sFile, "万维读者论坛", MB_OK);
#endif


//6华岳政治时事论坛 http://www.washeng.com/HuaShan/BBS/shishi/gbcurrent.html
	sURL = "http://washeng.com/cgi-bin/hbbs-add.cgi";
	sData = "barcode=1909434&forum=shishi&lang=gb&action=add&shijian=20:22:59&username=" + sName + 
			"&password=" + 
			"&email=" + 
			"&subject=" + sTitle +
			"&body=" + sBody +
			"&url=" + sUrl +
			"&url_title=" + sUrlTitle +
			"&img=";
	for (i = 0; i < TRYNUM; i++) 
		if (internet.httpPost(sURL,sData, sFile, nResult, sErrMsg)) break;
#ifdef SETMESSAGE
	if (i <= TRYNUM)
	MessageBox(NULL, sFile, "华岳政治时事论坛", MB_OK);
#endif

	
//7外交与方略http://omniboard.hypermart.net/diplomacy/mainpage.pl
	sURL = "http://omniboard.hypermart.net/diplomacy/mainboard.pl";
	sData = "name=" + sName + 
			"&usrpwd=" + 
			"&email=" + 
			"&subject=" + sTitle +
			"&body=" + sBody +
			"&url=" + sUrl +
			"&url_title=" + sUrlTitle +
			"&img=";
	for (i = 0; i < TRYNUM; i++) 
		if (internet.httpPost(sURL,sData, sFile, nResult, sErrMsg)) break;
#ifdef SETMESSAGE
	if (i <= TRYNUM)
	MessageBox(NULL, sFile, "外交与方略", MB_OK);
#endif


//8文学城论坛http://www.chinese-e.com/cgi-bin/life.pl
	sURL = "http://www.chinese-e.com/cgi-bin/lifeboard.pl";
	sData = "name=" + sName + 
			"&usrpwd=" + 
			"&email=" + 
			"&subject=" + sTitle +
			"&body=" + sBody +

⌨️ 快捷键说明

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