From fee82f476fdf124da4d081296043af59d80bb6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Fri, 10 Apr 2020 19:04:59 +0200 Subject: dodatek --- bettereveryloop.php | 2 +- main.php | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/bettereveryloop.php b/bettereveryloop.php index d3715f1..067a549 100755 --- a/bettereveryloop.php +++ b/bettereveryloop.php @@ -9,7 +9,7 @@ $o-> setpassword ($argv[2] ); while (1 ){ $o-> setflair ($argv[3] ); - sleep (3 ); + sleep (5 ); } // reddit is max 30 requests per minute tho ?> diff --git a/main.php b/main.php index fe160ef..4a6f1b4 100644 --- a/main.php +++ b/main.php @@ -67,7 +67,7 @@ Errors: class oldredditClient { private $username; private $password; - public $version = array(0, 0, 0); + public $version = array(0, 0, 1); private $programname = "oldredditclient"; private $programdomain = 'oldredditclient.sijanec.eu'; private $cookiedir; // set at runtime, ker je get_curerent_user, v login() @@ -128,7 +128,7 @@ Errors: $this->ch = $ch; return true; } - public function setflair($sub = "Slovenia", $flair = null, $magic = "bc411828-bfa2-11e5-ba67-0e414077483d") { + public function setflair($sub = "Slovenia", $flair = null, $magic = null, $post = false) { if(!curl_getinfo($this->ch)) { if (!$this->login()) { return -2; @@ -139,6 +139,13 @@ Errors: $dnevi = array("drekek", "ponedeljek", "torek", "sreda", "cetrtek", "petek", "sobota", "nedelja"); $flair = $dnevi[date("N")].", ".date("j.n.Y H:i:s"); } + if($magic == null) { + if($post) { + $magic = "8eff03aa-f62b-11e6-86f4-0e0e0c95c44a"; + } else { + $magic = "bc411828-bfa2-11e5-ba67-0e414077483d"; + } + } curl_setopt($ch, CURLOPT_URL, $this->setflairurl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array( @@ -146,7 +153,11 @@ Errors: 'X-ContactBotDeveloper: '."sijanecantonluka@gmail.com", "X-UselessBot: true" )); - curl_setopt($ch, CURLOPT_POSTFIELDS, 'flair=login-main&name='.$this->username.'&r='.$sub.'&flair_template_id='.$magic.'&text='.$flair); + if($post) { + curl_setopt($ch, CURLOPT_POSTFIELDS, 'link='.$post.'&r='.$sub.'&flair_template_id='.$magic.'&text='.$flair); + } else { + curl_setopt($ch, CURLOPT_POSTFIELDS, 'name='.$this->username.'&r='.$sub.'&flair_template_id='.$magic.'&text='.$flair); + } $request_output = curl_exec($ch); if(curl_getinfo($ch, CURLINFO_RESPONSE_CODE) != 200) { return false; -- cgit v1.2.3