Guest User

Untitled

a guest
Oct 22nd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.12 KB | None | 0 0
  1. <?php
  2. include("template/configure.php");
  3. include("config.inc.php");
  4. $db=mysql_connect($dbhost,$dbuser,$dbpass);
  5.  
  6.     if ($db==FALSE) die ("Errore accesso al database.");
  7.     mysql_select_db($dbname,$db) or die ("Errore accesso al database.");      
  8. ?>
  9. <h2 style="font-size:32px; text-align:center;"><font color="#000000"><strong>Lavori Realizzati</h2></strong>
  10.                
  11. <table width="900">
  12.   <tr>
  13. <?php
  14.     if(IsSet($_GET['page']) && Is_Int($_GET['page']) {
  15.         $limit = $_GET['page'];
  16.     }else{
  17.         $limit = 0;
  18.     }
  19.         $sql = sprintf("SELECT * FROM png ORDER BY id DESC LIMIT %s,9;", mysql_real_escape_string($limit));;
  20.         $rs = mysql_query($sql) or die(mysql_error());
  21.         $counter = 0; // contatore per il numero dei risultati trovati
  22.  
  23.             while ($row = mysql_fetch_array($rs)) {
  24.                 $body = ""; // conterrĂ  la parte risultante della pagina
  25.                 if($counter != 0 && $counter % 3 == 0) {
  26.                   $body .= "</tr><tr><td><br></td></tr><tr>";
  27.                 }
  28.  
  29.                 ++$counter;
  30.  
  31.                 $id = $row['id'];
  32.                 $body .= '<td width="200">';
  33.                 // INSERIMENTO IMMAGINE
  34.                 $dir = 'Immagini/link/'.$id.'.png';
  35.                 if (file_exists($dir)) {
  36.                     $body .= '<img src="'.$dir.'"  webstripperwas="'.$dir.'" width="230" height="190" border="0">';
  37.                 } else {
  38.                     // IMMAGINE CON SCRITTO ANTEPRIMA NON DISPONIBILE
  39.                 }
  40.                 $body .= '<div class="scheda"> Sito Web: <a href="'.$row['links'].'" target="_blank">'.$row['links'].'</a>';
  41.                 $body .= '<div class="scheda"> Scheda: <a href="schedasitiweb.php?id='.$row['id'].'"> Vai alla scheda</a>';
  42.      
  43.                 $body .= '</td>';
  44.                 echo $body;
  45.             }
  46.           ?>  
  47.     </tr>
  48. </table>
  49.  
  50. <?php
  51.     $Query = mysql_query("SELECT COUNT(*) as `tot` FROM `png`;");
  52.     if($Result = mysql_fetch_array($Query)) {
  53.         $pagine = $Result['tot'] / 9;
  54.         for($i = 0; $i <= $pagine; $i++) {
  55.         ?><a href="?page=<?php echo $i; ?>"><?php echo $i; ?></a> - <?php
  56.         }
  57.     }
  58.  
  59. ?>
Add Comment
Please, Sign In to add comment