Админ панел за Удобрение на Добавените Клипове

Pupe64etoo_92

Registered
Някой ще може ли да направи админ панел за удобрение на клиповете които са добавени от потребители на тази система.

add.php //тук добавяш клип от youtube или vibox
Код:
<!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" />
</head>
<?PHP
include('class_video_config.php'); ?>
<table width="300"><tr><td><form method="POST">URL от vbox7.com или YouTube: <input type="text" name="url"><input type="submit" class="btn" name="clips" value="Добави"></form></td></tr></table>
<?php
if($_POST['clips']){
$video="$_POST[url]";
$pics="$_POST[url]";
$source = file_get_contents($_POST['url']);
$title = explode("<title>", $source);
$title = explode("</title>", $title[1]);
$title=str_replace(" ","",$title[0]);
$title=iconv('utf-8','windows-1251',urldecode($title));
$imes = "$title";
$video=str_replace("http://youtube.com/watch?v=", "http://youtube.com/watch?v=", $video);
$video=str_replace("http://www.youtube.com/watch?v=", "http://youtube.com/watch?v=", $video);
$url=str_replace("&mode=related&search=", "", $video);
$url=str_replace("&mode=related&search=", "", $video);
$pics=str_replace("http://youtube.com/watch?v=", "http://img.youtube.com/vi/","$pics");
$pics=str_replace("http://www.youtube.com/watch?v=", "http://img.youtube.com/vi/","$pics/default.jpg");
$pics=str_replace("&mode=related&search=", "", $pics); 

$fail = explode(':',$_POST['url']);
$dir = substr($fail[2],0,2);
$source = file_get_contents($_POST['url']);
$title = explode("<title>", $source);
$title = explode("</title>", $title[1]);
$title=str_replace(" / ","",$title[0]);
$title=iconv('utf-8','windows-1251',urldecode($title));
$ime = "$title";
$clip="http://media.vbox7.com/play:$fail[2]";
$pic="http://i47.vbox7.com/p/$fail[2]3.jpg";

$number = explode(":", $_POST['url']);
$i = substr($number[2],0 ,2);
$link1 = "http://vbox7.com/play:$number[2]";
if(@fopen($link1, "r"))
{
$link="$link1";
}
else{
for($x = 2; $x<=5; $x++)
{
$link = "http://media0$x.vbox7.com/s/$i/$number[2].flv";
}
}

$checkurl = mysql_query("SELECT url FROM clips WHERE url='$_POST[url]'");
$checkurl= mysql_num_rows($checkurl);
if ($ime>0) {
echo "Този клип вече е бил добавян";
}
if(eregi('youtube.com',$_POST['url']) && isset($_POST['clips'])){
$query = mysql_query("INSERT INTO `clips` (ime, url, pic, id) VALUES('$imes','$url','$pics','NULL')");
echo "Успешно добави клип от youtube!";
}
else if(eregi('vbox7.com',$_POST['url']) && isset($_POST['clips'])){
$query = mysql_query("INSERT INTO `clips` (ime, url, pic, id) VALUES('$title','$link','$pic','NULL')");
echo "Успешно добави клип ot vbox!";?><?
}
}
?>

class_pagination_video.php
Код:
<?php
/* class pagination
author -> Pupe64etoo_92
date -> 02/11/09
site -> www.cs-xipnoza.info */
class pagination {
    private $d,$q,$page,$totalrows,$pagination;
    public $p;
    
    function __construct($rpp,$sql) {
        $this->rpp = $rpp; $this->sql = $sql;
    }
    
    private function getTotalRows() {
        $this->d = mysql_fetch_assoc(mysql_query($this->sql));
        $this->totalrows = $this->d['allz'];
        return $this->d['allz'];
    }
    
    public function page($page) {
        $this->page = (!isset($page) || $page < 0) ? $this->page = 1 : $this->page = $page;
    }
    
    private function lastPage() {
        return ceil($this->getTotalRows() / $this->rpp);
    }
    
    public function limit() {
        return ($this->page - 1) * $this->rpp;
    }
    
    public function showPages() {
        if($this->lastPage() != "1") {
            $this->pagination = '<div id="pagination">';
            $this->d = ceil($this->getTotalRows() / $this->rpp);
            $prev = ($this->page <= 1) ? '<div class="disabled button"> << Предишна </div>' : '<div class="enabled button"><a href="javascript:pagination('.($this->page - 1).')"> << Предишна </a></div>';
            $next = ($this->page >= $this->lastPage()) ? '<div class="disabled button"> Следваща >> </div>' : '<div class="enabled button"><a href="javascript:pagination('.($this->page + 1).')"> Следваща >> </a></div>';
            $this->pagination .= $prev;
            if($this->lastPage() > 7) {
                if($this->page > 3) { $this->pagination .= '<a class="button" href=" javascript:pagination(1) ">1</a> ...'; }
                if($this->page <= 3) {
                    for($x = 1;$x<=4;$x++) { $this->pagination .= '<a class="button" href="javascript:pagination('.$x.')">'.$x.'</a>'; }
                    $this->pagination .= '<div class="marg">...</div><a class="button" href="javascript:pagination('.$this->lastPage().')">'.$this->lastPage().'</a>';
                } else {
                    if($this->page >= ($this->lastPage() - 4)) {
                        for($x = ($this->lastPage() - 3);$x<=($this->lastPage() - 1);$x++) { $this->pagination .= '<a class="button" href="javascript:pagination('.$x.')">'.$x.'</a>'; }
                        $this->pagination .= '<a class="button" href="javascript:pagination('.$this->lastPage().')">'.$this->lastPage().'</a>';
                    }
                    else { 
                        for($x = $this->page;$x<=($this->page + 4);$x++) { $this->pagination .= '<a class="button" href="javascript:pagination('.($x - 1).')">'.($x - 1).'</a>'; }
                        $this->pagination .= '<div class="marg">...</div><a class="button" href="javascript:pagination('.$this->lastPage().')">'.$this->lastPage().'</a>';
                    }
                }
            } else {
                for($x = 1;$x<=$this->lastPage();$x++) { $this->pagination .= '<a class="button" href="javascript:pagination('.$x.')">'.$x.'</a>'; }
            }
            $this->pagination .= $next.'</div>';
            return $this->pagination;
        }
    }
}
?>

