<?php
#-----------------------------------------------------#
#          ********* Бизнес Сайты *********           #
#             Made by   :  BIZON                      #
#               E-mail  :  blin.alex@bk.ru            #
#                 Site  :  http://f913218p.bget.ru    #
#  Вы не имеете право вносить изменения в код скрипта #
#      это может повлечь неработоспособность сайта    #
#-----------------------------------------------------#
////////////////////////////////////////////////////////////// Навигация
echo'<div class="wrapper">';
echo'<div id="breadcrumb">';
echo'<ul>';
if(emptY($st)){
if(empty($dt)){
echo'<li class="first">Новые Товары</li>';
}else{
echo'<li><a href="'.$link.SID.'">Новые Товары</a></li>';
echo'<li>&#187;</li>';
echo'<li class="first">'.inf_db(s_vit_tovar,id,$dt,name).'</li>';
}
}else{
echo'<li><a href="'.$link.SID.'">Новые Товары</a></li>';
echo'<li>&#187;</li>';
if($st==4){
if(empty($dt)){
echo'<li class="first">Мои товары</li>';
}else{
echo'<li><a href="'.$link.'st=4&amp;'.SID.'">Мои товары</a></li>';
echo'<li>&#187;</li>';
echo'<li class="first">'.inf_db(s_vit_tovar,id,$dt,name).'</li>';
}
}
if($st==3)echo'<li class="first">Добавить</li>';
if($st==2)echo'<li class="first">Корзина</li>';
if($st==1){
if(empty($ct)){echo'<li class="first">Категории товаров</li>';
}else{
echo'<li><a href="'.$link.'st=1&amp;'.SID.'">Категории товаров</a></li>';
echo'<li>&#187;</li>';
echo'<li class="first">'.inf_db(s_vit_categ,id,$ct,name).'</li>';
}}}
echo'</ul>';
echo'</div></div>';
///////////////////////////////////////////////////////////// Середина
echo'<div class="wrapper">';
echo'<div class="container">';
echo'<div class="content">';
/////////////////////////////////
switch($st)
{
case 1:
if(all_dbname(s_vit_categ)==0){
echo'<div class="warning">На сайте нет ни одной категории товаров!</div>';
}else{
if(isset($ct)){
$strSQL = "SELECT * FROM s_vit_tovar WHERE `categ`='$ct' and `status`='1'";
$rs=mysql_query($strSQL);
$total=mysql_num_rows($rs);
if ($total>0){
if ($start<0 || $start > $total){$start = 0;}
$strdb="SELECT * FROM s_vit_tovar  WHERE `categ`='$ct' and `status`='1' ORDER BY time DESC LIMIT $start,9";
$rdd=mysql_query($strdb);
echo'<div class="center_content">';
$categ=inf_db(s_vit_categ,id,$ct,name);
echo'<div class="center_title_bar">'.$categ.'</div>';
while($ron=mysql_fetch_array($rdd)){
if(strlen($ron['name'])>12){
$sto=rtrim(mb_substr(strip_tags($ron['name']),0,20),"!,.-");
$sto=substr($sto,0,strrpos($sto,' '));
}else{$sto=$ron['name'];}
echo'<div class="prod_box"><div class="top_prod_box"></div><div class="center_prod_box">
<div class="product_title"><a href="'.$link.'dt='.$ron['id'].'&amp;'.SID.'" title="'.$ron['name'].'">'.$sto.'</a></div>
<div class="product_img"><a href="'.$link.'dt='.$ron['id'].'&amp;'.SID.'"><img src="vipg.php?url='.$ron['foto1'].'&amp;h=92" alt="pix" /></a></div>
<div class="prod_price"><b>Цена:&nbsp;</b>';
if($ron['szena']!=0) echo'<span class="reduce">'.$ron['szena'].'</span>';
echo'<span class="price">'.$ron['zena'].' '.val($ron['valet']).'</span>
</div></div>
<div class="bottom_prod_box"></div><div class="prod_details_tab">
<a href="'.$link.'cor='.$ron['id'].'&amp;st='.$st.'&amp;ct='.$ct.'&amp;'.SID.'"><img src="images/cart.gif" class="left_bt"/></a>
<a href="'.$link.'dt='.$ron['id'].'&amp;'.SID.'" title="'.$ron['name'].'" class="prod_details">'.date("d.m.y",$ron['time']).'</a>
</div></div>';
}
echo'</div>';
if($total>9)page_strnavigation($link."st=$st&amp;ct=$ct&amp;", 9, $start, $total);
}else{
echo'<div class="warning">В данной категории нет товаров!</div>';
}
}else{
echo'<h1>Категории товаров</h1>';
echo'<table summary="Summary Here" cellpadding="0" cellspacing="0" width="100%">';
echo'<thead><tr><th>Название</th><th>Товаров</th></tr></thead>';
$total = all_dbname(s_vit_categ);
if ($start < 0 || $start > $total){$start = 0;}
$strdb = "SELECT * FROM s_vit_categ ORDER BY name LIMIT $start,10";
$rdd = mysql_query($strdb);
while($ron = mysql_fetch_array($rdd)){
echo'<tr><td><input type=image src="/images/favorites.gif" name="sub">';
if(all_dbnamewatstatus(s_vit_tovar,categ,$ron['id'],status,"1")==0)echo'<b>'.$ron['name'].'</b>';
else
echo'<a href="'.$link.'st='.$st.'&amp;ct='.$ron['id'].'&amp;'.SID.'"><b>'.$ron['name'].'</b></a>';
echo'</td><td width="30px" align="right"><b>'.all_dbnamewatstatus(s_vit_tovar,categ,$ron['id'],status,"1").'</b></td></tr>';
}
echo'</table>';
if($total>10)page_strnavigation($link."st=$st&amp;", 10, $start, $total);
}}
break;
////////////////////////////////////////////////////////////////////////////////////
case 2:
if ($numaz != 0){
if(all_dbnamewat(s_vit_kor,user,s_userdan(id))==0){
echo'<div class="warning">У вас в корзине нет товаров!</div>';
}else{
echo'<h1>Корзина ('.all_dbnamewat(s_vit_kor,user,s_userdan(id)).')</h1>';
echo'<table summary="Summary Here" cellpadding="0" cellspacing="0" width="100%">';
echo'<thead><tr><th>Название</th><th>Цена</th><th>Валюта</th><th></th></tr></thead>';
$total = all_dbnamewat(s_vit_kor,user,s_userdan(id));
if ($start < 0 || $start > $total){$start = 0;}
$strdb = "SELECT * FROM s_vit_kor WHERE `user`='".s_userdan(id)."' ORDER BY time DESC LIMIT $start,6";
$rdd = mysql_query($strdb);
while($ron = mysql_fetch_array($rdd)){
$stf="SELECT * FROM s_vit_tovar  WHERE `id`='".$ron['tovar']."' ";
$rdf=mysql_query($stf);
$rof=mysql_fetch_array($rdf);
if(strlen($rof['name'])>12){
$sto=rtrim(mb_substr(strip_tags($rof['name']),0,90),"!,.-");
$sto=substr($sto,0,strrpos($sto,' '));
}else{$sto=$rof['name'];}
echo'<tr><td><a href="'.$link.'dt='.$rof['id'].'&amp;'.SID.'"><img src="vipg.php?url='.$rof['foto1'].'&amp;h=40" alt="pix" /></a>';
echo'&nbsp;&nbsp;<a href="'.$link.'dt='.$rof['id'].'&amp;'.SID.'"><b>'.$sto.'</b></a>';
echo'</td><td width="70px"><span class="price"><b>'.$rof['zena'].'</b></span></td><td width="70px"><b>'.vala($rof['valet']).'</b></td><td width="18px">
<form action="'.$link.'st='.$st.'&amp;'.SID.'" method="post">
<input type="hidden" name="delcor" value="'.$ron['id'].'">
<input type=image src="images/del.gif" name="sub">
</form></td></tr>';
}
echo'</table>';
if($total>6)page_strnavigation($link."st=$st&amp;", 6, $start, $total);
}}
break;
////////////////////////////////////////////////////////////////////////////////////
case 3:
if ($numaz != 0){
if(all_dbname(s_vit_categ)==0){
echo'<div class="warning">Невозможно добавлять товар, так как на сайте нет ни одной категории товаров!</div>';
}else{
if(!empty($error))echo'<div class="error">'.$error.'</div>';
echo'<form method="post" action="'.$link.'st='.$st.'&amp;'.SID.'" id="form" enctype="multipart/form-data">';
echo'<div class="field"><label>Раздел:</label><div class="input"><select name="categ">';
$v_cat = "SELECT * FROM s_vit_categ  ORDER BY name";
$v_c = mysql_query($v_cat);
while($vc = mysql_fetch_array($v_c)){
echo'<option value="'.$vc['id'].'">'.$vc['name'].'</option>';
}
echo'</select></div></div>';
echo'<div class="field"><label>Название:</label><div class="input"><input type="text" name="nazvan"  maxlength="250" ></div></div>';
echo'<div class="field"><label>Цена:</label><div class="input"><input type="text" name="zena"  maxlength="11" ></div></div>';
echo'<div class="field"><label>Волюта:</label><div class="input"><select name="val">
<option value="1">RUB</option>
<option value="2">USD</option>
<option value="3">EUR</option>
<option value="4">UAH</option>
</select></div></div>';
echo'<div class="field"><label>Формат файла <b>(JPG)</b>:</label><div class="input"><input type="file" name="file"></div></div>';
echo'<div class="field"><label>';
bb_codimg();
echo'</label><div class="input"><textarea id="textarea" type="text" name="text"  maxlength="3000" class="message" ></textarea></div></div>';
echo'<input type="hidden" name="add" value="go"><div class="submit"><button type="submit">Добавить</button></div>';
echo'</form>';

include_once("includes/bbcod.php");
}}
break;
////////////////////////////////////////////////////////////////////////////////////

case 4:
 if ($numaz != 0){
if(all_dbnamewat(s_vit_tovar,user,s_userdan(id))==0){
echo'<div class="warning">На сайте нет ваших товаров!</div>';
}else{
if(isset($dt)){
if(!empty($rbn['tth']))echo'<div class="validation">'.$rbn['tth'].'</div>';
if(!empty($error))echo'<div class="error">'.$error.'</div>';

echo'<form method="post" action="'.$link.'st='.$st.'&amp;dt='.$dt.'&amp;'.SID.'" id="form" enctype="multipart/form-data">';
echo'<div class="field"><label>Категории:</label><div class="input"><select name="categ" >';
$v_cat = "SELECT * FROM s_vit_categ  ORDER BY name";
$v_c = mysql_query($v_cat);
echo'<option value="'.inf_db(s_vit_categ,id,$rbn['categ'],id).'">'.inf_db(s_vit_categ,id,$rbn['categ'],name).'</option>';
while($vc = mysql_fetch_array($v_c)){
echo'<option value="'.$vc['id'].'">'.$vc['name'].'</option>';
}
echo'</select></div></div>';
echo'<div class="field"><label>Название:</label><div class="input"><input type="text" name="nazvan"  maxlength="150" value="'.$rbn['name'].'" ></div></div>';
echo'<div class="field"><label>Старая цена:</label><div class="input"><input type="text" name="szena"  maxlength="150" value="'.$rbn['szena'].'" ></div></div>';
echo'<div class="field"><label>Новая цена:</label><div class="input"><input type="text" name="zena"  maxlength="150" value="'.$rbn['zena'].'" ></div></div>';
echo'<div class="field"><label>Валюта:</label><div class="input"><select name="val">';
echo'<option value="'.$rbn['valet'].'">'.vala($rbn['valet']).'</option>';
if($rbn['valet']!=1)echo'<option value="1">RUB</option>';
if($rbn['valet']!=2)echo'<option value="2">USD</option>';
if($rbn['valet']!=3)echo'<option value="3">EUR</option>';
if($rbn['valet']!=4)echo'<option value="4">UAH</option>';
echo'</select></div></div>';
echo'<div class="field"><label>Текушее Фото</label><a rel="gallery" class="photo" href="gallery.php?url='.$rbn['foto1'].'&amp;cat=images/vit" title="'.$rbn['name'].'"><img src="vipg.php?url='.$rbn['foto1'].'&amp;h=40" alt="pix" title="'.$rbn['name'].'"/></a></div>';
echo'<div class="field"><label>Сменить Фото:</label><div class="input"><input type="file" name="file" ></div></div>';
echo'<div class="field"><label>';
bb_codimg();
echo'</label><div class="input"><textarea id="textarea" type="text" name="text"  maxlength="250" >'.$rbn['opis'].'</textarea></div></div>';
echo'<input type="hidden" name="edit" value="go"><div class="submit"><button type="submit">Изменить</button></div>';
echo'</form>';
include_once("includes/bbcod.php");
}else{
echo'<h1>Мои товары ('.all_dbnamewat(s_vit_tovar,user,s_userdan(id)).')</h1>';
echo'<table summary="Summary Here" cellpadding="0" cellspacing="0" width="100%">';
echo'<thead><tr><th>Название</th><th>Категория</th><th>Статус</th><th></th></tr></thead>';
$total = all_dbnamewat(s_vit_tovar,user,s_userdan(id));
if ($start < 0 || $start > $total){$start = 0;}
$strdb = "SELECT * FROM s_vit_tovar WHERE `user`='".s_userdan(id)."' ORDER BY time DESC LIMIT $start,6";
$rdd = mysql_query($strdb);
while($ron = mysql_fetch_array($rdd)){
if(strlen($rof['name'])>12){
$sto=rtrim(mb_substr(strip_tags($ron['name']),0,90),"!,.-");
$sto=substr($sto,0,strrpos($sto,' '));
}else{$sto=$ron['name'];}

if($ron['status']==1) $tinj="<span class='reduce'>На проверке</span>"; else  $tinj="<span class='price'>На проверке</span>";
if(!empty($ron['tth'])) $namen="<span class='price'>Замечания Админа</span>"; else $namen=$sto;
echo'<tr><td><a href="'.$link.'st='.$st.'&amp;dt='.$ron['id'].'&amp;'.SID.'"><img src="vipg.php?url='.$ron['foto1'].'&amp;h=40" alt="pix" title="'.$ron['name'].'"/></a>';
echo'&nbsp;&nbsp;<a href="'.$link.'st='.$st.'&amp;dt='.$ron['id'].'&amp;'.SID.'" title="'.$ron['name'].'"><b>'.$namen.'</b></a>';
echo'</td><td width="130px"><b>'.inf_db(s_vit_categ,id,$ron['categ'],name).'</b></td>';
echo'<td width="90px">'.$tinj.'</td>';
echo'<td width="18px"><form action="'.$link.'st='.$st.'&amp;'.SID.'" method="post">
<input type="hidden" name="deltov" value="'.$ron['id'].'">
<input type=image src="images/del.gif" name="sub">
</form></td></tr>';
}
echo'</table>';
if($total>6)page_strnavigation($link."st=$st&amp;", 6, $start, $total);
}}}
break;

///////////////////////////////////////////////////////////////////////////////////
default:
if(isset($dt)){
$categ=inf_db(s_vit_categ,id,$ron['categ'],name);
echo'<div class="center_content">';
echo'<div class="center_title_bar">'.$categ.'</div>';
echo'<div class="prod_box_big"><div class="top_prod_box_big"></div><div class="center_prod_box_big"><div class="product_img_big">';
echo'<a rel="gallery" class="photo" href="gallery.php?url='.$ron['foto1'].'&amp;cat=images/vit" title="'.$ron['name'].'"><img src="vipg.php?url='.$ron['foto1'].'&amp;h=92" alt="pix" /></a>';
echo'<div class="thumbs">';
echo'<a rel="gallery" class="photo" href="gallery.php?url='.$ron['foto1'].'&amp;cat=images/vit" title="'.$ron['name'].'"><img src="vipg.php?url='.$ron['foto1'].'&amp;h=25" alt="pix" /></a>';
echo'<a rel="gallery" class="photo" href="gallery.php?url='.$ron['foto1'].'&amp;cat=images/vit" title="'.$ron['name'].'"><img src="vipg.php?url='.$ron['foto1'].'&amp;h=25" alt="pix" /></a>';
echo'<a rel="gallery" class="photo" href="gallery.php?url='.$ron['foto1'].'&amp;cat=images/vit" title="'.$ron['name'].'"><img src="vipg.php?url='.$ron['foto1'].'&amp;h=25" alt="pix" /></a>';
echo'</div></div><div class="details_big_box">';
echo'<div class="product_title_big">'.$ron['name'].'</div>';
echo'<div class="specifications">';
echo'Дата: <span class="blue">'.date("d.m.y",$ron['time']).'</span><br />';
echo'Автор: <span class="blue">'.prof_dan(login,$ron['user']).' '.prof_onli($ron['user'],2).'</span><br />';
echo'</div>';
echo'<div class="prod_price_big">ЦЕНА:&nbsp;';
if($ron['szena']!=0)echo'<span class="reduce">'.$ron['szena'].'</span>';
echo'&nbsp;<span class="price">'.$ron['zena'].'  '.vala($ron['valet']).'</span>';
echo'</div>';
if ($numaz != 0)echo'<a href="'.$link.'cor='.$ron['id'].'&amp;dt='.$dt.'&amp;'.SID.'" class="addtocart">В корзину</a>';
echo'</div></div><div class="bottom_prod_box_big"></div></div>';
echo'<div class="center_title_bar">Описание';
echo'</div></div>
<p>&nbsp;&nbsp;'.bb_code($ron['opis']).'</p>
</div>';
}else{
$strSQL = "SELECT * FROM s_vit_tovar WHERE `status`= '1' ORDER BY time DESC";
$rs=mysql_query($strSQL);
$total=mysql_num_rows($rs);
if ($total>0){
if ($start<0 || $start > $total){$start = 0;}
$strdb="SELECT * FROM s_vit_tovar WHERE `status`= '1' ORDER BY time DESC LIMIT $start,9";
$rdd=mysql_query($strdb);
echo'<div class="center_content">';
while($ron=mysql_fetch_array($rdd)){
if(strlen($ron['name'])>12){
$sto=rtrim(mb_substr(strip_tags($ron['name']),0,20),"!,.-");
$sto=substr($sto,0,strrpos($sto,' '));
}else{$sto=$ron['name'];}
echo'<div class="prod_box"><div class="top_prod_box"></div><div class="center_prod_box">
<div class="product_title"><a href="'.$link.'dt='.$ron['id'].'&amp;'.SID.'" title="'.$ron['name'].'">'.$sto.'</a></div>
<div class="product_img"><a href="'.$link.'dt='.$ron['id'].'&amp;'.SID.'"><img src="vipg.php?url='.$ron['foto1'].'&amp;h=92" alt="pix" /></a></div>
<div class="prod_price"><b>Цена:&nbsp;</b>';
if($ron['szena']!=0) echo'<span class="reduce">'.$ron['szena'].'</span>';
echo'<span class="price">'.$ron['zena'].' '.val($ron['valet']).'</span>
</div></div>
<div class="bottom_prod_box"></div><div class="prod_details_tab">';
if ($numaz != 0)echo'<a href="'.$link.'cor='.$ron['id'].'&amp;'.SID.'"><img src="images/cart.gif" class="left_bt"/></a>';
echo'<a href="'.$link.'dt='.$ron['id'].'&amp;'.SID.'" title="'.$ron['name'].'" class="prod_details">'.date("d.m.y",$ron['time']).'</a>
</div></div>';
}
echo'</div>';
if($total>9)page_strnavigation($link, 9, $start, $total);
}else{
echo'<h1>В продаже нет товаров!</h1>';
}}
}
/////////////////////////////////////// Навигация
echo'</div><div class="column">';
echo'<div class="subnav">';
echo'<h2>Новигация</h2>';
echo'<ul>';
echo'<li><a href="'.$link.SID.'">Новые Товары</a></li>';
echo'<li><a href="'.$link.'st=1&amp;'.SID.'">Категории</a></li>';
if ($numaz != 0){
echo'<li><a href="'.$link.'st=2&amp;'.SID.'">Корзина ('.all_dbnamewat(s_vit_kor,user,s_userdan(id)).')</a></li>';
echo'<li><a href="'.$link.'st=3&amp;'.SID.'">Добавить товар</a>';
echo'<li><a href="'.$link.'st=4&amp;'.SID.'">Мои товары ('.all_dbnamewat(s_vit_tovar,user,s_userdan(id)).')</a></li>';
}
echo'</ul>';
echo'</div>';
echo'</div>';
///////////////////////////////////// низ
echo'<br class="clear" />';
echo'</div>';
echo'</div>';
?>

