Created
April 15, 2015 13:43
-
-
Save Michales/bc93affe68b6eb99ddb0 to your computer and use it in GitHub Desktop.
details
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/// stránkování | |
$stranka=isset($_GET['stranka']) ? (int)$_GET['stranka'] : 1; | |
$limit=5; | |
$start=($stranka -1)*$limit; | |
// /stránkování | |
$albs=Array(); | |
$pocetAlb=0; | |
If(isset($_GET['interpret'])) { | |
$where="WHERE Contentgroup='".mysql_real_escape_string($_GET['interpret'])."' AND Album='".mysql_real_escape_string($_GET['album'])."'"; | |
$interpretQ='&interpret='.RawUrlEncode($_GET['interpret']); | |
} | |
Else { | |
$where=''; | |
$interpretQ=''; | |
} | |
$q=MySQL_Query($sql="SELECT (SELECT COUNT(Album) FROM (SELECT * FROM zahranicni $where GROUP BY Album ) p) AS pocet,Album FROM zahranicni $where GROUP BY Album ORDER BY Year,Album LIMIT $start,$limit ") or die(mysql_error()); | |
//echo $sql; | |
While($r=MySQL_Fetch_Assoc($q)) { | |
$albs[]=mysql_real_escape_string($r['Album']); | |
$pocetAlb=$r['pocet']; | |
} | |
$where=Str_Replace('WHERE','AND',$where); // přepsání where pro vyhledávání alb interpreta | |
$query = "SELECT Title,Artist,Album,Track,Year,Length,Composer,Filename,Albumartist,Genre,Contentgroup,Publisher,Web,id,heslo FROM zahranicni WHERE Album IN('".(Implode("','",$albs))."') {$where} ORDER BY FIELD(Album,'".(Implode("','",$albs))."'),Album ASC,Track ASC"; | |
$results = mysql_query($query) or die(Mysql_error()); | |
$aktAlbum=''; | |
$i=0; | |
$a=0; | |
While($result=MySQL_Fetch_Assoc($results)) { | |
$lastResult=$result; // uchová poslední výsledek v proměnné (pro výpis Vydavatele u posledního alba) | |
If($aktAlbum!=$result['Album']) { | |
If($aktAlbum!='') { | |
$a++; | |
?> | |
</tbody> | |
</table> | |
<div class="oddelovac"> </div> | |
<?php } ?> | |
<h4><?php echo htmlSpecialChars($result['Albumartist'],ENT_QUOTES); ?></h4> | |
<h4><?php echo htmlSpecialChars($result['Year'],ENT_QUOTES); ?></h4> | |
<?php | |
$obrazek = '/'.$_GET['interpret'] . '/' . $result['Album'] . '.jpg'; | |
if (!is_file(__DIR__ . $obrazek)) { | |
$serializovane = is_file('chybne_obrazky.txt') ? file_get_contents('chybne_obrazky.txt') : ''; | |
$chybne_obrazky = unserialize($serializovane); | |
if (!isset($chybne_obrazky[$obrazek])) { | |
$chybne_obrazky[$obrazek] = true; | |
$serializovane = serialize($chybne_obrazky); | |
file_put_contents('chybne_obrazky.txt', $serializovane); | |
//mail('michalescz@gmail.com', 'Chybi img', 'Chybi img: ' . $obrazek); | |
} | |
} else { | |
?> | |
<div class="prvok"> | |
<img width="100" height="100" src="<?php echo '/' . rawurlencode($_GET['interpret']) . '/' . rawurlencode($result['Album']) . '.jpg'; ?>" alt="<?php echo htmlspecialchars($_GET['interpret'] . ' - ' . $result['Album']); ?>" title="<?php echo htmlspecialchars($_GET['interpret'] . ' - ' . $result['Album']); ?>" /> | |
<img class="logo" title="<?php echo htmlspecialchars($_GET['interpret'] . ' - ' . $result['Album']); ?>" src="img/logo1.png"> | |
</div> | |
<?php } ?> | |
<h4 style="text-align: center;">Vydavatel: <td><?php echo htmlSpecialChars($result['Publisher'],ENT_QUOTES); ?></td> </h4> | |
<?php if (!$user->is_logged()) { echo 'Pro získání hesla se přihlaš' ; } if ($user->is_logged()) { | |
echo'<p> Heslo k archívu :<font size="3" color="#1E90FF">' . htmlSpecialChars($result['heslo']) . '</font><br>Password for the archive : </font><font size="3" color="#1E90FF"> | |
' . htmlSpecialChars($result['heslo']) . '</font>'; } ?> | |
<table> | |
<thead> | |
<tr> | |
<br> <?php if ($user->is_logged()) { | |
echo'<a target="blank" href="redir.php?id=' . $result['id'] .'"><img width="150" src="img/download.png" alt="Download" /></a>' ; }?> | |
<th class="title">Track</th> | |
<th class="title">Title</th> | |
<th class="title">Artist</th> | |
<th class="title">Composer</th> | |
<th class="title">Length</th> | |
<th class="title">Lyrics</th> | |
</tr> | |
</thead> | |
<tbody> | |
<script type="text/javascript"> | |
function myFunction(e) { | |
var dataString = 'id1=' + e.getAttribute("data-id"); | |
$.ajax({ | |
type: "POST", | |
url: "lyrics.php", | |
data: dataString, | |
cache: false, | |
success: function(data) { | |
$("#test").html(data); | |
$("#test").dialog(); | |
} | |
}); | |
return false; | |
} | |
</script> | |
<?php | |
$aktAlbum=$result['Album']; | |
$i=0; | |
} | |
$i++; | |
?> | |
<tr class="<?=($i%2?'lichy':'sudy')?>"> | |
<td><?php echo htmlSpecialChars($result['Track'],ENT_QUOTES); ?></td> | |
<td><a style="font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 9px; color: #000; text-align: center; text-decoration: none;" onclick="myFunction(this)" data-id="<?php echo htmlSpecialChars($result['Title'],ENT_QUOTES); ?>"><?php echo htmlSpecialChars($result['Title'],ENT_QUOTES); ?></a></td> | |
<td><?php echo htmlSpecialChars($result['Artist'],ENT_QUOTES); ?></td> | |
<td><?php echo htmlSpecialChars($result['Composer'],ENT_QUOTES); ?></td> | |
<td><?php echo Str_Pad(Floor($result['Length']/60),2,'0',STR_PAD_LEFT).':'.Str_Pad($result['Length']%60,2,'0',STR_PAD_LEFT); ?></td> | |
<td><?php $query11 = "SELECT `skladba` FROM `lyrics` WHERE text_id = '".$result['id']."' AND interpret='".mysql_real_escape_string($_GET['interpret'])."' AND active='1'"; | |
$row = mysql_query($query11) or die(Mysql_error()); | |
if ($row && mysql_num_rows($row)) { | |
echo "<a onclick='myFunction(this)' data-id='".$result['id']."'><img width='20' height='20' src='img/lupa.png'></a>"; | |
}else{ | |
echo "<img width='15' height='15' src='img/delete.png'>"; | |
}?> </td> | |
</tr> | |
<?php | |
} | |
?> | |
</tbody><tr class="<?=($i%2?'sudy':'lichy')?>"> | |
<td></td> | |
<td> <?php | |
$poc = mysql_query("SELECT SUM(Length) FROM zahranicni WHERE Album='".mysql_real_escape_string($_GET['album'])."' AND Contentgroup='".mysql_real_escape_string($_GET['interpret'])."' "); | |
if( mysql_num_rows($poc) > 0 ){ | |
$hodnota = mysql_result( $poc, 0 ); | |
echo 'Total time: '; | |
} | |
?> </td><td></td><td></td> | |
<td><?php echo Str_Pad(Floor($hodnota/60),2,'0',STR_PAD_LEFT).':'.Str_Pad($hodnota%60,2,'0',STR_PAD_LEFT); ?><td> </tr> | |
</table> | |
<div class="oddelovac"> </div> | |
<br> | |
<div id="test"></div> | |
<div id="strankovani"> | |
<?php | |
//Odkd přišel na stránku? | |
$od = $_SERVER['HTTP_REFERER']; | |
//Je cesta zpět? | |
if($od != null){ | |
//Naformátujeme adresu | |
$parse = parse_url($od); | |
$format = $parse['host']; | |
//Vrať se tam | |
echo "<a href=\"$od\">Zpět</a>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Coucou