Go Back   CodingForums.com > Web Projects and Services Marketplace > Web Projects > Small projects (quick fixes and changes)

Notices

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-09-2011, 06:54 PM   PM User | #1
DJ Hands3
New Coder

 
Join Date: Feb 2009
Posts: 90
Thanks: 5
Thanked 0 Times in 0 Posts
DJ Hands3 is an unknown quantity at this point
Sort files by last date modified

1) Project Details: (be as specific as possible):

Need to show files by last modified date rather than alphabetical order so visitors can see the newest file to download

2) Payment Amount:

TBC - Please quote your price

3) Payment method/ details (Paypal, check? Timeline?):

Paypal

4) Additional Info (about project or potential bidders):

Heres the page code:

PHP Code:
<?php

// Error reporting:
error_reporting(E_ALL^E_NOTICE);

// Including the DB connection file:
require 'connect.php';

$extension='';
$files_array = array();
$unsorted_files_array = array();

/* Opening the thumbnail directory and looping through all the thumbs: */

$dir_handle = @opendir($directory) or die("There is an error with your file directory!");

while (
$file readdir($dir_handle)) 
{
    
/* Skipping the system files: */
    
if($file{0}=='.') continue;

    
/* end() returns the last element of the array generated by the explode() function: */
    
$extension strtolower(end(explode('.',$file)));

    
/* Skipping the php files and files not to be available: */
    // Thanks to -  Nile @ http://www.codingforums.com/showthread.php?t=214073
   
$skip = array("php""Z_Uncut.mp3""kie1.mp3""London_Thing_Trinity_JAN2011.mp3","kie1.mp3");
//specify the files/extensions you want to skip

if(in_array($file$skip) || in_array($extension$skip)){ 
//if the $file or $extension is found in $skip
    
continue;
}

    
$unsorted_files_array[]=$file;
}

/* Sorting the files alphabetically */

sort($unsorted_files_array,SORT_STRING);


//Set pagination config variables
$page       = isset($_GET['page']) ? (int) $_GET['page'] : 0;
$per_page   10;
$base_url   'index.php?';
$total_rows count($unsorted_files_array);

foreach(
$unsorted_files_array as $file)
{
    
$file_count++;

    if((
$file_count-1) < $page) continue;
    if((
count($files_array) + 1) > $per_page) continue;
    
    
$files_array[]=$file;
}

//Add the pagination library
require 'Pagination.php';

//Initiate the Pagination library
$pagination = new CI_Pagination();

$pagination_config['base_url']   = $base_url.'page=';
$pagination_config['total_rows'] = $total_rows;
$pagination_config['per_page']   = $per_page;
$pagination_config['cur_page']   = $page;

$pagination->initialize($pagination_config);

$pagination_link $pagination->create_links();

# intialize a new array of files that we want to show
$file_downloads=array();

# add a file to the $goodfiles array if its name doesn't begin with a period
foreach($files_array as $f){
  if(
strpos($f,'.')!==0){
    
array_push($file_downloads,$f);
  }
}

$file_downloads=array();

$result mysql_query("SELECT * FROM download_manager");

if(
mysql_num_rows($result))
while(
$row=mysql_fetch_assoc($result))
{
    
/*  The key of the $file_downloads array will be the name of the file,
        and will contain the number of downloads: */
    
$pages array_chunk($file_downloads5);
    
$file_downloads[$row['filename']]=$row['downloads'];
}

$random_intro = array("kie1.mp3",
                    
"kie1.mp3");
srand(time());
$sizeof count($random_intro);
$random = (rand()%$sizeof);

$random_advert = array("London_Thing_Trinity_JAN2011.mp3",
                    
"London_Thing_Trinity_JAN2011.mp3");
srand(time());
$sizeof count($random_advert);
$random = (rand()%$sizeof);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>www.djhandsfree.co.uk - Podcast area - lock into DJ Handsfree Saturdays 4-6pm live on www.flexfm.co.uk and London on 99.7FM</title>

<style type="text/css">

body{
margin:0;
padding:0;
line-height: 1.5em;
}

b{font-size: 110%;}
em{color: red;}

#maincontainer{
width: 1200px; /*Width of main container*/
margin: 0 auto; /*Center container on page*/
}

#topsection{
height: 180px; /*Height of top section*/
}

#topsection h1{
margin: 0;
padding-top: 15px;
}

#contentwrapper{
float: left;
width: 100%;
}

