Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost"; //Add your SQL Server host here
- $user = "root"; //SQL Username
- $pass = @file_get_contents('/home/pi/.mysql_passwd'); //SQL Password
- $dbname = "bezoekers_imanuel"; //SQL Database Name
- $con = mysqli_connect($host,$user,$pass,$dbname);
- if (mysqli_connect_errno($con)) {
- echo "Error: " . mysqli_connect_error();
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Builder (auto-launcher)</title>
- <script>
- refresher = window.setTimeout(function() {
- window.location.reload();
- },10000);
- </script>
- <style>
- @import 'https://fonts.googleapis.com/css?family=Open+Sans';
- body {
- font-family: Open Sans;
- }
- td {
- padding: .3em;
- }
- a {
- text-decoration: none;
- }
- a:hover, a:active, a:focus {
- text-decoration: underline;
- }
- </style>
- </head>
- <body>
- <table style="width: 50%; min-width: 700px; margin: 0 auto;">
- <col width="30%" />
- <?php
- $files = array();
- if ($handle = opendir('build')) {
- while (false !== ($file = readdir($handle))) {
- if ($file != "." && $file != "..") {
- $files[filemtime('build/'.$file)] = $file;
- }
- }
- closedir($handle);
- // sort
- ksort($files);
- // find the last modification
- $reallyLastModified = end($files);
- $fileTypes = array('.apk','.exe','.zip');
- $fileTypesDefault = true;
- if (isset($_GET['apk'])) {
- if ($fileTypesDefault) {
- $fileTypes = array();
- }
- $fileTypes[] = '.apk';
- $fileTypesDefault = false;
- }
- if (isset($_GET['exe'])) {
- if ($fileTypesDefault) {
- $fileTypes = array();
- }
- $fileTypes[] = '.apk';
- $fileTypesDefault = false;
- }
- if (isset($_GET['zip'])) {
- if ($fileTypesDefault) {
- $fileTypes = array();
- }
- $fileTypes[] = '.apk';
- $fileTypesDefault = false;
- }
- if (isset($_GET['gmz'])) {
- if ($fileTypesDefault) {
- $fileTypes = array();
- }
- $fileTypes[] = '.gmz';
- $fileTypesDefault = false;
- }
- foreach($files as $file) {
- $lastModified = date('d F Y, H:i:s',filemtime('build/'.$file));
- $mtime = date("Y-m-d H:i:s",filemtime('build/'.$file));
- if (in_array(substr($file,-4,4),$fileTypes)&&(isset($_GET['debug'])||!stristr($file,'debug'))) {
- if ($file == $reallyLastModified) {
- $style = 'background-color: rgba(128,128,128,.2)';
- $sha1 = mysqli_escape_string($con,sha1('build/'.$file));
- $file_sql = mysqli_escape_string($con,$file);
- $ip = mysqli_escape_string($con,$_SERVER['REMOTE_ADDR']);
- $result = mysqli_query($con,"SELECT * FROM builder WHERE mtime = '$mtime' AND filename = '$file_sql' AND ip = '$ip'");
- if (mysqli_num_rows($result)) {
- echo "<tr style=\"background-color: rgba(255,0,0,.2)\"><!--<td><input type=\"checkbox\" name=\"box[]\"></td>--><td><a href=\"build/$file\" target=\"_blank\">$file</a></td><td>$lastModified</td></tr>\r\n";
- continue;
- } else {
- $result = mysqli_query($con,"INSERT INTO builder (mtime,filename,ip) VALUES ('$mtime','$file_sql','$ip')");
- ?>
- <script>
- window.setTimeout(function() {
- window.location.replace('http://imanuelhab.mooo.com/<?php echo 'build/'.$file; ?>');
- window.clearTimeout(refresher);
- },5000);
- </script>
- <?php
- echo "<audio src=\"sounds/VANESSA.wav\" autoplay=\"\">Your browser does not support the <code>audio</code> element.</audio>\r\n";
- }
- } else {
- $style = '';
- }
- echo "<tr style=\"$style\"><!--<td><input type=\"checkbox\" name=\"box[]\"></td>--><td><a href=\"build/$file\" target=\"_blank\">$file</a></td><td>$lastModified</td></tr>\r\n";
- }
- }
- }
- ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement