| Server IP : 216.106.184.20 / Your IP : 216.73.216.234 Web Server : LiteSpeed System : Linux asmodeus.in-hell.com 5.14.0-570.58.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 29 06:24:11 EDT 2025 x86_64 User : sekoaid1 ( 1891) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/sekoaid1/spp.raudhatulfalah.sch.id/mts/admin/ |
Upload File : |
<section class="content-header">
<small>
<h1>Restore Database</h1>
</small>
<ol class="breadcrumb">
<li><a href="index.php"><i class="fa fa-dashboard"></i>Dashboard</a></li>
<li class="active">Restore Database</li>
</ol>
</section>
<section class="content">
<div class="col-xs-12">
<div class="box box-info box-solid">
<div class="box-header with-border">
<h3 class="box-title"> </h3>
<form enctype="multipart/form-data" method="post" class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label">File Database (*.sql)</label>
<div class="col-sm-7">
<input type="text" name="nip" class="form-control" maxlength="16">
<input type="file" name="datafile" size="20" />
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-5">
<button type="submit" name="restore" class="btn btn-danger">Restore Database</button>
</div>
</div>
</form>
<P>Abaikan Pesan Error Di Bawah Proses Restore Anda Tetap Berhasil :) </p>
<?php
if (isset($_POST['restore'])) {
$koneksi = mysql_connect("localhost", "root", "");
mysql_select_db("spp", $koneksi);
$nama_file = $_FILES['datafile']['name'];
$ukuran = $_FILES['datafile']['size'];
if ($nama_file == "") {
echo "Fatal Error";
} else {
//definisikan variabel file dan alamat file
$uploaddir = './application/';
$alamatfile = $uploaddir . $nama_file;
if (move_uploaded_file($_FILES['datafile']['tmp_name'], $alamatfile)) {
$filename = './application/' . $nama_file . '';
$templine = '';
$lines = file($filename);
foreach ($lines as $line) {
if (substr($line, 0, 2) == '--' || $line == '')
continue;
$templine .= $line;
if (substr(trim($line), -1, 1) == ';') {
mysql_query($templine) or print('Error performing query \'<strong>' . $templine . '\': ' . mysql_error() . '<br /><br />');
$templine = '';
}
}
echo "<center>Restore Database Telah Berhasil, Silahkan dicek !</center>";
} else {
echo "Restore Database Gagal, kode error = " . $_FILES['location']['error'];
}
}
} else {
unset($_POST['restore']);
}
?>
</div>
</div>
</div>
</div>
</div>
</section>