firefly007 |
20th August 2013 14:28 |
Youtube mod - firefly007
1 Attachment(s)
This will work on IE
1) Run Sql
PHP Code:
CREATE TABLE IF NOT EXISTS `youtube` ( `id` int(11) NOT NULL AUTO_INCREMENT, `uid` int(10) NOT NULL, `uname` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, `name` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, `link` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, `dt` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
2) If you don't have this function then save this to your bittorrent.php
PHP Code:
function sanitize($data) { $data = trim($data); if(get_magic_quotes_gpc()) $data = stripslashes($data); if(is_numeric($data) && preg_match('/\./', $data)) $data = floatval($data); elseif(is_numeric($data)) $data = intval($data); else $data = mysql_real_escape_string($data); return $data; }
3) Create a file called browse_you.php and save the below code.
PHP Code:
<? include "include/bittorrent.php"; dbconn(); loggedinorreturn(); stdhead();
//Created by firefly//
$res = mysql_query("SELECT id, uid, name, link FROM youtube ORDER BY id") or sqlerr(__FILE__, __LINE__);
echo "<table bgcolor='#0E0E0C' width='800' border='0'> <tr> <th bgcolor='#03233d'><div class='col'>Name <a href='/youtube_add.php'><strong>[Add]</strong></a></div></th> <th class='col' bgcolor='#03233d'>Del</th> <th class='col' bgcolor='#03233d'>Edit</th> </tr>";
while ($row = mysql_fetch_array($res)) {
$place = "Viewing <strong><a href='/browse_tv.php'>Youtube listings</a></strong>";
echo "<tr>"; echo "<td width='700'> <a href='/details_you.php?id=" . $row['id'] . "'class='btv'>" . $row['name'] . "</a></td>"; if ($row["uid"] == $CURUSER["id"] || get_user_class() >= UC_OWNER) { echo "<td width='10px'><center><a href='del_you.php?id=" . $row["id"] . "'><img src='pic/drop.png' alt='Download'></a></center></td>"; } else { echo "<td></td>"; } if ($rowl["uid"] == $CURUSER["id"] || get_user_class() >= UC_OWNER) { echo "<td width='10px'><center><a href='edit_you.php?id=" . $row["id"] . "'><img src='http://icons.iconarchive.com/icons/custom-icon-design/pretty-office-10/16/Pencil-icon.png' alt='Download'></a></center></td>";
} else { echo "<td></td>"; } echo "</tr>"; } echo "</table>";
stdfoot();
4) Create a file called details_you.php and save this.
PHP Code:
<? include "include/bittorrent.php"; dbconn(true); loggedinorreturn();
//Created by firefly//
$ids = sanitize($_GET['id']); if (empty($_GET['id'])) die('No ID'); $res = mysql_query("SELECT id, name, link FROM youtube WHERE id='$ids'") or sqlerr(__FILE__, __LINE__);
function get_youtube_embed($youtube_video_id, $autoplay = false) { $embed_code = "";
if ($autoplay) $embed_code = ' <embed src="http://www.youtube.com/v/' . $youtube_video_id . '&rel=1&autoplay=1" pluginspage="http://adobe.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="640" height="480" bgcolor="#ffffff" loop="false"></embed> '; else $embed_code = ' <embed src="http://www.youtube.com/v/' . $youtube_video_id . '&rel=1" pluginspage="http://adobe.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="640" height="480" bgcolor="#ffffff" loop="false"></embed> '; return $embed_code; }
while ($row = mysql_fetch_assoc($res))
$you = get_youtube_embed($row["link"], true);
stdhead();
$d = '<table width="600" cellpadding="4" cellspacing="4" bgcolor="#121212"> <tr><td>' . $you . '</td></tr><tr></table>';
print(" || <a href='/browse_you.php'><strong>Browse Youtube</strong></a> || "); print(" || <a href='/youtube_add.php'><strong>Add Clip</strong></a> || ");
print($d); $resl = mysql_query("SELECT * FROM youtube ORDER BY dt") or sqlerr(__FILE__, __LINE__);
echo "<table width='640'>"; echo "<tr>"; echo "<th bgcolor='#011327'>Name</th>"; echo "<th bgcolor='#011327'>added</th>"; echo "<th bgcolor='#011327'>User</th>"; echo "<th bgcolor='#011327'>Del</th>"; echo "<th bgcolor='#011327'>Edit</th>"; echo "<th bgcolor='#011327'>Play</th>";
echo "</tr>";
while ($rowl = mysql_fetch_array($resl)) { $todaydate = date('Y-m-d H:i:s'); $ago = strtotime($todaydate) - strtotime(($rowl["dt"])); if ($ago >= 86400) {$diff = floor($ago/86400).'<font color="#0f87cc"> days ago</font>'; }elseif($ago >= 3600) { $diff = floor($ago/3600).'<font color="#d4470f"> hours ago</font>'; }elseif ($ago >= 60) { $diff = floor($ago/60).'<font color="#0fd455"> mins ago</font>'; }else { $diff = $ago.'<font color="#4e063e"> secs ago</font>';}
echo "<tr>"; echo "<td width='540px'>" . $rowl['name'] . "</td>"; echo "<td width='90px'>" . $diff . "</td>"; echo "<td width='40px'>" . $rowl['uname'] . "</td>"; if ($rowl["uid"] == $CURUSER["id"] || get_user_class() >= UC_OWNER) { echo "<td width='10px'><center><a href='del_you.php?id=" . $rowl["id"] . "'><img src='pic/drop.png' alt='Download'></a></center></td>"; } else { echo "<td></td>"; } if ($rowl["uid"] == $CURUSER["id"] || get_user_class() >= UC_OWNER) { echo "<td width='10px'><center><a href='edit_you.php?id=" . $rowl["id"] . "'><img src='http://icons.iconarchive.com/icons/custom-icon-design/pretty-office-10/16/Pencil-icon.png' alt='Download'></a></center></td>";
} else { echo "<td></td>"; } echo "<td width='10px'><center><a href='details_you.php?id=" . $rowl["id"] . "'><img src='http://icons.iconarchive.com/icons/double-j-design/ravenna-3d/16/Play-icon.png' alt='Download'></a></center></td>"; echo "</tr>"; } echo "</table>";
stdfoot();
5) Create a file called youtube_add and paste this..
PHP Code:
<?php include "include/bittorrent.php"; dbconn(); loggedinorreturn();
//Created by firefly//
stdhead();
$form = '<lable><h1><center>Add Youtube to DB.</center></h1></lable> <form action="take_you.php" method="post"> <table width="801" cellpadding="4" cellspacing="4"> <tr> <td width="50"><strong>Name:</strong></td> <td width="600"><input name="name" type="text" size="50"> <strong>Add the name </strong></td> </tr> <tr> <td width="50"><strong>Link:</strong></td> <td><input type="text" name="link" size="20"> <strong>Add only code</strong> (xRXIwvHzIbk)</td> </tr> </table> <input name="Submit" type="submit" value="Enter!"> </body> </html>';
print ($form);
stdfoot();
6) Create a file called take_you.php and paste this.
PHP Code:
<? include "include/bittorrent.php"; dbconn(); loggedinorreturn();
//Created by firefly//
if (empty($_POST['name']))die('Empty name!'); if (empty($_POST['link']))die('Empty link!');
$res = "SELECT name FROM youtube WHERE name = '" . sanitize($_POST['name']) . "'"; $duplicate = mysql_query($res); if (mysql_num_rows($duplicate) > 0) { $count_duplicate++; } else { $uid = $CURUSER['id']; $unam = $CURUSER['username']; $en = sanitize($_POST['name']);$link = sanitize($_POST['link']); $todaydate = date('Y-m-d H:i:s'); mysql_query("INSERT INTO youtube (uid, uname, name, link, dt)VALUES ('$uid', '$unam', '$en', '$link', '$todaydate')") or sqlerr(__FILE__, __LINE__); }
$url = "browse_you.php"; $time_out = 1; header("refresh: $time_out; url=$url");
stdfoot();
7) Create a file called edit_you.php and save this..
PHP Code:
<? require_once("include/bittorrent.php"); dbconn();
//Created by firefly//
?> <style type="text/css">
.txte {height: 350px;width: 600px;} .tv {width: 300px;}
</style> <?
if (empty($_GET['id']))die('No ID'); $idsp = sanitize($_GET['id']); $res = mysql_query ("SELECT id, uid, name, link FROM youtube WHERE id='$idsp'")or die(mysql_error());;
$row = mysql_fetch_assoc($res); if ($row["uid"] == $CURUSER["id"] || get_user_class() >= UC_OWNER){
$name = $row["name"]; $link = $row["link"];
stdhead();
$outtab ="<form action='takeyouedit.php?id=$idsp' method='post'> <table width='950' cellpadding='4' cellspacing='4'> <tr> <td width='50'>Name:</td> <td width='950'><input name='name' type='text' class='tv' value='$name'> <strong>Add the name</td> </tr> <tr> <td>Poster:</td> <td><input type='text' name='link' class='tv' value='$link'> <strong>Add code only.</strong></td> </tr>
</table> <input type='submit'> </form>";
print $outtab; }else { ?><META HTTP-EQUIV=REFRESH CONTENT="1; URL=/browse_you.php"> <? exit('You do not own this clip.');
}
8) Created a file called takeyouedit.php and paste.
PHP Code:
<? include "include/bittorrent.php"; dbconn(); loggedinorreturn();
//Created by firefly//
if (empty($_GET['id']))die('No ID'); if (empty($_POST['name']))die('Empty Name!'); if (empty($_POST['link']))die('Empty link!'); $en = sanitize($_POST['name']);$link = sanitize($_POST['link']);$idsp = sanitize($_GET["id"]); mysql_query("UPDATE youtube SET name = '$en' WHERE id= '" . $idsp . "'") OR sqlerr( __FILE__, __LINE__ ); mysql_query("UPDATE youtube SET link = '$link' WHERE id= '" . $idsp . "'") OR sqlerr( __FILE__, __LINE__ );
header("location: browse_you.php"); stdfoot(); ?>
9) Create a file called del_you.php and copy
PHP Code:
<? require_once("include/bittorrent.php"); dbconn(false);
//Created by firefly//
if (empty($_GET['id']))die('No ID'); $id = sanitize($_GET['id']); $resl = mysql_query("SELECT id, uid, name, link FROM youtube") or sqlerr(__FILE__, __LINE__); while ($rowl = mysql_fetch_array($resl))
if ($rowl["uid"] == $CURUSER["id"] || get_user_class() >= UC_OWNER){
mysql_query("DELETE FROM youtube WHERE id='$id'"); ?><META HTTP-EQUIV=REFRESH CONTENT="0; URL=/browse_you.php"><? }else { ?><META HTTP-EQUIV=REFRESH CONTENT="1; URL=/browse_you.php"> <? exit('You do not own this clip'); }
|