<?php
$numb = 5;
$ALTA2 = "(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SID = ALTA2)
(SERVER = DEDICATED)
)
)
";
if($db1=OCILogon("b27", "b27", $ALTA2)) {
if(!$stmt = oci_parse($db1, "SELECT d1.NOMER, d1.money, d4.name1, d1.DATE2, d1.DATE3, d2.fio, d2.pasport, d2.registration, d2.telephone
FROM DOGOVOR d1, USERI d2 , USLUGA_DOGOVOR d3, USLUGI d4
WHERE (d1.id_u = d2.id) AND d3.nomer = d1.nomer AND d4.shifr = d3.shifr AND d4.type_us = 'tarif'
"))echo "</br>eror";
oci_execute($stmt);
$nrows = oci_fetch_all($stmt, $results);
echo "<table border=1 >\n<tr>\n";
echo "<td ><b>#договора</b></td><td >Баланс</td><td width=200>Тариф</td><td>Дата заключения</td><td>Дата истечения</td><td>Ф.И.О.</td><td>Паспорт</td><td>регистрация</td><td>телефон</td></tr>";
for ($i = 0; $i < $nrows; $i++ ) {
echo "<tr>\n";
echo "<td>" . $results["NOMER"][$i] . "</td>";
echo "<td>" . $results["MONEY"][$i]. "</td>";
echo "<td>" . $results["NAME1"][$i]. "</td>";
echo "<td>" . $results["DATE2"][$i]. "</td>";
echo "<td>" . $results["DATE3"][$i]. "</td>";
echo "<td>" . $results["FIO"][$i]. "</td>";
echo "<td>" . $results["PASPORT"][$i]. "</td>";
echo "<td>" . $results["REGISTRATION"][$i]. "</td>";
echo "<td>" . $results["TELEPHONE"][$i]. "</td>";
echo "</tr>\n";
}
echo "<tr><td colspan='9'> Number of Users: $nrows</td></tr></table>";
echo "<br><em>If you see data, then it works!</em><br></center>\n";
OCILogoff($db1);
}else {
$err = OCIError();
echo "Oracle Connect Error " . $err['message'];
}
?>
</form>
</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>
<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>
Файл “statistic.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>
<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['do'])) {/*если вход выполнен не из за нажатия кнопки*/
if($db1=OCILogon("b27", "b27", $ALTA2)){
$stmt = oci_parse($db1,"
SELECT *
FROM DOGOVOR
ORDER BY NOMER");
oci_execute($stmt);
$nrows = oci_fetch_all($stmt, $results);
echo "\n<form action=\"statistic.php\" method = post>\n";
echo "<select name=NOMER size=1>\n";
for($i = 0; $i < $nrows; $i++){
echo "<option value={$results['NOMER'][$i]}>{$results['NOMER'][$i]}</option>";
}
echo "</select>";
echo "</br><input type=submit name=do value=Далее>";
echo "</form>";
OCILogoff($db1);
}else echo "</br> Нет доступа к базе данных";
}else{
if($db1=OCILogon("b27", "b27", $ALTA2)){
$stmt = oci_parse($db1,"
SELECT *
FROM DOGOVOR INNER JOIN USERI ON DOGOVOR.ID_U = USERI.ID
WHERE DOGOVOR.NOMER = '{$_REQUEST['NOMER']}'
");
oci_execute($stmt);
oci_fetch_all($stmt, $results);
echo "</br>" . $results['NOMER'][0] . " " . $results['FIO'][0];
OCILogoff($db1);
}else{echo "</br> Нет доступа к базе данных при просмотре информации о абоненте";}
if($db1=OCILogon("b27", "b27", $ALTA2)){
$stmt = oci_parse($db1,"
SELECT *
FROM OPLATA
WHERE ID_D = '{$_REQUEST['NOMER']}'
");
oci_execute($stmt);
$nrows = oci_fetch_all($stmt, $results);
echo "<div width=60% style=\"position:;\">";
echo "<div width=% style=\"position:;background-color:;width:30%;\">";
echo "<table border=1 width='100%'>\n";
echo "<tr><td colspan=3><h3>Приход</h3></td></tr>";
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></div style=\"position:relative;\">";
$stmt = oci_parse($db1,"
SELECT *
FROM DEBIT
WHERE ID_D = '{$_REQUEST['NOMER']}'
");
oci_execute($stmt);
$nrows = oci_fetch_all($stmt, $results);
echo "<div style=\"position:;background-color:;width:30%;\">";
echo "<table border=1 width='100%'>";
echo "<tr><td colspan=3><h3>Расход</h3></td></tr>";
echo "<tr><td width=100>Дата</td><td>Описание</td><td width=60>Сумма</td></tr>";
for ($i = 0; $i < $nrows; $i++ ) {
echo "<tr><td>" . $results['TIME1'][$i] ."</td><td>" . $results['WHY'][$i] ."</td><td>" . $results['MONEY'][$i] ."</td></tr>";
}
echo "</table></div>";
echo "</div>";
OCILogoff($db1);
if($db1=OCILogon("b27", "b27", $ALTA2)){
echo "<div style=\":;\">";
$stmt = oci_parse($db1,"
SELECT *
FROM DOGOVOR
ORDER BY NOMER");
oci_execute($stmt);
$nrows = oci_fetch_all($stmt, $results);
echo "\n<form action=\"statistic.php\" method = post>\n";
echo "<select name=NOMER size=1>\n";
for($i = 0; $i < $nrows; $i++){
echo "<option value={$results['NOMER'][$i]}>{$results['NOMER'][$i]}</option>";
}
echo "</select>";
echo "</br><input type=submit name=do value=Далее>";
echo "</form>";
OCILogoff($db1);
echo" </div>";
}elseecho "</br> Нет доступа к базе данных";
}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>
Файл “sum_port.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>
<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($db1=OCILogon("b27", "b27", $ALTA2)) {
$stmt = oci_parse($db1,"SELECT WITH_PORT, SUM(BAIT) / (1024*1024)
FROM \"IP\"
WHERE IP.WITH_INTERFASE = 5
GROUP BY WITH_PORT
ORDER BY 1/SUM(BAIT) ");
oci_execute($stmt);
$nrows = oci_fetch_all($stmt, $results);
OCILogoff($db1);
}else {
$err = OCIError();
echo "Oracle Connect Error " . $err['message'];
}
echo "<center><h2>Активность портов</h2><br></center>";
?>
<form action="summ_port.php" method=get>
<input type=submit name="DoGo" value=Next>
<?
if(!isset($_REQUEST['DoGo']) & !isset($_REQUEST['DoGoPrevios'])){
if($nrows <100) $limit = $nrows; else $limit = 100;
echo "\n</br>Выводяться 1 - {$limit}\n";
echo "<table border=1 cellspacing='0' width='50%'>\n<tr>\n";
echo "<td><b>Номер порта</b><td>Обьем полученной информации</td></tr>";
for ($i = 0; $i < $limit; $i++ ) {
echo "<tr>\n";
echo "<td>" . $results["WITH_PORT"][$i] . "</td>";
echo "<td>" . $results["SUM(BAIT)/(1024*1024)"][$i] . "</td>";
echo "</tr>\n";
}
echo "<tr><td colspan='2'> <center>Total $nrows ports</center></td></tr></table>";
?>
<form action="summ_port.php" method=get>
<input type=hidden name="index" value ="<?echo $limit?>">
<input type=submit name="DoGo" value=Next>
</form>
<?
}if(isset($_REQUEST['DoGo']) || isset($_REQUEST['DoGoPrevios'])){
?>
<input type=submit name="DoGoPrevios" value=Previos>
<?
$flag_nrowsMax = false;
$flag_nrowsMin = false;
$flag_Next = false;
$flag_Previos = false;
if(isset($_REQUEST['DoGo'])){
$flag_Next = true;
if(($_REQUEST['index'] + 100) > $nrows) $flag_nrowsMax = true;
}
if(isset($_REQUEST['DoGoPrevios'])){
$flag_Previos = true;
if(($_REQUEST['index'] - 100) < 0 )$flag_nrowsMin = true;
}
if($flag_Previos & $flag_nrowsMin){
$limit = 0;
} else
if ($flag_Previos){$limit = $_REQUEST['index'] - 100;}
if($flag_Next & $flag_nrowsMax){
$limit = $nrows;
} else
if($flag_Next) $limit = $_REQUEST['index'] + 100;
if($_REQUEST['index'] < $limit){
$Start = $_REQUEST['index']; $End = $limit;
}else{
$End = $_REQUEST['index']; $Start = $limit;
}
echo "\n</br>Выводяться {$Start} - {$End}\n";
echo "<table border=1 cellspacing='0' width='50%'>\n<tr>\n";
echo "<td><b>Номер порта</b><td>Обьем полученной информации</td></tr>";
for ($i = $Start; $i < $End; $i++ ) {
echo "<tr>\n";
echo "<td>" . $results["WITH_PORT"][$i] . "</td>";
echo "<td>" . $results["SUM(BAIT)/(1024*1024)"][$i] . "</td>";
echo "</tr>\n";
}
echo "<tr><td colspan='2'> <center>Total $nrows ports</center></td></tr></table>";
?>
<form action="summ_port.php" method=get>
<input type=hidden name="index" value ="<?if($flag_Next)echo $End; else echo $Start;?>">
<input type=submit name="DoGo" value=Next>
<input type=submit name="DoGoPrevios" value=Previos>
</form>
<?
}
?>
</form>
</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>