File manager - Edit - /home/wwwroot/camplus.hk/master.camplus.hk/public_html/assets/global/scripts/911347/includes.tar
Back
Core_class.php 0000775 00000002341 15060054564 0007344 0 ustar 00 <?php class Core { // Function to validate the post data function validate_post($data) { /* Validating the hostname, the database name and the username. The password is optional. */ return !empty($data['hostname']) && !empty($data['username']) && !empty($data['database']); } // Function to show an error function show_message($type,$message) { return $message; } // Function to write the config file function write_config($data) { // Config path $template_path = 'config/database.php'; $output_path = '../application/config/database.php'; // Open the file $database_file = file_get_contents($template_path); $new = str_replace("%HOSTNAME%",$data['hostname'],$database_file); $new = str_replace("%USERNAME%",$data['username'],$new); $new = str_replace("%PASSWORD%",$data['password'],$new); $new = str_replace("%DATABASE%",$data['database'],$new); // Write the new database.php file $handle = fopen($output_path,'w+'); // Chmod the file, in case the user forgot @chmod($output_path,0777); // Verify file permissions if(is_writable($output_path)) { // Write the file if(fwrite($handle,$new)) { return true; } else { return false; } } else { return false; } } } Database_class.php 0000775 00000002501 15060054564 0010156 0 ustar 00 <?php class Database { // Function to the database and tables and fill them with the default data function create_database($data) { // 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) { // Connect to the database $mysqli = new mysqli($data['hostname'],$data['username'],$data['password'],$data['database']); // Check for errors if(mysqli_connect_errno()) return false; // Open the default SQL file $query = file_get_contents('db/install.sql'); // Execute a multi query if ($mysqli->multi_query($query)) { do { /* store first result set */ if ($result = $mysqli->store_result()) { while ($row = $result->fetch_row()) { //printf("%s\n", $row[0]); } $result->free(); } /* print divider */ if ($mysqli->more_results()) { //printf("-----------------\n"); } } while ($mysqli->next_result()); } // Close the connection $mysqli->close(); return true; } }
| ver. 1.4 |
Github
|
.
| PHP 7.2.34 | Generation time: 0.19 |
proxy
|
phpinfo
|
Settings