<TABLE BORDER="1" width="1024" height="865" align="center">
<TR height="169">
<TD ><img src="logotip.jpg"></TD>
<TD align="center">Заключение договора</TD>
</TR>
<TR height="39">
<TD align="center"><a href="http://winer/statistic.php"> Статистика оплат</a></TD>
<TD rowspan="7" align="justify" valign=top>
<?php
/*------------------------------------------------------------------------------------------------------*/
$ALTA2 = "(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SID = ALTA2)
(SERVER = DEDICATED)
)
)";
if(isset($_REQUEST['next'])) {/*если вход выполнен со страницы регистрации абонента*/
?>
<form action="add_dogovor.php" method = post>
<table>
<tr><td>Логин</td><td>
<?
if($db1=OCILogon("b27", "b27", $ALTA2)) {
$stmt = oci_parse($db1,"
SELECT *
FROM DOGOVOR
WHERE NOMER =(SELECT MAX(NOMER)
FROM DOGOVOR)
");
oci_execute($stmt);
oci_fetch_all($stmt, $results);
$NomerDogovor = $results['NOMER'][0][3] . $results['NOMER'][0][4] . $results['NOMER'][0][5];
$NomerDogovor++;
$Nomer_dogovora;
if($NomerDogovor < 10) $Nomer_dogovora = "npi00" . $_REQUEST['NomerDogovor'];
else if(($NomerDogovor > 10 )&&($NomerDogovor < 100 )) {$Nomer_dogovora = "npi0" . $NomerDogovor;}
else if(($NomerDogovor > 100 )&&($NomerDogovor < 1000 )) $Nomer_dogovora = "npi" . $NomerDogovor;
echo $Nomer_dogovora;
$now_date = date("d.m.Y");
?>
<input type=hidden name=NomerDogovor value=<?echo $Nomer_dogovora;?>>
<input type=hidden name=IdUser value=<?echo $_REQUEST['IdUser'];?>>
<input type=hidden name=now_date value=<?echo $now_date;?>>
<?
OCILogoff($db1);
}else echo "</br>Не удалось соедениться с базой данных";
?>
</td></tr>
<tr><td>Дата заключения</td><td><?echo $now_date?></td></tr>
<tr><td>Пароль</td><td><input type=text name="password" value="password"></td></tr>
<tr><td>Тариф</td><td>
<? /*выбор тарифа*/
if($db1=OCILogon("b27", "b27", $ALTA2)) {
$stmt = oci_parse($db1,"
SELECT *
FROM USLUGI
WHERE type_us = 'tarif'
ORDER BY STOIMOST");
oci_execute($stmt);
$nrows = oci_fetch_all($stmt, $results);
//echo "<pre>";
//var_dump($results);
//echo "</pre>";
echo "<select name=tarif size=1>";
for($i = 0; $i < $nrows; $i++){
echo "\n</br><option value={$results['SHIFR'][$i]}>{$results['NAME1'][$i]}</option>";
}
echo "</select>";
OCILogoff($db1);
}else{
echo "</br>Не удалось соедениться с базой данных";
}
?>
</td></tr>
<tr><td colspan=2></td></tr>
</table>
<input type=submit name="Add" value="Добавить"></br>
</form>
<?
}
else{
if($db1=OCILogon("b27", "b27", $ALTA2)) {
$Next_date = date("Y") + 1;
$Next_date = date("d.m") . "." . $Next_date;
$Nomer_dogovora = $_REQUEST['NomerDogovor'];
$tempstr = "INSERT INTO DOGOVOR VALUES('{$Nomer_dogovora}', TO_DATE('{$_REQUEST['now_date']}', 'DD.MM.YYYY'), TO_DATE('{$Next_date}','DD.MM.YYYY'), '777777777777',{$_REQUEST['IdUser']}, 0 ,'{$_REQUEST['password']}','1')";
echo $tempstr;
$stmt = oci_parse($db1,$tempstr);
oci_execute($stmt);
oci_commit($db1);
echo "<pre>";
var_dump($_REQUEST['tarif'][0]);
$tempstr = "INSERT INTO USLUGA_DOGOVOR VALUES('{$_REQUEST['tarif'][0]}', '{$Nomer_dogovora}')";
echo "</pre></br>".$tempstr;
$stmt = oci_parse($db1,$tempstr);
oci_execute($stmt);
oci_commit($db1);
?>
<form action="" method = get>
</br><input type=submit name="next" value="Next">
</form>
<?
OCILogoff($db1);
}else{
echo "/n</br><h1>Не удалось соедениться с сервером баз данных</h1>/n";
}
}
/*------------------------------------------------------------------------------------------------------*/
?>
</TD>
</TR>
<TD height=39 align="center"><a href="http://winer/add_user.php">Добавление клиента</a></TD>
<TR >
<TD align="center" height="39"><a href="http://winer/spisok_userov.php">Список клиентов</a></br></TD>
</TR>
<TR>
<TD align="center" height="39"><a href="http://winer/add_schet.php?nomer_d=npi001">Пополнение баланса</a></br></TD>
</TR>
<TR>
<TD align="center" height="39"><a href="http://winer/alter_user.php"> Изменение данных</a></br></TD>
</TR>
<TR>
<TD align="center" height="39"><a href="http://winer/any_information.php"> Некоторая информация</a></br></TD>
</TR>
<TR height="380">
<TD align="center" width="220" valign="top" ><a href="http://winer/summ_port.php">Активность портов</a></TD>
</TR>
</TABLE>
</BODY>
</HTML>
Файл “add_schet.php”
<HTML>
<HEAD>
<TITLE>Сайт статистики::Пополнение баланса</TITLE>
</HEAD>
<BODY>
<TABLE BORDER="1" width="1024" height="865" align="center">
<TR height="169">
<TD ><img src="logotip.jpg"></TD>
<TDalign="center">Пополнение баланса</TD>
</TR>
<TR height="39">
<TD align="center"><a href="http://winer/statistic.php"> Статистика оплат</a></TD>
<TD rowspan="7" align="justify" valign=top>
<?php
/*------------------------------------------------------------------------------------------------------*/
$ALTA2 = "(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SID = ALTA2)
(SERVER = DEDICATED)
)
)";
function print_karta($nomer_d){
$ALTA2 = "(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SID = ALTA2)
(SERVER = DEDICATED)
)
)";
if($db1=OCILogon("b27", "b27", $ALTA2)){
$stmt = oci_parse($db1,"
SELECT *
FROM OPLATA
WHERE ID_D = '{$nomer_d}'
");
oci_execute($stmt);
$nrows = oci_fetch_all($stmt, $results);
echo "<table border=1 width='40%'>\n";
echo "<tr><td width=100>Дата</td><td>Номер карты</td><td width=60>Сумма</td></tr>";
for ($i = 0; $i < $nrows; $i++ ) {
echo "<tr><td>" . $results['DATA_VREMYA'][$i] ."</td><td>" . $results['ID_KARTI'][$i] ."</td><td>" . $results['SUMMA'][$i] ."</td></tr>";
}
echo "</table>";
OCILogoff($db1);
}else echo "</br> Не удалось подключиться к базе";
}
if(!isset($_REQUEST['put'])) {/*если вход выполнен не из за нажатия кнопки*/
?>
</br>
<form action=add_schet.php method=post>
Номер карты:<input type=text size=7 name=nomer value=123456>
Пароль:<input type=text size=7 name=password value=pass>
<input type=hidden name=nomer_d value=<?echo $_REQUEST['nomer_d'];?>>
</br><input type=submit name=put value=Положить>
</form>
<?
print_karta($_REQUEST['nomer_d']);
}else{
if($db1=OCILogon("b27", "b27", $ALTA2)){
$stmt = oci_parse($db1,"
SELECT *
FROM KARTA
WHERE NOMER = '{$_REQUEST['nomer']}' AND PASSWORD_K = '{$_REQUEST['password']}'");
oci_execute($stmt);
$nrows = oci_fetch_all($stmt, $results);
if($nrows == 0) {
echo "Неправильно введен номер или пароль</br>";
?>
<form action=add_schet.php method=post>
Номер карты:<input type=text size=7 name=nomer value=123456>
Пароль:<input type=text size=7 name=password value=pass>
<input type=hidden name=nomer_d value=<?echo $_REQUEST['nomer_d'];?>>
</br><input type=submit name=put value=Положить>
</form>
<?
print_karta($_REQUEST['nomer_d']);
}else
if($results['SOSTOYANIE'][0] == 1){
echo "Эта карта уже использовалась</br>";
?>
<form action=add_schet.php method=post>
Номер карты:<input type=text size=7 name=nomer value=123456>
Пароль:<input type=text size=7 name=password value=pass>
<input type=hidden name=nomer_d value=<?echo $_REQUEST['nomer_d'];?>>
</br><input type=submit name=put value=Положить>
</form>
<?
print_karta($_REQUEST['nomer_d']);
}else{
$dat = date("d.m.Y H:i");
$stmt = oci_parse($db1,"
UPDATE KARTA
SET SOSTOYANIE = 1
WHERE NOMER = '{$_REQUEST['nomer']}' AND PASSWORD_K = '{$_REQUEST['password']}'");
oci_execute($stmt);
echo "</pre>";
$tempstr = "INSERT INTO OPLATA VALUES('{$_REQUEST['nomer']}', TO_DATE('{$dat}','dd.mm.yyyy HH24:MI'),'{$results['SUMMA'][0]}', '{$_REQUEST['nomer_d']}')";
$stmt = oci_parse($db1,$tempstr);
oci_execute($stmt);
$stmt = oci_parse($db1,"
SELECT *
FROM DOGOVOR
WHERE NOMER = '{$_REQUEST['nomer_d']}'");
oci_execute($stmt);
oci_fetch_all($stmt, $results2);
$temp = $results['SUMMA'][0] + $results2['MONEY'][0];
$tempstr ="UPDATE DOGOVOR
SET MONEY = '{$temp}'
WHERE NOMER = '{$results2['NOMER'][0]}'
";
$stmt = oci_parse($db1,$tempstr);
oci_execute($stmt);
oci_commit($db1);
OCILogoff($db1);
?>
<form action=add_schet.php method=post>
</br>
Номер карты:<input type=text size=7 name=nomer value=123456>
Пароль:<input type=text size=7 name=password value=pass>
<input type=hidden name=nomer_d value=<?echo $_REQUEST['nomer_d'];?>>
</br><input type=submit name=put value=Положить>
</form>
<?
print_karta($_REQUEST['nomer_d']);
}
}else{echo "</br> Нет доступа к базе данных при чтении оплаты";}
}
/*------------------------------------------------------------------------------------------------------*/
?>
</TD>
</TR>
<TD height=39 align="center"><a href="http://winer/add_user.php">Добавление клиента</a></TD>
<TR >
<TD align="center" height="39"><a href="http://winer/spisok_userov.php">Список клиентов</a></br></TD>
</TR>
<TR>
<TD align="center" height="39"><a href="http://winer/add_schet.php?nomer_d=npi001">Пополнение баланса</a></br></TD>
</TR>
<TR>
<TD align="center" height="39"><a href="http://winer/alter_user.php"> Изменение данных</a></br></TD>
</TR>
<TR>
<TD align="center" height="39"><a href="http://winer/any_information.php"> Некоторая информация</a></br></TD>
</TR>
<TR height="380">
<TD align="center" width="220" valign="top" ><a href="http://winer/summ_port.php">Активность портов</a></TD>
</TR>
</TABLE>
</BODY>
</HTML>
Файл “add_user.php”
<HTML>
<HEAD>
<TITLE>Сайт статистики::Добавление пользователя</TITLE>
</HEAD>
<BODY>
<TABLE BORDER="1" width="1024" height="865" align="center">
<TR height="169">
<TD ><img src="logotip.jpg"></TD>
<TDalign="center">Добавление пользователя</TD>
</TR>
<TR height="39">
<TD align="center"><a href="http://winer/statistic.php"> Статистика оплат</a></TD>
<TD rowspan="7" align="justify" valign=top>
<?php
/*------------------------------------------------------------------------------------------------------*/
if(!isset($_REQUEST['doGo'])) {?>
<form action="add_user.php" method = post>
<table>
<tr><td>Паспорт: </td><td><input type=text name="pasport" value="Паспорт"></td></tr>
<tr><td>Ф. И.О.: </td><td><input type=text name="fio" value="Ф. И. О."></td></tr>
<tr><td>Место Регистрации в г. Новочеркасске:</td><td><input type=text name="registration" value="Место Регистрации в г. Новочеркасске:"></td></tr>
<tr><td>Номер Телефона</td><td><input type=text name="telephone" value="Телефон"></td></tr>
<tr><td colspan=2></td></tr>
</table>
<input type=submit name=doGo value="Зарегистрировать"></br>
</form>
<?} else{
$ALTA2 = "(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SID = ALTA2)
(SERVER = DEDICATED)
)
)";
if($db1=OCILogon("b27", "b27", $ALTA2)) {
$stmt = oci_parse($db1,"
SELECT *
FROM USERI
WHERE ID =(SELECT MAX(ID)