Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once('header.php');
- ?>
- <table width="100%" cellpadding="0" cellspacing="0">
- <tr>
- <td width="20%" valign="top">
- <br>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- </td>
- <td>
- <table style="margin-top: 10px" cellpadding="0" cellspacing="5">
- <?php
- $n = $_GET['n'];
- $n = $n * 5 - 5;
- $category = $_GET['c'];
- mb_internal_encoding("UTF-8");
- require_once('mysql.php');
- if (isset($c) && $c == 'all') {
- $query = mysql_query("SELECT id FROM articles ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
- $query1 = mysql_query("SELECT name FROM articles ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
- $query2 = mysql_query("SELECT datetime FROM articles ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
- $query3 = mysql_query("SELECT text FROM articles ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
- }
- else if (isset($c) && $c != all) {
- $query = mysql_query("SELECT id FROM articles WHERE category = '$category' ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
- $query1 = mysql_query("SELECT name FROM articles WHERE category = '$category' ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
- $query2 = mysql_query("SELECT datetime FROM articles WHERE category = '$category' ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
- $query3 = mysql_query("SELECT text FROM articles WHERE category = '$category' ORDER BY id DESC LIMIT $n, 5") or die(mysql_error());
- }
- $temp_id = 0;
- while($row_id = mysql_fetch_array($query)) {
- $x_id[$temp_id]= $row_id['id'];
- $temp_id++;
- }
- $temp = 0;
- while($row2 = mysql_fetch_array($query2)) {
- $x[$temp]= $row2['datetime'];
- $temp++;
- }
- $temp2 = 0;
- while($row3 = mysql_fetch_array($query3)) {
- $x2[$temp2]= $row3['text'];
- $temp2++;
- }
- $temp_id = 0;
- $temp = 0;
- $temp2 = 0;
- while($row = mysql_fetch_array($query1)) {
- //echo '<tr><td colspan="2" height="20px"></td></tr>';
- echo '<tr style="background-color: #669980; color: white; padding: 2px 5px; font-family: tahoma; font-size: 10pt"><td style="padding-left: 20px">';
- echo '<div class="linkname"><a href="http://www.my-site.ru/article.php?a=';
- printf($x_id[$temp_id]);
- $temp_id++;
- echo '">';
- printf($row["name"]);
- echo '</a></div>';
- echo '</td>';
- echo '<td width="10%" style="text-align: center">';
- printf($x[$temp]);
- $temp++;
- echo '</td></tr>';
- echo '<tr style="font-family: tahoma; font-size: 10pt"><td colspan="2" style="padding: 5px; padding-bottom: 10px">';
- $xc = $x2[$temp2];
- $xc = mb_substr($xc, 0, 600);
- echo strip_tags ($xc);
- printf('...');
- $temp2++;
- echo '</td></tr>';
- }
- ?>
- </table>
- </td>
- </tr>
- </table>
- <div class="articles_n">
- <?php
- $n = $_GET['n'];
- $c = $_GET['c'];
- if ($n >= 2) {
- echo '<a href="http://www.my-site.ru/articles.php?c=';
- echo $c;
- echo '&n=';
- echo $n-1;
- echo '">< </a>';
- }
- $x = 0;
- require_once('mysql.php');
- if ($c != 'all') {
- $query = mysql_query("SELECT id FROM articles WHERE category = '$c'") or die(mysql_error());
- }
- else {
- $query = mysql_query("SELECT id FROM articles") or die(mysql_error());
- }
- while($row = mysql_fetch_array($query)) {
- $x++;
- }
- //$x = $x-1;
- if ($x % 5) {
- if (($x - 1) % 5) {
- if (($x - 2) % 5) {
- if (($x - 3) % 5) {
- if (($x - 4) % 5) {
- }
- else {
- $x = $x - 4;
- $nx = $x/5+2;
- for ($nx2 = 1; $nx2 < $nx; $nx2++) {
- echo '<a href="http://www.my-site.ru/articles.php?c=';
- echo $c;
- echo '&n=';
- echo $nx2;
- echo '">';
- echo $nx2;
- echo '</a> ';
- }
- $x = $x/5+1;
- if ($n != $x) {
- echo '<a href="http://www.my-site.ru/articles.php?c=';
- echo $c;
- echo '&n=';
- echo $n+1;
- echo '"> ></a>';
- }
- }
- }
- else {
- $x = $x - 3;
- $nx = $x/5+2;
- for ($nx2 = 1; $nx2 < $nx; $nx2++) {
- echo '<a href="http://www.my-site.ru/articles.php?c=';
- echo $c;
- echo '&n=';
- echo $nx2;
- echo '">';
- echo $nx2;
- echo '</a> ';
- }
- $x = $x/5+1;
- if ($n != $x) {
- echo '<a href="http://www.my-site.ru/articles.php?c=';
- echo $c;
- echo '&n=';
- echo $n+1;
- echo '"> ></a>';
- }
- }
- }
- else {
- $x = $x - 2;
- $nx = $x/5+2;
- for ($nx2 = 1; $nx2 < $nx; $nx2++) {
- echo '<a href="http://www.my-site.ru/articles.php?n=';
- echo $nx2;
- echo '">';
- echo $nx2;
- echo '</a> ';
- }
- $x = $x/5+1;
- if ($n != $x) {
- echo '<a href="http://www.my-site.ru/articles.php?n=';
- echo $n+1;
- echo '"> ></a>';
- }
- }
- }
- else {
- $x = $x - 1;
- $nx = $x/5+2;
- for ($nx2 = 1; $nx2 < $nx; $nx2++) {
- echo '<a href="http://www.my-site.ru/articles.php?c=';
- echo $c;
- echo '&n=';
- echo $nx2;
- echo '">';
- echo $nx2;
- echo '</a> ';
- }
- $x = $x/5+1;
- if ($n != $x) {
- echo '<a href="http://www.my-site.ru/articles.php?c=';
- echo $c;
- echo '&n=';
- echo $n+1;
- echo '"> ></a>';
- }
- }
- }
- else {
- $nx = $x/5+1;
- for ($nx2 = 1; $nx2 < $nx; $nx2++) {
- echo '<a href="http://www.my-site.ru/articles.php?c=';
- echo $c;
- echo '&n=';
- echo $nx2;
- echo '">';
- echo $nx2;
- echo '</a> ';
- }
- $x = $x/5;
- if ($n != $x) {
- echo '<a href="http://www.my-site.ru/articles.php?c=';
- echo $c;
- echo '&n=';
- echo $n+1;
- echo '"> ></a>';
- }
- }
- ?>
- </div>
- <?php
- include_once('footer.php');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement