.p-1 { font-size:20px; margin-top:5px; margin-left:20px; color:#005B00; font-family:Tahoma}
.body-2 {background-image:url(pic/14.jpg); margin-left:0px; margin-top:0px; margin-right:0px; background-repeat:repeat}
.p-2 {font-size:16px; margin-top:8px; margin-left:10px; color:#438746; font-family:Verdana}
.table-1 {background-image:url(Pic/14.jpg); font-size:24px; color:#00714D}
<?php
session_start ();
require("bd.php");
?>
Zakaz.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<title>Интернет- магазин</title>
<style type="text/css">
<!--
a:link {
color: #006231;
text-decoration: none;
}
a:visited {
color: #F1958D;
text-decoration: none;
}
-->
</style>
<link href="style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
-->
</style></head>
<link href="style.css" rel="stylesheet" type="text/css">
<script src="Scripts/AC_RunActiveContent.js" type="text/JavaScript"></script>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
background-image: url(pic/14.jpg);
background-repeat: repeat;
font-family:"Times New Roman", Times, serif, Tahoma
}
-->
</style>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body class="body-2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="0%" rowspan="3"> </td>
<td colspan="3" align="left" valign="top"><script type="text/JavaScript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','1000','height','123','src','flash/shapka','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','flash/shapka' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1000" height="123">
<param name="movie" value="flash/shapka.swf">
<param name="quality" value="high">
<embed src="flash/shapka.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1000" height="123"></embed>
</object></noscript></td>
<td width="0%" rowspan="3"> </td>
</tr>
<tr>
<td width="40%" rowspan="2" align="left" valign="top"><script type="text/JavaScript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','410','height','455','src','flash/main','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','flash/main' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="410" height="455">
<param name="movie" value="flash/main.swf">
<param name="quality" value="high">
<embed src="flash/main.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="410" height="455"></embed>
</object></noscript></td>
<td width="43%" align="left" valign="top"><p class="p-1">Добро пожаловать в Интернет- магазин </p></td>
<td width="17%" align="left" valign="top">
<?php
if (isset ($_SESSION['valid_user']))
{
?>
<style type="text/css">
<!--
.стиль2 {
font-size: 18px;
color: #00714D;
font-weight: bold;
font-style: italic;
}
-->
</style>
<?php
echo '<div align="right"> <span class="стиль2"> Вы вошли как: '.$_SESSION['valid_user']. '
</span> </div> <br>'; ?>
<div align="right"> <a href="logout.php">Выход</a> </div> <br />
<div align="right"> <a href="admin/admin.php">Админ блок</a> </div>
<?php
}
else
{
?>
<div> <a href="registr.php">Регистрация</a> </div>
<?php
echo '<br> Вы не вошли в систему. <br /> <br />';
require ('login.php');
}
?>
</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top">
<?php
$nazv=$_POST['nazv'];
$sort=$_POST['sort'];
$kol_vo_produk=$_POST['kol_vo_produk'];
$price_edin=$_POST['price_edin'];
if (!isset($_POST['nazv'])&&!isset($_POST['sort'])&&!isset($_POST['kol_vo_produk'])
&&!isset($_POST['price_edin']) )
{
require ('bd.php');
$sql="select a.nazv, a.sort, b.kol_vo_produk, b.price_edin from produkt a, poz_dok b
where (a.nom = b.nom_produk)";
$result=mysql_query($sql) or die ("Невозможно сделать запрос!" .mysql_error());
$myrow= mysql_fetch_array ($result);
?>
<table width='100%' border='2' cellspacing='1' cellpadding='1'>
<form method='post' action='zakaz.php'>
<tr>
<td width='18%' bgcolor='#66CC66'><div align='center'>Название</div></td>
<td width='17%' bgcolor='#66CC66'><div align='center'>Сорт</div></td>
<td width='27%' bgcolor='#66CC66'><div align='center'>Количество на складе, кг </div></td>
<td width='21%' bgcolor='#66CC66'><div align='center'>Цена, руб </div></td>
<td width='17%' bgcolor='#66CC66'><div align='center'>Количество заказа , кг </div></td>
</tr>
<tr>
<?php
do
{
printf ("
<tr>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td> <label>
<input name = 'kol['nazv']' type='text' size='5' maxlength='5'>
</label> </td>
</tr>
", $myrow["nazv"], $myrow["sort"], $myrow["kol_vo_produk"], $myrow["price_edin"]);
$price ['nazv']= $myrow["sort"];
}
while ($myrow= mysql_fetch_array ($result));
?>
<tr>
<td> <label> <input type="submit" name="Submit" value="Заказать"> </label> </td>
</tr>
</form>
</table>
<?php
}
else
{
if (isset ($_SESSION['valid_user']))
{
if (!isset($_POST['oplata'])&&!isset($_POST['dost'])&&!isset($_POST['kol_vo_produk'])
&&!isset($_POST['price_edin']))
{
?>
<table width="463" height="232" border = 0 cellspacing = 0 background="Pic/14.jpg">
<form action = 'zakaz_produk.php' method = 'post'>
<tr>
<th height="32" colspan = 2 bgcolor='#9BEE9F' class="p-1">Заполните следующие поля </th>
</tr>
<tr>
<td width="163">Оплата</td>
<td width="296"><input type = 'text' name = 'oplata' value = "" maxlength = 40 size = 40></td>
</tr>
<tr>
<td>Доставка (да/нет)</td>
<td><input type = 'text' name = 'dost' value = "" maxlength = 40 size = 40></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="Submit" value="Добавить">
</label></td>
</tr>
</form>
</table>
<?php
}
else
{
$username= $_SESSION['valid_user'];
$query= "select count (*) from admin where username='$username'";
$result= mysql_query($query) or die ("Ошибка при выполнении запроса:" .mysql_error());
$row= mysql_fetch_row ($result);
$nom_urid_face= $row ['nom_urid_face'];
$dat_zakl= date ('Y-m-d');
$date1 = strtotime ($dat_zakl);
$srok_ispol= $date1+60 * 60 * 24 * 7;
$query= "insert into dog_pro (dat_zakl, srok_ispol, oplata, dost, kol_vo_zak, price_zak) values ('".$dat_zakl."', '". $srok_ispol."', '". $oplata."', '". $dost."', '". $kol+vo_zak."',
'". $price_zak."',)";
$result= mysql_query($query) or die ("Ошибка при выполнении запроса:" .mysql_error());
if ($result)
{
echo ' <p class="p-2"> Ваша заявка принята. </p>'; ?>
<a href="dog_prod.php"> <p class="p-1"> Перейти к составлению договора </p></a>
<?php
}
}
}
else
{
echo '<p class="p-1"> Для заказа продукции нужно авторизоваться </p> <br/> <br/>';
}
}
?>
</body>
</html>
Приложение Б
(обязательное)