public function database() { $add = 'create table posts( id int (10) AUTO_INCREMENT, name varchar(30) NOT NULL, author varchar(15) NOT NULL, text varchar(100) NOT NULL, image varchar(100) NOT NULL, PRIMARY KEY (id));'; $const = 'create table const( id int(10) AUTO_INCREMENT, name varchar(30) NOT NULL, value varchar(30) NOT NULL, PRIMARY KEY (id))'; $log = 'create table logs_users( id_user int(21), login varchar(12) NOT NULL, password CHAR(60) NOT NULL, PRIMARY KEY (id_user));'; $con = new Connect('localhost', 'mysql', 'mysql'); $con->qur('create database proto01;'); $con->qur('use proto01;'); $con->ins($add); $con->ins($log); $con->ins($const); if ($con) { $this->res = 'installed'; } else { $this->res = 'error install'; } }
public function accept() { $add = 'INSERT INTO const(name,value)VALUES("' . $_POST['name'] . '","' . $_POST['value'] . '");'; $con = new Connect('localhost', 'mysql', 'mysql'); $con->qur('use proto01;'); $con->ins($add); header('Location: http://localhost/admin/sittings'); }