Ir para conteúdo
Fórum Script Brasil
  • 0

Novos Links


sorocabaunderground

Pergunta

Oi tudo bom?

eu queria saber como eu posso fazer para em uma seção de link q eu tenho aqui, eu posso fazer que ele mostre os 10 ultimos links cadastrados no sistema..

se precisar postar o meu Script Avisa ae

abraços e Feliz 2005 =)

Link para o comentário
Compartilhar em outros sites

8 respostass a esta questão

Posts Recomendados

  • 0

Ai vai todo o Script

<?

#$conexao = mysql_connect("localhost","root","");

#mysql_select_db("servicos",$conexao);

$conexao = mysql_connect("localhost","sorocaba_link","XxXx");

mysql_select_db("sorocaba_link",$conexao);

/************************************

# Tabelas:

CREATE TABLE `link` (

`id` INT(50) NOT NULL AUTO_INCREMENT PRIMARY KEY,

`site` TEXT NOT NULL,

`url` TEXT NOT NULL,

`uf` CHAR(30) NOT NULL,

`info` VARCHAR(250) NOT NULL

)

COMMENT = 'link';

INSERT INTO link VALUES (1, 'Sorocabaunderground', 'http://www.sorocabaunderground.com/', 'Portal da Música Alternativa', 'RZ'');

INSERT INTO link VALUES (2, 'TEste', 'http://www.teste.com.br/', 'so um teste', 'BA');

************************************/

$siglas = array("bandas","zines.revistas","gravadoras.selos"); if($_GET['include']) $include=";

