Търся система за търсене на клипове

Готови за използване кодове
User avatar
kriss
Гуру
Гуру
Posts: 2201
Joined: Wed Sep 02, 2009 4:38 pm
Answers: 148
Location: Варна
Contact:

Търся система за търсене на клипове

Post by kriss » Thu Nov 26, 2009 8:59 pm

някой може ли да даде системата за търсене на клипове на http://nameri-video.com/
виждал съм я и в много други сайтове абсолютно същата (даже и дизайн)

User avatar
MaLa_NocHe
Потребител
Потребител
Posts: 839
Joined: Tue Aug 04, 2009 11:26 am
Answers: 20
Location: Русе

Post by MaLa_NocHe » Thu Nov 26, 2009 9:46 pm

Тази система е мега лесна :D става за отрицателно време :) , много спешно ли ти трябва? МОга да я направя, поне нещо подобно :)

User avatar
kriss
Гуру
Гуру
Posts: 2201
Joined: Wed Sep 02, 2009 4:38 pm
Answers: 148
Location: Варна
Contact:

Post by kriss » Thu Nov 26, 2009 10:08 pm

ами ако може до утре до 11 ще е супер. :lol:

User avatar
MaLa_NocHe
Потребител
Потребител
Posts: 839
Joined: Tue Aug 04, 2009 11:26 am
Answers: 20
Location: Русе

Post by MaLa_NocHe » Thu Nov 26, 2009 10:19 pm

kriss wrote:ами ако може до утре до 11 ще е супер. :lol:
Окей

User avatar
MaLa_NocHe
Потребител
Потребител
Posts: 839
Joined: Tue Aug 04, 2009 11:26 am
Answers: 20
Location: Русе

Post by MaLa_NocHe » Fri Nov 27, 2009 12:16 am

Ето, дано да ти хареса, елементарно е направена.

config.php

Code: Select all

<?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "video";
mysql_connect&#40;$host,$user,$pass&#41; or die &#40;"Не мога да се свържа с хостинга."&#41;;
mysql_select_db&#40;$db&#41; or die &#40;"$db &#40;база данни&#41;, не бе открита!"&#41;;
mysql_query&#40;"SET names utf8"&#41; or die &#40;mysql_error&#40;&#41;&#41;;
?>
add.php

Code: Select all

<?php
include "config.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http&#58;//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Видеота - Добавяне</title>
	</head>
<body style="background&#58;black;color&#58;white;">
<center>
<menu><a href="index.php" style="color&#58;white;">Начало</a> | <a href="add.php" style="color&#58;white;">Добавяне на Клип</a></menu><br />
<?php
$ip = $_SERVER&#91;'REMOTE_ADDR'&#93;;
if&#40;$ip == '77.78.24.17'&#41;
&#123;
?>
<form action="" method="post">
<table border="0">
<tr><td>От кой сайт</td><td> <select name="kategoria">
<?php
$sql = mysql_query&#40;"SELECT * FROM cats"&#41; or die &#40;mysql_error&#40;&#41;&#41;;
while&#40;$row = mysql_fetch_assoc&#40;$sql&#41;&#41;
&#123;
echo "<option value='".$row&#91;'id'&#93;."'>".$row&#91;'kategoria'&#93;."</option>";
&#125;
?>
</select></td></tr>
<tr><td>Име на клипа</td><td> <input type="text" name="title" /></td></tr>
<tr><td></td><td>ПРАВИЛО!!!<br />
1. Ако качваш от YouTube, линка трябва <br />да изглежда така&#58;<br /> http&#58;//www.youtube.com/watch?v=9vrY0vMUts4<hr>
2. Ако качваш от Vbox7, линка трябва <br />да изглежда така&#58;<br /> http&#58;//www.vbox7.com/play&#58;d0662c13</td></tr>
<tr><td>Линк към клипа</td><td> <input type="text" name="link" /></td></tr>
<tr><td><input type="submit" name="add" value="Добави" /></td></tr>
</table>
</form>
<?php
if&#40;isset&#40;$_POST&#91;'add'&#93;&#41;&#41;
&#123;
$kategoria = htmlspecialchars&#40;$_POST&#91;'kategoria'&#93;&#41;;
$title = htmlspecialchars&#40;$_POST&#91;'title'&#93;&#41;;
$link = htmlspecialchars&#40;$_POST&#91;'link'&#93;&#41;;
$data = time&#40;&#41;;
if&#40;$title == NULL || $link == NULL&#41;
&#123;
echo "Не сте попълнили всички полета!";
&#125;
else&#123;
mysql_query&#40;"INSERT INTO klips &#40;kategoria,title,link,data&#41; VALUES &#40;'$kategoria','$title','$link','$data'&#41;"&#41; or die &#40;mysql_error&#40;&#41;&#41;;
echo "Клипа е добавен успешно!";
&#125;
&#125;
&#125;
else&#123;
echo "Нямате права за качване на клипове!";
&#125;
?>
<center>
</body>
</html>
index.php

Code: Select all

<?php
include "config.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http&#58;//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Видеота - Начало</title>
	</head>
<body style="background&#58;black;color&#58;white;">
<center>
<menu><a href="index.php" style="color&#58;white;">Начало</a> | <a href="add.php" style="color&#58;white;">Добавяне на Клип</a></menu><br />
<form action="search.php" method="get">
<input type="text" name="duma" size="100"/><br />
<input type="submit" name="search" value="Търси" />
</form>
<br /><br />
Може да търсите както на Латиница така и на Кирилица.
<center>
</body>
</html>
search.php

Code: Select all

<?php
include "config.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http&#58;//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Видеота - Търсене</title>
	</head>
<body style="background&#58;black;color&#58;white;">
<center>
<menu><a href="index.php" style="color&#58;white;">Начало</a> | <a href="add.php" style="color&#58;white;">Добавяне на Клип</a></menu><br />
<?php
if&#40;isset&#40;$_GET&#91;'search'&#93;&#41;&#41;
&#123;
$duma = htmlspecialchars&#40;$_GET&#91;'duma'&#93;&#41;;
if&#40;$duma == NULL&#41;
&#123;
echo "Не сте въвели критерии за търсене!";
&#125;
else&#123;
if&#40;strlen&#40;$duma&#41; < 2&#41;
&#123;
echo "Търсачката не възприема думи по малки от 2 символа!";
&#125;
else&#123;
$query = mysql_query&#40;"SELECT * FROM klips WHERE title LIKE '%$duma%'"&#41; or die &#40;mysql_error&#40;&#41;&#41;;
$queryBroi = mysql_num_rows&#40;$query&#41;;
if&#40;$query == 0&#41;
&#123;
echo "Няма разултати от вашето търсене! Опитайте с други критерии!";
&#125;else&#123;
echo "<table width='532' border='1'>";
echo "<tr><td>Име</td><td>Източник</td><td>Преглеждания</td></tr>";
while&#40;$rowQ = mysql_fetch_assoc&#40;$query&#41;&#41;
&#123;
$kategoria = mysql_fetch_assoc&#40;mysql_query&#40;"SELECT * FROM cats WHERE id='$rowQ&#91;kategoria&#93;'"&#41;&#41;;
$kategoria = $kategoria&#91;'kategoria'&#93;;
if&#40;$rowQ&#91;'kategoria'&#93; == 1&#41;
&#123;
?>
<tr><td><a href="youtube.php?id=<?=$rowQ&#91;'id'&#93;?>" style="color&#58;white;"/><?=$rowQ&#91;'title'&#93;?></a></td><td><?=$kategoria?></td><td><?=$rowQ&#91;'views'&#93;?></td></tr>
<?php
&#125;
else&#123;
?>
<tr><td><a href="vbox7.php?id=<?=$rowQ&#91;'id'&#93;?>" style="color&#58;white;"/><?=$rowQ&#91;'title'&#93;?></a></td><td><?=$kategoria?></td><td><?=$rowQ&#91;'views'&#93;?></td></tr>
<?php
&#125;
&#125;
echo "</table>";
&#125;
&#125;
&#125;
&#125;
?>
<center>
</body>
</html>
vbox7.php

