Browse Source

Add Get from History on page ID 4
add direct link vers share.ewft.org/mel
add IP filtering
add stuff to show desc

git-svn-id: svn://svn.ewft.org/giwyt_web/trunk/Giwyt@7 55ef4c61-40bf-456b-a624-22b955e865a6

Benjamin 7 years ago
parent
commit
ca6ec8e40b

BIN
down.png


+ 35 - 3
episode_desc.php

@@ -9,14 +9,46 @@
 <section>
     
     <?php
-        $reponse = $bdd->query('SELECT * FROM shows,episode,torrent_data WHERE `episode`.`id`='.$_GET['epi_id'].' AND `episode`.`shows_id`=`shows`.`id` AND `episode`.`id`=`torrent_data`.`episode_id`' );
-        $donnees = $reponse->fetch()
+        $reponse = $bdd->query('SELECT * FROM TVS_shows,TVS_episode,torrent_data WHERE `TVS_episode`.`id`='.$_GET['epi_id'].' AND `TVS_episode`.`shows_id`=`TVS_shows`.`id` AND `TVS_episode`.`id`=`torrent_data`.`episode_id`' );
+        $donnees = $reponse->fetch();
+      $tordata = $bdd->query('SELECT * FROM  `torrent_data` WHERE  `res`<>\'SD\' AND `episode_id` =' . $_GET['epi_id']);
     ?>
     <h2><?php echo $donnees['Name']; ?>             Season <?php echo $donnees['season_num']; ?> - Episode <?php echo $donnees['episode_num']; ?></h2>
-    <div id="show_banner">
+    <div class="show_banner">
         <img alt="<?php echo $donnees['Name']; ?>" src="<?php cache_image("http://thetvdb.com/banners/graphical/" . $donnees['tvdbid'] . "-g" . $donnees['TVDB_banner_id'] . ".jpg"); ?>" /> 
     <?php
         
     ?>
+       
+    </div>
+    <div class="list_tor">
+    <ul>
+     <?php
+                while ($tordatarow = $tordata->fetch()) {
+            ?>
+        <li>
+                <div><img src='<?php echo $tordatarow['res']; ?>.png' height='60px' /></div>
+                <div><progress value="<?php echo $tordatarow['percent']; ?>" max="100" ></progress></div> 
+                <div><?php echo $tordatarow['timeadded']; ?></div>
+                <div><?php echo $tordatarow['state']; ?></div>
+                <div><?php echo $tordatarow['hash']; ?></div>
+                <div><a href="<?php echo $tordatarow['magnet']; ?>" ><img src='magnet.png' height='60px' /></a></div>
+                <?php 
+                if($tordatarow['modif_hash']==""){
+                    ?>
+                     <div></div>
+                     <?php
+                }  else {
+                    ?>
+                     <div><a href="http://share.ewft.org/mel/<?php echo $tordatarow['modif_hash']; ?>" ><img src='down.png' height='60px' /></a></div>
+                <?php
+                     }
+                ?>
+               
+        </li>
+            <?php
+                }
+            ?>
+    </ul>
     </div>
 </section>

+ 50 - 1
index.php

@@ -10,6 +10,33 @@ try {
 }
 
 include_once 'header.php';
