From b4eb610a58e903bb62abe58e5372c6f1ebe9300f Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Mon, 21 Dec 2020 17:01:30 +0700 Subject: [PATCH 1/4] ganti ke url --- index.php | 33 ++++++++++++++++++--------- t_games.sql | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tabel.sql | 45 ------------------------------------ 3 files changed, 88 insertions(+), 56 deletions(-) create mode 100644 t_games.sql delete mode 100644 tabel.sql diff --git a/index.php b/index.php index 7d642a6..1931d9a 100644 --- a/index.php +++ b/index.php @@ -35,27 +35,38 @@ readfile($cacheFile ); }else{ $json = array(); - $games = $db->select('t_games',['id', 'title','titleid', 'fileSize'],['folder'=>$folder,'ORDER'=>['title'=>'ASC']]); + $games = $db->select('t_games',['url', 'filename','titleid', 'fileSize'],['AND'=>['folder'=>$folder,'shared'=>1],'ORDER'=>['title'=>'ASC']]); foreach($games as $game){ - if(!empty($game['title']) && !empty($game['titleid'])){ - if($game['fileSize']>0){ - $json[] = [ - 'url'=>'https://docs.google.com/uc?export=download&id='.$game['id'].'#'.urlencode(str_replace('#','',$game['title'])), - 'size'=>$game['fileSize'] - ]; + if(!empty($game['filename']) && !empty($game['titleid'])){ + if(substr($game['url'],0,4)=='http'){ + if($game['fileSize']>0){ + $json[] = [ + 'url'=>$game['url'].'#'.urlencode(str_replace('#','',$game['filename'])), + 'size'=>$game['fileSize'] + ]; + }else{ + $json[] = $game['url'].'#'.urlencode(str_replace('#','',$game['filename'])); + } }else{ - $json[] = 'https://docs.google.com/uc?export=download&id='.$game['id'].'#'.urlencode(str_replace('#','',$game['title'])); + if($game['fileSize']>0){ + $json[] = [ + 'url'=>'https://docs.google.com/uc?export=download&id='.$game['url'].'#'.urlencode(str_replace('#','',$game['filename'])), + 'size'=>$game['fileSize'] + ]; + }else{ + $json[] = 'https://docs.google.com/uc?export=download&id='.$game['url'].'#'.urlencode(str_replace('#','',$game['filename'])); + } } } } - file_put_contents($cacheFile ,json_encode(['files'=>$json])); - echo json_encode(['files'=>$json]); + file_put_contents($cacheFile ,json_encode(['total'=>count($json),'files'=>$json])); + echo json_encode(['total'=>count($json),'files'=>$json]); } die(); } } -$folders = $db->select('t_games', ['folder'=>Medoo::raw('DISTINCT folder')], $where); +$folders = $db->select('t_games', ['folder'=>Medoo::raw('DISTINCT folder')]); $json = [ 'success' => 'Pakai Seperlunya, Download hanya yang mau dimainkan, agar tidak cepat kena limit. punya google drive mau dishare juga? mention @ibnux | Donasi Biaya Server trakteer.id/ibnux karyakarsa.com/ibnux' ]; diff --git a/t_games.sql b/t_games.sql new file mode 100644 index 0000000..8243c47 --- /dev/null +++ b/t_games.sql @@ -0,0 +1,66 @@ +-- phpMyAdmin SQL Dump +-- version 4.9.5 +-- https://www.phpmyadmin.net/ +-- +-- Host: localhost +-- Generation Time: Dec 21, 2020 at 10:00 AM +-- Server version: 8.0.13 +-- PHP Version: 7.4.10 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET AUTOCOMMIT = 0; +START TRANSACTION; +SET time_zone = "+00:00"; + +-- +-- Database: `nintendo` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `t_games` +-- + +CREATE TABLE `t_games` ( + `nomor` int(11) NOT NULL, + `url` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', + `filename` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `title` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `titleid` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `fileSize` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0', + `md5Checksum` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `folder` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `root` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `owner` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '', + `shared` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1 shared' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +-- +-- Dumping data for table `t_games` +-- + +INSERT INTO `t_games` (`nomor`, `url`, `filename`, `title`, `titleid`, `fileSize`, `md5Checksum`, `folder`, `root`, `owner`, `shared`) VALUES +(1, '1Ywmnyna6yeZE8pyp9S27v9ygO0A2Uvz5', 'Youtubers Life OMG Edition[01002C9005F36000][US][v0].nsz', 'Youtubers Life OMG Edition', '01002C9005F36000', '665796945', '60710e3ecd4683fcfa7742e50785283b', 'nsz', ' ', ' ', 1); + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `t_games` +-- +ALTER TABLE `t_games` + ADD PRIMARY KEY (`nomor`), + ADD UNIQUE KEY `id` (`url`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `t_games` +-- +ALTER TABLE `t_games` + MODIFY `nomor` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; +COMMIT; diff --git a/tabel.sql b/tabel.sql deleted file mode 100644 index 67669e6..0000000 --- a/tabel.sql +++ /dev/null @@ -1,45 +0,0 @@ - --- --- Table structure for table `t_games` --- - -CREATE TABLE `t_games` ( - `nomor` int(11) NOT NULL, - `id` varchar(128) COLLATE utf8mb4_general_ci NOT NULL, - `title` varchar(256) COLLATE utf8mb4_general_ci NOT NULL, - `titleid` varchar(16) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', - `fileSize` varchar(128) COLLATE utf8mb4_general_ci NOT NULL, - `md5Checksum` varchar(64) COLLATE utf8mb4_general_ci NOT NULL, - `folder` varchar(32) COLLATE utf8mb4_general_ci NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - --- --- Dumping data for table `t_games` --- - -INSERT INTO `t_games` (`nomor`, `id`, `title`, `titleid`, `fileSize`, `md5Checksum`, `folder`) VALUES -(1, '1mqUb2nXyLeGJVe7Ob8kXCiF7RS2i6rki', 'YouTube[01003A400C3DA000][US][v0].nsz', '01003A400C3DA000', '53830921', '6a831a77849b069d66767f115f52b62f', 'nsz'), -(2, '1QUjapxmgWvIWBBHGCYDt0oExGBkx1zXK', 'YouTube[01003A400C3DA800][US][v131072].nsz', '01003A400C3DA800', '25473613', '1606c9ffddb50b2bbf39dddb3d279cc3', 'updates'), -(3, '13dCzkukasg7i1Tcpl4drDHF1i0DO9j_I', 'YouTubers Life OMG! [Europe] [En,De,Fr,Es,It,Pt,Ru] [0100A7700CAA4000].xci', '0100A7700CAA4000', '2223010304', '9de62f646b72528aadeb7a1c074ff083', 'xci'); - --- --- Indexes for dumped tables --- - --- --- Indexes for table `t_games` --- -ALTER TABLE `t_games` - ADD PRIMARY KEY (`nomor`), - ADD UNIQUE KEY `id` (`id`); - --- --- AUTO_INCREMENT for dumped tables --- - --- --- AUTO_INCREMENT for table `t_games` --- -ALTER TABLE `t_games` - MODIFY `nomor` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -COMMIT; \ No newline at end of file From 94bf2ba470d50edf59701550bd9290f9dcfdbdd2 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Mon, 21 Dec 2020 17:16:45 +0700 Subject: [PATCH 2/4] intval size --- index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 1931d9a..5a10201 100644 --- a/index.php +++ b/index.php @@ -42,7 +42,7 @@ if($game['fileSize']>0){ $json[] = [ 'url'=>$game['url'].'#'.urlencode(str_replace('#','',$game['filename'])), - 'size'=>$game['fileSize'] + 'size'=>intval($game['fileSize']) ]; }else{ $json[] = $game['url'].'#'.urlencode(str_replace('#','',$game['filename'])); @@ -51,7 +51,7 @@ if($game['fileSize']>0){ $json[] = [ 'url'=>'https://docs.google.com/uc?export=download&id='.$game['url'].'#'.urlencode(str_replace('#','',$game['filename'])), - 'size'=>$game['fileSize'] + 'size'=>intval($game['fileSize']) ]; }else{ $json[] = 'https://docs.google.com/uc?export=download&id='.$game['url'].'#'.urlencode(str_replace('#','',$game['filename'])); From 1d7b6320b7b261bd62922c0a0108b3ed965c2dae Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Mon, 21 Dec 2020 17:23:06 +0700 Subject: [PATCH 3/4] tanpa urlencode --- index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index 5a10201..6683a68 100644 --- a/index.php +++ b/index.php @@ -41,20 +41,20 @@ if(substr($game['url'],0,4)=='http'){ if($game['fileSize']>0){ $json[] = [ - 'url'=>$game['url'].'#'.urlencode(str_replace('#','',$game['filename'])), + 'url'=>$game['url'].'#'.(str_replace('#','',$game['filename'])), 'size'=>intval($game['fileSize']) ]; }else{ - $json[] = $game['url'].'#'.urlencode(str_replace('#','',$game['filename'])); + $json[] = $game['url'].'#'.(str_replace('#','',$game['filename'])); } }else{ if($game['fileSize']>0){ $json[] = [ - 'url'=>'https://docs.google.com/uc?export=download&id='.$game['url'].'#'.urlencode(str_replace('#','',$game['filename'])), + 'url'=>'https://docs.google.com/uc?export=download&id='.$game['url'].'#'.(str_replace('#','',$game['filename'])), 'size'=>intval($game['fileSize']) ]; }else{ - $json[] = 'https://docs.google.com/uc?export=download&id='.$game['url'].'#'.urlencode(str_replace('#','',$game['filename'])); + $json[] = 'https://docs.google.com/uc?export=download&id='.$game['url'].'#'.(str_replace('#','',$game['filename'])); } } } From 75d075bc2ccc46c4d151edb58b870ac72804f6c1 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Mon, 21 Dec 2020 17:24:18 +0700 Subject: [PATCH 4/4] urlencode --- index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index 6683a68..5a10201 100644 --- a/index.php +++ b/index.php @@ -41,20 +41,20 @@ if(substr($game['url'],0,4)=='http'){ if($game['fileSize']>0){ $json[] = [ - 'url'=>$game['url'].'#'.(str_replace('#','',$game['filename'])), + 'url'=>$game['url'].'#'.urlencode(str_replace('#','',$game['filename'])), 'size'=>intval($game['fileSize']) ]; }else{ - $json[] = $game['url'].'#'.(str_replace('#','',$game['filename'])); + $json[] = $game['url'].'#'.urlencode(str_replace('#','',$game['filename'])); } }else{ if($game['fileSize']>0){ $json[] = [ - 'url'=>'https://docs.google.com/uc?export=download&id='.$game['url'].'#'.(str_replace('#','',$game['filename'])), + 'url'=>'https://docs.google.com/uc?export=download&id='.$game['url'].'#'.urlencode(str_replace('#','',$game['filename'])), 'size'=>intval($game['fileSize']) ]; }else{ - $json[] = 'https://docs.google.com/uc?export=download&id='.$game['url'].'#'.(str_replace('#','',$game['filename'])); + $json[] = 'https://docs.google.com/uc?export=download&id='.$game['url'].'#'.urlencode(str_replace('#','',$game['filename'])); } } }