Смекни!
smekni.com

Организация базы данных провайдера (стр. 7 из 8)

FROM USERI)

");

oci_execute($stmt);

$nrows = oci_fetch_all($stmt, $results);

$temp = $results['ID'][0] + 1;

$tempstr = "INSERT INTO USERI VALUES({$temp},{$_REQUEST['pasport']},'{$_REQUEST['fio']}','{$_REQUEST['registration']}','{$_REQUEST['telephone']}')";

if($stmt = oci_parse($db1,$tempstr)){

oci_execute($stmt);

echo "</br><H1>Запись добавлена успешна</H1>";

echo "<br>({$temp},{$_REQUEST['pasport']},'{$_REQUEST['fio']}','{$_REQUEST['registration']}','{$_REQUEST['telephone']}')";

echo "</br>Для продолжения нажимите кнопку далее";

?>

<form action="add_dogovor.php" method = get>

</br><input type=hidden name=IdUser value=<?echo $temp;?>

</br><input type=submit name="next" value="Далее">

</form>

<?

OCILogoff($db1);

}else{

echo "</br><H1>Ошибка добавления</H1>";

OCILogoff($db1);

}

}

}

/*------------------------------------------------------------------------------------------------------*/

?>

</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>

Файл “alter_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>

<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)

)

)";

?>

<form action="alter_user.php" method = get>

<?

if($db1=OCILogon("b27", "b27", $ALTA2)) {

$stmt = oci_parse($db1,"

SELECT NOMER

FROM DOGOVOR

ORDER BY NOMER");

oci_execute($stmt);

$nrows = oci_fetch_all($stmt, $results);

echo "<select name=dogovor size=1>";

for($i = 0; $i < $nrows; $i++){

echo "&bsol;n</br><option value={$results['NOMER'][$i]}>{$results['NOMER'][$i]}</option>";

}

echo "</select>";

OCILogoff($db1);

}else{

echo "</br>Не удалось соедениться с базой данных";

}

?>

<input type=submit name=Next value=Далее>

</form>

<?

if(isset($_REQUEST['Next'])){

if($db1=OCILogon("b27", "b27", $ALTA2)) {

$stmt = oci_parse($db1,"

SELECT *

FROM USERI,DOGOVOR

WHERE USERI.ID = DOGOVOR.ID_U AND DOGOVOR.NOMER = '{$_REQUEST['dogovor']}'

");

oci_execute($stmt);

oci_fetch_all($stmt, $results);

?>

<form action="alter_user.php" method = post>

<table>

<tr><td>Паспорт: </td><td><input type=text name="pasport" value=<?echo $results['PASPORT'][0]?>></td></tr>

<tr><td>Ф. И.О.: </td><td><input type=text name="fio" value="<?echo $results['FIO'][0]?>"></td></tr>

<tr><td>Место Регистрации в г. Новочеркасске:</td><td><input type=text name="registration" value="<?echo $results['REGISTRATION'][0]?>"></td></tr>

<tr><td>Номер Телефона</td><td><input type=text name="telephone" value="<?echo $results['TELEPHONE'][0]?>"></td></tr>

</table>

<input type=hidden name=nomer value=<?echo $_REQUEST['dogovor']?>>

<input type=hidden name=id_u value=<?echo $results['ID_U'][0]?>>

<input type=submit name=alter value="Изменить"></br>

</form>

<?

OCILogoff($db1);

}else{

echo "</br><H1>Ошибка добавления</H1>";

}

}

if(isset($_REQUEST['alter'])){

if($db1=OCILogon("b27", "b27", $ALTA2)) {

$tempstr = "UPDATE USERI

SET FIO = '{$_REQUEST['fio']}', PASPORT = {$_REQUEST['pasport']}, REGISTRATION = '{$_REQUEST['registration']}', TELEPHONE = '{$_REQUEST['telephone']}'

WHERE USERI.ID = '{$_REQUEST['id_u']}'

";

echo $tempstr;

$stmt = oci_parse($db1,$tempstr);

oci_execute($stmt);

oci_commit($db1);

OCILogoff($db1);

}else{

echo "</br><H1>Ошибка подключения</H1>";

}

}

/*------------------------------------------------------------------------------------------------------*/

?>

</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>

Файл “any_information.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>

<h2>Различная информация:</h2>

<?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)) {

echo "&bsol;n<h3>Сколько и какие услуги использованы:</h3>";

$stmt = oci_parse($db1,"

SELECT USLUGI.NAME1, COUNT(USLUGI.SHIFR) AS &bsol;"NUMBER&bsol;"

FROM USLUGA_DOGOVOR, USLUGI

WHERE USLUGI.SHIFR = USLUGA_DOGOVOR.SHIFR

GROUP BY USLUGI.NAME1

ORDER BY USLUGI.NAME1");

oci_execute($stmt);

$nrows = oci_fetch_all($stmt, $results);

echo "<table border = 1>&bsol;n";

echo "<tr> <td>Имя услуги </td> <td>COUNT</td></tr>";

for($i = 0; $i < $nrows; $i++){

echo "<tr><td width=100>{$results['NAME1'][$i]}</td><td>{$results['NUMBER'][$i]}</td></tr>&bsol;n";

}

echo "</table>";

echo "&bsol;n<h3>Какие услуги не использованы</h3>";

$stmt = oci_parse($db1,"

SELECT SHIFR, NAME1

FROM USLUGI d1

WHERE NOT EXISTS (

SELECT USLUGI.SHIFR

FROM USLUGA_DOGOVOR, USLUGI

WHERE d1.SHIFR = USLUGA_DOGOVOR.SHIFR

)");

oci_execute($stmt);

$nrows = oci_fetch_all($stmt, $results);

echo "<table border = 1>&bsol;n";

echo "<tr> <td>Код услуги </td> <td>Имя услуги</td></tr>";

for($i = 0; $i < $nrows; $i++){

echo "<tr><td width=100>{$results['SHIFR'][$i]}</td><td>{$results['NAME1'][$i]}</td></tr>&bsol;n";

}

echo "</table>";

$stmt = oci_parse($db1,"

SELECT SUM(MONEY) AS &bsol;"Profit&bsol;"

FROM DEBIT

WHERE TO_CHAR(TIME1, 'mm.yyyy') = TO_CHAR(sysdate, 'mm.yyyy')");

oci_execute($stmt);

oci_fetch_all($stmt, $results);

echo "<h3>Прибыль в текущем месяце состовляет {$results['Profit'][0]} руб.</h3>";

$stmt = oci_parse($db1,"SELECT TIME1, WITH_ADRESS, WITH_PORT, BAIT, ip.nomer FROM IP WHERE BAIT = (SELECT MAX(BAIT) FROM IP WHERE IP.WITH_INTERFASE = 5)");

oci_execute($stmt);

$nrows = oci_fetch_all($stmt, $results);

echo "<h3>Максимальное количество байт принято</h3>";

echo $results['TIME1'][0] . " от " . $results['WITH_ADRESS'][0] . " с порта " . $results['WITH_PORT'][0] . " обьемом в " . $results['BAIT'][0];

OCILogoff($db1);

}else {

$err = OCIError();

echo "Oracle Connect Error " . $err['message'];

}

?>

</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>

Файл “index.html”

<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">

<center><h2>Это главная страница сайта статистики.</h2></center>

</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>

Файл “spisok_userov.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>