Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class mysql{
- public $ID;
- private $website_ID;
- private $host;
- private $user;
- private $password;
- private $database;
- public function __construct($ID=0){
- if ($ID){
- $ID=(int)$this->ID;
- $website_ID=(int)get_X("mysql","ID",$ID,"website_ID");
- $host=htmlentities(get_X("mysql","ID",$ID,"host"));
- $user=htmlentities(get_X("mysql","ID",$ID,"user"));
- $password=htmlentities(get_X("mysql","ID",$ID,"password"));
- $database=htmlentities(get_X("mysql","ID",$ID,"database"));
- }
- }
- //add: new, edit and delete mysql
- public function generate_code(){
- if ($this->ID){
- $code = "<?php\n";
- $code .= "/* WebCMS.code.database.start */\n";
- $code .= "//database connect code\n";
- $code .= "mysql_connect(".$this->host.", ".$this->user.", ".$this->password, ");\n";
- $code .= "mysql_select_db(".$this->database.");\n";
- $code .= "//generated by WebCMS at ". date(time()); //fix date format;
- $code .= "/* WebCMS.code.database.end */\n";
- $code .= "?>";
- }
- }
- public function export_xml(){
- if ($this->ID){
- $xml = "<mysql>\n";
- $xml = "\t<host>".$this->host."</host>\n";
- $xml = "\t<user>".$this->user."</user>\n";
- $xml = "\t<password>".$this->password."</password>\n";
- $xml = "\t<database>".$this->database."</database>\n";
- $xml .= "</mysql>\n";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement