All pastes #330707 Raw Edit

Miscellany

public php v1 · immutable
#330707 ·published 2007-01-28 04:51 UTC
rendered paste body
<?phpdefine('HEADER', 'header.php');define('FOOTER', 'footer.php');define('TABLE', 'stories');define('IDIS', 'id');define('TITLEIS', 'title');class statify {	public $error=array();	private $id;	private $title;	private $code;	private $file;	private $folder;	private $body;	private $date;	private $query;	function __construct() {		$this->date = time();	}	function set($id,$subject='story') {		$this->query = mysql_query("SELECT ".TITLEIS." FROM ".TABLE." WHERE ".IDIS." = $id LIMIT 1");		if (mysql_num_rows($this->query) != 1) {			$this->error="No such story ID found.";			return 0;		} else {			$this->id = $id;			$this->folder = $subject;			$this->title = mysql_result($this->query,0);			statify::makeFileName();			return 1;		}	}	function makeFileName() {		$this->file = $this->title;		$this->file = str_replace(' ','_',$this->file);		$this->file = str_replace('.','',$this->file);		$this->file = str_replace('"','\'',$this->file);	}