Simple Twister bot written in PHP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
600 B

<?php
class HabrRSSDb
{
protected $hDatabase = null;
public function __construct($dbFile)
{
fclose(fopen($dbFile, 'a')); // create file if not exists
$this->hDatabase = fopen($dbFile, 'r+');
}
public function __destruct()
{
fclose($this->hDatabase);
}
public function isPublished($id)
{
fseek($this->hDatabase, $id);
$status = fgetc($this->hDatabase);
return $status === '1';
}
public function setPublished($id)
{
fseek($this->hDatabase, $id);
fwrite($this->hDatabase, '1');
}
}