if($include=="index"){

$query = mysql_query("SELECT * FROM `link` ORDER BY site ASC");

echo "<STYLE>\n";

echo ".fo0{FONT-FAMILY: verdana,arial; FONT-SIZE: 10;}\n";

echo ".li0:link {font-size: 10; color: #000000; text-decoration: none;}\n";

echo ".li0:visited {font-size: 10; color: #000000; text-decoration: none;}\n";

echo ".li0:hover {font-size: 10; color: #FF0000; text-decoration: underline;}\n";

echo "</STYLE>\n\n";

echo "<TABLE WIDTH='290' CELLPADDING='0' CELLSPACING='0' BORDER='0' CLASS='ta0'>\n\n";

echo "<TR HEIGHT='22'><TD BACKGROUND='agenda.gif'></TD></TR>\n";

echo "<TR><TD>\n\n";

echo "<TABLE WIDTH='100%' CELLPADDING='2' CELLSPACING='4' BORDER='0'>\n\n"; $x=1;

      if(mysql_num_rows($query)==0)

      {

      echo "<TR><TD CLASS='fo0'>Nenhum Link Cadastrado!</TD></TR>\n";

      }

      else{

      /***************************************************************/

      while($campo = mysql_fetch_array($query)){

      if($x%2==0){$tr=0;}else{$tr=1;}

      /***************************************************************/

      echo "<TR CLASS='tr".$tr."'><TD WIDTH='40' ALIGN='CENTER' CLASS='fo0'><B><A HREF='index.php?uf=".$campo['uf]."' CLASS='li0'>[".$campo['uf']."]</A></B></TD>\n";

      echo "".$campo['site']."<a href=".$campo['url]."' CLASS='fo0'>".$campo['info']."</a> \n";

      echo "</TD></TR>\n\n";

      /******/

      $x++;}}

      /******/

unset($include);

} if($_POST['include']==cadastrar"){

switch($_POST['uf])

{

  case 'zines.revistas' :

      $uf="zines.revistas";

  break;

  case 'bandas' :

      $uf="bandas";

  break;

  default:

      $uf="gravadoras.selos";

echo "</TABLE>\n\n";

echo "</TD></TR></TABLE>\n\n";

  unset($include);

} if($_POST['include']==cadastrar"){

mysql_query("INSERT INTO link VALUES ('','".$_POST['site]."',

'".$_POST['url']."','".$_POST['uf']."','".$_POST['info']."') ");

echo "<HTML>\n";

echo "<TITLE>Cadastrando...</TITLE>\n";

echo "<BODY>\n\n";

echo "<script>\n";

echo "function SetOsG(){location.href=index.php';}";

echo "setTimeout('SetOsG()',1000);\n";

echo "</SCRIPT>\n\n";

echo "</BODY></HTML>\n";

} if($include=="formulario"){ $select="";foreach($siglas as $valor){

                              $select .= "<OPTION VALUE='".$valor."'>".

                              $valor."</OPTION>";}

echo "<STYLE>\n";

echo ".ta1{BACKGROUND-COLOR: #DDDDDD; BORDER: 0px SOLID #000000;}\n";

echo ".ta2{BACKGROUND-COLOR: #8000000; COLOR: #FFFFFF;}\n";

echo ".for{BACKGROUND-COLOR: #EEEEEF; BORDER: 1px SOLID #000000; FONT-SIZE: 10;}\n";

echo ".fo1{FONT-FAMILY: verdana,arial; FONT-SIZE: 10;}\n";

echo ".fo2{FONT-FAMILY: verdana,arial; FONT-SIZE: 10; COLOR: #000000;}\n";

echo "</STYLE>\n\n";

echo "<TABLE WIDTH='130' CELLPADDING='0' CELLSPACING='4' BORDER='0' CLASS='ta1'>\n\n";

echo "<TR><TD>\n";

echo "<TABLE WIDTH='130' CELLPADDING='0' CELLSPACING='0' BORDER='0'>\n\n";

echo "<TR><TD CLASS='fo2'><B>Incluir Site</B></TD></TR></TABLE>\n";

echo "</TD></TR>\n";

echo "<TR><FORM ACTION='../links/link_cadastrar.php' METHOD='POST'><TD CLASS='fo1'>\n\n";

echo "Site:<BR><INPUT TYPE='text' SIZE='22' NAME='site' CLASS='for'><BR>\n\n";

echo "url:<BR><INPUT TYPE='text' SIZE='22' NAME='url' CLASS='for' value='http://'><BR>\n\n";

echo "Categoria: <BR><SELECT NAME='uf' CLASS='for'>".$select."</SELECT><BR>\n\n";

echo "info:<BR><INPUT TYPE='text' SIZE='22' NAME='info' CLASS='for'><BR>\n\n";

echo "<BR><BR><CENTER><input name='I12' type='image' src='../imgs/botao_enviar.jpg' width='38' height='15' border='0' target='_blank'></CENTER>\n\n";

echo "</TD><INPUT NAME='include' TYPE='hidden' VALUE='cadastrar'></FORM><TR>\n";

echo "</TABLE>\n\n";

  unset($include);

 

} if($include=="geral"){

// LINK.PHP

    $where=""; foreach($siglas as $valor)

    {

    if($valor==$_GET['uf]) $where = " AND uf='".$valor."' ";

    }

$query = mysql_query("SELECT * FROM `link` ".$where." ORDER BY site ASC ");

echo "<STYLE>\n";

echo ".fo0{FONT-FAMILY: verdana,arial; FONT-SIZE: 10;}\n";

echo ".fo3{FONT-FAMILY: verdana,arial; FONT-SIZE: 10; COLOR: #000000;}\n";

echo ".li0:link {font-size: 10; color: #000000; text-decoration: none;}\n";

echo ".li0:visited {font-size: 10; color: #000000; text-decoration: none;}\n";

echo ".li0:hover {font-size: 10; color: #FF0000; text-decoration: underline;}\n";

echo "</STYLE>\n\n";

echo "<TABLE WIDTH='496' CELLPADDING='0' CELLSPACING='0' BORDER='0' CLASS='ta0'>\n";

echo "<TR><TD>\n\n";

echo "<TABLE WIDTH='100%' CELLPADDING='6' CELLSPACING='0' BORDER='0'>\n\n";

      echo "<TR><TD>\n";

      echo "<TABLE WIDTH='100%' CELLPADDING='0' CELLSPACING='0' BORDER='0'>\n\n";

      echo "</TD></TR>\n";

      if(mysql_num_rows($query)==0)

      {

      if($where){

      echo "<TR HEIGHT='30'><TD CLASS='fo0'>Não temos nada em <B>".$uf."</B> ainda!</TD></TR>\n";

      }else{

      echo "<TR HEIGHT='30'><TD CLASS='fo0'>Não temos nada ainda!</TD></TR>\n";

      }

      }

      else{

      /***************************************************************/

      while($campo = mysql_fetch_array($query)){

      /***************************************************************/

      echo "<TR CLASS='tr".$tr."'>\n";

      echo "<TD CLASS='fo0'>".$campo['site']." - <a href=".$campo['url]."' CLASS='fo0' target='_blank'>".$campo['info']."</a> \n";

      echo "\n";

      echo "\n";

      echo "\n";

      echo "</TD></TR>\n\n";

      echo "<TR><TD><br></TD></TR>\n\n";

      /******/

      }}

      /******/

echo "</TABLE>\n\n";

echo "</TD></TR></TABLE>\n\n";

  unset($include);

}

?>

rolleyes.gif

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.


  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,3k
×
×
  • Criar Novo...