Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class CMS
- {
- var $host;
- var $user;
- var $password;
- var $table;
- public function connect()
- {
- mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error());
- mysql_select_db($this->table) or die("Could not select database. " . mysql_error());
- }
- public function newnews($title, $author, $date)
- {
- $sql = <<<SQL
- "INSERT INTO `news`(`title`, `author`, `date`) VALUES ($title, $author, $date);";
- SQL;
- if(mysql_query($sql) == NULL)
- {
- echo "Is not good, sumthing went wrung!";
- } else {
- $java = "<script language='javascript'>
- alert('New news item added!');
- </script>";
- echo $java;
- }
- }
- public function newuser($username, $password, $email)
- {
- $sql = <<<SQL
- "INSERT INTO `user` (`username`, `password`, `email`) VALUES ($username, $password, $email);";
- SQL;
- if(mysql_query($sql) == NULL)
- {
- echo "Something went wrong, please contact your webmaster.";
- } else {
- $java = <<< JAVA
- "<script language='javascript'>
- alert('Succesfully registerd.');
- </script>
- JAVA;
- echo $java;
- }
- }
- }
Add Comment
Please, Sign In to add comment