Jump to content

p9j

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

p9j's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hi all, i have this music website and i have to upload every album under this folder "newsongs" ... in AlbumName folder i have normal quilty songs and HQ folder..under HQ folder i have High Quilty songs for each album. i have this coding which moves Album folder and normal quilty songs to other folder "songs" but i also want to move subfolder "HQ" and High Quilty songs with AlbumName folder for($i=0;$i<=$ct;$i++) { $alb=$alname[$i]; $cat=$catname[$i]; $albids=$albid[$i]; $fon=$folder_name[$i]; $tmp_name=$doc_root."newsongs/$fon"; $uploads_dir=$doc_root."songs/$cat/$fon"; if ($handle = opendir($tmp_name)) { /* This is the correct way to loop over the directory. */ while (false !== ($file = readdir($handle))) { //echo "$file\n <br>"; if($file !=='..' and $file !=='.') { $song_path="songs/$cat/$fon/$file"; if(!is_dir("$tmp_name/$file") and (!is_dir("$uploads_dir/$file"))) { if(copy("$tmp_name/$file", "$uploads_dir/$file")) { $cp=1; $ext=substr($file,-4); if($ext=='.mp3') $insqry=mysql_query(" insert into tbl_songs set song_name='$file', album_id='$albids', artist_id='$artid', song_path='$song_path' "); unlink($tmp_name.'/'.$file); } else { echo "could not move songs "; } } } if($insqry) $msg="songs Added to the database"; else $msg="songs Not Added to the database"; } closedir($handle); thnx in advnce
  2. and thats 20 newest albums code in index.php /** * Only list 20 newest albums if this is the homepage */ if (!$HTTP_GET_VARS) $query = "SELECT TO_DAYS(now())-TO_DAYS(album.post_date)as date_diff, album.album_name, artist.name as artist_name, album.album_photo, album.album_info, album.id as album_id, artist.id as artist_id,album.post_date FROM album, artist WHERE album.artist_id = artist.id ORDER BY album.id DESC LIMIT 20"; else $query = "SELECT TO_DAYS(now())-TO_DAYS(album.post_date)as date_diff, album.album_name, artist.name as artist_name, album.album_photo, album.album_info, album.id as album_id, artist.id as artist_id FROM album, artist WHERE album.artist_id = artist.id ORDER BY album.id DESC LIMIT 20"; $result = mysql_query($query) or die(mysql_error()); print("<td valign='top' class='album_bg' style='border-top: 0px solid #FFFFFF;'> <table cellpadding='0' cellspacing='0' class='moduletable'> <tr> <td valign='top' class=title_class align=left> ".$lang['20_Newest_Albums']." </td> </tr></table>"); print("<title>".PGTITLE."</title>"); print("<table cellpadding=2 cellspacing=2 width=100%> <tr><td> \n"); $lastchar = ''; while( $album = mysql_fetch_assoc($result) ) { // get initial name character if( $sortby == 'album' ) { $thischar = $album['album_name']{0}; $display = $album['album_name']." - ".$album['artist_name']; } else { $thischar = $album['artist_name']{0}; $display = $album['album_name']; } // Check to see if different than last if( $lastchar != $thischar ) { if( $lastchar != '' ) { print(""); } } // Print album Info //echo "<br/>album['album_photo'] urldecode : ".urldecode($album['album_photo']); //echo "<br/>album['album_photo'] : ".$album['album_photo']; $query = 'select count(*) as total from song where song.album_id = '.$album['album_id']; $totalSongs = mysql_query($query); $totalSongs = mysql_fetch_assoc($totalSongs); $totalSongs = $totalSongs['total']; [attachment deleted by admin]
  3. hey evry1 whtz up?? i need help with this..i have this website: livepunjabi.com/music and on home page underneath 20 Newest albums i want show 10 albums from each Genre (category) example: livepunjabi.com/music/index.php?action=genre&id=2 same thing with other genres. here is the index page code: /********** Genre Functions **********/ function genre() { global $HTTP_POST_VARS,$HTTP_GET_VARS,$HTTP_SERVER_VARS,$HTTP_SESSION_VARS,$HTTP_COOKIE_VARS,$HTTP_POST_FILES; $genre = $HTTP_GET_VARS['id']; if( $genre != '' ) { $this->displayGenre($genre); } else { $this->listGenres(); } } function displayGenre( $id ) { global $HTTP_POST_VARS,$HTTP_GET_VARS,$HTTP_SERVER_VARS,$HTTP_SESSION_VARS,$HTTP_COOKIE_VARS,$HTTP_POST_FILES; $sortby = $HTTP_POST_VARS['sort']; if( $id == 'all' ) { $query = "SELECT * FROM genre WHERE 1"; } else { $query = "SELECT * FROM genre WHERE id = '".$id."'"; } $result = mysql_query($query); $genre = mysql_fetch_assoc($result); //$query = "SELECT TO_DAYS(now())-TO_DAYS(album.post_date)as date_diff, album.id as album_id, album.album_name, album.album_photo, artist.name as artist_name FROM album, artist WHERE ".(($id!='all')?"album.genre_id = '".$id."' AND ":"")."album.artist_id = artist.id ORDER BY ".(($sortby=='album')?'album.album_name':'artist.name')." ASC"; $query = 'select * from artist where genre_id = '.mysql_real_escape_string($id).' ORDER BY artist.name ASC'; $result = mysql_query($query) or die(mysql_error()); // Genre print("<title>".$genre['genre']."</title>"); print("<META name='description' content='".$genre['genre']."'> <META name='distribution' content='global'> <META NAME='ROBOTS' CONTENT='index,follow'> <META NAME='REVISIT-AFTER' CONTENT='3 days'> <META name='keywords' content='".$genre['genre']."'>"); print("<table cellpadding='0' cellspacing='0' class='moduletable'> <tr> <td class='title_class' valign='top'>".$genre['genre']." </td> </tr></table> \n"); print("<div id='content' class=content>"); $lastchar = ''; while( $album = mysql_fetch_assoc($result) ) { $artistName = $album['name']; if (is_file($album['artist_photo'])) { $artistPhoto = $album['artist_photo']; } else { $artistPhoto = "images/notavailable.gif"; } $song_ids = $this->getArtistSongs($album['id']); print("<div id='content' class=content><table class ='albumbox'><tr><td><table ><tr><td><table ><tr><td><div id='newartframe'><div id='newartfr'><a href='index.php?action=artist&id=".$album['id']."'><img src='$artistPhoto' width=86 height=86/></a><br><br>"); print("<b><a href='index.php?action=artist&id=".$album['id']."'>$artistName</a></b><br />"); print("Total Albums: ".$this->getAlbumCount($album['id']).'<br />'); print("Total Songs: ".$this->getSongCount($album['id']).'<br />'); print('<a href=javascript:playMultiple("'.$song_ids.'");>Listen All</a>'); print("</div></div></td></tr></table></td></tr></table></td></tr></table>"); } } function getAlbumCount($artistId) { $query = "select count(*) as 'total' from album where artist_id = '$artistId'"; $results = mysql_query($query); $row = mysql_fetch_assoc($results); return $row['total']; } function getSongCount($artistId) { $query = "select count(*) as 'total' from song where artist_id = '$artistId'"; $results = mysql_query($query); $row = mysql_fetch_assoc($results); return $row['total']; } function getAlbumSongCount($albumId) { $query = "select count(*) as 'total' from song where album_id = '$albumId'"; $results = mysql_query($query); $row = mysql_fetch_assoc($results); return $row['total']; } function listGenres() { global $HTTP_POST_VARS,$HTTP_GET_VARS,$HTTP_SERVER_VARS,$HTTP_SESSION_VARS,$HTTP_COOKIE_VARS,$HTTP_POST_FILES; $query = "SELECT * FROM genre"; $result = mysql_query($query); print("<div id='content' class=content>"); while( $genre = mysql_fetch_assoc($result) ) { print("<a href='".$this->thisfile."?action=genre&id=".$genre['id']."'>".$genre['genre']."</a><br>"); } print("</div>"); } thanks in advance:)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.