Курсовые - Интернет-каталог по продаже мобильных устройств

ПРИЛОЖЕНИЕ А Листинг программы

Приложение А. Листинг программы

 

<?php

   define('myeshop', true);

   include("include/db_connect.php");

   include("functions/functions.php");

   session_start();

   include("include/auth_cookie.php");

 

$sorting = $_GET["sort"];  

 

switch ($sorting)

{

    case 'price-asc';

    $sorting = 'price ASC';

    $sort_name = 'От дешевых к дорогим';

    break;

 

    case 'price-desc';

    $sorting = 'price DESC';

    $sort_name = 'От дорогих к дешевым';

    break;

   

    case 'popular';

    $sorting = 'count DESC';

    $sort_name = 'Популярное';

    break;

   

    case 'news';

    $sorting = 'datetime DESC';

    $sort_name = 'Новинки';

    break;

   

    case 'brand';

    $sorting = 'brand';

    $sort_name = 'Новинки';

    break;

   

    default:

    $sorting = 'products_id DESC';

    $sort_name = 'Нет сортировки';

    break;                          

}

  

   

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

 

<head>

      <meta http-equiv="content-type" content="text/html; charset=utf-8" />

 

      <link href="css/reset.css" rel="stylesheet" type="text/css" />

    <link href="css/style.css" rel="stylesheet" type="text/css" />

    <link href="trackbar/trackbar.css" rel="stylesheet" type="text/css" />

     

      <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>

    <script type="text/javascript" src="js/jcarousellite_1.0.1.js"></script>

    <script type="text/javascript" src="js/shop-script.js"></script>

    <script type="text/javascript" src="js/jquery.cookie.min.js"></script>

    <script type="text/javascript" src="trackbar/jquery.trackbar.js"></script>

    <script type="text/javascript" src="js/TextChange.js"></script>

 

   

      <title>Интернет-Магазин E-MOGILEV</title>

</head>

<body>

<div id="block-body">

 

<?php

    include("include/block-header.php");

?>

 

<div id="block-right">

<?php

    include("include/block-category.php"); 

    include("include/block-parameter.php"); 

    include("include/block-news.php");

?>

</div>

<div id="block-content">

<div id="block-sorting">

<p id="nav-breadcrumbs"><a href="index.php" >Главная страница</a> \ <span>Все товары</span></p>

<ul id="options-list">

<li>Вид: </li>

<li><img id="style-grid" src="/images/icon-grid.png" /></li>

<li><img id="style-list" src="/images/icon-list.png" /></li>

<li>Сортировать:</li>

<li><a id="select-sort"><?php echo $sort_name; ?></a>

<ul id="sorting-list">

<li><a href="index.php?sort=price-asc" >От дешевых к дорогим</a></li>

<li><a href="index.php?sort=price-desc" >От дорогих к дешевым</a></li>

<li><a href="index.php?sort=popular" >Популярное</a></li>

<li><a href="index.php?sort=news" >Новинки</a></li>

<li><a href="index.php?sort=brand" >От А до Я</a></li>

</ul>

</li>

</ul>

</div>

 

<ul id="block-tovar-grid" >

 

<?php

 

      $num = 12; // Здесь указываем сколько хотим выводить товаров.

    $page = (int)$_GET['page'];             

   

      $count = mysql_query("SELECT COUNT(*) FROM table_products WHERE visible = '1'",$link);

    $temp = mysql_fetch_array($count);

 

      If ($temp[0] > 0)

      { 

      $tempcount = $temp[0];

 

      // Находим общее число страниц

      $total = (($tempcount - 1) / $num) + 1;

      $total =  intval($total);

 

      $page = intval($page);

 

      if(empty($page) or $page < 0) $page = 1; 

      

      if($page > $total) $page = $total;

       

      // Вычисляем начиная с какого номера

    // следует выводить товары

      $start = $page * $num - $num;

 

      $qury_start_num = " LIMIT $start, $num";

      }

 

 

     

  $result = mysql_query("SELECT * FROM table_products WHERE visible='1' ORDER BY $sorting $qury_start_num ",$link); 

 

if (mysql_num_rows($result) > 0)

{

 $row = mysql_fetch_array($result);

 

 do

 {

 

if  ($row["image"] != "" && file_exists("./uploads_images/".$row["image"]))

{

$img_path = './uploads_images/'.$row["image"];

$max_width = 200;

$max_height = 200;

 list($width, $height) = getimagesize($img_path);

$ratioh = $max_height/$height;

$ratiow = $max_width/$width;

$ratio = min($ratioh, $ratiow);

$width = intval($ratio*$width);

$height = intval($ratio*$height);   

}else

{

$img_path = "/images/no-image.png";

$width = 110;

$height = 200;

}

 

 // Количество отзывов

$query_reviews = mysql_query("SELECT * FROM table_reviews WHERE products_id = '{$row["products_id"]}' AND moderat='1'",$link); 

$count_reviews = mysql_num_rows($query_reviews);

   

 

  echo '

 

  <li>

  <div class="block-images-grid" >

  <img src="'.$img_path.'" width="'.$width.'" height="'.$height.'" />

  </div>

  <p class="style-title-grid" ><a href="view_content.php?id='.$row["products_id"].'" >'.$row["title"].'</a></p>

  <ul class="reviews-and-counts-grid">

  <li><img src="/images/eye-icon.png" /><p>'.$row["count"].'</p></li>

  <li><img src="/images/comment-icon.png" /><p>'.$count_reviews.'</p></li>

  </ul>

  <a class="add-cart-style-grid" tid="'.$row["products_id"].'" ></a>

  <p class="style-price-grid" ><strong>'.group_numerals($row["price"]).'</strong> руб.</p>

  <div class="mini-features" >

  '.$row["mini_features"].'

  </div>

  </li>

 

  ';

 

   

 }

    while ($row = mysql_fetch_array($result));

}   

 

 

?>

</ul>

 

 

<ul id="block-tovar-list" >

 

<?php

     

  $result = mysql_query("SELECT * FROM table_products WHERE visible='1' ORDER BY $sorting $qury_start_num",$link); 

 

if (mysql_num_rows($result) > 0)

{

 $row = mysql_fetch_array($result);

 

 do

 {

 

if  ($row["image"] != "" && file_exists("./uploads_images/".$row["image"]))

{

$img_path = './uploads_images/'.$row["image"];

$max_width = 150;

$max_height = 150;

 list($width, $height) = getimagesize($img_path);

$ratioh = $max_height/$height;

$ratiow = $max_width/$width;

$ratio = min($ratioh, $ratiow);

$width = intval($ratio*$width);

$height = intval($ratio*$height);   

}else

{

$img_path = "/images/noimages80x70.png";

$width = 80;

$height = 70;

}

 // Количество отзывов

$query_reviews = mysql_query("SELECT * FROM table_reviews WHERE products_id = '{$row["products_id"]}' AND moderat='1'",$link); 

$count_reviews = mysql_num_rows($query_reviews); 

  echo '

 

  <li>

  <div class="block-images-list" >

  <img src="'.$img_path.'" width="'.$width.'" height="'.$height.'" />

  </div>

 

  <ul class="reviews-and-counts-list">

  <li><img src="/images/eye-icon.png" /><p>'.$row["count"].'</p></li>

  <li><img src="/images/comment-icon.png" /><p>'.$count_reviews.'</p></li>

  </ul>

 

  <p class="style-title-list" ><a href="view_content.php?id='.$row["products_id"].'" >'.$row["title"].'</a></p>

 

  <a class="add-cart-style-list" tid="'.$row["products_id"].'" ></a>

  <p class="style-price-list" ><strong>'.group_numerals($row["price"]).'</strong> руб.</p>

  <div class="style-text-list" >

  '.$row["mini_description"].'

  </div>

  </li>

 

  ';

 

   

 }

    while ($row = mysql_fetch_array($result));

}   

 

echo '</ul>';

 

if ($page != 1){ $pstr_prev = '<li><a class="pstr-prev" href="index.php?page='.($page - 1).'">&lt;</a></li>';}

if ($page != $total) $pstr_next = '<li><a class="pstr-next" href="index.php?page='.($page + 1).'">&gt;</a></li>';

 

 

// Формируем ссылки со страницами

if($page - 5 > 0) $page5left = '<li><a href="index.php?page='.($page - 5).'">'.($page - 5).'</a></li>';

if($page - 4 > 0) $page4left = '<li><a href="index.php?page='.($page - 4).'">'.($page - 4).'</a></li>';

if($page - 3 > 0) $page3left = '<li><a href="index.php?page='.($page - 3).'">'.($page - 3).'</a></li>';

if($page - 2 > 0) $page2left = '<li><a href="index.php?page='.($page - 2).'">'.($page - 2).'</a></li>';

if($page - 1 > 0) $page1left = '<li><a href="index.php?page='.($page - 1).'">'.($page - 1).'</a></li>';

 

if($page + 5 <= $total) $page5right = '<li><a href="index.php?page='.($page + 5).'">'.($page + 5).'</a></li>';

if($page + 4 <= $total) $page4right = '<li><a href="index.php?page='.($page + 4).'">'.($page + 4).'</a></li>';

if($page + 3 <= $total) $page3right = '<li><a href="index.php?page='.($page + 3).'">'.($page + 3).'</a></li>';

if($page + 2 <= $total) $page2right = '<li><a href="index.php?page='.($page + 2).'">'.($page + 2).'</a></li>';

if($page + 1 <= $total) $page1right = '<li><a href="index.php?page='.($page + 1).'">'.($page + 1).'</a></li>';

 

 

if ($page+5 < $total)

{

    $strtotal = '<li><p class="nav-point">...</p></li><li><a href="index.php?page='.$total.'">'.$total.'</a></li>';

}else

{

    $strtotal = "";

}

 

if ($total > 1)

{

    echo '

    <div class="pstrnav">

    <ul>

    ';

    echo $pstr_prev.$page5left.$page4left.$page3left.$page2left.$page1left."<li><a class='pstr-active' href='index.php?page=".$page."'>".$page."</a></li>".$page1right.$page2right.$page3right.$page4right.$page5right.$strtotal.$pstr_next;

    echo '

    </ul>

    </div>

    ';

}

 

 

?>

 

 

 

</div>

 

<?php

    include("include/block-random.php");

    include("include/block-footer.php");   

?>

</div>

 

 

</body>

 

</html>

 

<?php

   define('myeshop', true);  

   include("include/db_connect.php");

   include("functions/functions.php");

   session_start();

   include("include/auth_cookie.php");

 

 

    $go = clear_string($_GET["go"]);

   

    switch ($go) {

 

          case "news":    

          $query_aystopper= " WHERE visible = '1' AND new = '1'";

        $name_aystopper = "Новинки товаров";

          break;

 

          case "leaders":

          $query_aystopper= " WHERE visible = '1' AND leader = '1'";

        $name_aystopper = "Лидеры продаж";

          break;

 

          case "sale":

          $query_aystopper= " WHERE visible = '1' AND sale = '1'";

        $name_aystopper = "Распродажа товаров";

          break;

       

       

          default:

        $query_aystopper = ""; 

          break;

}

 

 

$sorting = $_GET["sort"];  

 

switch ($sorting)

{

    case 'price-asc';

    $sorting = 'price ASC';

    $sort_name = 'От дешевых к дорогим';

    break;

 

    case 'price-desc';

    $sorting = 'price DESC';

    $sort_name = 'От дорогих к дешевым';

    break;

   

    case 'popular';

    $sorting = 'count DESC';

    $sort_name = 'Популярное';

    break;

   

    case 'news';

    $sorting = 'datetime DESC';

    $sort_name = 'Новинки';

    break;

   

    case 'brand';

    $sorting = 'brand';

    $sort_name = 'Новинки';

    break;

   

    default:

    $sorting = 'products_id DESC';

    $sort_name = 'Нет сортировки';

    break;                          

}

  

   

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

 

<head>

      <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    <link href="css/reset.css" rel="stylesheet" type="text/css" />

    <link href="css/style.css" rel="stylesheet" type="text/css" />

    <link href="trackbar/trackbar.css" rel="stylesheet" type="text/css" />

 

    <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>

    <script type="text/javascript" src="js/jcarousellite_1.0.1.js"></script>

    <script type="text/javascript" src="js/shop-script.js"></script>

    <script type="text/javascript" src="js/jquery.cookie.min.js"></script>

    <script type="text/javascript" src="trackbar/jquery.trackbar.js"></script>

    <script type="text/javascript" src="js/TextChange.js"></script>

   

      <title>Интернет-Магазин E-MOGILEV</title>

</head>

<body>

<div id="block-body">

<?php

    include("include/block-header.php");   

?>

<div id="block-right">

<?php

    include("include/block-category.php"); 

    include("include/block-parameter.php"); 

    include("include/block-news.php");

?>

</div>

<div id="block-content">

 

