Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Coding Releases > Coding Snippets
You last visited: Today at 18:30

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Script zum Erstellen von Treasures

Discussion on Script zum Erstellen von Treasures within the Coding Snippets forum part of the Coding Releases category.

Reply
 
Old   #1

 
~ JWonderpig ~'s Avatar
 
elite*gold: 60
Join Date: Sep 2013
Posts: 1,436
Received Thanks: 248
Script zum Erstellen von Treasures

Moin,

hier ein kleines Script mit dem ihr einfach Treasures via PHP erstellen könnt.
Das Script besteht aus zwei Klassen:

TreasureManager.php
PHP Code:
<?php

class TreasureManager
{

    const 
BASE_URL 'http://www.elitepvpers.com/forum/';

    
/**
     *    [MENTION=881620]Var[/MENTION] string
     */
    
private $username;

    
/**
     *    [MENTION=881620]Var[/MENTION] string
     */
    
private $password;

    public function 
__construct($username$password)
    {
        
$this->username $username;
        
$this->password md5($password);

        
$this->login();
    }

    
/**
     * Creates a treasure
     *
     *    [MENTION=1985011]param[/MENTION] Treasure $treasure
     */
    
public function createTreasure(Treasure $treasure)
    {
        
$url 'http://www.elitepvpers.com/theblackmarket/treasures/';
        
$referer self::BASE_URL;
        
$postFields = array(
            
'title' => $treasure->getTitle(),
            
'content' => $treasure->getContent(),
            
'cost' => $treasure->getCost(),
            
'createtreasure' => 'Submit'
        
);
        
$this->sendHttpPostRequest($url$referer$postFields);
    }

    
/**
     * Login to get necessary cookies
     */
    
private function login()
    {
        
$url self::BASE_URL 'login.php?do=login';
        
$referer self::BASE_URL;
        
$postFields = array(
            
'do' => 'login',
            
'vb_login_username' => $this->username,
            
'vb_login_md5password' => $this->password,
            
'vb_login_md5password_utf' => $this->password,
            
'security_token' => 'guest',
            
's' => '',
            
'cookieuser' => '1'
        
);
        
$this->sendHttpPostRequest($url$referer$postFields);

        
$url self::BASE_URL 'clientscript/vbulletin_global.js?v=373';
        
$referer self::BASE_URL 'login.php?do=login';
        
$this->sendHttpPostRequest($url$referer);

        
$url self::BASE_URL 'index.php';
        
$referer self::BASE_URL 'login.php?do=login';
        
$this->sendHttpPostRequest($url$referer);
    }

    
/**
     * Sends a HTTP Post Request
     *
     *    [MENTION=1985011]param[/MENTION] $url
     *    [MENTION=1985011]param[/MENTION] $referer
     *    [MENTION=1985011]param[/MENTION] array $postFields
     *    [MENTION=326673]return[/MENTION] mixed
     */
    
private function sendHttpPostRequest($url$referer,array $postFields = array())
    {
        
$postFields http_build_query($postFields);
        
$ch curl_init();
        
curl_setopt($chCURLOPT_HEADERfalse);
        
curl_setopt($chCURLOPT_COOKIEFILEdirname(__FILE__) . 'veri.txt');
        
curl_setopt($chCURLOPT_COOKIEJARdirname(__FILE__) . 'veri.txt');
        
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
        
curl_setopt($chCURLOPT_COOKIESESSIONtrue);
        
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
        
curl_setopt($chCURLOPT_SSL_VERIFYHOSTfalse);
        
curl_setopt($chCURLOPT_FOLLOWLOCATIONfalse);
        
curl_setopt($chCURLOPT_USERAGENT$_SERVER['HTTP_USER_AGENT']);
        
curl_setopt($chCURLOPT_REFERER$referer);
        
curl_setopt($chCURLOPT_URL$url);
        
curl_setopt($chCURLOPT_POST1);
        
curl_setopt($chCURLOPT_POSTFIELDS$postFields);
        
$exec curl_exec($ch);
        
curl_close($ch);

        return 
$exec;
    }
}
Treasure.php
PHP Code:
<?php

