Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $subject=$_POST['subject'];
- $body=$_POST['body'];
- $idBoard=$_POST['idBoard'];
- $idMember=2;
- $posterTime=time();
- $posterName="BotPicpost";
- $posterEmail='-';
- $posterIP='-';
- $server="localhost";
- $username="wantdota";
- $password="thejestei2";
- $dbname="wantdota_wantdota";
- $db = mysql_connect($server,$username,$password);
- if(!$db) {
- echo "Database Error";
- exit;
- }
- mysql_select_db($dbname);
- mysql_query("SET NAMES UTF-8");
- mysql_query("SET character_set_results=utf8");
- mysql_query("SET character_set_client=utf8");
- mysql_query("SET character_set_connection=utf8");
- $sql="insert into smf_topics values
- ('',0,$idBoard,0,0,$idMember,$idMember,0,0,0,0,0,0,0,1)";
- $result=mysql_query($sql);
- if (!$result) {
- echo "Topic Error";
- exit;
- }
- $sql="select MAX(ID_TOPIC) AS ID_TOPIC from smf_topics";
- $result=mysql_query($sql);
- $rs=mysql_fetch_array($result);
- $idTopic=$rs["ID_TOPIC"];
- $sql="insert into smf_messages values
- ('',$idTopic,$idBoard,$posterTime,$idMember,'','$subject','$posterName','$posterEmail','$posterIP',1,0,'','$body','xx',1)";
- $result=mysql_query($sql);
- if (!$result) {
- echo "Msg Error";
- exit;
- }
- $sql="select MAX(ID_MSG) AS ID_MSG from smf_messages";
- $result=mysql_query($sql);
- $rs=mysql_fetch_array($result);
- $idMsg=$rs["ID_MSG"];
- $sql="update smf_topics set ID_FIRST_MSG=$idMsg, ID_LAST_MSG=$idMsg where ID_TOPIC=$idTopic";
- $result=mysql_query($sql);
- $sql="select * from smf_boards where ID_BOARD=$idBoard";
- $result=mysql_query($sql);
- $rs=mysql_fetch_array($result);
- $numTopics=$rs["num_topics"]+1;
- $numPosts=$rs["num_posts"]+1;
- $sql="update smf_boards SET id_last_msg=$idMsg, id_msg_updated=$idMsg,
- num_topics=$numTopics, num_posts=$numPosts where id_board=$idBoard";
- $result=mysql_query($sql);
- if (!$result) {
- echo "Update Error";
- exit;
- }
- echo "Success";
- mysql_close();
- ?>
Add Comment
Please, Sign In to add comment