<?php

      if ($query_aystopper != "")

    {

   

      $num = 12; // Здесь указываем сколько хотим выводить товаров.

    $page = (int)$_GET['page'];             

   

      $count = mysql_query("SELECT COUNT(*) FROM table_products $query_aystopper",$link);

    $temp = mysql_fetch_array($count);

 

      If ($temp[0] > 0)

      { 

      $tempcount = $temp[0];

 

      // Находим общее число страниц

      $total = (($tempcount - 1) / $num) + 1;

      $total =  intval($total);

 

      $page = intval($page);

 

      if(empty($page) or $page < 0) $page = 1; 

      

      if($page > $total) $page = $total;

       

      // Вычисляем начиная с какого номера

    // следует выводить товары

      $start = $page * $num - $num;

 

      $qury_start_num = " LIMIT $start, $num";

      }

 

 

 

If ($temp[0] > 0)

      {

 

?>

 

 

<div id="block-sorting">

<p id="nav-breadcrumbs"><a href="index.php" >Главная страница</a> \ <span><?php echo $name_aystopper; ?></span></p>

<ul id="options-list">

<li>Вид: </li>

<li><img id="style-grid" src="/images/icon-grid.png" /></li>

<li><img id="style-list" src="/images/icon-list.png" /></li>

<li>Сортировать:</li>

<li><a id="select-sort"><?php echo $sort_name; ?></a>

<ul id="sorting-list">

<li><a href="view_aystopper.php?go=<?php echo $go; ?>&sort=price-asc" >От дешевых к дорогим</a></li>

<li><a href="view_aystopper.php?go=<?php echo $go; ?>&sort=price-desc" >От дорогих к дешевым</a></li>

<li><a href="view_aystopper.php?go=<?php echo $go; ?>&sort=popular" >Популярное</a></li>

<li><a href="view_aystopper.php?go=<?php echo $go; ?>&sort=news" >Новинки</a></li>

<li><a href="view_aystopper.php?go=<?php echo $go; ?>&sort=brand" >От А до Я</a></li>

</ul>

</li>

</ul>

</div>

 

<ul id="block-tovar-grid" >

<?php

     

  $result = mysql_query("SELECT * FROM table_products $query_aystopper ORDER BY $sorting $qury_start_num ",$link); 

 

if (mysql_num_rows($result) > 0)

{

 $row = mysql_fetch_array($result);

 

 do

 {

 

if  ($row["image"] != "" && file_exists("./uploads_images/".$row["image"]))

{

$img_path = './uploads_images/'.$row["image"];

$max_width = 200;

$max_height = 200;

 list($width, $height) = getimagesize($img_path);

$ratioh = $max_height/$height;

$ratiow = $max_width/$width;

$ratio = min($ratioh, $ratiow);

$width = intval($ratio*$width);

$height = intval($ratio*$height);   

}else

{

$img_path = "/images/no-image.png";

$width = 110;

$height = 200;

}

 

  echo '

 

  <li>

  <div class="block-images-grid" >

  <img src="'.$img_path.'" width="'.$width.'" height="'.$height.'" />

  </div>

  <p class="style-title-grid" ><a href="view_content.php?id='.$row["products_id"].'" >'.$row["title"].'</a></p>

  <ul class="reviews-and-counts-grid">

  <li><img src="/images/eye-icon.png" /><p>0</p></li>

  <li><img src="/images/comment-icon.png" /><p>0</p></li>

  </ul>

  <a class="add-cart-style-grid" ></a>

  <p class="style-price-grid" ><strong>'.$row["price"].'</strong> руб.</p>

  <div class="mini-features" >

  '.$row["mini_features"].'

  </div>

  </li>

 

  ';

 

   

 }

    while ($row = mysql_fetch_array($result));

}   

 

 

?>

</ul>

 

 

<ul id="block-tovar-list" >

 

<?php

     

  $result = mysql_query("SELECT * FROM table_products $query_aystopper ORDER BY $sorting $qury_start_num",$link); 

 

if (mysql_num_rows($result) > 0)

{

 $row = mysql_fetch_array($result);

 

 do

 {

 

if  ($row["image"] != "" && file_exists("./uploads_images/".$row["image"]))

{

$img_path = './uploads_images/'.$row["image"];

$max_width = 150;

$max_height = 150;

 list($width, $height) = getimagesize($img_path);

$ratioh = $max_height/$height;

$ratiow = $max_width/$width;

$ratio = min($ratioh, $ratiow);

$width = intval($ratio*$width);

$height = intval($ratio*$height);   

}else

{

$img_path = "/images/noimages80x70.png";

$width = 80;

$height = 70;

}

 

  echo '

 

  <li>

  <div class="block-images-list" >

  <img src="'.$img_path.'" width="'.$width.'" height="'.$height.'" />

  </div>

 

  <ul class="reviews-and-counts-list">

  <li><img src="/images/eye-icon.png" /><p>0</p></li>

  <li><img src="/images/comment-icon.png" /><p>0</p></li>

  </ul>

 

  <p class="style-title-list" ><a href="view_content.php?id='.$row["products_id"].'" >'.$row["title"].'</a></p>

 

  <a class="add-cart-style-list" ></a>

  <p class="style-price-list" ><strong>'.$row["price"].'</strong> руб.</p>

  <div class="style-text-list" >

  '.$row["mini_description"].'

  </div>

  </li>

 

  ';

 

   

 }

    while ($row = mysql_fetch_array($result));

}   

 

echo '</ul>';

 

}else

{

    echo '<p>Товаров нет!</p>';

}

 

    }else

    {

        echo '<p>Данная категория не найдена!</p>';

    }

 

 

if ($page != 1){ $pstr_prev = '<li><a class="pstr-prev" href="view_aystopper.php?go='.$go.'&page='.($page - 1).'">&lt;</a></li>';}

if ($page != $total) $pstr_next = '<li><a class="pstr-next" href="view_aystopper.php?go='.$go.'&page='.($page + 1).'">&gt;</a></li>';

 

 

// Формируем ссылки со страницами

if($page - 5 > 0) $page5left = '<li><a href="view_aystopper.php?go='.$go.'&page='.($page - 5).'">'.($page - 5).'</a></li>';

if($page - 4 > 0) $page4left = '<li><a href="view_aystopper.php?go='.$go.'&page='.($page - 4).'">'.($page - 4).'</a></li>';

if($page - 3 > 0) $page3left = '<li><a href="view_aystopper.php?go='.$go.'&page='.($page - 3).'">'.($page - 3).'</a></li>';

if($page - 2 > 0) $page2left = '<li><a href="view_aystopper.php?go='.$go.'&page='.($page - 2).'">'.($page - 2).'</a></li>';

if($page - 1 > 0) $page1left = '<li><a href="view_aystopper.php?go='.$go.'&page='.($page - 1).'">'.($page - 1).'</a></li>';

 

if($page + 5 <= $total) $page5right = '<li><a href="view_aystopper.php?go='.$go.'&page='.($page + 5).'">'.($page + 5).'</a></li>';

if($page + 4 <= $total) $page4right = '<li><a href="view_aystopper.php?go='.$go.'&page='.($page + 4).'">'.($page + 4).'</a></li>';

if($page + 3 <= $total) $page3right = '<li><a href="view_aystopper.php?go='.$go.'&page='.($page + 3).'">'.($page + 3).'</a></li>';