Code: Select all

<?php
include "config.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http&#58;//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Видеота - Клипче от Vbox7</title>
	</head>
<body style="background&#58;black;color&#58;white;">
<center>
<menu><a href="index.php" style="color&#58;white;">Начало</a> | <a href="add.php" style="color&#58;white;">Добавяне на Клип</a></menu>
<?php
$id = $_GET&#91;'id'&#93;;
$sql = mysql_fetch_assoc&#40;mysql_query&#40;"SELECT * FROM klips WHERE id='$id'"&#41;&#41;;
$link = explode&#40;"http&#58;//www.vbox7.com/play&#58;",$sql&#91;'link'&#93;&#41;;
mysql_query&#40;"UPDATE klips SET views=views+1 WHERE id='$id'"&#41; or die &#40;mysql_error&#40;&#41;&#41;;
?>
<h2>В момента гледате &#40;<?=$sql&#91;'title'&#93;?>&#41;</h2>
<object classid="clsid&#58;D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http&#58;//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="450" height="403"><param name="movie" value="http&#58;//i48.vbox7.com/player/ext.swf?vid=<?=$link&#91;1&#93;?>"><param name="quality" value="high"><embed src="http&#58;//i47.vbox7.com/player/ext.swf?vid=<?=$link&#91;1&#93;?>" quality="high" pluginspage="http&#58;//www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="450" height="403"></embed></object>
<br /><br />
Добавено на&#58; <?=date&#40;"d/m/Y г. H&#58;i ч.",$rowQ&#91;'data'&#93;&#41;?><br /><br />
<small><strong>Преглеждания&#58;</strong> <?=$sql&#91;'views'&#93;?></small>
</center>
</body>
</html>
youtube.php

Code: Select all

<?php
include "config.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http&#58;//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Видеота - Клипче от YouTube</title>
	</head>
<body style="background&#58;black;color&#58;white;">
<center>
<menu><a href="index.php" style="color&#58;white;">Начало</a> | <a href="add.php" style="color&#58;white;">Добавяне на Клип</a></menu>
<?php
$id = $_GET&#91;'id'&#93;;
$sql = mysql_fetch_assoc&#40;mysql_query&#40;"SELECT * FROM klips WHERE id='$id'"&#41;&#41;;
$link = explode&#40;"http&#58;//www.youtube.com/watch?v=",$sql&#91;'link'&#93;&#41;;
mysql_query&#40;"UPDATE klips SET views=views+1 WHERE id='$id'"&#41; or die &#40;mysql_error&#40;&#41;&#41;;
?>
<h2>В момента гледате &#40;<?=$sql&#91;'title'&#93;?>&#41;</h2>
<object width="425" height="344"><param name="movie" value="http&#58;//www.youtube.com/v/<?=$link&#91;1&#93;?>&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http&#58;//www.youtube.com/v/<?=$link&#91;1&#93;?>&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>
<br /><br />
<small><strong>Добавено на&#58;</strong> <?=date&#40;"d/m/Y г. H&#58;i ч.",$sql&#91;'data'&#93;&#41;?><br /><br />
<strong>Преглеждания&#58;</strong> <?=$sql&#91;'views'&#93;?></small>
</center>
</body>
</html>
SQL

Code: Select all

--
-- Структура на таблица `cats`
--

CREATE TABLE IF NOT EXISTS `cats` &#40;
  `id` int&#40;11&#41; NOT NULL AUTO_INCREMENT,
  `kategoria` varchar&#40;255&#41; COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY &#40;`id`&#41;
&#41; ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;

--
-- Дъмп &#40;схема&#41; на данните в таблицата `cats`
--

INSERT INTO `cats` &#40;`id`, `kategoria`&#41; VALUES
&#40;1, 'YouTube'&#41;,
&#40;2, 'Vbox7'&#41;;

-- --------------------------------------------------------

--
-- Структура на таблица `klips`
--