class Treasure
{
    
/**
     *    [MENTION=881620]Var[/MENTION] string string
     */
    
private $title;

    
/**
     *    [MENTION=881620]Var[/MENTION] string string
     */
    
private $content;

    
/**
     *    [MENTION=881620]Var[/MENTION] string int
     */
    
private $cost;

    
/**
     *    [MENTION=881620]Var[/MENTION] string
     *    [MENTION=326673]return[/MENTION] string
     */
    
public function getTitle()
    {
        return 
$this->title;
    }

    
/**
     *    [MENTION=881620]Var[/MENTION] string
     */
    
public function setTitle($title)
    {
        
$this->title $title;
    }

    
/**
     *    [MENTION=881620]Var[/MENTION] string
     *    [MENTION=326673]return[/MENTION] string
     */
    
public function getContent()
    {
        return 
$this->content;
    }

    
/**
     *    [MENTION=881620]Var[/MENTION] string
     */
    
public function setContent($content)
    {
        
$this->content $content;
    }

    
/**
     *    [MENTION=881620]Var[/MENTION] int
     *    [MENTION=326673]return[/MENTION] int
     */
    
public function getCost()
    {
        return 
$this->cost;
    }

    
/**
     *    [MENTION=881620]Var[/MENTION] int
     */
    
public function setCost($cost)
    {
        
$this->cost $cost;
    }
}
Aufrufen müsst ihr das Script dann so:
PHP Code:
    $tm = new TreasureManager('Username''Passwort');

    
$treasure = new Treasure();
    
$treasure->setTitle('Titel der Treasure');
    
$treasure->setContent('Inhalt der Treasure');
    
$treasure->setCost(1);

    
$tm->createTreasure($treasure); 
#edit: Keine Ahnung warum er aus den @ [MENTION...] macht
~ JWonderpig ~ is offline  
Thanks
1 User
Old 04/06/2016, 12:58   #2



 
Serraniel's Avatar
 
elite*gold: 2222
The Black Market: 204/1/0
Join Date: May 2010
Posts: 6,846
Received Thanks: 5,099
@ Erläutere den unwissenden Nutzern bitte noch, dass und vielleicht auch wie sie die Cookie File schützen und dort ein Risiko besteht. Gab hier schonmal jemanden der sowas hier für eg verkauft hat und dazu nicht in der Lage war wodurch man sich easy in seinen Account einloggen konnte, wenn man wusste wie. Und die Kunden von ihm waren davor auch nicht geschützt da er weder drauf hingewiesen hat noch in der Lage war sein eigenes Live Bsp zu schützen.
Serraniel is offline  
Old 04/13/2016, 08:19   #3
♥ Yuuki Asuna ♥



 
DarkOPM's Avatar
 
elite*gold: 45
The Black Market: 140/0/0
Join Date: Jun 2005
Posts: 53,960
Received Thanks: 8,487
Arrow Coding Releases -> Coding Snippets

#moved…
DarkOPM is online now  
Reply


Similar Threads Similar Threads
» [NUR 30 E*GOLD] TreasureMaster - Schnell viele Treasures erstellen! «
04/30/2012 - elite*gold Trading - 44 Replies
http://dl.dropbox.com/u/37289435/treasuremaster.pn g Mit dem TreasureMaster kannst du mit sehr wenig Aufwand beliebig viele Treasures erstellen lassen. TreasureMaster ist perfekt für Leute, die oft und viel handeln, und so immer Treasures parat haben müssen. Screenshots http://dl.dropbox.com/u/37289435/tm_login.png http://dl.dropbox.com/u/37289435/tm_main.png



All times are GMT +1. The time now is 18:30.


Powered by vBulletin®
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2023 elitepvpers All Rights Reserved.