if($page + 2 <= $total) $page2right = '<li><a href="view_aystopper.php?go='.$go.'&page='.($page + 2).'">'.($page + 2).'</a></li>';

if($page + 1 <= $total) $page1right = '<li><a href="view_aystopper.php?go='.$go.'&page='.($page + 1).'">'.($page + 1).'</a></li>';

 

 

if ($page+5 < $total)

{

    $strtotal = '<li><p class="nav-point">...</p></li><li><a href="view_aystopper.php?go='.$go.'&page='.$total.'">'.$total.'</a></li>';

}else

{

    $strtotal = "";

}

 

if ($total > 1)

{

    echo '

    <div class="pstrnav">

    <ul>

    ';

    echo $pstr_prev.$page5left.$page4left.$page3left.$page2left.$page1left."<li><a class='pstr-active' href='view_aystopper.php?go=".$go."&page=".$page."'>".$page."</a></li>".$page1right.$page2right.$page3right.$page4right.$page5right.$strtotal.$pstr_next;

    echo '

    </ul>

    </div>

    ';

}

 

 

?>

 

 

 

</div>

 

<?php

    include("include/block-footer.php");   

?>

</div>

 

</body>

</html>

 

<?php

   define('myeshop', true);

   include("include/db_connect.php");

   include("functions/functions.php");

   session_start();

   include("include/auth_cookie.php");

   $cat = clear_string($_GET["cat"]);

   $type = clear_string($_GET["type"]);

  

   $sorting = $_GET["sort"];  

 

switch ($sorting)

{

    case 'price-asc';

    $sorting = 'price ASC';

    $sort_name = 'От дешевых к дорогим';

    break;

 

    case 'price-desc';

    $sorting = 'price DESC';

    $sort_name = 'От дорогих к дешевым';

    break;

   

    case 'popular';

    $sorting = 'count DESC';

    $sort_name = 'Популярное';

    break;

   

    case 'news';

    $sorting = 'datetime DESC';

    $sort_name = 'Новинки';

    break;

   

    case 'brand';

    $sorting = 'brand';

    $sort_name = 'Новинки';

    break;

   

    default:

    $sorting = 'products_id DESC';

    $sort_name = 'Нет сортировки';

    break;                          

}

  

   

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

 

<head>

      <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    <link href="css/reset.css" rel="stylesheet" type="text/css" />

    <link href="css/style.css" rel="stylesheet" type="text/css" />

    <link href="trackbar/trackbar.css" rel="stylesheet" type="text/css" />

 

    <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>

    <script type="text/javascript" src="js/jcarousellite_1.0.1.js"></script>

    <script type="text/javascript" src="js/shop-script.js"></script>

    <script type="text/javascript" src="js/jquery.cookie.min.js"></script>

    <script type="text/javascript" src="trackbar/jquery.trackbar.js"></script>

    <script type="text/javascript" src="js/TextChange.js"></script>

   

      <title>Интернет-Магазин E-MOGILEV</title>

</head>

<body>

 

<div id="block-body">

<?php

    include("include/block-header.php");   

?>

<div id="block-right">

<?php

    include("include/block-category.php"); 

    include("include/block-parameter.php"); 

    include("include/block-news.php");

?>

</div>

<div id="block-content">

 

 

 

<?php

 

     

 if (!empty($cat) && !empty($type))

 {

 

     $querycat = "AND brand='$cat' AND type_tovara='$type'";

     $catlink = "cat=$cat&";

   

 }else

 {

   

    if (!empty($type))

    {

       $querycat = "AND type_tovara='$type'";

    }else

    {

       $querycat = "";

    }

  

       if (!empty($cat))

    {

       $catlink = "cat=$cat&";

    }else

    {

       $catlink = "";

    }

   

     

 } 

 

      $num = 12; // Здесь указываем сколько хотим выводить товаров.

    $page = (int)$_GET['page'];             

   

      $count = mysql_query("SELECT COUNT(*) FROM table_products WHERE visible = '1' $querycat",$link);

    $temp = mysql_fetch_array($count);

 

      If ($temp[0] > 0)

      { 

      $tempcount = $temp[0];

 

      // Находим общее число страниц

      $total = (($tempcount - 1) / $num) + 1;

      $total =  intval($total);

 

      $page = intval($page);

 

      if(empty($page) or $page < 0) $page = 1; 

      

      if($page > $total) $page = $total;

       

      // Вычисляем начиная с какого номера

    // следует выводить товары

      $start = $page * $num - $num;

 

      $qury_start_num = " LIMIT $start, $num";

      }   

   

   

  $result = mysql_query("SELECT * FROM table_products WHERE visible='1' $querycat ORDER BY $sorting $qury_start_num",$link); 

 

if (mysql_num_rows($result) > 0)

