php include core database_scripts connection php include safemysql cla

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
include '/core/database_scripts/connection.php';
include 'safemysql.class.php';
// Получение данных из базы
// Общая информация
$generalInfo = mysql_query("SELECT * FROM general_information WHERE id='1'", $db);
$generalInfoArr = mysql_fetch_array($generalInfo);
// Товары
$goods = mysql_query("SELECT * FROM goods WHERE category='suvs' LIMIT 0,3");
$q="SELECT count(*) FROM goods LIMIT 0,3";
$res=mysql_query($q);
$row=mysql_fetch_row($res);
$total_rows=$row[0];
$per_page='3';
$num_pages=ceil($total_rows/$per_page);
?>
<!DOCTYPE html>
<html lang="ru" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8">
<title>PerfectRun-Обувь для вас</title>
<link href="/styles/bootstrap.min.css" rel="stylesheet">
<link href="/styles/bootstrap-responsive.min.css" rel="stylesheet">
<link href="/styles/style.css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="scripts/html5shiv.js"></script>
<![endif]-->
<script type="text/javascript" src="/scripts/jquery.min.js"></script>
<script type="text/javascript" src="/scripts/bootstrap.min.js"></script>
<script type="text/javascript" src="/scripts/scripts.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="navbar">
<div class="navbar navbar-inverse" style="position: static;">
<div class="navbar-inner">
<div class="container-fluid">
<a data-target=".navbar-responsive-collapse" data-toggle="collapse" class="btn btn-navbar">
<span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
</a>
<a href="/" class="brand">
<?php echo $generalInfoArr['name']; ?>
</a>
<div class="nav-collapse collapse navbar-responsive-collapse">
<ul class="nav">
<li class="dropdown">
<a href="#"
class="dropdown-toggle"
data-toggle="dropdown">
Каталог
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="/index.php">Марафонки</a></li>
<li><a href="/goods/suvs.php">Внедорожники</a></li>
<li><a href="/goods/amortization.php">Аммортизация</a></li>
<li class="divider"></li>
<li><a href="#">Мужская обувь</a></li>
<li><a href="#">Женская обувь</a></li>
<li><a href="#">Детская обувь</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#"
class="dropdown-toggle"
data-toggle="dropdown">
О нас
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="\goods/about.php">О компании</a></li>
<li><a href="#">Местонахождение</a></li>
<li><a href="#">Адреса</a></li>
</ul>
<li>
<a href="/reviews.php">Обзоры</a>
</li>
<li>
<a href="/feedback.php">Обратная связь</a>
</li>
<li>
<a href="/reg.php">Регистрация</a>
</li>
</ul>
<ul class="nav pull-right">
<li class="divider-vertical"></li>
<li><a href="cart.php?view=cart.php">Ваша корзина<?=$_SESSION['total_items']?></a></li>
</div>
</div>
</div>
</div>
<ul class="nav nav-pills">
<li class='active'>
<a href="/index.php">Марафонки</a>
</li>
<li><a href="/goods/suvs.php">Внедорожники</a></li>
<li><a href="/goods/amortization.php">Аммортизация</a></li>
</ul>
<br>
</div>
</div>
<div class="row-fluid">
<?php while ($good = mysql_fetch_array($goods, MYSQL_ASSOC)) { ?>
<div class="span3">
<div class="thumbnail well">
<a href="/goods/good.php?good_id=<?= $good['id'] ?>">
<img src="<? echo $good['image']; ?>" class="fixed-media-object" >
</a>
<div class="caption ">
<h4 class="media-heading">
<? echo $good['title']; ?>
</h4>
<p class="price"><? echo $good['price']; ?> руб</p>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<? for($i=1;$i<=$num_pages;$i++) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?num='.$i*$per_page.'">'.$i."</a>\n";
}?>
</body>
</html>