CREATE TABLE IF NOT EXISTS `klips` &#40;
  `id` int&#40;11&#41; NOT NULL AUTO_INCREMENT,
  `kategoria` int&#40;11&#41; NOT NULL,
  `title` varchar&#40;255&#41; COLLATE utf8_unicode_ci NOT NULL,
  `link` varchar&#40;255&#41; COLLATE utf8_unicode_ci NOT NULL,
  `data` varchar&#40;255&#41; COLLATE utf8_unicode_ci NOT NULL,
  `views` int&#40;11&#41; NOT NULL,
  PRIMARY KEY &#40;`id`&#41;
&#41; ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ;

--
-- Дъмп &#40;схема&#41; на данните в таблицата `klips`
--

INSERT INTO `klips` &#40;`id`, `kategoria`, `title`, `link`, `data`, `views`&#41; VALUES
&#40;1, 2, '2pac Ft. Nas, Obie Trice - 3 Message', 'http&#58;//www.vbox7.com/play&#58;d0662c13', '1259311456', 7&#41;,
&#40;2, 2, '2pac - Wonda Why They Call U Bitch &#40;bg subs&#41;', 'http&#58;//www.vbox7.com/play&#58;5f792f99', '1259313986', 1&#41;,
&#40;4, 1, 'Galena - 100 pyti', 'http&#58;//www.youtube.com/watch?v=UIRCokRb4k4', '1259315771', 6&#41;;
Сложил съм ти три клипа, просто за тестване :) Успех, ако има некви проблеми казвай.
В add.php там където се вижда 77.78.24.17 го замени с твоето IP за да имаш само ти достъп за добавяне на клипове.

MaZZoHuCTa
Нов
Нов
Posts: 151
Joined: Thu Apr 10, 2008 10:16 pm

Post by MaZZoHuCTa » Fri Nov 27, 2009 4:18 pm

като отварям клиповете от заз нещо ми пише че няма такъв клип!
Можеш ли да направиш в индекса да изкарва последните 5 клипа и ако може повече от 1 човек да добавя клипове.. мерси предварително

User avatar
MaLa_NocHe
Потребител
Потребител
Posts: 839
Joined: Tue Aug 04, 2009 11:26 am
Answers: 20
Location: Русе

Post by MaLa_NocHe » Fri Nov 27, 2009 4:25 pm

MaZZoHuCTa wrote:като отварям клиповете от заз нещо ми пише че няма такъв клип!
Можеш ли да направиш в индекса да изкарва последните 5 клипа и ако може повече от 1 човек да добавя клипове.. мерси предварително
Аз съм написал при добавянето как трябва да слагаш линка от vbox7 ;] демек заз но си има точни указания.

Иначе ето

index.php

Със добавена опция: последни 5 клипа.

Code: Select all

<?php
include "config.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http&#58;//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Видеота - Начало</title>
	</head>
<body style="background&#58;black;color&#58;white;">
<center>
<menu><a href="index.php" style="color&#58;white;">Начало</a> | <a href="add.php" style="color&#58;white;">Добавяне на Клип</a></menu><br />
<form action="search.php" method="get">
<input type="text" name="duma" size="100"/><br />
<input type="submit" name="search" value="Търси" />
</form>
<br /><br />
Може да търсите както на Латиница така и на Кирилица.
<h2><u>Последни 5 Клипа</u></h3>
<?php
$sql = mysql_query&#40;"SELECT * FROM klips ORDER by id DESC LIMIT 0,5"&#41; or die &#40;mysql_error&#40;&#41;&#41;;
echo "<table width='532' border='1'>";
echo "<tr><td>Име</td><td>Източник</td><td>Преглеждания</td></tr>";
while&#40;$rowQ = mysql_fetch_assoc&#40;$sql&#41;&#41;
&#123;
$kategoria = mysql_fetch_assoc&#40;mysql_query&#40;"SELECT * FROM cats WHERE id='$rowQ&#91;kategoria&#93;'"&#41;&#41;;
$kategoria = $kategoria&#91;'kategoria'&#93;;
if&#40;$rowQ&#91;'kategoria'&#93; == 1&#41;
&#123;
?>
<tr><td><a href="youtube.php?id=<?=$rowQ&#91;'id'&#93;?>" style="color&#58;white;"/><?=$rowQ&#91;'title'&#93;?></a></td><td><?=$kategoria?></td><td><?=$rowQ&#91;'views'&#93;?></td></tr>
<?php
&#125;
else&#123;
?>
<tr><td><a href="vbox7.php?id=<?=$rowQ&#91;'id'&#93;?>" style="color&#58;white;"/><?=$rowQ&#91;'title'&#93;?></a></td><td><?=$kategoria?></td><td><?=$rowQ&#91;'views'&#93;?></td></tr>
<?php
&#125;
&#125;
echo "</table>";

