• 29-07-2010, 10:53:47
    #1
    Merhaba Arkadaşlar,

    Daha önceki konuları inceleyerek smf'e üye girişini başardım. Bunun haricinde kendim üye girşinden sonra veri post etmeye çalıştım fakat başarısız oldum. Smf şu şekilde bir geri dönüş yaptı:

    Alıntı
    Mesaj yollanırken şu hatalar oluştu:
    Oturumunuz zaman aşımına uğradığı için iletiniz gönderilemiyor. Tekrar giriş yaparak mesajınızı yeniden göndermeyi deneyin.
    Bunun haricinde herhangi bir sıkıntı olmadı. Ayrıca şuanda denemelerimi localhosttan yapıyorum (windows xp). Girişi sorunsuz yapıyor fakat dosya.txt şeklinde belirttiğim txt dosyasının içerisi dolmuyor bomboş. Salt okunur da değil. Bu sorunuda çözemedim. Aşağıda linkteki konuyu buldum fakat açıkcası altından çıkamadım. Rica etsem benim kodlamamdaki eksiklikleri, yanlışlıkları söylerseniz sevinirim. Smf 1.x serisi formum...

    https://www.r10.net/php/679494-hf-aut...ison-post.html

       <?php
    $id = "test";
    $pw = "test";
    $mesaj="test";
    $baslik="curl";
    $hidden="115945";
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://www.test.com/forum/index.php?action=login2");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Allow redirection
    curl_setopt($ch, CURLOPT_COOKIEJAR, "dosya.txt");
    curl_setopt($ch, CURLOPT_COOKIEFILE, "dosya.txt");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$id&passwrd=$pw");
    curl_setopt($ch, CURLOPT_URL, "http://www.test.com/forum/index.php?action=post2;start=0;board=5");
    curl_setopt($ch, CURLOPT_POSTFIELDS, "message=$mesaj&subject=$baslik&topic=$hidden");
    curl_exec($ch);
    curl_close($ch);
    ?>
    Teşekkürler...
  • 29-07-2010, 11:22:21
    #2
    bir gün lazım olur diye foruma koymuştum incelediğin için tşk

    https://www.r10.net/php/679494-hf-aut...ison-post.html
    uğraşmak istemiyorum hazır olsun diyorsan
    https://www.r10.net/php/694934-curl-i...ost-atmak.html

    smf 1 v 2 için olan sınıfları incele ama



    bu kısımda çok eksiğin var
    ); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, "message=$mesaj&subject=$baslik&topic=$hidden");
    alttaki şekilde 2.0 sürümleri için kullanabilirsin

    2.x Sürümler İçin
    <?
    session_start();
    
    class SMF_2_X_ALL_Versions {
        public $domain;
        public $login     =     "index.php?action=login2";
        public $username;
        public $password;
        public $cookie;
        public $subject;
        public $message;
        public $random;
        public $seqnum;
        public $sesid;
        public $time;
        public $topicid;
        public $boardid;
        public $replies;
    
        
    public function __construct($domain,$username,$password,$mesaj,$topic){
    $this->domain     = $domain;
    $this->username = $username;
    $this->password = $password;
    $this->message     = $mesaj;
    $this->topicid    = $topic;
    
            $ch = curl_init();
            curl_setopt($ch,    CURLOPT_URL,$this->domain.$this->login);
            curl_setopt($ch,    CURLOPT_FOLLOWLOCATION,TRUE);
            curl_setopt($ch,    CURLOPT_POST,TRUE);
            curl_setopt($ch,    CURLOPT_POSTFIELDS,"user=$this->username&passwrd=$this->password&cookieneverexp=on&Submit=Giriş Yap");
            $this->cookie = session_id()."-".$this->username."-".$this->password.".txt";
            curl_setopt($ch,    CURLOPT_COOKIEJAR,dirname(__FILE__)."/kayitlar/".$this->cookie);
                if (file_exists(dirname(__FILE__)."/kayitlar/".$this->cookie)) {
                    
                }else{
                    curl_exec($ch);
                }
            
    }
    public function SMF_2_X(){
            $ch = curl_init();
            curl_setopt($ch,    CURLOPT_URL,$this->domain."index.php?action=post;topic=$this->topicid;$this->replies");
            curl_setopt($ch,    CURLOPT_RETURNTRANSFER,TRUE);
            curl_setopt($ch,    CURLOPT_FOLLOWLOCATION,TRUE);
            curl_setopt($ch,    CURLOPT_COOKIEFILE,dirname(__FILE__)."/kayitlar/".$this->cookie);
            $exe = curl_exec($ch);    
                
                //Mesaj Başlığı
                preg_match_all('/<input type="text" name="subject" value="(.*?)"/',$exe,$subject);
                $this->subject = $subject[1][0];            
                
                //Replies
                preg_match_all('/<input type="hidden" name="num_replies" value="(.*?)"/',$exe,$replies);
                $this->replies = $replies[1][0];            
                
                //Sessionİd
                preg_match_all("/sSessionId: '(.*?)'/",$exe,$sessionid);
                $this->sesid = $sessionid[1][0];
    
                //Random Deger        
                preg_match_all("/sSessionVar: '(.*?)'/",$exe,$random);
                $this->random = $random[1][0];            
                
                //Seqnum Deger
                preg_match_all('/<input type="hidden" name="seqnum" value="(.*?)"/',$exe,$seqnum);
                $this->seqnum = $seqnum[1][0];            
                
                
                //board Deger
                preg_match_all('/var current_board = (.*?);/',$exe,$board);
                $this->boardid = $board[1][0];
                $exe;
            
            curl_setopt($ch,    CURLOPT_URL,$this->domain."index.php?action=post2;start=0;$this->boardid");
            curl_setopt($ch,    CURLOPT_RETURNTRANSFER,TRUE);
            curl_setopt($ch,    CURLOPT_FOLLOWLOCATION,TRUE);
            curl_setopt($ch,    CURLOPT_POST,TRUE);
            curl_setopt($ch,    CURLOPT_POSTFIELDS,"topic=".  $this->topicid  ."&subject=". $this->subject ."&icon=&sel_face=&sel_size=&sel_color=&message=".$this->message."&message_mode=1&notify=0&notify=1&goback=1&attachment[]&num_replies=".$this->replies."additional_options=0&".$this->random."=".$this->sesid."&seqnum=". $this->seqnum."");
    
            echo $exe = curl_exec($ch);    
           // echo $this->domain."index.php?action=post;topic=".$this->topicid;$this->replies;
    }}
    
    
    $yeni = new SMF_2_X_ALL_Versions("http://www.kralforumcu.net/","bypckopatkral","*****","merhaba","805");
    $yeni->SMF_2_X();
    ?>
    1.x Sürümler İçin
    <?
    class SMF_1_X_ALL_Versions {
    public         $Domain;    
    public         $Username;
    public         $Pass;
    public         $UserAgent      = "Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4";
    public         $Login_Url   = "index.php?action=login2";
    public       $Cookie_File;//cooike sessiondan geliyor
    public         $Topic_id;
    public         $Subject;
    public         $Message;
    public      $Icon = "xx";
    public         $FromGr;
    public         $notify;
    public         $GoBack;
    public         $Num_Replies;
    public         $Sc;
    public         $Sesid;
    public         $Seqnum;
    public         $board_id;
    public         $crack;
    public function __construct($domain,$username,$pass,$topic_id,$messsage){
                                                                                    $this ->    Domain         = $domain;
                                                                                    $this ->    Username     = $username;
                                                                                    $this ->     Pass         = $pass;
                                                                                    $this ->     Topic_id    = $topic_id;
                                                                                    $this ->      Message        = $messsage;
                                                                                    $this ->     Post_At();}
    public function Post_At (){
    $this->Cookie_File = rand();    
        $ch = curl_init();
                    curl_setopt($ch        ,CURLOPT_HEADER,0);    
                    curl_setopt($ch        ,CURLOPT_RETURNTRANSFER,1);
                    curl_setopt($ch        ,CURLOPT_URL,        $this->Domain.$this->Login_Url);
                    curl_setopt($ch        ,CURLOPT_USERAGENT,    $this->UserAgent);                
                    curl_setopt($ch        ,CURLOPT_COOKIEJAR,  dirname(__FILE__)."/Cookieler/".$this->Cookie_File); 
                    curl_setopt($ch        ,CURLOPT_COOKIEFILE, dirname(__FILE__)."/Cookieler/".$this->Cookie_File);
                    curl_setopt($ch        ,CURLOPT_FOLLOWLOCATION,1);
                    curl_setopt($ch        ,CURLOPT_POST,1);
                    curl_setopt($ch        ,CURLOPT_POSTFIELDS, "user=$this->Username&passwrd=$this->Pass&cookieneverexp=on&Submit=Giriş Yap");
                        $this12 = curl_exec($ch);
                        $REP = $this->Num_Replies +1;
                    curl_setopt($ch        ,CURLOPT_URL,$this->Domain."index.php?action=post;topic=$this->Topic_id;num_replies=$REP");
                    curl_setopt($ch     , CURLOPT_POST,0);
                        $this12 = curl_exec($ch);
    preg_match_all("/name=\"subject\" value=\"(.*?)\"/",$this12,$degerler);
        $this->Subject         = $degerler[1][0];        
    preg_match_all("/hidden\" name=\"num_replies\" value=\"(.*?)\"/",$this12,$replies);
        $this->Num_Replies     = $replies[1][0]+1;
    preg_match_all("/hidden\" name=\"sc\" value=\"(.*?)\"/",$this12,$sesid);
        $this->Sesid         = $sesid[1][0];
    preg_match_all("/hidden\" name=\"seqnum\" value=\"(.*?)\"/",$this12,$seqnum);
        $this->Seqnum         = $seqnum[1][0];    
    preg_match_all("/var current_board = (.*?);/",$this12,$board);
        $this->board_idf     = $board[1][0];            
    
                    curl_setopt($ch , CURLOPT_URL,$this->Domain."index.php?action=post2;start=0;$this->board_id");
                    curl_setopt($ch , CURLOPT_POST,1);
                    sleep(5);
                    curl_setopt($ch    , CURLOPT_POSTFIELDS,"topic=".  $this->Topic_id  ."&subject=". $this->Subject ."&icon=&message=".$this->Message."&notify=0&post=Gönder&num_replies=".$this->Num_Replies."&additional_options=0&sc=".$this->Sesid."&seqnum=". $this->Seqnum."");
                        sleep(15);
                     $this12 = curl_exec($ch);}
    }    
    
    $yeni = new SMF_1_X_ALL_Versions("http://www.phpogreniyorum.com/","ByTrislasis","7415974","50","Merhaba Bottan Gelen mesaj :)");
    ?>
  • 29-07-2010, 21:57:03
    #3
    İşime yaradı teşekkür ederim hocam. Gerçekten mükemmel hazırlamışsınız.