{

 $row = mysql_fetch_array($result);

 

 echo '

 <div id="block-sorting">

<p id="nav-breadcrumbs"><a href="index.php" >Главная страница</a> \ <span>Все товары</span></p>

<ul id="options-list">

<li>Вид: </li>

<li><img id="style-grid" src="/images/icon-grid.png" /></li>

<li><img id="style-list" src="/images/icon-list.png" /></li>

<li>Сортировать:</li>

<li><a id="select-sort">'.$sort_name.'</a>

<ul id="sorting-list">

<li><a href="view_cat.php?'.$catlink.'type='.$type.'&sort=price-asc" >От дешевых к дорогим</a></li>

<li><a href="view_cat.php?'.$catlink.'type='.$type.'&sort=price-desc" >От дорогих к дешевым</a></li>

<li><a href="view_cat.php?'.$catlink.'type='.$type.'&sort=popular" >Популярное</a></li>

<li><a href="view_cat.php?'.$catlink.'type='.$type.'&sort=news" >Новинки</a></li>

<li><a href="view_cat.php?'.$catlink.'type='.$type.'&sort=brand" >От А до Я</a></li>

</ul>

</li>

</ul>

</div>

 

 <ul id="block-tovar-grid" >

 

 ';

 

 

 do

 {

 

if  ($row["image"] != "" && file_exists("./uploads_images/".$row["image"]))

{

$img_path = './uploads_images/'.$row["image"];

$max_width = 200;

$max_height = 200;

 list($width, $height) = getimagesize($img_path);

$ratioh = $max_height/$height;

$ratiow = $max_width/$width;

$ratio = min($ratioh, $ratiow);

$width = intval($ratio*$width);

$height = intval($ratio*$height);   

}else

{

$img_path = "/images/no-image.png";

$width = 110;

$height = 200;

}

 

  echo '

 

  <li>

  <div class="block-images-grid" >

  <img src="'.$img_path.'" width="'.$width.'" height="'.$height.'" />

  </div>

  <p class="style-title-grid" ><a href="view_content.php?id='.$row["products_id"].'" >'.$row["title"].'</a></p>

  <ul class="reviews-and-counts-grid">

  <li><img src="/images/eye-icon.png" /><p>0</p></li>

  <li><img src="/images/comment-icon.png" /><p>0</p></li>

  </ul>

  <a class="add-cart-style-grid" ></a>

  <p class="style-price-grid" ><strong>'.$row["price"].'</strong> руб.</p>

  <div class="mini-features" >

  '.$row["mini_features"].'

  </div>

  </li>

 

  ';

 

   

 }

    while ($row = mysql_fetch_array($result));

   

 

 

?>

</ul>

 

 

<ul id="block-tovar-list" >

 

<?php

     

  $result = mysql_query("SELECT * FROM table_products WHERE visible='1' $querycat ORDER BY $sorting $qury_start_num",$link); 

 

if (mysql_num_rows($result) > 0)

{

 $row = mysql_fetch_array($result);

 

 do

 {

 

if  ($row["image"] != "" && file_exists("./uploads_images/".$row["image"]))

{

$img_path = './uploads_images/'.$row["image"];

$max_width = 150;

$max_height = 150;

 list($width, $height) = getimagesize($img_path);

$ratioh = $max_height/$height;

$ratiow = $max_width/$width;

$ratio = min($ratioh, $ratiow);

$width = intval($ratio*$width);

$height = intval($ratio*$height);   

}else

{

$img_path = "/images/noimages80x70.png";

$width = 80;

$height = 70;

}

 

  echo '

 

  <li>

  <div class="block-images-list" >

  <img src="'.$img_path.'" width="'.$width.'" height="'.$height.'" />

  </div>

 

  <ul class="reviews-and-counts-list">

  <li><img src="/images/eye-icon.png" /><p>0</p></li>

  <li><img src="/images/comment-icon.png" /><p>0</p></li>

  </ul>

 

  <p class="style-title-list" ><a href="view_content.php?id='.$row["products_id"].'" >'.$row["title"].'</a></p>

 

  <a class="add-cart-style-list" ></a>

  <p class="style-price-list" ><strong>'.$row["price"].'</strong> руб.</p>

  <div class="style-text-list" >

  '.$row["mini_description"].'

  </div>

  </li>

 

  ';

 

   

 }

    while ($row = mysql_fetch_array($result));

}

}else

{

    echo '<h3>Категория не доступна или не создана!</3>';

}   

 

echo '</ul>';

 

if ($page != 1){ $pstr_prev = '<li><a class="pstr-prev" href="view_cat.php?page='.($page - 1).'">&lt;</a></li>';}

if ($page != $total) $pstr_next = '<li><a class="pstr-next" href="view_cat.php?page='.($page + 1).'">&gt;</a></li>';

 

 

// Формируем ссылки со страницами

if($page - 5 > 0) $page5left = '<li><a href="view_cat.php?page='.($page - 5).'">'.($page - 5).'</a></li>';

if($page - 4 > 0) $page4left = '<li><a href="view_cat.php?page='.($page - 4).'">'.($page - 4).'</a></li>';

if($page - 3 > 0) $page3left = '<li><a href="view_cat.php?page='.($page - 3).'">'.($page - 3).'</a></li>';

if($page - 2 > 0) $page2left = '<li><a href="view_cat.php?page='.($page - 2).'">'.($page - 2).'</a></li>';

