Потребител Парола | Регистрация | Забравена парола
Меню
· Начало
· Файлове
· Форум
· Връзки
· Категории на уроците
· За контакти
· Фото галерия
· Търсене
Кажи на приятел

Вашия email:
email на приятел:
Копие за вас?
Реклама

Система за Музика Без Дизайн

PHP & MySQLСтруктура на основната папка/
sql.sql
add.php
index.php
connect.php
play.php
broken.php
player.swf



Започваме с sql -а  правиме файл sql.sql в него поставяме следния код



CREATE TABLE `songs_cat` (
`id` int(4) NOT NULL auto_increment,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


INSERT INTO `songs_cat` VALUES (1, 'Áàëàäè');
INSERT INTO `songs_cat` VALUES (2, 'Club');
INSERT INTO `songs_cat` VALUES (3, 'Dance');
INSERT INTO `songs_cat` VALUES (4, 'Electronic');
INSERT INTO `songs_cat` VALUES (5, 'Gothic');
INSERT INTO `songs_cat` VALUES (6, 'Hip-Hop');
INSERT INTO `songs_cat` VALUES (7, 'JazZ');
INSERT INTO `songs_cat` VALUES (8, 'Latin');
INSERT INTO `songs_cat` VALUES (9, 'Pop');
INSERT INTO `songs_cat` VALUES (10, 'Psychedelic');
INSERT INTO `songs_cat` VALUES (11, 'R&B');
INSERT INTO `songs_cat` VALUES (12, 'Reggae');
INSERT INTO `songs_cat` VALUES (13, 'Rock');
INSERT INTO `songs_cat` VALUES (14, 'Techno');
INSERT INTO `songs_cat` VALUES (15, 'Íàðîäíè');
INSERT INTO `songs_cat` VALUES (16, 'Êþ÷åöè');
INSERT INTO `songs_cat` VALUES (17, 'Õîðà');
INSERT INTO `songs_cat` VALUES (18, 'Drum''n''Bass');
INSERT INTO `songs_cat` VALUES (19, 'Retro');
INSERT INTO `songs_cat` VALUES (20, 'Ãðúöêî');
INSERT INTO `songs_cat` VALUES (21, 'House');
INSERT INTO `songs_cat` VALUES (22, 'Jungle');
INSERT INTO `songs_cat` VALUES (23, 'Metal');
INSERT INTO `songs_cat` VALUES (24, 'Ïîï Ôîëê');
INSERT INTO `songs_cat` VALUES (25, 'Punk');
INSERT INTO `songs_cat` VALUES (26, 'Rap');
INSERT INTO `songs_cat` VALUES (27, 'Reggaeton');
INSERT INTO `songs_cat` VALUES (28, 'Ñðúáñêî');
INSERT INTO `songs_cat` VALUES (29, 'Trance');
INSERT INTO `songs_cat` VALUES (30, 'Äåòñêè');
INSERT INTO `songs_cat` VALUES (31, 'Äðóãè');


CREATE TABLE `songs` (
`id` int(4) NOT NULL auto_increment,
`author` varchar(255) NOT NULL,
`artist` varchar(255) NOT NULL,
`title` varchar(255) NOT NULL,
`path` varchar(255) NOT NULL,
`year` varchar(255) NOT NULL,
`album` varchar(255) NOT NULL,
`size` varchar(255) NOT NULL,
`cat` varchar(255) NOT NULL,
`date` varchar(255) NOT NULL,
`broken` varchar(255) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;



Сега правим този add.php в него поставяме код :



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Песни</title>
<style type="text/css">
<!--
.txt {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
background-color: #FFFFFF;
border: 1px solid #000000;
}
.btn {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
background-color: #FFFFFF;
height: auto;
width: 55px;
border: 1px solid #000000;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
text-decoration: none;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
}
#table {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
border: 1px solid #000000;
}
.boxtext {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
color: #000000;
text-decoration: underline;
}
a {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
color: #000000;
}
a:hover {
color: #333333;
}
-->
</style>
</head>

<body>
<div align="center" class="boxtext"><b>Добавяне на песен</b><br />
</div>
<form id="form2" name="form2" method="post" action="">
<table width="250" border="0" align="center" cellpadding="1" cellspacing="1" id="table">
<tr>
<td>Изпълнител</td>
<td><strong>:</strong></td>
<td align="center"><input name="artist" type="text" class="txt" id="artist" size="30" /></td>
</tr>
<tr>
<td align="left">Песен</td>
<td align="center"><strong>:</strong></td>
<td align="center"><input name="title" type="text" class="txt" id="title" size="30"></td>
</tr>
<tr>
<td align="left">Албум</td>
<td align="center"><strong>:</strong></td>
<td align="center"><input name="album" type="text" class="txt" id="album" size="30"></td>
</tr>
<tr>
<td align="left">Размер</td>
<td align="center"><strong>:</strong></td>
<td align="center"><input name="size" type="text" class="txt" id="size" size="30"></td>
</tr>
<tr>
<td align="left">Година</td>
<td align="center"><strong>:</strong></td>
<td align="center"><input name="year" type="text" class="txt" id="year" size="30"></td>
</tr>
<tr>
<td align="left">Линк</td>
<td align="center"><strong>:</strong></td>
<td align="center"><input name="path" type="text" class="txt" id="path" size="30"></td>
</tr>
<tr>
<td align="left">Добавил</td>
<td align="center"><strong>:</strong></td>
<td align="center"><input name="author" type="text" class="txt" id="author" size="30" /></td>
</tr>
<tr>
<td colspan="3" align="center"><select name="cat" class="txt" id="cat">
<option>Изберете категория</option>
<?php
include("connect.php");
$r = mysql_query("SELECT * FROM songs_cat");
while($row = mysql_fetch_array($r)){
$cat .= "<option value="$row[id]" class="bottom">$row[value]</option>";
}
echo $cat;
?>
</select></td>
</tr>
<tr>
<td colspan="3" align="center"><input name="submit" type="submit" class="btn" id="button" value="Изпрати" />
<input name="button2" type="reset" class="btn" value="Изчисти" /></td>
</tr>
</table>
</form>
<?php

if($_POST['submit']){
if($_POST['title'] == ""){
echo "<script type="text/javascript">
alert('Не сте написали заглавие и/или съдържание на обявата.Моля направете го.');
</script>";}
elseif($_POST['cat'] == "Изберете категория" || $_POST['pic'] == "http://"){
echo "<script type="text/javascript">
alert('Не сте избрали категория и/или снимка на обявата.Моля направете го.');
</script>";}
else {
$date = date("d.m.Y");
$sql = "INSERT INTO `songs` (`id`, `author`, `artist`, `title`, `path`, `year`, `album`, `size`, `cat`, `date`) VALUES (NULL, '$_POST[author]', '$_POST[artist]', '$_POST[title]', '$_POST[path]', '$_POST[year]', '$_POST[album]', '$_POST[size] mb', '$_POST[cat]', '$date');";
$result = mysql_query($sql) or die(mysql_error());
}
}
?>
</body>
</html>
а сега index.php



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Песни</title>
<style type="text/css">
<!--
.txt {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
background-color: #FFFFFF;
border: 1px solid #000000;
}
.btn {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
background-color: #FFFFFF;
height: auto;
width: 55px;
border: 1px solid #000000;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
text-decoration: none;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
}
#table {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
border: 1px solid #000000;
}
.boxtext {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
color: #000000;
text-decoration: underline;
}
a {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
color: #000000;
}
a:hover {
color: #333333;
}
-->
</style>
</head>

<body>
<table width="375" border="0" align="center" cellpadding="1" cellspacing="1" id="table">
<tr>
<td><div class="boxtext">Стилове</div>
<?php
include("connect.php");
$gener = $_GET['gener'];
$cat = mysql_query("SELECT * FROM `songs_cat`");
while($row = mysql_fetch_array($cat)){
$our = mysql_query("SELECT count(id) as total FROM songs WHERE cat=$row[id]");
while($raw=mysql_fetch_array($our)){
$total=$raw['total'];
}
echo "<a href="?gener=$row[id]">$row[value] ($total) </a> | ";
}
?>
<br></td>
</tr>
<tr>
<td><div class="boxtext">
<?php if($gener == ""){
echo "Добавени песни";
} else {
$cat = mysql_query("SELECT * FROM `songs_cat` WHERE `id`='$gener'");
$category = mysql_fetch_array($cat);
$id=$category['id'];
$genername = $category['value'];
echo "Песни в стил $genername";
}

?>
</div>
<?php
if($_GET['gener']){
// Отбележете по колко резултата да се показват на страница
$pp = "50";
// изберета таблиза която искате да покажете
$table = "songs";

$total = mysql_result(mysql_query("SELECT COUNT(*) FROM $table"),0);
$numofpages = $total / $pp;
if (!isset($_GET['page'])) {
$page = 1;
}
else {
$page = $_GET['page'];
}
$limitvalue = $page * $pp - ($pp);

/* покажете записите, в този случай аз показвам само [username] */
$query = "SELECT * FROM `$table` WHERE `cat`='$gener' ORDER BY `id` DESC LIMIT $limitvalue, $pp";
$result = mysql_query($query);
while($row=mysql_fetch_array($result))
{
echo "» <a href="playsong.php?id=$row[id]">$row[artist] - $row[title]</a><br>";
}
function per_page($link, $offset) {
global $numofpages, $page;
$numofpages = round($numofpages);

$pagesstart = round($page-$offset);
$pagesend = round($page+$offset);

/* показване на стрелки « за предишна страница */
if ($page != "1" && round($numofpages) != "0") {
echo str_replace("%page", round($page-1), '<a href="'.$link.'"><font face="Trebuchet MS">«</font></a> ');
}

for($i = 1; $i <= $numofpages; $i++) {
if ($pagesstart <= $i && $pagesend >= $i) {
if ($i == $page) {
echo "<b>[$i]</b> ";
}
else {
echo str_replace("%page", "$i", '<a href="'.$link.'">'.$i.'</a> '); //номерация на страниците
}
}
}
if (round($numofpages) == "0") {
echo "[$i]";
}
/* показване на стрелки » за следваща страница */
if ($page != round($numofpages) && round($numofpages) != "0") {
echo str_replace("%page", round($page+1), '<a href="'.$link.'"><font face="Trebuchet MS">»</font></a>');
}
}

/* показване на общия брой страници и избор на страница */
echo '<br>';
echo 'Общо страници: '.round($numofpages).'<br>';

per_page("?page=%page", "5");
} else {
// Отбележете по колко резултата да се показват на страница
$pp = "50";
// изберета таблиза която искате да покажете
$table = "songs";

$total = mysql_result(mysql_query("SELECT COUNT(*) FROM $table"),0);
$numofpages = $total / $pp;
if (!isset($_GET['page'])) {
$page = 1;
}
else {
$page = $_GET['page'];
}
$limitvalue = $page * $pp - ($pp);

/* покажете записите, в този случай аз показвам само [username] */
$sql = "SELECT * FROM `$table` ORDER BY id DESC LIMIT $limitvalue, $pp";
$result = mysql_query($sql);
while($row=mysql_fetch_array($result))
{
echo "» <a href="playsong.php?id=$row[id]">$row[artist] - $row[title]</a><br>";
}
function per_page($link, $offset) {
global $numofpages, $page;
$numofpages = round($numofpages);

$pagesstart = round($page-$offset);
$pagesend = round($page+$offset);

/* показване на стрелки « за предишна страница */
if ($page != "1" && round($numofpages) != "0") {
echo str_replace("%page", round($page-1), '<a href="'.$link.'"><font face="Trebuchet MS">«</font></a> ');
}

for($i = 1; $i <= $numofpages; $i++) {
if ($pagesstart <= $i && $pagesend >= $i) {
if ($i == $page) {
echo "<b>[$i]</b> ";
}
else {
echo str_replace("%page", "$i", '<a href="'.$link.'">'.$i.'</a> '); //номерация на страниците
}
}
}
if (round($numofpages) == "0") {
echo "[$i]";
}
/* показване на стрелки » за следваща страница */
if ($page != round($numofpages) && round($numofpages) != "0") {
echo str_replace("%page", round($page+1), '<a href="'.$link.'"><font face="Trebuchet MS">»</font></a>');
}
}

/* показване на общия брой страници и избор на страница */
echo '<br>';
echo 'Общо страници: '.round($numofpages).'<br>';

per_page("?page=%page", "5");
}
?></td>
</tr>
</table>
</body>
</html>





след това play.php



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Песни</title>
<style type="text/css">
<!--
.txt {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
background-color: #FFFFFF;
border: 1px solid #000000;
}
.btn {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
background-color: #FFFFFF;
height: auto;
width: 55px;
border: 1px solid #000000;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
text-decoration: none;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
}
#table {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
border: 1px solid #000000;
}
.table {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
border: 1px solid #000000;
}
.boxtext {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
color: #000000;
text-decoration: underline;
}
a {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
color: #000000;
}
a:hover {
color: #333333;
}
-->
</style>
</head>

<body>
<?php
include("connect.php");
$id = $_GET['id'];
$sql = mysql_query("SELECT * FROM `songs` WHERE `id`='$id'");
$row = mysql_fetch_array($sql);
?>
<table width="395" border="0" align="center" cellpadding="1" cellspacing="1" class="table">
<tr>
<td colspan="2" class="lfhead"><?php echo "$row[artist] - $row[title]"; ?></td>
</tr>
<tr>
<td width="100">Стил :</td>
<td width="200"><?php
$cat = mysql_query("SELECT * FROM `songs_cat` WHERE `id`='$row[cat]'");
$raw = mysql_fetch_array($cat);
$genername = $raw['value'];
echo "<a href="songs.php?gener=$row[cat]" title="Песни в стил $genername">$genername</a>";
?></td>
</tr>
<tr>
<td>Добавена на :</td>
<td><?php echo $row['date']; ?></td>
</tr>
<tr>
<td>Добавена от:</td>
<td><?php echo $row['author']; ?></td>
</tr>
<tr>
<td>Албум :</td>
<td><?php echo $row['album']; ?></td>
</tr>
<tr>
<td>Размер :</td>
<td><?php echo $row['size']; ?></td>
</tr>
<tr>
<td>Година :</td>
<td align="left"><?php echo $row['year']; ?></td>
</tr>
<tr>
<td colspan="2" align="center"><object type="application/x-shockwave-flash" data="player.swf?son=<?php echo $row['path']; ?>" height="20" width="200">
<param name="movie" value="player.swf?son=<?php echo $row['path']; ?>">
</object></td>
</tr>
<tr>
<td colspan="2" align="center"><a href="broken.php?id=<?php echo $row['id']; ?>" title="Докладвайте за песента <?php echo "$row[artist] - $row[title]"; ?>">Неработещ линк</a> | <a href="<?php echo $row['path']; ?>" target="_blank" title="Изтеглете песента <?php echo "$row[artist] - $row[title]"; ?>">Изтегли</a></td>
</tr>
</table>
</body>
</html>



и сега



правим broken.php



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Песни</title>
<style type="text/css">
<!--
.txt {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
background-color: #FFFFFF;
border: 1px solid #000000;
}
.btn {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
background-color: #FFFFFF;
height: auto;
width: 55px;
border: 1px solid #000000;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
text-decoration: none;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
}
#table {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
border: 1px solid #000000;
}
.table {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none;
border: 1px solid #000000;
}
.boxtext {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
color: #000000;
text-decoration: underline;
}
a {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
color: #000000;
}
a:hover {
color: #333333;
}
-->
</style>
</head>

