summaryrefslogtreecommitdiffstats
path: root/main.php
diff options
context:
space:
mode:
authorAnton L. Šijanec <anton@sijanec.eu>2020-05-06 10:22:00 +0200
committerAnton L. Šijanec <anton@sijanec.eu>2020-05-06 10:22:00 +0200
commit041247b46f831a05ec67280fe1695fb5a5644c84 (patch)
tree739e422cf029823c43981c6cfaaaf25b2c70ab33 /main.php
parentadded corinavitus counter (diff)
downloadoldredditclient-041247b46f831a05ec67280fe1695fb5a5644c84.tar
oldredditclient-041247b46f831a05ec67280fe1695fb5a5644c84.tar.gz
oldredditclient-041247b46f831a05ec67280fe1695fb5a5644c84.tar.bz2
oldredditclient-041247b46f831a05ec67280fe1695fb5a5644c84.tar.lz
oldredditclient-041247b46f831a05ec67280fe1695fb5a5644c84.tar.xz
oldredditclient-041247b46f831a05ec67280fe1695fb5a5644c84.tar.zst
oldredditclient-041247b46f831a05ec67280fe1695fb5a5644c84.zip
Diffstat (limited to '')
-rw-r--r--main.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/main.php b/main.php
index d6c5649..0b869e6 100644
--- a/main.php
+++ b/main.php
@@ -73,6 +73,7 @@ Errors:
private $cookiedir; // set at runtime, ker je get_curerent_user, v login()
private $loginurl = "https://old.reddit.com/api/login/";
private $setflairurl = "https://old.reddit.com/api/selectflair";
+ private $modflairurl = "https://old.reddit.com/api/flair";
public $modhash = "";
private $loggedin = false;
public $ch = false;
@@ -177,5 +178,26 @@ Errors:
}
return true;
}
+ public function modflair($name, $text = "Preverjen Bežigrajčan!", $css_class = "preverjen-bezigrajcan-flair", $r = "bezigrad") {
+ if(!curl_getinfo($this->ch)) {
+ if (!$this->login()) {
+ return -2;
+ }
+ }
+ $ch = $this->ch;
+ curl_setopt($ch, CURLOPT_URL, $this->modflairurl);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
+ 'X-Modhash: '.$this->modhash,
+ 'X-ContactBotDeveloper: '."sijanecantonluka@gmail.com",
+ "X-UselessBot: true"
+ ));
+ curl_setopt($ch, CURLOPT_POSTFIELDS, 'name='.$name.'&r='.$r.'&css_class='.$css_class.'&text='.$text);
+ $request_output = curl_exec($ch);
+ if(curl_getinfo($ch, CURLINFO_RESPONSE_CODE) != 200) {
+ return false;
+ }
+ return true;
+ }
}
?>