+/* Verify IP */
+
+
+$seluser = $bdd->query('SELECT * FROM users ');
+while($userdata = $seluser->fetch()){
+    if($userdata["ip"]==$_SERVER["REMOTE_ADDR"]){
+        break;
+    }
+}
+if($userdata["ip"]!=$_SERVER["REMOTE_ADDR"]){
+
+    
+    
+
+?>
+<section>
+    
+    <h2>
+        <?php echo $_SERVER["REMOTE_ADDR"]; ?> : Adresse IP Inconnue ! Demandez l'ajout à vous savez qui ;) 
+    </h2>
+    
+</section>
+    
+<?php
+    
+}  else {
+    
 
 
 if (isset($_GET['page_id'])) {
@@ -23,6 +50,12 @@ if (isset($_GET['page_id'])) {
         case 2:
             include_once 'episode_desc.php';
             break;
+         case 3:
+            include_once 'user.php';
+            break;
+         case 4:
+            include_once 'manually_add.php';
+            break;
         default:
             break;
     }
@@ -31,11 +64,27 @@ if (isset($_GET['page_id'])) {
 }
 //
 
-
+}
 $reponse->closeCursor(); // Termine le traitement de la requête
 ?>
 
 </div>
+<!-- Piwik -->
+<script type="text/javascript">
+  var _paq = _paq || [];
+  _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
+  _paq.push(["trackPageView"]);
+  _paq.push(["enableLinkTracking"]);
+
+  (function() {
+    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://ks367658.kimsufi.com/piwik/";
+    _paq.push(["setTrackerUrl", u+"piwik.php"]);
+    _paq.push(["setSiteId", "9"]);
+    var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
+    g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
+  })();
+</script>
+<!-- End Piwik Code -->
 </body>
 
 

+ 101 - 0
index.php.v3.php

@@ -0,0 +1,101 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>God Is Watching YOUr Torrents</title>
+<link rel="stylesheet" type="text/css" href="style.css" />
+</head>
+<?php
+try
+{
+	// On se connecte à MySQL
+	$bdd = new PDO('mysql:host=localhost;dbname=tv_shows', 'tv_shows', 'YfAUKKGwv8dm8NXV');
+}
+catch(Exception $e)
+{
+	// En cas d'erreur, on affiche un message et on arrête tout
+        die('Erreur : '.$e->getMessage());
+}
+ 
+// Si tout va bien, on peut continuer
+
+// On récupère tout le contenu de la table jeux_video
+$reponse = $bdd->query('SELECT * FROM shows');
+
+
+echo '<table id="gradient-style" >';
+echo '<tbody>';
+
+?>
+
+<thead> <!-- En-tête du tableau -->
+       <tr>
+          <th scope="col" width=40%>Nom</th>
+	 <th scope="col" width=10%>id episode</th>
+	<th scope="col" width=15%>Saison</th>
+	<th scope="col" width=15%>Episode</th>
+	 <th scope="col" width=10%>Quality</th>
+        <th scope="col" width=10%>Progress</th>
+      </tr>
+   </thead>
+
+<?php
+
+// On affiche chaque entrée une à une
+while ($donnees = $reponse->fetch())
+{
+$repepisode = $bdd->query('SELECT * FROM episode WHERE shows_id=\''. $donnees['ID'].'\'');
+$first = true;
+
+
+while ($donepi = $repepisode->fetch())
+{
+$tordata = $bdd->query('SELECT * FROM  `torrent_data` WHERE  `episode_id` ='.$donepi['id']);
+$joinres = $bdd->query('SELECT * FROM  `episode` ,  `torrent_data` WHERE  `episode`.`id` =  `torrent_data`.`episode_id` AND  `episode`.`shows_id` = '.$donnees['ID']);
+
+$first2=true;
+if($first){
+$first=false;
+?>
+
+        <tr onclick="document.getElementById('Shows_<?php echo $donnees['ID']; ?>_').style.display='none'">
+                <td rowspan='<?php echo $joinres->rowCount(); ?>' ><img height='100px' src='http://thetvdb.com/banners/graphical/<?php echo $donnees['tvdbid']; ?>-g<?php echo $donnees['TVDB_banner_id']; ?>.jpg'/> </td>
+<?php
+
+}else{
+echo '<tr>';
+}
+
+?>
+
+		<td  rowspan='<?php echo $tordata->rowCount(); ?>' > <?php echo $donepi['id']; ?></td>
+		<td  rowspan='<?php echo $tordata->rowCount(); ?>' ><?php echo $donepi['season_num']; ?></td>
+		<td  rowspan='<?php echo $tordata->rowCount(); ?>'><?php echo $donepi['episode_num']; ?> </td>
+<?php
+while ($tordatarow = $tordata->fetch())
+{
+if($first2){
+$first2=false;
+echo 'plop';
+}else{
+echo '<tr>';
+}
+
+?>
+
+
+		<td><img src='<?php echo $tordatarow['res']; ?>.png' height='40px' /></td>
+                <td><progress value="<?php echo $tordatarow['state']; ?>" max="7" ></progress> </td>
+
+</tr>
+<?php
+}
+}
+
+}
+
+$reponse->closeCursor(); // Termine le traitement de la requête
+
+?>
+</tbody>
+</table>

BIN
magnet.png


+ 2 - 2
main.php

@@ -9,7 +9,7 @@
     <h2>Last Episodes</h2>
     <ul >
     <?php
-        $repepisode = $bdd->query('SELECT * FROM `episode` , `shows`  WHERE `shows`.`id`=`episode`.`shows_id` ORDER BY `episode`.`id` DESC LIMIT 0,5');
+        $repepisode = $bdd->query('SELECT * FROM `TVS_episode` , `TVS_shows`  WHERE `TVS_shows`.`id`=`TVS_episode`.`shows_id` ORDER BY `TVS_episode`.`id` DESC LIMIT 0,5');
         while ($donepi = $repepisode->fetch()) {
         $tordata = $bdd->query('SELECT * FROM  `torrent_data` WHERE  `res`<>\'SD\' AND `episode_id` =' . $donepi['id']);
     ?>
@@ -38,7 +38,7 @@
     <h2>TV Shows</h2>
     <div id="tv_shows">
     <?php
-        $reponse = $bdd->query('SELECT * FROM shows');
+        $reponse = $bdd->query('SELECT * FROM TVS_shows');
         while ($donnees = $reponse->fetch()) {
     ?>
         <a href="index.php?page_id=1&show_id=<?php echo $donnees['ID']; ?>"><img alt="<?php echo $donnees['Name']; ?>" src="<?php cache_image("http://thetvdb.com/banners/graphical/" . $donnees['tvdbid'] . "-g" . $donnees['TVDB_banner_id'] . ".jpg"); ?>" /></a> 

+ 153 - 0
manually_add.php

@@ -0,0 +1,153 @@
+<?php
+
+/* 
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+if(!isset($_GET['step'])){
+?>
+<section class="new_item">
+    <h2>TPB History</h2>
+    <ul >
+    <?php
+        $repepisode = $bdd->query('SELECT * FROM `TVS_tpb_history` ORDER BY `id` DESC LIMIT 0,3000');
+        while ($donepi = $repepisode->fetch()) {
+       
+    ?>
+        <li><a href="index.php?page_id=4&step=0&hist_id=<?php echo $donepi['id']; ?>">
+            <div><?php echo $donepi['title']; ?></div>
+            <div><?php echo $donepi['publish_date']; ?> </div>   
+            </a>
+        </li>
+
+    <?php
+        }
+    ?>
+    </ul>
+</section>
+
+<?php
+
+}else{
+    
+      $rephist = $bdd->query('SELECT * FROM `TVS_tpb_history` WHERE `id`='.$_GET['hist_id']);
+     $donhist = $rephist->fetch(); 
+    switch ($_GET['step']){
+        case 0:
+      
+     ?>
+ 
+     
+    
+<section class="new_item">
+    <h2>TPB History - Select Shows</h2>
+    <h3><?php echo $donhist['title']; ?></h3>
+    <form action="index.php">
+         <input type="hidden" name="step" value=1 />
+         <input type="hidden" name="page_id" value=4 />
+         <input type="hidden" name="hist_id" value=<?php echo $_GET['hist_id']; ?> />
+            <select name="tvshows_id">
+                     <?php
+                         $repepisode = $bdd->query('SELECT * FROM `TVS_shows` ORDER BY `Name` ASC');
+                          while ($donepi = $repepisode->fetch()) { 
+                    ?>
+                    <option value="<?php echo $donepi['ID']; ?>"><?php echo $donepi['Name']; ?></option>
+                    <?php
+                    }
+                    ?>
+            </select>
+            <button>Submit</button>
+        </form>
+ </section> 
+    <?php
+    break;
+           case 1:
+          ?>
+
+<section class="new_item">
+    <h2>TPB History - Select Episode</h2>
+    <h3><?php echo $donhist['title']; ?></h3>
+    <form action="index.php?page_id=4">
+         <input type="hidden" name="step" value=2 />
+         <input type="hidden" name="page_id" value=4 />
+         <input type="hidden" name="hist_id" value=<?php echo $_GET['hist_id']; ?> />
+         <input type="hidden" name="tvshows_id" value=<?php echo $_GET['tvshows_id']; ?> />
+            <select name="episode_id">
+                     <?php
+                         $repepisode = $bdd->query('SELECT * FROM  `TVS_episode` WHERE `shows_id`='.$_GET['tvshows_id']);
+                          while ($donepi = $repepisode->fetch()) { 
+                    ?>
+                    <option value="<?php echo $donepi['id']; ?>">Saison <?php echo $donepi['season_num']; ?> - Episode <?php echo $donepi['episode_num']; ?></option>
+                    <?php
+                    }
+                    ?>
+            </select>
+            <input type="checkbox" name="newepi" selected="true">New Episode </option>
+            <input type="number" name="epinum" />
+            <input type="number" name="seanum" />
+            <button>Next</button>
+        </form>
+ </section> 
+    <?php
+    break;
+    
+      case 2:
+         
+      if($_GET['newepi']==true){
+          $bdd->exec("INSERT INTO TVS_episode VALUES('','".$_GET['seanum']."','".$_GET['epinum']."','1','".$_GET['tvshows_id']."')");
+          $repepisode = $bdd->query('SELECT MAX(id) AS id FROM  `TVS_episode` WHERE `shows_id`='.$_GET['tvshows_id']);
+          $donepi = $repepisode->fetch(); 
+          $epinumber=$donepi["id"];
+      }else{
+          $epinumber=$_GET['episode_id'];
+      }   
+          
+          ?>
+
+
+
+
+
+
+
+
+<section class="new_item">
+    <h2>TPB History - Option</h2>
+    <h3><?php echo $donhist['title']; ?> - <?php echo $donhist['magnet']; ?></h3>
+    <form action="index.php?page_id=4">
+         <input type="hidden" name="step" value=3 />
+         <input type="hidden" name="page_id" value=4 />
+         <input type="hidden" name="hist_id" value=<?php echo $_GET['hist_id']; ?> />
+         <input type="hidden" name="epinumber" value=<?php echo $epinumber; ?> />
+            <select name="res">
+                   <option value="SD">480 p</option>
+                  <option value="HD">720 p</option>
+                  <option value="FHD">1080 p</option>
+            </select>
+            <input type="text" name="hash"/>
+            <button>Next</button>
+        </form>
+ </section> 
+    <?php
+    break;
+               case 3:
+          ?>
+
+<section class="new_item">
+    <h2>TPB History - Finish</h2>
+    <?php
+     // $bdd->exec("INSERT INTO torrent_data VALUES('','magnet','1','episode_id',res,hash,'','0','0','0',CURRENT_TIMESTAMP)");
+        $bdd->exec("INSERT INTO torrent_data VALUES('','".$donhist['magnet']."','1','".$_GET['epinumber']."','".$_GET['res']."','".$_GET['hash']."','','0','0','0',CURRENT_TIMESTAMP)");
+   ?>
+     
+ </section> 
+    <?php       
+            
+        break;    
+   
+    }  
+    
+    
+}
+

+ 31 - 5
show_desc.php

@@ -9,14 +9,40 @@
 <section>
     
     <?php
-        $reponse = $bdd->query('SELECT * FROM shows WHERE `id`='.$_GET['show_id'] );
+        $reponse = $bdd->query('SELECT * FROM TVS_shows WHERE `id`='.$_GET['show_id'] );
         $donnees = $reponse->fetch()
     ?>
     <h2><?php echo $donnees['Name']; ?></h2>
-    <div id="show_banner">
-        <img alt="<?php echo $donnees['Name']; ?>" src="<?php cache_image("http://thetvdb.com/banners/graphical/" . $donnees['tvdbid'] . "-g" . $donnees['TVDB_banner_id'] . ".jpg"); ?>" /> 
-    <?php
-        
+    <div class="show_banner">
+        <img alt="<?php echo $donnees['Name']; ?>" src="<?php cache_image("http://thetvdb.com/banners/posters/" . $donnees['tvdbid'] . "-" . $donnees['TVDB_poster_id'] . ".jpg"); ?>" /> 
+    </div>
+        <div class="epi_list">
+            <table>
+                <thead>
+                    <th>Season</th>
+                    <th>Episode</th>
+                    <th>Quality</th>
+                    <th>Available Until</th>
+                </thead>
+                <tbody>
+ <?php
+         $repepisode = $bdd->query('SELECT *,  GROUP_CONCAT(`torrent_data`.`res`) AS RESALL ,  DATE_ADD(timeadded, INTERVAL 7 DAY) AS UNTILE FROM `TVS_episode`,`torrent_data`   WHERE `TVS_episode`.`shows_id`='.$_GET['show_id'].' AND `torrent_data`.`episode_id`=`TVS_episode`.`id` GROUP BY `TVS_episode`.`id`  ORDER BY `TVS_episode`.`id` ');
+        while ($donepi = $repepisode->fetch()) {
+            ?>
+                    <tr onclick="document.location = 'index.php?page_id=2&epi_id=<?php echo $donepi['0']; ?>'">
+                <td><?php echo $donepi['season_num']; ?></td>    
+                <td><?php echo $donepi['episode_num']; ?></td>
+                <td><?php echo $donepi['RESALL']; ?></td>
+                <td><?php echo $donepi['UNTILE']; ?></td>
+ 
+               </tr>
+            
+        <?php
+        }
     ?>
+                </tbody>
+             </table>
+            
+        </div>
     </div>
 </section>

+ 97 - 0
style.css

@@ -38,6 +38,103 @@ header{
     
 }
 
+.show_banner img
+{
+         display: inline-block;
+             float: left;
+         margin: 1%;
+         width: 40%;
+}
+div.epi_list 
+{
+     display:  inline-block;
+     width: 50%;
+    margin : 1%;
+  
+}
+.epi_list table
+{
+     width: 100%;
+   text-align: center;
+   border: none;
+}
+a
+{
+     text-decoration: none;
+     color: inherit;
+  
+}
+
+
+.epi_list tr
+{
+   // display: inline-block;
+    width: 100%;
+   
+    margin: 1px;
+}
+
+.epi_list tr:hover
+{
+    background-color: #99ccff;
+  
+}
+
+.epi_list tr td
+{
+   
+    vertical-align : middle;
+    
+}
+
+
+div.list_tor 
+{
+     display:  inline-block;
+     width: 50%;
+    margin : 1%;
+  
+}
+.list_tor ul
+{
+     width: 100%;
+   text-align: center;
+   border: none;
+    list-style-type: none;
+     margin-right: 1%;
+}
+a
+{
+     text-decoration: none;
+     color: inherit;
+  
+}
+
+
+.list_tor li
+{
+   // display: inline-block;
+    width: 100%;
+   
+    margin: 1px;
+}
+
+.list_tor li:hover
+{
+    background-color: #99ccff;
+  
+}
+
+.list_tor li div
+{
+   
+     vertical-align : middle;
+     display: inline-block;
+}
+
+
+
+
 h1{
         margin-top: 0px;
       margin-left: 15%;

BIN
table-images/back.png


BIN
table-images/blurry.jpg


BIN
table-images/botleft.png


BIN
table-images/botright.png


BIN
table-images/gradhover.png


BIN
table-images/header.jpg


BIN
table-images/left.png


BIN
table-images/pattern-head.png


BIN
table-images/pattern.gif


BIN
table-images/pattern.png


BIN
table-images/patternb-head.png


BIN
table-images/patternb.png


BIN
table-images/right.png


+ 66 - 0
user.php

@@ -0,0 +1,66 @@
+<?php
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+$seluser = $bdd->query('SELECT * FROM users WHERE id=' . $_GET['user_id']);
+$userdata = $seluser->fetch();
+?>
+
+
+<section>
+    <h2><?php echo $userdata['name']; ?></h2>
+    <div>
+        <div><?php echo $userdata['username']; ?> </div>
+        <div><?php echo $userdata['created']; ?> </div>
+        <div><?php echo $userdata['last_login']; ?> </div>
+    </div>
+</section>
+<section>
+    <h2>Your TV Shows</h2>
+    <div id="tv_shows">
+        <table>
+        <?php
+        $reponse = $bdd->query('SELECT * FROM shows WHERE shows.ID IN ( SELECT shows_id 
+FROM  `users_tvshows` WHERE user_id=' . $_GET['user_id'] . ')');
+        while ($donnees = $reponse->fetch()) {
+            ?>
+            <tr>
+                <td><a href="index.php?page_id=1&show_id=<?php echo $donnees['ID']; ?>"><img alt="<?php echo $donnees['Name']; ?>" src="<?php cache_image("http://thetvdb.com/banners/graphical/" . $donnees['tvdbid'] . "-g" . $donnees['TVDB_banner_id'] . ".jpg"); ?>" /></a> </td>
+                <td><?php echo $donnees['Name']; ?></td>
+                <td>SXX</td>
+                <td>EXX</td>
+                <td>Remove </td>
+                <td>Suscribe</td>
+            </tr>
+                <?php
+        }
+        ?>
+        </table>
+    </div>
+</section>
+<section>
+    <h2>Add Shows</h2>
+
+
+
+    <form>
+        <select name='shows' id='shows'>
+            <?php
+            $toaddshows = $bdd->query('SELECT * FROM shows WHERE shows.ID NOT IN ( SELECT shows_id 
+FROM  `users_tvshows` WHERE user_id=' . $_GET['user_id'] . ')');
+            while ($donnees = $toaddshows->fetch()) {
+                ?>
+                <option value='<?php echo $donnees['ID']; ?>' ><?php echo $donnees['Name']; ?></option> 
+                <?php
+            }
+            ?>
+        </select>
+    </form>
+
+
+</form>
+
+</section>