if($page - 1 > 0) $page1left = '<li><a href="view_cat.php?page='.($page - 1).'">'.($page - 1).'</a></li>';

 

if($page + 5 <= $total) $page5right = '<li><a href="view_cat.php?page='.($page + 5).'">'.($page + 5).'</a></li>';

if($page + 4 <= $total) $page4right = '<li><a href="view_cat.php?page='.($page + 4).'">'.($page + 4).'</a></li>';

if($page + 3 <= $total) $page3right = '<li><a href="view_cat.php?page='.($page + 3).'">'.($page + 3).'</a></li>';

if($page + 2 <= $total) $page2right = '<li><a href="view_cat.php?page='.($page + 2).'">'.($page + 2).'</a></li>';

if($page + 1 <= $total) $page1right = '<li><a href="view_cat.php?page='.($page + 1).'">'.($page + 1).'</a></li>';

 

 

if ($page+5 < $total)

{

    $strtotal = '<li><p class="nav-point">...</p></li><li><a href="view_cat.php?page='.$total.'">'.$total.'</a></li>';

}else

{

    $strtotal = "";

}

 

if ($total > 1)

{

    echo '

    <div class="pstrnav">

    <ul>

    ';

    echo $pstr_prev.$page5left.$page4left.$page3left.$page2left.$page1left."<li><a class='pstr-active' href='view_cat.php?page=".$page."'>".$page."</a></li>".$page1right.$page2right.$page3right.$page4right.$page5right.$strtotal.$pstr_next;

    echo '

    </ul>

    </div>

    ';

}

?>

 

 

 

</div>

 

<?php

    include("include/block-footer.php");   

?>

</div>

 

</body>

</html>

 

<?php

   define('myeshop', true);

   include("include/db_connect.php");

   include("functions/functions.php");

   session_start();

   include("include/auth_cookie.php");

 

   $id = clear_string($_GET["id"]);

 

     $seoquery = mysql_query("SELECT seo_words,seo_description FROM table_products WHERE products_id='$id' AND visible='1'",$link);

    

     If (mysql_num_rows($seoquery) > 0)

     {

        $resquery = mysql_fetch_array($seoquery);

     }  

  

  If ($id != $_SESSION['countid'])

{

$querycount = mysql_query("SELECT count FROM table_products WHERE products_id='$id'",$link);

$resultcount = mysql_fetch_array($querycount);

 

$newcount = $resultcount["count"] + 1;

 

$update = mysql_query ("UPDATE table_products SET count='$newcount' WHERE products_id='$id'",$link); 

}

 

$_SESSION['countid'] = $id;

     

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

 

<head>

      <meta http-equiv="content-type" content="text/html; charset=utf-8" />

   

    <meta name="Description" content="<? echo $resquery["seo_description"]; ?>"/>

    <meta name="keywords" content="<? echo $resquery["seo_words"]; ?>" />

 

    <link href="css/reset.css" rel="stylesheet" type="text/css" />

    <link href="css/style.css" rel="stylesheet" type="text/css" />

    <link href="trackbar/trackbar.css" rel="stylesheet" type="text/css" />

 

    <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>

    <script type="text/javascript" src="js/jcarousellite_1.0.1.js"></script>

    <script type="text/javascript" src="js/shop-script.js"></script>

    <script type="text/javascript" src="js/jquery.cookie.min.js"></script>

    <script type="text/javascript" src="trackbar/jquery.trackbar.js"></script>

    <script type="text/javascript" src="js/TextChange.js"></script>

 

    <link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox.css" />

    <script type="text/javascript" src="fancybox/jquery.fancybox.js"></script>

    <script type="text/javascript" src="js/jTabs.js"></script>

   

      <title>Интернет-Магазин E-MOGILEV</title>

 

 

<script type="text/javascript">

$(document).ready(function(){

 

    $("ul.tabs").jTabs({content: ".tabs_content", animate: true, effect:"fade"});

    $(".image-modal").fancybox();

    $(".send-review").fancybox();

     

});  

</script>

</head>

<body>

<div id="block-body">

<?php

    include("include/block-header.php");   

?>

<div id="block-right">

<?php

    include("include/block-category.php"); 

    include("include/block-parameter.php"); 

    include("include/block-news.php");

?>

</div>

<div id="block-content">

<?php

$result1 = mysql_query("SELECT * FROM table_products WHERE products_id='$id' AND visible='1'",$link);

If (mysql_num_rows($result1) > 0)