#contentcolumn{
margin-left: 200px; /*Set left margin to LeftColumnWidth*/
}

#leftcolumn{
float: left;
width: 200px; /*Width of left column*/
margin-left: -1200px; /*Set left margin to -(MainContainerWidth)*/

}

#footer{
clear: left;
width: 100%;
background: black;
color: #FFF;
text-align: center;
padding: 4px 0;
}

#footer a{
color: #FFFF80;
}

.innertube{
margin: 10px; /*Margins for inner DIV inside each column (to provide padding)*/
margin-top: 0;
}

</style>




<link rel="stylesheet" type="text/css" href="styles.css" />
<style type="text/css" media="screen">
@import "general.css"; /* Mostly just text styling. */

#Content {
  text-align:center; /* Hack for IE5/Win */
  width:586px;
  margin:0px auto; /* Right and left margin widths set to "auto" */

  padding:15px;
  border:1px dashed #333;
  background-color:#fff;
  }
</style>
<style type="text/css" media="screen">
@import "general.css"; /* Mostly just text styling. */

#poll {
  text-align:center; /* Hack for IE5/Win */
  width:300px;
  margin:0px auto; /* Right and left margin widths set to "auto" */

  padding:15px;
  border:1px dashed #333;
  background-color:#fff;
  }
</style>

<style type="text/css">

/*Credits: Dynamic Drive CSS Library */
/*URL: http://www.dynamicdrive.com/style/ */<!-- Hide entire CSS code from IE6 -->
<![if !IE 6]>



.shiftcontainer{
position: relative;
left: 7px; /*Number should match -left shadow depth below*/
top: 7px; /*Number should match -top shadow depth below*/
}

.shadowcontainer{
width: 600px; /* container width*/
background: transparent url(img/bigshadow.gif) no-repeat bottom right;
}

.shadowcontainer .innerdiv{
/* Add container height here if desired */
background-color: white;
border: 1px solid gray;
padding: 6px;
position: relative;
left: -7px; /*shadow depth*/
top: -7px; /*shadow depth*/
}

</style>



<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.2.6.css" media="screen" />

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>

</head>

<body>
<div id="maincontainer">

<div id="topsection"><div class="innertube"><img border="0" src="img/logo.jpg" width="1022" height="113"><br>DJ Handsfree Podcasts - LOCK INTO DJHANDSFREE SATURDAYS 4-6PM LIVE ON FLEXFM.CO.UK AND 99.7 FM LONDON</div></div>

           <div id="contentwrapper">
<div id="contentcolumn">
<div class="innertube">


      <div id="Content">
        <a target="_blank" href="http://www.flexfm.co.uk"><br>
<img border="0" src="admin/images/carbonpirate324x243.jpg" width="324" height="243"></a><br><br><?php echo $pagination_link?><br><br>

    <?php 

        
foreach($files_array as $key=>$val)
        {
            echo 
'<div class="shiftcontainer">
<div class="shadowcontainer">
<div class="innerdiv">
<b>'
.urlencode($val).'</b> <br />
This mix has been downloaded and listened to - '
.(int)$file_downloads[$val].' time(s)<br /><br />
       <a href="download.php?file='
.urlencode($val).'" title="Download file '.$val.'"><img border="0" src="img/downloads.png" width="48" height="48" align="middle"></a> <a href="listen.php?file='.urlencode($val).'&intro='.$random_intro[$random].'&advert='.$random_advert[$random].'&mix='.urlencode($val).'" title="Stream this file now! '.$val.'"><img border="0" src="img/play.png" width="48" height="48" align="middle"></a>
 </div>
</div>
</div>
      <br />


<div class="shiftcontainer2">
<div class="shadowcontainer2">
</div>
</div>' 
;
        }
    
    
?>
    <br />
    <?php echo $pagination_link?>

 </div>

   </div>
</div>
</div>

     <div id="leftcolumn">
<div class="innertube">
<?php include("guest.php"); ?> <br>


</div></div>
</div>

</body>
</html>
Website: http://www.djhandsfree.co.uk
DJ Hands3 is offline   Reply With Quote
Old 01-16-2011, 01:17 PM   PM User | #2
DJ Hands3
New Coder

 
Join Date: Feb 2009
Posts: 90
Thanks: 5
Thanked 0 Times in 0 Posts
DJ Hands3 is an unknown quantity at this point
resolved

Thanks, small project complete
DJ Hands3 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:36 AM.


Advertisement
Log in to turn off these ads.