Advertisement
Guest User

my-site

a guest
Feb 10th, 2012
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.92 KB | None | 0 0
  1. <?php
  2.  
  3. include_once('header.php');
  4.  
  5. ?>
  6.  
  7. <table width="100%" cellpadding="0" cellspacing="0">
  8.    
  9.     <tr>
  10.    
  11.         <td width="20%" valign="top">
  12. <br>
  13. <div class="articles_category"><a href="http://www.my-site.ru/articles.php?c=1&n=1" onmouseover="this.style.color='#890000'" onmouseout="this.style.color='white'">Категория 1</a></div>
  14. <div class="articles_category"><a href="http://www.my-site.ru/articles.php?c=2&n=1" onmouseover="this.style.color='#890000'" onmouseout="this.style.color='white'">Категория 2</a></div>
  15. <div class="articles_category"><a href="http://www.my-site.ru/articles.php?c=3&n=1" onmouseover="this.style.color='#890000'" onmouseout="this.style.color='white'">Категория 3</a></div>
  16. <div class="articles_category"><a href="http://www.my-site.ru/articles.php?c=4&n=1" onmouseover="this.style.color='#890000'" onmouseout="this.style.color='white'">Категория 4</a></div>
  17. <div class="articles_category"><a href="http://www.my-site.ru/articles.php?c=5&n=1" onmouseover="this.style.color='#890000'" onmouseout="this.style.color='white'">Категория 5</a></div>
  18. <div class="articles_category"><a href="http://www.my-site.ru/articles.php?c=6&n=1" onmouseover="this.style.color='#890000'" onmouseout="this.style.color='white'">Категория 6</a></div>
  19.         </td>
  20.        
  21.         <td>
  22.  
  23. <table style="margin-top: 10px" cellpadding="0" cellspacing="5">
  24.    
  25.             <?php
  26.            
  27.                 $n = $_GET['n'];
  28.                
  29.                 $n = $n * 5 - 5;
  30.                
  31.                 $category = $_GET['c'];
  32.                
  33.                 mb_internal_encoding("UTF-8");
  34.                
  35.                 require_once('mysql.php');
  36.                
  37.                 if (isset($c) && $c == 'all') {
  38.                
  39.                 $query = mysql_query("SELECT id FROM articles ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
  40.                
  41.                 $query1 = mysql_query("SELECT name FROM articles ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
  42.                
  43.                 $query2 = mysql_query("SELECT datetime FROM articles ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
  44.                
  45.                 $query3 = mysql_query("SELECT text FROM articles ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
  46.                
  47.                 }
  48.                
  49.                 else if (isset($c) && $c != all) {
  50.                
  51.                 $query = mysql_query("SELECT id FROM articles WHERE category = '$category' ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
  52.                
  53.                 $query1 = mysql_query("SELECT name FROM articles WHERE category = '$category' ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
  54.                
  55.                 $query2 = mysql_query("SELECT datetime FROM articles WHERE category = '$category' ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
  56.                
  57.                 $query3 = mysql_query("SELECT text FROM articles WHERE category = '$category' ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
  58.                
  59.                 }
  60.                
  61.                 $temp_id = 0;
  62.                
  63.                 while($row_id = mysql_fetch_array($query)) {
  64.                
  65.                 $x_id[$temp_id]= $row_id['id'];
  66.                
  67.                 $temp_id++;
  68.                
  69.                 }
  70.                
  71.                 $temp = 0;
  72.                
  73.                 while($row2 = mysql_fetch_array($query2)) {
  74.                
  75.                 $x[$temp]= $row2['datetime'];
  76.                
  77.                 $temp++;
  78.                
  79.                 }
  80.                
  81.                 $temp2 = 0;
  82.                
  83.                 while($row3 = mysql_fetch_array($query3)) {
  84.                
  85.                 $x2[$temp2]= $row3['text'];
  86.                
  87.                 $temp2++;
  88.                
  89.                 }
  90.                
  91.                 $temp_id = 0;
  92.                
  93.                 $temp = 0;
  94.                
  95.                 $temp2 = 0;
  96.                
  97.                 while($row = mysql_fetch_array($query1)) {
  98.                
  99.                 //echo '<tr><td colspan="2" height="20px"></td></tr>';
  100.                
  101.                 echo '<tr style="background-color: #669980; color: white; padding: 2px 5px; font-family: tahoma; font-size: 10pt"><td style="padding-left: 20px">';
  102.                
  103.                 echo '<div class="linkname"><a href="http://www.my-site.ru/article.php?a=';
  104.                
  105.                 printf($x_id[$temp_id]);
  106.                
  107.                 $temp_id++;
  108.                
  109.                 echo '">';
  110.                
  111.                 printf($row["name"]);
  112.                
  113.                 echo '</a></div>';
  114.                
  115.                 echo '</td>';
  116.                
  117.                 echo '<td width="10%" style="text-align: center">';
  118.                
  119.                 printf($x[$temp]);
  120.                
  121.                 $temp++;
  122.                
  123.                 echo '</td></tr>';
  124.                
  125.                 echo '<tr style="font-family: tahoma; font-size: 10pt"><td colspan="2" style="padding: 5px; padding-bottom: 10px">';
  126.                
  127.                 $xc = $x2[$temp2];
  128.                
  129.                 $xc = mb_substr($xc, 0, 600);
  130.                
  131.                 echo strip_tags ($xc);
  132.                
  133.                 printf('...');
  134.                
  135.                 $temp2++;
  136.                
  137.                 echo '</td></tr>';
  138.                
  139.                 }
  140.                
  141.             ?>
  142. </table>
  143.  
  144. </td>
  145. </tr>
  146.  
  147. </table>
  148.  
  149. <div class="articles_n">
  150. <?php
  151.  
  152.     $n = $_GET['n'];
  153.    
  154.     $c = $_GET['c'];
  155.    
  156.     if ($n >= 2) {
  157.    
  158.         echo '<a href="http://www.my-site.ru/articles.php?c=';
  159.        
  160.         echo $c;
  161.        
  162.         echo '&n=';
  163.    
  164.         echo $n-1;
  165.        
  166.         echo '">< </a>';
  167.        
  168.     }
  169.    
  170.     $x = 0;
  171.    
  172.     require_once('mysql.php');
  173.    
  174.     if ($c != 'all') {
  175.    
  176.     $query = mysql_query("SELECT id FROM articles WHERE category = '$c'") or die(mysql_error());
  177.    
  178.     }
  179.    
  180.     else {
  181.    
  182.     $query = mysql_query("SELECT id FROM articles") or die(mysql_error());
  183.    
  184.     }
  185.    
  186.     while($row = mysql_fetch_array($query)) {
  187.    
  188.     $x++;
  189.    
  190.     }
  191.    
  192.     //$x = $x-1;
  193.    
  194.     if ($x % 5) {
  195.    
  196.         if (($x - 1) % 5) {
  197.      
  198.             if (($x - 2) % 5) {
  199.            
  200.                 if (($x - 3) % 5) {
  201.                
  202.                     if (($x - 4) % 5) {
  203.                    
  204.                    
  205.                    
  206.                     }
  207.                    
  208.                     else {
  209.                    
  210.                     $x = $x - 4;
  211.        
  212.                     $nx = $x/5+2;
  213.    
  214.                     for ($nx2 = 1; $nx2 < $nx; $nx2++) {
  215.    
  216.                     echo '<a href="http://www.my-site.ru/articles.php?c=';
  217.                    
  218.                     echo $c;
  219.                    
  220.                     echo '&n=';
  221.        
  222.                     echo $nx2;
  223.        
  224.                     echo '">';
  225.        
  226.                     echo $nx2;
  227.        
  228.                     echo '</a> ';
  229.        
  230.                     }
  231.        
  232.                     $x = $x/5+1;
  233.    
  234.                     if ($n != $x) {
  235.    
  236.                     echo '<a href="http://www.my-site.ru/articles.php?c=';
  237.                    
  238.                     echo $c;
  239.                    
  240.                     echo '&n=';
  241.    
  242.                     echo $n+1;
  243.        
  244.                     echo '"> ></a>';
  245.        
  246.                     }
  247.                    
  248.                     }
  249.                
  250.                 }
  251.                
  252.                 else {
  253.                
  254.                 $x = $x - 3;
  255.        
  256.                 $nx = $x/5+2;
  257.    
  258.                 for ($nx2 = 1; $nx2 < $nx; $nx2++) {
  259.    
  260.                 echo '<a href="http://www.my-site.ru/articles.php?c=';
  261.                
  262.                 echo $c;
  263.                
  264.                 echo '&n=';
  265.        
  266.                 echo $nx2;
  267.        
  268.                 echo '">';
  269.        
  270.                 echo $nx2;
  271.        
  272.                 echo '</a> ';
  273.        
  274.                 }
  275.        
  276.                 $x = $x/5+1;
  277.    
  278.                 if ($n != $x) {
  279.    
  280.                 echo '<a href="http://www.my-site.ru/articles.php?c=';
  281.        
  282.                 echo $c;
  283.        
  284.                 echo '&n=';
  285.        
  286.                 echo $n+1;
  287.        
  288.                 echo '"> ></a>';
  289.        
  290.                 }
  291.                
  292.                 }
  293.            
  294.             }
  295.            
  296.             else {
  297.            
  298.             $x = $x - 2;
  299.        
  300.             $nx = $x/5+2;
  301.    
  302.             for ($nx2 = 1; $nx2 < $nx; $nx2++) {
  303.    
  304.             echo '<a href="http://www.my-site.ru/articles.php?n=';
  305.        
  306.             echo $nx2;
  307.        
  308.             echo '">';
  309.        
  310.             echo $nx2;
  311.        
  312.             echo '</a> ';
  313.        
  314.             }
  315.        
  316.             $x = $x/5+1;
  317.    
  318.             if ($n != $x) {
  319.    
  320.             echo '<a href="http://www.my-site.ru/articles.php?n=';
  321.    
  322.             echo $n+1;
  323.        
  324.             echo '"> ></a>';
  325.        
  326.             }
  327.            
  328.             }
  329.      
  330.         }
  331.      
  332.         else {
  333.        
  334.         $x = $x - 1;
  335.        
  336.         $nx = $x/5+2;
  337.    
  338.         for ($nx2 = 1; $nx2 < $nx; $nx2++) {
  339.    
  340.         echo '<a href="http://www.my-site.ru/articles.php?c=';
  341.        
  342.         echo $c;
  343.        
  344.         echo '&n=';
  345.        
  346.         echo $nx2;
  347.        
  348.         echo '">';
  349.        
  350.         echo $nx2;
  351.        
  352.         echo '</a> ';
  353.        
  354.         }
  355.        
  356.         $x = $x/5+1;
  357.    
  358.         if ($n != $x) {
  359.    
  360.         echo '<a href="http://www.my-site.ru/articles.php?c=';
  361.        
  362.         echo $c;
  363.        
  364.         echo '&n=';
  365.    
  366.         echo $n+1;
  367.        
  368.         echo '"> ></a>';
  369.        
  370.         }
  371.      
  372.     }
  373.    
  374.     }
  375.    
  376.     else {
  377.  
  378.    
  379.     $nx = $x/5+1;
  380.    
  381.     for ($nx2 = 1; $nx2 < $nx; $nx2++) {
  382.    
  383.         echo '<a href="http://www.my-site.ru/articles.php?c=';
  384.        
  385.         echo $c;
  386.        
  387.         echo '&n=';
  388.        
  389.         echo $nx2;
  390.        
  391.         echo '">';
  392.        
  393.         echo $nx2;
  394.        
  395.         echo '</a> ';
  396.        
  397.     }
  398.        
  399.         $x = $x/5;
  400.    
  401.     if ($n != $x) {
  402.    
  403.         echo '<a href="http://www.my-site.ru/articles.php?c=';
  404.        
  405.         echo $c;
  406.        
  407.         echo '&n=';
  408.    
  409.         echo $n+1;
  410.        
  411.         echo '"> ></a>';
  412.        
  413.     }
  414.    
  415. }
  416.  
  417. ?>
  418. </div>
  419.  
  420. <?php
  421.  
  422. include_once('footer.php');
  423.  
  424. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement