Guest User

Untitled

a guest
Jan 23rd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. <?php
  2.  
  3. class CMS
  4. {
  5.  
  6.     var $host;
  7.     var $user;
  8.     var $password;
  9.     var $table;
  10.    
  11.     public function connect()
  12.     {
  13.         mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error());
  14.         mysql_select_db($this->table) or die("Could not select database. " . mysql_error());
  15.     }
  16.    
  17.     public function newnews($title, $author, $date)
  18.     {
  19.         $sql = <<<SQL
  20.         "INSERT INTO `news`(`title`, `author`, `date`) VALUES ($title, $author, $date);";
  21. SQL;
  22.         if(mysql_query($sql) == NULL)
  23.         {
  24.             echo "Is not good, sumthing went wrung!";
  25.         } else {
  26.             $java = "<script language='javascript'>
  27.             alert('New news item added!');
  28.             </script>";
  29.             echo $java;
  30.         }
  31.     }
  32.    
  33.     public function newuser($username, $password, $email)
  34.     {
  35.         $sql = <<<SQL
  36.         "INSERT INTO `user` (`username`, `password`, `email`) VALUES ($username, $password, $email);";
  37. SQL;
  38.         if(mysql_query($sql) == NULL)
  39.         {
  40.             echo "Something went wrong, please contact your webmaster.";
  41.         } else {
  42.             $java = <<< JAVA
  43.             "<script language='javascript'>
  44.             alert('Succesfully registerd.');
  45.             </script>
  46. JAVA;
  47.             echo $java;
  48.         }
  49.     }
  50. }
Add Comment
Please, Sign In to add comment