<body>
<?php
include("connect.php");
$id = $_GET['id'];
$update = mysql_query("UPDATE `songs` SET `broken` = '1' WHERE `songs`.`id` = '$id'");
if($update == true){
$r = "<div align=center" class="boxtext">Вие успешно докладвахте за тази песен.След преглед от администратор тя ще бъде изтрита и/или заместана и/или оправена.Благодарим Ви!</div>";
} elseif($update == false){
$r = "<div align=center" class="boxtext">Вашето докладване е неуспешно.Свържете се с администратор!</div>";
} else {
$r = "";
}
echo $r;
?>
</body>
</html>





и сега playera можете да изтеглите от тук ако не са спрели линк- а



http://lt-bg.eu/wt/player.rar



Системата е написана от Александър Е. Цветанов можете да я използвате за ваш саит Smile но немога да ви дам дизаина Smile

Източник: <!--[if gte mso 9]> Normal 0 21 false false false BG X-NONE X-NONE MicrosoftInternetExplorer4 <![endif]--><!--[if gte mso 9]> <![endif]--><!--[if gte mso 10]> <![endif]-->web-tourist.net
· smilev на January 12 2011 10:37:10 · 0 Коментари · 1614 Прочитания · Отпечатай
Коментари
Няма добавени коментари.
Напиши коментар
Моля влезте, за да коментирате.
Оценка
Рейтингите са достъпни само за регистрирани.

Моля влезте или се регистрирайте за да гласувате.

Няма оценки.
Вход
Потребител

Парола



Не сте регистрирани?
Натиснете тук за регистрация.

Забравена парола?
Натиснете тук за нова.
Анкета
С каква операционна система работите











Трябва да влезете за да гласувате.
ЧАТ
Трябва да влезате за да пуснете съобщение.

Няма съобщения.
Статистика