Docstoc

SMF Forum Poster

Document Sample
SMF Forum Poster Powered By Docstoc
					<?


class SMF1_REPLY {
    var $login_page = "/index.php?action=login2";
    var $cerez         = "/Cache/cerez.txt";
    var $post_adres = "/index.php?action=post;topic=";
    var $post_yolla = "/index.php?action=post2;start=0;board=";
        public function SeoLink($text){
    $tr = array('þ','Þ','ý','Ý','ð','Ð','ü','Ü','ö','Ö','Ç','ç');
    $eng = array('s','S','i','I','g','G','u','U','o','O','C','c');
    $text = str_replace($tr,$eng,$text);
    return strtolower($text);}
        public function
__construct($username,$password,$url,$topic,$mesaj){
            $smf1 = curl_init();
                curl_setopt($smf1,CURLOPT_URL,$url.$this->login_page);
                curl_setopt($smf1,CURLOPT_TIMEOUT,3);

curl_setopt($smf1,CURLOPT_COOKIEJAR,dirname(__FILE__).$this->cerez);

curl_setopt($smf1,CURLOPT_COOKIEFILE,dirname(__FILE__).$this->cerez);
                curl_setopt($smf1,CURLOPT_FOLLOWLOCATION,TRUE);
                curl_setopt($smf1,CURLOPT_RETURNTRANSFER,TRUE);
                curl_setopt($smf1,CURLOPT_POST,TRUE);
                $login_bilgileri =
array("user"=>$username,"passwrd"=>$password,"cookieneverexp"=>"on","subm
it"=>"login");

                curl_setopt($smf1,CURLOPT_POSTFIELDS,$login_bilgileri);
                curl_exec($smf1);

                curl_setopt($smf1,CURLOPT_URL,$url.$this-
>post_adres.$topic);
                $exe = curl_exec($smf1);

                preg_match('/name="num_replies"
value="(.*?)"/',$exe,$num_replies);
                $replies = $num_replies[1];

                preg_match('/name="additional_options"
value="(.*?)"/',$exe,$additional_options);
                $additional = $additional_options[1];

                preg_match('/name="sc" value="(.*?)"/',$exe,$sc1);
                $sc = $sc1[1];

                preg_match('/name="seqnum"
value="(.*?)"/',$exe,$seqnum1);
                $seqnum = $seqnum1[1];

                preg_match('/var current_board = (.*?);/',$exe,$board1);
                $board = $board1[1];
                preg_match('/name="subject"
value="(.*?)"/',$exe,$subject1);
                $subject = $subject1[1];

                   preg_match("/sSessionVar: '(.*?)'/",$exe,$sSessionVar1);
                   $sSessionVar = $sSessionVar1[1];


                   preg_match("/sSessionId: '(.*?)'/",$exe,$sSessionId1);
                   $sSessionId = $sSessionId1[1];
                                                   $gonder = array(
                                                   "topic"
=>$topic,
                                                   "subject"
=>$this->SeoLink($subject),
                                                   "icon"
=>"",
                                                   "message"
=>$this->SeoLink($mesaj),
                                                   "notify"
=>"",
                                                   "lock"
=>"",
                                                   "sticky"
=>"",
                                                   "move"
=>"",
                                                   "attachment[]"
=>"",
                                                   "post"
=>"",
                                                   "num_replies"
=>$replies,
                                                   "additional_options"
=>$additional,
                                                   "sc"
=>$sc,
                                                   "seqnum"
=>$seqnum,
                                                   $sSessionVar
=> $sSessionId);


curl_setopt($smf1,CURLOPT_URL,$url.$this->post_yolla.$board);
curl_setopt($smf1,CURLOPT_POSTFIELDS,$gonder);

echo curl_exec($smf1);

}}

class SMF_NEW_THEREAD{
    var $login_page = "/index.php?action=login2";
    var $cerez         = "/Cache/cerez.txt";
    var $konu_ac     = "/index.php?action=post;board=";
    var $konu_ac_post_adres = "/index.php?action=post2;start=0;board=";
    public function SeoLink($text){
    $tr = array('þ','Þ','ý','Ý','ð','Ð','ü','Ü','ö','Ö','Ç','ç');
    $eng = array('s','S','i','I','g','G','u','U','o','O','C','c');
    $text = str_replace($tr,$eng,$text);
    return strtolower($text);}
    public function
__construct($username,$password,$url,$board_id,$baslik,$mesaj){
            $smf1 = curl_init();
                curl_setopt($smf1,CURLOPT_URL,$url.$this->login_page);
                curl_setopt($smf1,CURLOPT_TIMEOUT,3);

curl_setopt($smf1,CURLOPT_COOKIEJAR,dirname(__FILE__).$this->cerez);

curl_setopt($smf1,CURLOPT_COOKIEFILE,dirname(__FILE__).$this->cerez);
                curl_setopt($smf1,CURLOPT_FOLLOWLOCATION,TRUE);
                curl_setopt($smf1,CURLOPT_RETURNTRANSFER,TRUE);
                curl_setopt($smf1,CURLOPT_POST,TRUE);
                $login_bilgileri =
array("user"=>$username,"passwrd"=>$password,"cookieneverexp"
=>"on","submit"=>"login");

                curl_setopt($smf1,CURLOPT_POSTFIELDS,$login_bilgileri);
                curl_exec($smf1);
                curl_setopt($smf1, CURLOPT_URL,$url.$this-
>konu_ac.$board_id);
                $exe = curl_exec($smf1);



                preg_match('/name="num_replies"
value="(.*?)"/',$exe,$num_replies);
                $replies = $num_replies[1];

                preg_match('/name="additional_options"
value="(.*?)"/',$exe,$additional_options);
                $additional = $additional_options[1];

                preg_match('/name="sc" value="(.*?)"/',$exe,$sc1);
                $sc = $sc1[1];

                preg_match('/name="seqnum"
value="(.*?)"/',$exe,$seqnum1);
                $seqnum = $seqnum1[1];

                preg_match('/var current_board = (.*?);/',$exe,$board1);
                $board = $board1[1];

                preg_match('/name="subject"
value="(.*?)"/',$exe,$subject1);
                $subject = $subject1[1];


                preg_match("/sSessionVar: '(.*?)'/",$exe,$sSessionVar1);
                   $sSessionVar = $sSessionVar1[1];


                   preg_match("/sSessionId: '(.*?)'/",$exe,$sSessionId1);
                   $sSessionId = $sSessionId1[1];


                                                      $gonder = array(
                                                      "topic"
=>"",
                                                      "subject"
=>$baslik,
                                                      "icon"
=>"",
                                                      "message"
=>$this->SeoLink($mesaj),
                                                      "notify"
=>"",
                                                      "lock"
=>"",
                                                      "sticky"
=>"",
                                                      "move"
=>"",
                                                      "attachment[]"
=>"",
                                                      "post"
=>"",
                                                      "num_replies"
=>$replies,
                                                      "additional_options"
=>$additional,
                                                      "sc"
=>$sc,
                                                      "seqnum"
=>$seqnum,
                                                      $sSessionVar
=> $sSessionId);

curl_setopt($smf1,CURLOPT_URL,$url.$this->konu_ac_post_adres.$board_id);
curl_setopt($smf1,CURLOPT_POSTFIELDS,$gonder);
echo curl_exec($smf1);
    }
}

//post için
$smf_Post_At = new
SMF1_REPLY("useranme","12345678","http://www.domain.net","152410","Mesajý
mýz Buraya");

//konu için
$smf_Konu_Ac = new
SMF_NEW_THEREAD("username","12345678","http://www.domain.net","458","dene
me Konu","Deneme Ýçeriði");
/*

SMF 1X ve 2X sürümlerinde sorunsuz çalýþýr ilerleyen günlerde VB ve phpbb
mybb kodlarýnýda ekleyeceðim
sýnýflar hem konu acmaya hemde mesaj atmaya uyumludur


cerezlerin saklandýgý yol
/Cache/cerez.txt

*/

				
DOCUMENT INFO
Shared By:
Tags:
Stats:
views:92
posted:2/26/2012
language:
pages:5
Description: Smf forumlara post atmak isteyenler i�in harika bir kod par�ası. yeni konu a�mak yada konulara mesaj yazmak i�in kullanabilirsiniz. kullanımı text dosyası i�inde yer almaktadır.