?>
<center>
</body>
</html>
Ето и кода за добавяне на клипове от всеки

add.php

Code: Select all

<?php
include "config.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http&#58;//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Видеота - Добавяне</title>
	</head>
<body style="background&#58;black;color&#58;white;">
<center>
<menu><a href="index.php" style="color&#58;white;">Начало</a> | <a href="add.php" style="color&#58;white;">Добавяне на Клип</a></menu><br />
<form action="" method="post">
<table border="0">
<tr><td>От кой сайт</td><td> <select name="kategoria">
<?php
$sql = mysql_query&#40;"SELECT * FROM cats"&#41; or die &#40;mysql_error&#40;&#41;&#41;;
while&#40;$row = mysql_fetch_assoc&#40;$sql&#41;&#41;
&#123;
echo "<option value='".$row&#91;'id'&#93;."'>".$row&#91;'kategoria'&#93;."</option>";
&#125;
?>
</select></td></tr>
<tr><td>Име на клипа</td><td> <input type="text" name="title" /></td></tr>
<tr><td></td><td>ПРАВИЛО!!!<br />
1. Ако качваш от YouTube, линка трябва <br />да изглежда така&#58;<br /> http&#58;//www.youtube.com/watch?v=9vrY0vMUts4<hr>
2. Ако качваш от Vbox7, линка трябва <br />да изглежда така&#58;<br /> http&#58;//www.vbox7.com/play&#58;d0662c13</td></tr>
<tr><td>Линк към клипа</td><td> <input type="text" name="link" /></td></tr>
<tr><td><input type="submit" name="add" value="Добави" /></td></tr>
</table>
</form>
<?php
if&#40;isset&#40;$_POST&#91;'add'&#93;&#41;&#41;
&#123;
$kategoria = htmlspecialchars&#40;$_POST&#91;'kategoria'&#93;&#41;;
$title = htmlspecialchars&#40;$_POST&#91;'title'&#93;&#41;;
$link = htmlspecialchars&#40;$_POST&#91;'link'&#93;&#41;;
$data = time&#40;&#41;;
if&#40;$title == NULL || $link == NULL&#41;
&#123;
echo "Не сте попълнили всички полета!";
&#125;
else&#123;
mysql_query&#40;"INSERT INTO klips &#40;kategoria,title,link,data&#41; VALUES &#40;'$kategoria','$title','$link','$data'&#41;"&#41; or die &#40;mysql_error&#40;&#41;&#41;;
echo "Клипа е добавен успешно!";
&#125;
&#125;
?>
<center>
</body>
</html>

MaZZoHuCTa
Нов
Нов
Posts: 151
Joined: Thu Apr 10, 2008 10:16 pm

Post by MaZZoHuCTa » Fri Nov 27, 2009 5:43 pm

мерси много страхотно е

User avatar
MaLa_NocHe
Потребител
Потребител
Posts: 839
Joined: Tue Aug 04, 2009 11:26 am
Answers: 20
Location: Русе

Post by MaLa_NocHe » Fri Nov 27, 2009 7:00 pm

MaZZoHuCTa wrote:мерси много страхотно е
Но проблемо

User avatar
bankera1990
Потребител
Потребител
Posts: 683
Joined: Sat Aug 01, 2009 2:28 am
Answers: 15

Post by bankera1990 » Fri Nov 27, 2009 7:24 pm

системата е супер но ако имаше и едно свали евала :)

Post Reply