<?php
if(isset($_GET['sort'])){
   if(
$_GET['sort'] == "date")
      
setcookie('sort','date');
   elseif(
$_GET['sort'] == "title"){
      
setcookie('sort','title');
   }
   
header("Location: ".$_SERVER['PHP_SELF']."\n\n");
   die();
//header protection
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Chillout Mixes</title>
<meta name="keywords" content="chillout music mixes cardamar zeilenga" />
<meta name="description" content="Free chillout music mixes" />
<link href="default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="sarissa.js"></script>
<script type="text/javascript" src="dhListAjax.js"></script>
<script type="text/javascript">
<!--
   var request = null;
var done = false;
addEvent(window,'load',init);
// based off of the init function from
// http://www.yourhtmlsource.com/examples/ajaxformsubmission.html
function init(){
   if(!Sarissa) return;
   request = new XMLHttpRequest();
   if(!request || !document.getElementById) return;
   var forms = document.getElementsByTagName('form');
   for(var i=0;i<forms.length; i++){
      if(forms[i].className.match(/\bajaxForm\b/)){
         addEvent(forms[i],'submit',submitToList);
      }
   }

  addEvent(document.getElementById('unsubButton'),'click',unsubSet);
}
 
//-->
</script>
<style type="text/css">
.block{
   display: block;
}

.hidden{
   display: none;
}
</style>
</head>
<body>
<div id="header">
<h1>Chillout Mixes</h1>
<h2>The source for free chillout</h2>
</div>
<div id="content">
<div id="colOne">
<div id="request">
<h2>Request to Artists and DJs</h2>
If you make mixes like the ones found here and would like for yours to be included, please send an email to <a href="mailto:webmaster@chilloutmixes.com" title="webmaster at chilloutmixes dot com">webmaster@chilloutmixes.com</a> so we can work things out and spread your work to the world. Thank you.
</div>
<?php
// simple script to show all files in current
$evil = array('.','..','.htaccess','index.php','source.php','default.css','cgi-bin','images''tla.xml'"robots.txt""favicon.ico""favicon.gif"); // files to ignore
$dh opendir("./");
$i=0;
/**
 * The number of file entries to appear in any one page
 *
 */
define("ENTRIES_PER_PAGE",10);
while((
$file=readdir($dh))){
   if(
in_array($file,$evil) || preg_match('/.*\.diz$/',$file) ||
     
preg_match('/.*\.md5$/',$file) || preg_match('/.*\.php$/',$file) ||
     
preg_match('/.*\.js/',$file) || preg_match('/.*\.swp$/',$file))
        continue;
    
$filenames[] = $file;
   
$filetimes[] = filemtime($file);
    
$files[$i]['name']=$file;
   
$files[$i]['modtimestring']=date('Y-m-d H:i:s',filemtime($file));
    
//1024*1024 = 1048576, bytes in a megabyte
    
$files[$i]['size'] = round(filesize($file)/1048576*10)/10;
    
$files[$i]['md5_s']="";
    
$md5 = @file_get_contents($file.'.md5');
    if(
$md5)$files[$i]['md5_s'] = "MD5 Hash: ".$md5."<br/>";
    
$files[$i]['content'] = @file_get_contents($file.".diz");
    if(
$files[$i]['content'] !=""$files[$i]['content'] .= "<br/>";
    
$i++;
}
// sort
if(isset($_COOKIE['sort']) && $_COOKIE['sort'] == "date"){
   
array_multisort($filetimesSORT_DESCSORT_NUMERIC$files);
} else {
   
array_multisort($filenames,SORT_ASC,SORT_STRING,$files);
}
$page = ($_GET['page']<1?0:$_GET['page']-1); // offset for array index
$start ENTRIES_PER_PAGE*$page;
// need to determine the number of pages to display
$num_pages ceil(count($files)/ENTRIES_PER_PAGE);
for(
$j=$start;$j<$start+ENTRIES_PER_PAGE;$j++){    
    if (
$files[$j]['name']){
        
$fixed_name str_replace('_',' ',$files[$j]['name']);
        echo <<<EOP
<div class="file">
<h2>
{$fixed_name}</h2>
{$files[$j]['content']}
<a href="
{$files[$j]['name']}">Download {$files[$j]['name']}</a>({$files[$j]['size']} MB)<br/>
Last modified: 
{$files[$j]['modtimestring']}<br/>
{$files[$j]['md5_s']}
</div>
EOP;
    }
}
echo 
"<div class=\"pages\">";
if(
$page>=1) echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$page.'" title="Go To the Previous Page">&lt;</a>'// no previous on first page and $page has -1 already in it
for($k=0;$k<$num_pages;$k++){
    
$disp $k+1;
    if(
$k==$page){ // no link if current page, just print number
        
echo " "$disp " ";
    }else{ 
// link
        
echo " <a href=\"{$_SERVER['PHP_SELF']}?page=$disp\" title=\"Go to Page $disp\">$disp</a> ";
    }
}
if(
$page!=$num_pages-1){
    
$disp $page+2;
    echo 
'<a href="'.$_SERVER['PHP_SELF']."?page=$disp\" title=\"Go To the Next Page\">&gt;</a>"// no next on the last page
}
echo 
"</div>";
?>
</div>
<div id="colTwo">
<h2>Recent Updates</h2>
<?php
$lastTwo 
shell_exec('ls -t *.mp3 | head -n 2');
$recentAr explode("\n",$lastTwo);
$splitAr = array(explode(" - ",$recentAr[0]),
   
explode(' - ',$recentAr[1]));
$splitAr[0][1] = substr($splitAr[0][1],0,-4);
$splitAr[1][1] = substr($splitAr[1][1],0,-4);
?>
   <h3><?php echo trim($splitAr[0][0]);?></h3>
   <p><?php echo trim($splitAr[0][1]);?>. <a
   href="http://chilloutmixes.com/<?php echo $recentAr[0];?>"
title="Download Mix">Download</a></p>
   <h3><?php echo trim($splitAr[1][0]);?></h3>
   <p><?php echo trim($splitAr[1][1]);?>. <a
   href="http://chilloutmixes.com/<?php echo $recentAr[1];?>"
title="Download Mix">Download</a></p>
<h2>Artist Links</h2>
<ul>
<li><a href="http://soundcloud.com/DJQB">DJ QB</a></li>
<li><a href="http://soundcloud.com">SoundCloud</a></li>
<li><a href="http://www.mixcloud.com/">mixcloud</a></li>
<li><a href="http://www.di.fm">Digitally Imported Radio</a></li>
<li><a href="http://www.quad341.com">Quad's World</a></li>
</ul>
<div id="sort_options">
   The listing can be sorted differently based on your preference. Please choose how you would like it sorted below (sets a cookie):
   <ul>
      <li><a href="<?php echo $_SERVER['PHP_SELF'];?>?sort=title" title="Sort by title">Sort by title</a></li>
      <li><a href="<?php echo $_SERVER['PHP_SELF'];?>?sort=date" title="Sort by date">Sort by date</a></li>
   </ul>
</div>
<h2>Mailing List</h2>
<div id="loadingBox" class="hidden">
<img src="images/ajax_loading.gif" alt="AJAX loading image" 
title="Please wait while your data is submitted" />
</div>
<?php if(!isset($_GET['code'])){?>
<div id="messageBox" class="hidden"></div>
<?php } else {?>
<div id="messageBox" class="block">
<?php switch($_GET['code']){
case 
1: echo "Email successfully added";
   break;
case 
2: echo "Email successfully removed";
   break;
case 
3: echo "Verification email sent";
   break;
case -
1: echo "Email already on announce list";
   break;
case -
2: echo "Email not on list (nothing removed)";
   break;
case -
3: echo "The provided email address is invalid. Please try again";
   break;
case -
4: echo "One or more of the required fields was not filled in.";
   echo 
" Please try again.";
   break;
case -
5: echo "The second email address does not match the first.";
   echo 
" Please try again.";
   break;
}
?>
</div>
<?php ?>
<div id="listForm" <?php if(isset($_GET['code']) && $_GET['code']>-2){?>
class ="hidden"<?php } else { ?>class="block"<?php ?>>
<form action="announceListHandler.php" method="GET" class="ajaxForm">
<input type="hidden" id="unsubBox" name="unsubBox" value="false" />
<label for="name">Name</label><br/>
<input type="text" name="name" id="name"/><br />
<label for="email">Email <small>Required</small></label><br/>
<input type="text" name="email" id="email"><br />
<input type="submit" id="joinButton" name="submit" value="Join" />
<input type="submit" id="unsubButton" name="unsub" value="Unsubscribe"/>
</form>
</div>
<div id="ads">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- ChilloutMixes-Vertical -->
<ins class="adsbygoogle"
     style="display:inline-block;width:160px;height:600px"
     data-ad-client="ca-pub-2561184740981554"
     data-ad-slot="8620643024"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
<div style="clear: both;">&nbsp;</div>
</div>
<div id="footer">
<p>Copyright &copy; 2006-<?php echo date('Y');?> Quad341. Designed by <a href="http://www.freecsstemplates.org"><strong>Free CSS Templates</strong></a></p>
</div>

</body>
</html>