kod źródłowy:
<?php // Biblioteka news słurząca do -> utworzenia tabeli, -> zapisu, edycji, -> modyfikacji i usówania newsów // CreaWeb, Marcin Lenkowski wszelkie prawa zastrzeżone (c) 2008 // Data stwożenia biblioteki 2008-03-08. Dokumentacja nie została jeszcze napisana // Aby klasa poprawnie działała należy najpierw połączyć się z serwerem bazy danych # Zabezpieczenie przed bezpośredmim dostępem do pliku class News { function install() { $install = "CREATE TABLE IF NOT EXISTS `news` ( id int AUTO_INCREMENT NOT NULL, title char(255) NOT NULL, name char(255) NULL, section int NULL, category int NULL, description text NULL, content text NOT NULL, tags char(255) NOT NULL, visible_for char(255) NULL, date_writing datetime NOT NULL, author int NOT NULL, date_mod datetime NULL, last_mod_by int NULL, mod_quantum int NULL, date_publisching int NOT NULL, PRIMARY KEY (id) )"; } } function add_new($title, $name, $section, $category, $description, $content, $tags, $visible_for, $date_writing, $author, $date_publisching, $image) { $this->install(); if ($this->news_exists($title, $name, $section, $category, $description, $content, $tags, $visible_for, $author, $date_publisching, $image)) { $add_new = "INSERT INTO `news` ( `id`, `title`, `name`, `section`, `category`, `description`, `content`, `tags`, `visible_for`, `date_writing`, `author`, `date_publisching` ) VALUES ( '', '".$title."', '".$name."', '".$section."', '".$category."', '".$description."', '".$content."', '".$tags."', '".$visible_for."', '".$date_writing."', '".$author."', '".$date_publisching."')"; } else { } } else { } } function edit($where, $title, $name, $section, $category, $description, $content, $tags, $visible_for, $date_writing, $author, $date_publisching, $image) { $edit = "UPDATE `news` SET `title`='".$title."', `name`='".$name."', `section`='".$section."', `category`='".$category."', `description`='".$description."', `content`='".$content."', `tags`='".$tags."', `visible_for`='".$visible_for."', `author` = '".$author."', `date_publisching` = '".$date_publisching."' WHERE ".$where.""; } else { } } private function news_exists($title, $name, $section, $category, $description, $content, $tags, $visible_for, $author, $date_publisching, $image) { $exists = mysql_query("SELECT `id` FROM `news` WHERE `title`='".$title."' AND `name`='".$name."' AND `section`='".$section."' AND `category`='".$category."' AND `description`='".$description."' AND `content`='".$content."' AND `tags`='".$tags."' AND `visible_for`='".$visible_for."' AND `author` = '".$author."' AND `date_publisching` = '".$date_publisching."' LIMIT 1"); return FALSE; } else { return TRUE; } } } ?>
Dodam że na moim serwie jest wszystko ok, ale na yoyo już nie.