Skip to content

Commit

Permalink
Merge pull request #1 from ibnux/development
Browse files Browse the repository at this point in the history
fix size and change structure tabel
  • Loading branch information
ibnux authored Dec 21, 2020
2 parents 564264d + 75d075b commit bf46021
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 56 deletions.
33 changes: 22 additions & 11 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'=>intval($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'=>intval($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'
];
Expand Down
66 changes: 66 additions & 0 deletions t_games.sql
Original file line number Diff line number Diff line change
@@ -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;
45 changes: 0 additions & 45 deletions tabel.sql

This file was deleted.

0 comments on commit bf46021

Please sign in to comment.