Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class mysqlFN{
- /*CREATE USER 'test1'@'localhost' IDENTIFIED BY '***';
- GRANT USAGE ON * . * TO 'test1'@'localhost' IDENTIFIED BY '***' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
- CREATE DATABASE IF NOT EXISTS `test1` ;
- GRANT ALL PRIVILEGES ON `test1` . * TO 'test1'@'localhost';*/
- public $result;
- private $user = null;
- private $pass = null;
- private $database = null;
- public function __construct(){
- $this->user = mysql_real_escape_string($_POST['usermysql']);
- $this->pass = mysql_real_escape_string($_POST['passmysql']);
- $this->database = mysql_real_escape_string($_POST['database']);
- }
- public function createUser(){
- /* CREERT GEBRUIKER */
- $sql = "CREATE USER '" . $this->user . "'@'localhost' IDENTIFIED BY 'PASSWORD(" . $this->pass . ")'";
- $result = mysql_query($sql) or ($this->result = mysql_error());
- }
- public function createdb(){
- /* CREERT DB MET DE RECHTEN DAAROP */
- $sql = " GRANT USAGE ON * . * TO '" . $this->user . "'@'localhost' IDENTIFIED BY 'PASSWORD(" . $this->pass . ")' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
- CREATE DATABASE IF NOT EXISTS '".$this->database."';
- GRANT ALL PRIVILEGES ON '" . $this->database . "' . * TO '" . $this->user . "'@'localhost';';
- ";
- $result = mysql_query($sql) or ($this->result = mysql_error());
- }
- public function result(){
- print_r( $this->result );
- print_r($this->sql);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement