summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Luka Šijanec <sijanecantonluka@gmail.com>2020-04-10 19:04:59 +0200
committerAnton Luka Šijanec <sijanecantonluka@gmail.com>2020-04-10 19:04:59 +0200
commitfee82f476fdf124da4d081296043af59d80bb6ad (patch)
treebb6a7f65fcd1a77ff70d0bf607bf3d80cbd831f8
parentprevzetna deklica (diff)
downloadoldredditclient-fee82f476fdf124da4d081296043af59d80bb6ad.tar
oldredditclient-fee82f476fdf124da4d081296043af59d80bb6ad.tar.gz
oldredditclient-fee82f476fdf124da4d081296043af59d80bb6ad.tar.bz2
oldredditclient-fee82f476fdf124da4d081296043af59d80bb6ad.tar.lz
oldredditclient-fee82f476fdf124da4d081296043af59d80bb6ad.tar.xz
oldredditclient-fee82f476fdf124da4d081296043af59d80bb6ad.tar.zst
oldredditclient-fee82f476fdf124da4d081296043af59d80bb6ad.zip
Diffstat (limited to '')
-rwxr-xr-xbettereveryloop.php2
-rw-r--r--main.php17
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;