Файл: Luxe-Shop v6.0/install/includes/database_class.php
Строк: 49
<?php
class Database {
// Function to the database and tables and fill them with the default data
function create_database($data)
{
$domen = $data['hostname'];
// Connect to the database
$mysqli = new mysqli($data['hostname'],$data['username'],$data['password'],'');
// Check for errors
if(mysqli_connect_errno())
return false;
// Create the prepared statement
$mysqli->query("CREATE DATABASE IF NOT EXISTS ".$data['database']);
// Close the connection
$mysqli->close();
return true;
}
// Function to create the tables and fill them with the default data
function create_tables($data,$sub)
{
// Connect to the database
$mysqli = new mysqli($data['hostname'],$data['username'],$data['password'],$data['database']);
$email = $data['useremail'];
$pass = md5($data['userpass']);
// Check for errors
if(mysqli_connect_errno())
return false;
// Open the default SQL file
$query = file_get_contents('config/database.sql');
// Execute a multi query
$mysqli->multi_query($query);
while($mysqli->next_result()) $mysqli->store_result();
$create = "INSERT INTO `users` (`id`, `email`, `password`, `name`, `group`) VALUES (NULL, '".$email."', '".$pass."', 'admin', '1');";
$mysqli->query($create);
print_r($mysqli->error);
// Close the connection
$mysqli->close();
return true;
}
}