Untitled

By Whipped Treeshrew, 3 Days ago, written in php.
  1. <?php
  2. /**
  3.  * Classe Para Pegar arquivos e Links no Banco de Dados
  4.  * @package Funcoes.inc
  5.  * @author Ramon Vicente
  6.  * @copyright 2009 - Ramon Vicente
  7.  */
  8. class materia {
  9.         /**
  10.          * Funcao _materia() Seleciona a Materia Pelo Parametro
  11.          * Se For Buscado Corretamente Retorna Os arquivos e Links
  12.          */
  13.                 function _materia($bd,$materia){
  14.                
  15.                 //Query para Pegar dados
  16.                                 $sql = "SELECT * FROM ARQUIVOS WHERE MATERIA='".$materia."'";
  17.                
  18.                 //Execulta a Query
  19.                                                 $rs = $bd->Execute( $sql );
  20.        
  21.  // Se Nao For Encontrado Nenhum Arquivo Retorna a Msg de Erro
  22.         if($rs->RecordCount() == 0)
  23.                                          echo '<h1 align=center style=color:#F00;>Nenhum Arquivo Encontrado!!</h1>';
  24.          
  25.          // Se Tiver Arquivos Continua a Funcao
  26.                         else
  27.  echo'
  28.                                         <table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
  29.                         <tr align="center">
  30.         <td width="150"><strong>Arquivo </strong></td>
  31.                         <td width="120"><strong>Data</strong></td>
  32.                                         <td width="108"><strong>Downloads</strong></td>
  33.  
  34.                                 </tr>';
  35.  
  36.   //Realisa o Loop e Retorna as Linhas dos Arquivos
  37.                         while (! $rs->EOF){
  38.                         echo'
  39.                                 <tr align="center">
  40.                                                 <td><a href="?i=download&id='.$rs->fields['Id'].'">'.$rs->fields['Arquivo'].'</a></td>
  41.                         <td>'.$rs->fields['Data'].'</td>
  42.                                         <td>'.$rs->fields['clicks'].'</td>
  43.                                                                 </tr>';
  44.   $rs->movenext(); //Funcao ADODB que Move Para o Proximo Registro
  45. }
  46. echo '</table>';
  47. } //Fecha funcao _materia
  48. }//Fecha Classe materia
  49. ?>