class_video_config.php
Код:
<?php
define("dbhost", "сървър на БД");
define("dbuser", "потребитлско име на БД");
define("dbpass", "Парола на БД");
define("dbtable", "clips");
$c = mysql_connect(dbhost,dbuser,dbpass) or die("Не мога да се свържа с базата данни!");
$conn = mysql_select_db(dbtable,$c) or die("Не мога да избера таблица!");
mysql_query('SET NAMES UTF8'); 
mysql_query('SET CHARACTER SET UTF8'); 
?>

playvideo.php
Код:
<!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" />
</head>
<?php 

class VideoportalPlayer 
{ 
var $width = 590; 
var $height = 500; 

function _setReplace($posting, $results, $tmpl_player, $index=1) 
{ 
foreach($results as $item) 
$posting = str_replace($item[0], str_replace('[ID]', $item[$index], $tmpl_player), $posting); 
return $posting; 
}
function getYoutube($posting) 
{ 
$tmpl_player= '<object width="'.$this->width.'" height="'.$this->height.'"> 
<param name="movie" value="http://www.youtube.com/v/[ID]"></param> 
<param name="wmode" value="transparent"></param> 
<embed src="http://www.youtube.com/v/[ID]" type="application/x-shockwave-flash" wmode="transparent" width="'.$this->width.'" height="'.$this->height.'"></embed> 
</object>'; 
preg_match_all('/@http:\/\/(www\.|uk\.)?youtube\.com\/watch\?v=([\d\w-_]+)/', $posting, $results, PREG_SET_ORDER); 
if($results) 
$posting = $this->_setReplace($posting, $results, $tmpl_player, $index=2); 
return $posting; 
} 
function getVibox($posting)
{
$tmpl_player='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'.$this->width.'" height="'.$this->height.'"><param name="movie" value="http://i47.vbox7.com/player/ext.swf?vid=[ID]"><param name="quality" value="high"><embed src="http://i47.vbox7.com/player/ext.swf?vid=[ID]" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'.$this->width.'" height="'.$this->height.'"></embed></object>';
preg_match_all('/@http:\/\/vbox7\.com\/play:([\d\w-_]+)/', $posting, $results, PREG_SET_ORDER); 
if($results)
$posting = $this->_setReplace($posting, $results, $tmpl_player); 
return $posting; 

} 


} 

?>

stranica_video.php
Код:
<style>
.klips a{text-decoration:none; color:
#FFFFFF}
.klips a:hover{color:#ff9c00;}
.klips td:hover{ background-color:#000000}
</style>
<? 
include("class_video_config.php");
include("class_pagination_video.php");
$rpp = 20; //колко клипа да ти изкарва на страница
$sql = "SELECT count(id) as `allz` FROM clips ORDER BY `id` DESC";
$pagination = new pagination($rpp,$sql);
$pagination->page($_GET['page']);
$query = mysql_query("SELECT * from clips LIMIT ".$pagination->limit().",".$pagination->rpp."");
while($d = mysql_fetch_assoc($query)) {
$ime=$d[ime]; 
$pic=$d[pic];  
$url=$d[url];

echo"<table align=left width=120px class=\"klips\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td align=center style=padding:4px;><a href=\"play.php?id=$d[id]\" onmouseover=\"return overlib('$d[ime]')\" onmouseout=\"return nd();\"><img src=\"$pic\" border=\"0\" width=\"138\" height=\"108\"><div style=width:120px; class=ws10>$ime</div></a></td></tr></table>";   
}
?>
<?php echo $pagination->showPages(); ?>
 
eдвали някой щи даде панела защото направо трябва да ти го напише може ти дам идеята как ще стане трябва да направиш едно поле в датабазата status и там като се добави клипа пускаш да записва status="off" и когато запише в базата данни статуса щее off и така направи един файл в който да излизат файоловете с status="off" и от там направи като натиснеш на даден файл OK да update status="on" и после само искарай клиповете с status="on" и клиповете с status="off" няма да бъдат видими от потребителите само ти ще ги виждаш и ще си ги одобряваш това е идеята ако разбираш поне малко php ще го направиш Супер лесно :) Но пак си е играчка защото докат направиш всичките тези работи нестава бързо... :)
 

Back
Горе