{

$row1 = mysql_fetch_array($result1);

do

{  

if  (strlen($row1["image"]) > 0 && file_exists("./uploads_images/".$row1["image"]))

{

$img_path = './uploads_images/'.$row1["image"];

$max_width = 300;

$max_height = 300;

 list($width, $height) = getimagesize($img_path);

$ratioh = $max_height/$height;

$ratiow = $max_width/$width;

$ratio = min($ratioh, $ratiow);

 

$width = intval($ratio*$width);

$height = intval($ratio*$height);   

}else

{

$img_path = "/images/no-image.png";

$width = 110;

$height = 200;

}    

 

// Количество отзывов

$query_reviews = mysql_query("SELECT * FROM table_reviews WHERE products_id = '$id' AND moderat='1'",$link); 

$count_reviews = mysql_num_rows($query_reviews);

 

 

echo  '

 

<div id="block-breadcrumbs-and-rating">

<p id="nav-breadcrumbs2"><a href="index.php">Все товары</a> \ <span>'.$row1["brand"].'</span></p>

<div id="block-like">

<p id="likegood" tid="'.$id.'" >Нравится</p><p id="likegoodcount" >'.$row1["yes_like"].'</p>

</div>

</div>

 

<div id="block-content-info">

 

<img src="'.$img_path.'" width="'.$width.'" height="'.$height.'" />

 

<div id="block-mini-description">

 

<p id="content-title">'.$row1["title"].'</p>

 

<ul class="reviews-and-counts-content">

<li><img src="/images/eye-icon.png" /><p>'.$row1["count"].'</p></li>

<li><img src="/images/comment-icon.png" /><p>'.$count_reviews.'</p></li>

</ul>

 

 

<p id="style-price" >'.group_numerals($row1["price"]).' руб</p>

 

<a class="add-cart" id="add-cart-view" tid="'.$row1["products_id"].'" ></a>

 

<p id="content-text">'.$row1["mini_description"].'</p>

 

</div>

 

</div>

 

';

 

  

}

 while ($row1 = mysql_fetch_array($result1));

 

 

 $result = mysql_query("SELECT * FROM uploads_images WHERE products_id='$id'",$link);

If (mysql_num_rows($result) > 0)

{

$row = mysql_fetch_array($result);

echo '<div id="block-img-slide">

      <ul>';

do

{

   

$img_path = './uploads_images/'.$row["image"];

$max_width = 70;

$max_height = 70;

 list($width, $height) = getimagesize($img_path);

$ratioh = $max_height/$height;

$ratiow = $max_width/$width;

$ratio = min($ratioh, $ratiow);

 

$width = intval($ratio*$width);

$height = intval($ratio*$height);   

   

   

echo '

<li>

<a class="image-modal" href="#image'.$row["id"].'"><img src="'.$img_path.'" width="'.$width.'" height="'.$height.'" /></a>

</li>

<a style="display:none;" class="image-modal" rel="group" id="image'.$row["id"].'" ><img  src="./uploads_images/'.$row["image"].'" /></a>

';

}

 while ($row = mysql_fetch_array($result));

 echo '

 </ul>

 </div>   

        ';

}

 

$result = mysql_query("SELECT * FROM table_products WHERE products_id='$id' AND visible='1'",$link);

$row = mysql_fetch_array($result);

 

echo '

 

<ul class="tabs">

    <li><a class="active" href="#" >Описание</a></li>

    <li><a href="#" >Характеристики</a></li>

    <li><a href="#" >Отзывы</a></li>  

</ul>

 

<div class="tabs_content">

 

<div>'.$row["description"].'</div>

<div>'.$row["features"].'</div>

<div>

<p id="link-send-review" ><a class="send-review" href="#send-review" >Написать отзыв</a></p>

';

 

$query_reviews = mysql_query("SELECT * FROM table_reviews WHERE products_id='$id' AND moderat='1' ORDER BY reviews_id DESC",$link);

 

If (mysql_num_rows($query_reviews) > 0)

{

$row_reviews = mysql_fetch_array($query_reviews);

do

{

 

echo '

<div class="block-reviews" >

<p class="author-date" ><strong>'.$row_reviews["name"].'</strong>, '.$row_reviews["date"].'</p>

<img src="/images/plus-reviews.png" />

<p class="textrev" >'.$row_reviews["good_reviews"].'</p>

<img src="/images/minus-reviews.png" />

<p class="textrev" >'.$row_reviews["bad_reviews"].'</p>

 

<p class="text-comment">'.$row_reviews["comment"].'</p>

</div>

 

';

       

}

 while ($row_reviews = mysql_fetch_array($query_reviews));

}

else

{

    echo '<p class="title-no-info" >Отзывов нет</p>';

}

 

 

 

echo '

</div>

 

</div>

 

 

    <div id="send-review" >

   

    <p align="right" id="title-review">Публикация отзыва производится после предварительной модерации.</p>

   

    <ul>

    <li><p align="right"><label id="label-name" >Имя<span>*</span></label><input maxlength="15" type="text"  id="name_review" /></p></li>

    <li><p align="right"><label id="label-good" >Достоинства<span>*</span></label><textarea id="good_review" ></textarea></p></li>   

    <li><p align="right"><label id="label-bad" >Недостатки<span>*</span></label><textarea id="bad_review" ></textarea></p></li>    

    <li><p align="right"><label id="label-comment" >Комментарий</label><textarea id="comment_review" ></textarea></p></li>    

    </ul>

    <p id="reload-img"><img src="/images/loading.gif"/></p> <p id="button-send-review" iid="'.$id.'" ></p>

    </div>

 

 

 

';

 

}

     

?>

</div>

 

<?php

    include("include/block-footer.php");   

?>

</div>

 

</body>

</html>

 

 

Количество комментариев: 0

Для того, чтобы оставить коментарий необходимо зарегистрироваться