Ir para conteúdo
Fórum Script Brasil

medeiroscv

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre medeiroscv

  • Data de Nascimento 20/11/1979

Contatos

  • MSN
    contato@sucessonoradio.com
  • Website URL
    http://
  • ICQ
    0

Perfil

  • Gender
    Male

medeiroscv's Achievements

0

Reputação

  1. SOU NOVO AQUI, ESSE É MEU 1º POST. GALERA ME AJUDE POR FAVOR, COMPREI UM SCRIPT PARA EU DISPONIBILIZAR ARQUIVOS PARA DOWNLOAD PARA EMISSORAS DE RÁDIO PARA ISSO TENHO QUE CRIAR PASTAS COM O NOME DO DIA DO MES. EX: DIA 01 DIA 02 DIA 03 E POR AI VAI. MAIS AO LISTAR AS PASTAS ELE NÃO TA LISTANDO NA ORDEM FICA POR EXEMPLO DIA 10 DIA 01 DIA 02 DIA 11 DIA 20 DESSA FORMA NÃO DÁ. ESSE É O UNICO PROBLEMA DO SCRIPT, alguém PODE ME AJUDAR??? <?php /****************************************************************************** # Advanced File Manager v2.0 #****************************************************************************** # Author: Convergine.com # Email: info@convergine.com # Website: [url=http://www.convergine.com]http://www.convergine.com[/url] # # # Version: 2.0 # Copyright: © 2009 - Convergine.com # Icons from PixelMixer - [url=http://pixel-mixer.com/basic_set/]http://pixel-mixer.com/basic_set/[/url] # #*******************************************************************************/ ######################### DO NOT MODIFY (UNLESS SURE) ######################## session_start(); require_once("includes/dbconnect.php"); //Load the settings require_once("includes/functions.php"); //Load the functions $msg=""; $files_table = array(); $files_table_sub = array(); if(isset($_SESSION["logged_in"]) && $_SESSION["logged_in"]!=true){ header("Location: index.php"); exit(); } else { //get access level if(isset($_SESSION["accesslevel"])){ $access = $_SESSION["accesslevel"]; //determin admin or not. if(stristr($access,"abcdef")){ $level="admin"; }else{ $level="user"; } } else { header("Location: index.php"); } ######################### DO NOT MODIFY (UNLESS SURE) END ######################## $filter = " WHERE 1 "; //default filter variable. getting rid of undefined variable exception. $bgClass="even"; // default first row highlighting CSS class $files_table = array(); //var with php generated html table. $view_dir = (!empty($_REQUEST["view_dir"]))?strip_tags(str_replace("'","`",$_REQUEST["view_dir"])):''; if($level=="user"){ //permission check $q="SELECT upload_dirs FROM users WHERE id='".$_SESSION["idUser"]."'"; $res=mysql_query($q); $rr=mysql_fetch_assoc($res); $folders = str_replace(',',"','",$rr["upload_dirs"]); //get users folder /* $q="SELECT folders.id as fid FROM folders RIGHT JOIN users ON folders.name=users.upload_dir WHERE users.id='".$_SESSION["idUser"]."'"; $res=mysql_query($q); $rr=mysql_fetch_assoc($res); $folderID= $rr["fid"];*/ if(!stristr($access,"i")){ //if user can't see all files - show only his files in his assigned folders if(stristr($access,"t")){ //if user can view only his uploaded files if(empty($view_dir)){ $filter.= " AND userID='".$_SESSION["idUser"]."'"; } else { $filter.= " AND userID='".$_SESSION["idUser"]."'"; //$filter.= " AND catID='".$view_dir."' "; } } else { if(empty($view_dir)){ //$filter.= " AND catID IN ('".$folders."')"; } else { //$filter.= " AND catID='".$view_dir."' "; } } $pageTitle = "Files"; } else { $pageTitle = "Files"; } } else { //admin //if(!empty($view_dir)){ $filter .= " AND catID='".$view_dir."' "; } $pageTitle = "Files"; } //paging settings // how many rows to show per page $rowsPerPage = 9999; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_REQUEST['page'])) { $pageNum = $_REQUEST['page']; } $offset = ($pageNum - 1) * $rowsPerPage; //CREATE PAGING LINKS // how many rows we have in database $query = "SELECT COUNT(id) AS numrows FROM files ".$filter; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum){ $nav .= " $page "; // no need to create a link to current page } else { $nav .= " <a href=\"java script:document.ff21.page.value='".$page."';document.ff21.submit();\">$page</a> "; } } // creating previous and next link // plus the link to go straight to // the first and last page if ($pageNum > 1){ $page = $pageNum - 1; $prev = " <a href=\"java script:document.ff21.page.value='".$page."';document.ff21.submit();\">Prev</a> "; $first = " <a href=\"java script:document.ff21.page.value='1';document.ff21.submit();\">1st Page</a> "; } else { $prev = ' '; // we're on page one, don't print previous link $first = ' '; // nor the first page link } if ($pageNum < $maxPage){ $page = $pageNum + 1; $next = " <a href=\"java script:document.ff21.page.value='".$page."';document.ff21.submit();\">Next</a> "; $last = " <a href=\"java script:document.ff21.page.value='".$maxPage."';document.ff21.submit();\">Last</a> "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' '; // nor the last page link } //"delete selected files" action processing. if(!empty($_REQUEST["files_delete"]) && $_REQUEST["files_delete"]=="yes"){ $filesToDel = (!empty($_REQUEST["filesToDel"]))?strip_tags(str_replace("'","`",$_REQUEST["filesToDel"])):''; if(is_array($_POST['filesToDel'])){ if(join(",", $_POST['filesToDel'])!='') { //select file path to delete it from server and free up some space. $sql="SELECT id,path FROM files WHERE id IN ('".join("','", $_POST['filesToDel'])."')"; $result=mysql_query($sql) or die("oopsy, error when tryin to select files 1"); if(mysql_num_rows($result)>0){ while($rr=mysql_fetch_assoc($result)){ @unlink($_SERVER['DOCUMENT_ROOT'].$rr["path"]); //delete file from server } } //delete file from database $file_titles=""; for($r=0;$r<count($_POST['filesToDel']);$r++){ $file_titles.=getFileTitle($_POST['filesToDel'][$r])."; "; } $sql="DELETE FROM files WHERE id IN ('".join("','", $_POST['filesToDel'])."')"; $result=mysql_query($sql) or die("oopsy, error when tryin to delete files 2"); $msg = "Files with id ".join(",", $_POST['filesToDel'])." were deleted."; addLog($_SESSION["idUser"],"Deleted following files: ".$file_titles); $notice = sendNotice('notify_delete'); if($notice){ //send notice to system mail send_mail("File(s) were deleted!", getUser($_SESSION["idUser"])." have successfully deleted following files: $file_titles"); } } } } //10-02-2011 $c1=0; $main_attr = array(); if($level=="user"){ $qN="SELECT * FROM folders WHERE parentID='0' AND id IN ('".$folders."')"; } else { $qN="SELECT * FROM folders WHERE parentID='0'"; } $resN = mysql_query($qN) or die(mysql_error()); if(mysql_num_rows($resN)>0){ while($rN=mysql_fetch_assoc($resN)){ $c1++; $main_attr[$rN["id"]] = $rN["name"]; //FILES TABLE GENERATION TO SHOW IN HTML BELOW $sql="SELECT * FROM files ".$filter." AND catID='".$rN["id"]."' ORDER BY title ASC LIMIT ".$offset.", ".$rowsPerPage; //echo $sql; $result=mysql_query($sql) or die("error getting files from db"); if(mysql_num_rows($result)>0){ while($rr=mysql_fetch_assoc($result)){ if($rr["size"]>1048576){ //if more than 1MB show MB else show KB $this_file_size= $rr["size"]/1024/1024; $prefix="MB"; } else { $this_file_size= $rr["size"]/1024; $prefix="KB"; } //PERMISSION CHECK - for showing EDIT FILE icon. if($rr["userID"]==$_SESSION["idUser"] && stristr($access,"k")){ /* logged in users file + has right to edit his files*/ $editable="<a href=\"edit_file.php?id=".$rr["id"]."\"><img src=\"images/pencil_16.png\" alt=\"Edit this file\" border=\"0\"/></a>"; } else if(stristr($access,"l")){ /* not current users file but has rigt to edit all files*/ $editable="<a href=\"edit_file.php?id=".$rr["id"]."\"><img src=\"images/pencil_16.png\" alt=\"Edit this file\" border=\"0\"/></a>"; } else { /* doesnt have right to edit files.*/ $editable = ""; } $bgClass=($bgClass=="even"?"odd":"even"); if(!isset($files_table[$rN["id"]])){ $files_table[$rN["id"]] = ""; } $files_table[$rN["id"]] .="<tr class=\"".$bgClass."\">"; $files_table[$rN["id"]] .=""; if((stristr($access,"h") && !stristr($access,"j") && $rr["userID"]==$_SESSION["idUser"]) || (stristr($access,"j")) ){ //if permissions allow to delete files. $files_table[$rN["id"]] .="<td height=\"24\"><input name=\"filesToDel[]\" type=\"checkbox\" value=\"".$rr["id"]."\" /></td>"; } else { $files_table[$rN["id"]] .= "<td height=\"24\"> </td>"; } $files_table[$rN["id"]] .= "<td>".$rr["title"]."</td>"; $files_table[$rN["id"]] .= "<td>".number_format($this_file_size,1,".",",")." ".$prefix."</td>"; $files_table[$rN["id"]] .= "<td>".$rr["extension"]."</td>"; $query2="SELECT * FROM folders ORDER BY name ASC"; $result2=mysql_query($query2) or die("error getting folders from database"); while($rr2=mysql_fetch_assoc($result2)){ //$new_folders[]= $rr["id"]; //$new_folders_names[]= $rr["name"]; $new_folders_namesID[$rr2["id"]]= $rr2["name"]; } // $files_table[$rN["id"]] .= "<td>".$new_folders_namesID[$rr["catID"]]."</td>"; $files_table[$rN["id"]] .= "<td>".date("d/m/Y",strtotime($rr["dateUploaded"]))."</td>"; $fileInfo = getFileInfo($rr["id"]); //check if user can share (his / or by permission) file if(strstr($access,"m")==true){ $files_table[$rN["id"]] .= "<td><a href=\"sharelink.php?id=".$rr["id"]."\"><img src=\"images/right_16.png\" border=\"0\"></a></td>"; } else { if($fileInfo[3]==$_SESSION["idUser"]){ $files_table[$rN["id"]] .= "<td><a href=\"sharelink.php?id=".$rr["id"]."\"><img src=\"images/right_16.png\" border=\"0\"></a></td>"; } else { $files_table[$rN["id"]] .= "<td> </td>"; } } $files_table[$rN["id"]] .= "<td><a href=\"download.php?path=".$rr["path"]."\"><img src=\"images/save_16.png\" alt=\"Download File\" border=\"0\"/></a> ".$editable; //if($fileInfo[3]==$_SESSION["idUser"] || $_SESSION["idUser"]=="1"){ $files_table[$rN["id"]] .= " <a href=\"messages.php?file=".$rr["id"]."\"><img src=\"images/bubble_16.png\" alt=\"".getCommentCount($rr["id"])." File Messages\" border=\"0\"/></a>(".getCommentCount($rr["id"]).") </td></tr>"; // } $files_table[$rN["id"]] .= "</td></tr>"; } // end of all files from db query (end of while loop) //show button to complete file deletion if proper permissions. if(stristr($access,"h") || stristr($access,"j")){ $files_table[$rN["id"]] .="<tr><td height=\"32\" colspan=\"7\"><input name=\"delete_files\" type=\"submit\" value=\"Delete Selected\" /></td></tr>"; } else { $files_table[$rN["id"]] .="<tr><td height=\"32\" colspan=\"7\"> </td></tr>"; } } else { //0 files found in database. ( end of IF mysql_num_rows > 0 ) if(!isset($files_table[$rN["id"]])){ $files_table[$rN["id"]] = ""; } $files_table[$rN["id"]] .="<tr><td colspan=\"7\"></td></tr>"; } } } // SUBS $c2=0; if($level=="user"){ $qN="SELECT * FROM folders WHERE parentID<>'0' AND id IN ('".$folders."')"; } else { $qN="SELECT * FROM folders WHERE parentID<>'0'"; } $resN = mysql_query($qN) or die(mysql_error()); if(mysql_num_rows($resN)>0){ while($rN=mysql_fetch_assoc($resN)){ $c2++; $main_attr[$rN["id"]] = $rN["name"]; //FILES TABLE GENERATION TO SHOW IN HTML BELOW $sql="SELECT * FROM files ".$filter." AND catID='".$rN["id"]."' ORDER BY title ASC LIMIT ".$offset.", ".$rowsPerPage; //echo $sql; $result=mysql_query($sql) or die("error getting files from db"); if(mysql_num_rows($result)>0){ while($rr=mysql_fetch_assoc($result)){ if($rr["size"]>1048576){ //if more than 1MB show MB else show KB $this_file_size= $rr["size"]/1024/1024; $prefix="MB"; } else { $this_file_size= $rr["size"]/1024; $prefix="KB"; } //PERMISSION CHECK - for showing EDIT FILE icon. if($rr["userID"]==$_SESSION["idUser"] && stristr($access,"k")){ /* logged in users file + has right to edit his files*/ $editable="<a href=\"edit_file.php?id=".$rr["id"]."\"><img src=\"images/pencil_16.png\" alt=\"Edit this file\" border=\"0\"/></a>"; } else if(stristr($access,"l")){ /* not current users file but has rigt to edit all files*/ $editable="<a href=\"edit_file.php?id=".$rr["id"]."\"><img src=\"images/pencil_16.png\" alt=\"Edit this file\" border=\"0\"/></a>"; } else { /* doesnt have right to edit files.*/ $editable = ""; } $bgClass=($bgClass=="even"?"odd":"even"); if(!isset($files_table_sub[$rN["parentID"]][$rN["id"]])){ $files_table_sub[$rN["parentID"]][$rN["id"]] = ""; } $files_table_sub[$rN["parentID"]][$rN["id"]] .="<tr class=\"".$bgClass."\">"; $files_table_sub[$rN["parentID"]][$rN["id"]] .=""; if((stristr($access,"h") && !stristr($access,"j") && $rr["userID"]==$_SESSION["idUser"]) || (stristr($access,"j")) ){ //if permissions allow to delete files. $files_table_sub[$rN["parentID"]][$rN["id"]] .="<td height=\"24\"><input name=\"filesToDel[]\" type=\"checkbox\" value=\"".$rr["id"]."\" /></td>"; } else { $files_table_sub[$rN["parentID"]][$rN["id"]] .= "<td height=\"24\"> </td>"; } $files_table_sub[$rN["parentID"]][$rN["id"]] .= "<td>".$rr["title"]."</td>"; $files_table_sub[$rN["parentID"]][$rN["id"]] .= "<td>".number_format($this_file_size,2,".",",")." ".$prefix."</td>"; $files_table_sub[$rN["parentID"]][$rN["id"]] .= "<td>".$rr["extension"]."</td>"; $query2="SELECT * FROM folders ORDER BY name ASC"; $result2=mysql_query($query2) or die("error getting folders from database"); while($rr2=mysql_fetch_assoc($result2)){ //$new_folders[]= $rr["id"]; //$new_folders_names[]= $rr["name"]; $new_folders_namesID[$rr2["id"]]= $rr2["name"]; } // $files_table_sub[$rN["parentID"]][$rN["id"]] .= "<td>".$new_folders_namesID[$rr["catID"]]."</td>"; $files_table_sub[$rN["parentID"]][$rN["id"]] .= "<td>".date("d M Y, H:i",strtotime($rr["dateUploaded"]))."</td>"; $fileInfo = getFileInfo($rr["id"]); //check if user can share (his / or by permission) file if(strstr($access,"m")==true){ $files_table_sub[$rN["parentID"]][$rN["id"]] .= "<td><a href=\"sharelink.php?id=".$rr["id"]."\"><img src=\"images/right_16.png\" border=\"0\"></a></td>"; } else { if($fileInfo[3]==$_SESSION["idUser"]){ $files_table_sub[$rN["parentID"]][$rN["id"]] .= "<td><a href=\"sharelink.php?id=".$rr["id"]."\"><img src=\"images/right_16.png\" border=\"0\"></a></td>"; } else { $files_table_sub[$rN["parentID"]][$rN["id"]] .= "<td> </td>"; } } $files_table_sub[$rN["parentID"]][$rN["id"]] .= "<td><a href=\"download.php?path=".$rr["path"]."\"><img src=\"images/save_16.png\" alt=\"Download File\" border=\"0\"/></a> ".$editable; //if($fileInfo[3]==$_SESSION["idUser"] || $_SESSION["idUser"]=="1"){ $files_table_sub[$rN["parentID"]][$rN["id"]] .= " <a href=\"messages.php?file=".$rr["id"]."\"><img src=\"images/bubble_16.png\" alt=\"".getCommentCount($rr["id"])." File Messages\" border=\"0\"/></a>(".getCommentCount($rr["id"]).") </td></tr>"; // } $files_table_sub[$rN["parentID"]][$rN["id"]] .= "</td></tr>"; } // end of all files from db query (end of while loop) //show button to complete file deletion if proper permissions. if(stristr($access,"h") || stristr($access,"j")){ $files_table_sub[$rN["parentID"]][$rN["id"]] .="<tr><td height=\"32\" colspan=\"7\"><input name=\"delete_files\" type=\"submit\" value=\"Delete Selected\" /></td></tr>"; } else { $files_table_sub[$rN["parentID"]][$rN["id"]] .="<tr><td height=\"32\" colspan=\"7\"> </td></tr>"; } } else { //0 files found in database. ( end of IF mysql_num_rows > 0 ) if(!isset($files_table_sub[$rN["parentID"]][$rN["id"]])){ $files_table_sub[$rN["parentID"]][$rN["id"]] = ""; } $files_table_sub[$rN["parentID"]][$rN["id"]] .="<tr><td colspan=\"7\">0 files found in this folder</td></tr>"; } } } // ============-----==========----================------------===========-------------- /*if($level!="user"){ $view_dirs=""; $query="SELECT * FROM folders ORDER BY name ASC"; $result=mysql_query($query) or die("error getting folders from database"); while($rr=mysql_fetch_assoc($result)){ $view_dirs .= "<option value='".$rr["id"]."' ".($view_dir==$rr["id"]?"selected":"").">".$rr["name"]."</option>"; } } else { if(!stristr($access,"i")){ //if user cant see all files $q="SELECT upload_dirs FROM users WHERE id='".$_SESSION["idUser"]."'"; $res=mysql_query($q); $rr=mysql_fetch_assoc($res); $folders = str_replace(',',"','",$rr["upload_dirs"]); $query="SELECT * FROM folders WHERE id IN ('".$folders."') ORDER BY name ASC"; $result=mysql_query($query) or die("error getting folders from database"); while($rr=mysql_fetch_assoc($result)){ $view_dirs .= "<option value='".$rr["id"]."' ".($view_dir==$rr["id"]?"selected":"").">".$rr["name"]."</option>"; } } else { $query="SELECT * FROM folders ORDER BY name ASC"; $result=mysql_query($query) or die("error getting folders from database"); while($rr=mysql_fetch_assoc($result)){ $view_dirs .= "<option value='".$rr["id"]."' ".($view_dir==$rr["id"]?"selected":"").">".$rr["name"]."</option>"; } } }*/ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Advanced File Manager - Welcome <?php echo $_SESSION["username"]?>!</title> <link rel="stylesheet" href="css/filemanager.css" type="text/css" /> <link rel="stylesheet" href="css/smoothness/jquery-ui-1.8.9.custom.css"> &lt;script src="js/jquery-1.4.4.min.js"></script> &lt;script src="js/menu.js" type="text/javascript"></script> &lt;script src="js/jquery-ui-1.8.9.custom.min.js" type="text/javascript"></script> &lt;script> $(document).ready(function() { $(function() { $( "#accordion" ).accordion({ autoHeight: false, navigation: true }); }); /*$("#acc1").accordion({ active:".ui-accordion-left", alwaysOpen: false, autoheight: false, header: 'a.acc1', clearStyle: true });*/ }); </script> </head> <body> <div id="content"> <h1>Sucesso no Rádio - Arquivos </h1> <!-- nv --> <?php require("includes/menu.php");?> <div class="content_block"> <h2><?php echo $pageTitle ?></h2> <strong><?php echo $msg; ?></strong> <br /> <? /* <form action="files.php" enctype="multipart/form-data" method="post" name="ff21"> <table width="350" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="92" valign="middle">View Files:</td> <td width="258" align="left" valign="middle"><select name="view_dir" id="view_dir"> <option value="">All assigned files</option> <?php echo $view_dirs?> </select> <input type="submit" name="create" id="create" value="Select" /></td> </tr> </table> <input type="hidden" value="1" name="page" id="page"/> </form><? */ ?> <form enctype="multipart/form-data" action="files.php" method="post" name="ff21"> <input type="hidden" value="yes" name="files_delete" /> <!-- FOLDERS START--> <? if(!empty($files_table)){ $count=1; $count1=1;?> <div id="accordion"> <? foreach($files_table as $k=>$v){?> <!-- FOLDER with subfolders--> <h3><a href="#"><?=$main_attr[$k]?></a></h3> <div style="font-size:11px;"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr class="topRow"> <td width="3%" height="30" align="center"> </td> <td width="40%" align="left">Título</td> <td width="10%" align="left"><strong>Tamanho</strong></td> <td width="10%" align="left"><strong>Extensão</strong></td> <td width="20%" align="left"><strong>Data do envio </strong></td> <td width="5%" align="left"><strong>Link</strong></td> <td width="12%" height="30" align="center"> </td> </tr> <?php echo $v; ?> <!-- PAGING NAVIGATION LINKS ROW --> <tr><td colspan="8" align="right" class="paging"><?php //echo $first . $prev . $nav . $next . $last;?></td></tr> <!-- PAGING NAVIGATION LINKS ROW END --> </table> <!-- SUBFOLDERS START--> <? if(!empty($files_table_sub[$k])){ ?> <ul class="menu"> <? foreach($files_table_sub[$k] as $kk=>$vv){?> <li> <a href="#"><?=$main_attr[$kk]?></a> <div class="acitem panel"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr class="topRow"> <td width="3%" height="30" align="center"> </td> <td width="40%" align="left">Título</td> <td width="10%" align="left"><strong>Tamanho</strong></td> <td width="10%" align="left"><strong>Extensão</strong></td> <td width="20%" align="left"><strong>Data do envio </strong></td> <td width="5%" align="left"><strong>Link</strong></td> <td width="12%" height="30" align="center"> </td> </tr> <?php echo $vv; ?> <!-- PAGING NAVIGATION LINKS ROW --> <tr><td colspan="8" align="right" class="paging"><?php //echo $first . $prev . $nav . $next . $last;?></td></tr> <!-- PAGING NAVIGATION LINKS ROW END --> </table> </div> </li> <? } ?> </ul> <? } ?> </div> <!-- SUBFOLDERS END --> <!-- FOLDER end--> <? $count++; } ?> </div> <? } ?> </form> </div> </div> </body> </html> <?php }?> <html>
×
×
  • Criar Novo...