Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include dirname(__FILE__).'/../../vendor/autoload.php';
- // API USAGE | POST GET ALLOWED
- // add-profile.php?url=https://www.instagram.com/evieeffendie/&jumlah=100
- class AddProfile
- {
- protected $url;
- protected $jumlah;
- public function __construct($url, $jumlah)
- {
- $this->expired = date("Y-F-d", strtotime("+30 days"));
- $this->url = $url;
- $this->jumlah = $jumlah;
- $this->profileFileLocation = dirname(__FILE__).'/../Profile.txt';
- $this->history = dirname(__FILE__).'/../History.txt';
- }
- public function run()
- {
- // empty check
- if (empty($this->url) || empty($this->jumlah)) {
- return false;
- }
- $profileArray = explode("\n", file_get_contents($this->profileFileLocation));
- $profileArray[] = $this->url.'|'.$this->jumlah;
- $profileArray = array_filter($profileArray);
- return file_put_contents($this->profileFileLocation, implode("\n", array_unique($profileArray)));
- }
- public function history()
- {
- $historyArray = explode("\n", file_get_contents($this->history));
- $historyArray[] = $this->url.' - '.$this->expired;
- $historyArray = array_filter($historyArray);
- return file_put_contents($this->history, implode("\n", array_unique($historyArray)));
- }
- }
- $api = new AddProfile($_REQUEST['url'], $_REQUEST['jumlah']);
- $api->run();
- $api->history();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement