Разработка информационной системы для администрации села Пономаревка Оренбургской области

Сравнительный анализ инструментов разработки и реализации информационной системы, описание исходного кода системы, подробное рассмотрение интерфейса. Выбор операционной системы для развертывания и функционирования информационной системы для администрации.

Рубрика Программирование, компьютеры и кибернетика
Вид дипломная работа
Язык русский
Дата добавления 07.08.2018
Размер файла 988,1 K

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

return $this->query("SELECT id,doc_view,description,doc_number,date_accept,date_publish,file FROM instructions WHERE id='$id'");

}

public function insert_instructions($doc_view,$description,$doc_number,$date_accept,$date_publish,$file_name) {

$this->query("INSERT INTO instructions (doc_view,description,doc_number,date_accept,date_publish,file) VALUES ('$doc_view','$description','$doc_number','$date_accept','$date_publish','$file_name')");

}

public function delete_instructions($id) {

$this->query("DELETE FROM instructions WHERE id='$id' ");

}

/*-------------------------------------------SOLUTIONS--------------*/

public function extraction_solutions($start,$per_page,$doc_view,$description,$doc_number,$date_accept,$year_accept,$year_accept1,$month_accept,$month_accept1,$date_publish,$year_publish,$year_publish1,$month_publish,$month_publish1) {

if ($date_accept == "") {$date_accept1="IS NOT NULL";} else if($date_accept!= "") {$date_accept1="='$date_accept'";}

if ($date_publish == "") {$date_publish1="IS NOT NULL";} else if($date_publish!= "") {$date_publish1="='$date_publish'";}

if ($month_accept == "-" && $month_accept1 == "-") {$month_accept2="IS NOT NULL";} else if ($month_accept!= "-" && $month_accept1 == "-"){$month_accept2="BETWEEN $month_accept AND $month_accept";} else if ($month_accept!= "-" && $month_accept1!= "-") {$month_accept2="BETWEEN $month_accept AND $month_accept1";}

if ($year_accept == "" && $year_accept1 == "") {$year_accept2="IS NOT NULL";} else if ($year_accept!= "" && $year_accept1 == ""){$year_accept2="BETWEEN $year_accept AND $year_accept";} else if ($year_accept!= "" && $year_accept1!= "") {$year_accept2="BETWEEN $year_accept AND $year_accept1";}

if ($month_publish == "-" && $month_publish1 == "-") {$month_publish2="IS NOT NULL";} else if ($month_publish!= "-" && $month_publish1 == "-"){$month_publish2="BETWEEN $month_publish AND $month_publish";} else if ($month_publish!= "-" && $month_publish1!= "-") {$month_publish2="BETWEEN $month_publish AND $month_publish1";}

if ($year_publish == "" && $year_publish1 == "") {$year_publish2="IS NOT NULL";} else if ($year_publish!= "" && $year_publish1 == ""){$year_publish2="BETWEEN $year_publish AND $year_publish";} else if ($year_publish!= "" && $year_publish1!= "") {$year_publish2="BETWEEN $year_publish AND $year_publish1";}

return $this->query("SELECT id,doc_view,description,doc_number,date_accept,date_publish,file FROM solutions WHERE doc_view LIKE '%$doc_view%' AND description LIKE '%$description%' AND doc_number LIKE '%$doc_number%' AND date_accept $date_accept1 AND MONTH(date_accept) $month_accept2 AND YEAR(date_accept) $year_accept2 AND date_publish $date_publish1 AND

MONTH(date_publish) $month_publish2 AND YEAR(date_publish) $year_publish2 LIMIT $start,$per_page");

}

public function extraction_count_solutions($doc_view,$description,$doc_number,$date_accept,$year_accept,$year_accept1,$month_accept,$month_accept1,$date_publish,$year_publish,$year_publish1,$month_publish,$month_publish1) {

if ($date_accept == "") {$date_accept1="IS NOT NULL";} else if($date_accept!= "") {$date_accept1="='$date_accept'";}

if ($date_publish == "") {$date_publish1="IS NOT NULL";} else if($date_publish!= "") {$date_publish1="='$date_publish'";}

if ($month_accept == "-" && $month_accept1 == "-") {$month_accept2="IS NOT NULL";} else if ($month_accept!= "-" && $month_accept1 == "-"){$month_accept2="BETWEEN $month_accept AND $month_accept";} else if ($month_accept!= "-" && $month_accept1!= "-") {$month_accept2="BETWEEN $month_accept AND $month_accept1";}

if ($year_accept == "" && $year_accept1 == "") {$year_accept2="IS NOT NULL";} else if ($year_accept!= "" && $year_accept1 == ""){$year_accept2="BETWEEN $year_accept AND $year_accept";} else if ($year_accept!= "" && $year_accept1!= "") {$year_accept2="BETWEEN $year_accept AND $year_accept1";}

if ($month_publish == "-" && $month_publish1 == "-") {$month_publish2="IS NOT NULL";} else if ($month_publish!= "-" && $month_publish1 == "-"){$month_publish2="BETWEEN $month_publish AND $month_publish";} else if ($month_publish!= "-" && $month_publish1!= "-") {$month_publish2="BETWEEN $month_publish AND $month_publish1";}

if ($year_publish == "" && $year_publish1 == "") {$year_publish2="IS NOT NULL";} else if ($year_publish!= "" && $year_publish1 == ""){$year_publish2="BETWEEN $year_publish AND $year_publish";} else if ($year_publish!= "" && $year_publish1!= "") {$year_publish2="BETWEEN $year_publish AND $year_publish1";}

return $this->query("SELECT count(*) FROM solutions WHERE doc_view LIKE '%$doc_view%' AND description LIKE '%$description%' AND doc_number LIKE '%$doc_number%' AND date_accept $date_accept1 AND MONTH(date_accept) $month_accept2 AND YEAR(date_accept) $year_accept2 AND date_publish $date_publish1 AND MONTH(date_publish) $month_publish2 AND YEAR(date_publish) $year_publish2");

}

public function update_solutions($id,$doc_view,$description,$doc_number,$date_accept,$date_publish,$file_name){

$this->query("UPDATE solutions SET doc_view = '$doc_view', description = '$description', doc_number = '$doc_number',date_accept = '$date_accept',date_publish = '$date_publish',file = '$file_name' WHERE id = '$id'");

}

public function edit_solutions($id){

return $this->query("SELECT id,doc_view,description,doc_number,date_accept,date_publish,file FROM solutions WHERE id='$id'");

}

public function insert_solutions($doc_view,$description,$doc_number,$date_accept,$date_publish,$file_name) {

$this->query("INSERT INTO solutions (doc_view,description,doc_number,date_accept,date_publish,file) VALUES ('$doc_view','$description','$doc_number','$date_accept','$date_publish','$file_name')");

}

public function delete_solutions($id) {

$this->query("DELETE FROM solutions WHERE id='$id' ");

}

/*---------------------------------------------PHONE---------------------------------------------- */

public function extraction_phone($start,$per_page,$full_name,$email,$work_phone,$mobile_phone) {

return $this->query("SELECT id,full_name,email,work_phone,mobile_phone FROM phone WHERE full_name LIKE '%$full_name%' AND email LIKE '%$email%' AND work_phone

LIKE '%$work_phone%' AND mobile_phone LIKE '%$mobile_phone%' LIMIT $start,$per_page");

}

public function extraction_count_phone($full_name,$email,$work_phone,$mobile_phone) {

return $this->query("SELECT count(*) FROM phone WHERE full_name LIKE '%$full_name%' AND email LIKE '%$email%' AND work_phone LIKE '%$work_phone%' AND mobile_phone LIKE '%$mobile_phone%'");

}

public function update_phone($id,$full_name,$email,$work_phone,$mobile_phone){

$this->query("UPDATE phone SET full_name = '$full_name', email = '$email', work_phone = '$work_phone',mobile_phone = '$mobile_phone' WHERE id = '$id'");

}

public function edit_phone($id){

return $this->query("SELECT id,full_name,email,work_phone,mobile_phone FROM phone WHERE id='$id'");

}

public function insert_phone($full_name,$email,$work_phone,$mobile_phone) {

$this->query("INSERT INTO phone (full_name,email,work_phone,mobile_phone) VALUES ('$full_name','$email','$work_phone','$mobile_phone')");

}

public function delete_phone($id) {

$this->query("DELETE FROM phone WHERE id='$id' ");

}

/*-----------------------------------------------STAFF-------------------------------------------- */

public function extraction_staff($start,$per_page,$position,$full_name,$dob,$organisation) {

return $this->query("SELECT id,position,full_name,dob,organisation FROM staff WHERE position LIKE '%$position%' AND full_name LIKE '%$full_name%' AND dob LIKE '%$dob%' AND organisation LIKE '$organisation' LIMIT $start,$per_page");

}

public function extraction_count_staff($position,$full_name,$dob,$organisation) {

return $this->query("SELECT count(*) FROM staff WHERE position LIKE '%$position%' AND full_name LIKE '%$full_name%' AND dob LIKE '%$dob%' AND organisation LIKE '$organisation'");

}

public function update_staff($id,$position,$full_name,$dob,$organisation) {

return $this->query("UPDATE staff SET position = '$position', full_name = '$full_name', dob = '$dob', organisation = '$organisation' WHERE id = '$id'");

}

public function edit_staff($id) {

return $this->query("SELECT id,position,full_name,dob,organisation FROM staff WHERE id = '$id' ");

}

public function insert_staff($position,$full_name,$dob,$organisation) {

return $this->query("INSERT INTO staff (position,full_name,dob,organisation) VALUES ('$position','$full_name','$dob','$organisation')");

}

public function delete_staff($id) {

$this->query("DELETE FROM staff WHERE id='$id' ");

}

/*-----------------------------------------------USERS-------------------------------------------- */

public function verify($name, $password){

$name = $this->real_escape_string($name);

$password = $this->real_escape_string($password);

$result = $this->query("SELECT 1 FROM users

WHERE user_name = '". $name. "' AND user_password = '". $password. "'");

return $result->data_seek(0);

}

public function extraction_user($start,$per_page) {

return $this->query("SELECT id,user_name,user_password,right_add,right_edit,right_del,right_personal FROM users LIMIT $start,$per_page");

}

public function extraction_count_user() {

return $this->query("SELECT count(*) FROM users");

}

public function update_user($id,$user_name,$user_password,$right_add,$right_edit,$right_del,$right_personal) {

return $this->query("UPDATE users SET user_name = '$user_name', user_password = '$user_password', right_add = '$right_add', right_edit = '$right_edit',right_del = '$right_del',right_personal = '$right_personal' WHERE id = '$id'");

}

public function edit_user($id) {

return $this->query("SELECT id,user_name,user_password,right_add,right_edit,right_del,right_personal FROM users WHERE id = '$id' ");

}

public function insert_user($user_name,$user_password,$right_add,$right_edit,$right_del,$right_personal) {

return $this->query("INSERT INTO users (user_name,user_password,right_add,right_edit,right_del,right_personal) VALUES ('$user_name','$user_password','$right_add','$right_edit','$right_del','$right_personal')");

}

public function delete_user($id) {

$this->query("DELETE FROM users WHERE id='$id' ");

}

public function user_rights($user_name) {

return $this->query("SELECT right_add,right_edit,right_del,right_personal FROM users WHERE user_name = '$user_name'");

}

auth.php

<!DOCTYPE html>

<?php

require_once("blocks/db.php");

$logonSuccess = false;

if ($_SERVER['REQUEST_METHOD'] == "POST") {

$logonSuccess = (regDB::getInstance()->verify($_POST['user_name'], $_POST['user_password']));

if ($logonSuccess == true) {

session_start();

$_SESSION['user'] = $_POST['user_name'];

header('Location:home.php');

exit;

}

}

if (isset($_POST["user_name"])) $name=$_POST["user_name"];else $name="";

?>

<html>

<head>

<link href="style.css" type="text/css" rel="stylesheet" media="all" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Авторизация</title>

</head>

<body>

<form action="auth.php" method="POST">

<div class="auth_name">

Имя пользователя:<br/><input type="search" name="user_name" value="<?php echo $name ?>"><br/><br/>

Пароль:<br/><input type="password" name="user_password"></div>

<input type="hidden" name="check" value="check">

<input type="submit" value="Войти"/>

</form>

<?php

if (isset($_POST["check"])) {

if ($_POST["user_name"] == "" && $_POST["user_password"]!= "") {

echo '<div class="auth_mes">Введите имя пользователя</div>';

}

else if($_POST["user_name"]!= "" && $_POST["user_password"] == "") {

echo '<div class="auth_mes">Введите пароль</div>';

}

else if ($_POST["user_name"] == "" && $_POST["user_password"] == "") {

echo '<div class="auth_mes">Введите имя пользователя и пароль';

} else echo '<div class="auth_mes">Неправильное имя пользователя и/или пароль</div>';

}

?>

</body>

</html>

decrees.php

<!DOCTYPE html>

<?php

error_reporting(0);

session_start();

if (!array_key_exists("user", $_SESSION)) {

header('Location: auth.php');

exit;

}

require_once("blocks/db.php");

include "blocks/menu.php";

include "blocks/rights.php";

include "blocks/var.php";

include "blocks/month.php";

?>

<html>

<head>

<link href="style.css" type="text/css" rel="stylesheet" media="all" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Постановления</title>

</head>

<body>

<div id="name_registry">Постановления</div>

<form action="home.php" method="POST">

<input type="submit" value="Главная страница" name="home_page" />

</form>

<form action="decrees.php" method="POST">

<?php include "blocks/filter.php" ?>

</form>

<table>

<tr>

<th width="2%">№ п/п</th>

<th width="10%">Вид документа</th>

<th width="44%">Наименование</th>

<th width="10%">Номер документа</th>

<th width="5%">Дата принятия</th>

<th width="8%">Дата опубликования</th>

<th width="6%">Файл</th>

</tr>

<?php

$page_name="decrees";

$per_page=10;

$cur_page = 1;

if (isset($_GET['page'])) $page=($_GET['page']-1); else $page=0;

$start=abs($page*$per_page);

$result = regDB::getInstance()->extraction($start,$per_page,$_SESSION['doc_view'],$_SESSION['description'],$_SESSION['doc_number'],$_SESSION['date_accept'],$_SESSION['year_accept'],$_SESSION['year_accept1'],$_SESSION['month_accept'],$_SESSION['month_accept1'],$_SESSION['date_publish'],$_SESSION['year_publish'],$_SESSION['year_publish1'],$_SESSION['month_publish'],$_SESSION['month_publish1']);

$num=(($page+1)*$per_page)-9;

while($row = mysqli_fetch_array($result)):

echo "<tr><td>".$num++."</td>";

echo "<td>". htmlentities($row['doc_view']). "</td>";

echo '<td>'. htmlentities($row['description']). '</td>';

echo "<td>". htmlentities($row['doc_number']). "</td>";

echo "<td>". htmlentities($row['date_accept']). "</td>";

echo "<td>". htmlentities($row['date_publish']). "</td>";

if ($row['file']!= ""){echo '<td><a href="download.php?file='.$row['file'].'">документ</a></td>';} else{$doc="Документ не загружен"; echo "<td>". htmlentities($doc). "</td>";}

$id=$row['id'];

$page1=$page+1;

if ($check_user["right_edit"] == "+") {

echo '<td width="8%"><form name="edit" action="editDecrees.php" method="GET">

<input type="hidden" name="id" value='.$id.'>

<input type="hidden" name="pages" value='.$page1.'>

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

</form></td>';}

if ($check_user["right_del"] == "+") {

$file1=$row['file'];

echo '<td width="7%"><form action="delete.php" method="POST">

<input type="hidden" name="id" value='.$id.'>

<input type="hidden" name="pages" value='.$page1.'>

<input type="hidden" name="page_name" value='.$page_name.'>

<input type="hidden" name="file_name" value='.$file1.'>

<input type="submit" name="delete" value="Удалить">

</form></td>';}

echo "</tr>\n";

ENDWHILE;

mysqli_free_result($result);

$res = regDB::getInstance()->extraction_count($_SESSION['doc_view'],$_SESSION['description'],$_SESSION['doc_number'],$_SESSION['date_accept'],$_SESSION['year_accept'],$_SESSION['year_accept1'],$_SESSION['month_accept'],$_SESSION['month_accept1'],$_SESSION['date_publish'],$_SESSION['year_publish'],$_SESSION[

'year_publish1'],$_SESSION['month_publish'],$_SESSION['month_publish1']);

$row1=mysqli_fetch_row($res);

$total_rows=$row1[0];

$num_pages=ceil($total_rows/$per_page);

if ($check_user["right_add"] == "+") {

echo '<form name="add" action="editDecrees.php" method="GET">

<input type="hidden" name="pages" value='.$num_pages.'>

<input type="submit" value="Добавить">

</form><br/>';

}

echo "Найдено документов: <b>$total_rows</b><br/><br/>Страницы: ";

$limiter=6;

if ($num_pages <= $limiter) {

for($i=1;$i<=$num_pages;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="decrees.php?page='.$i.'">'.$i."</a> &nbsp";}

}

}

if ($num_pages > $limiter) {

if ($page+1 <= $limiter-2) {

$i=1;

for($i;$i<=$limiter;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="decrees.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

echo '...<a href="decrees.php?page='.$num_pages.'">'.$num_pages."</a>";

}

else if (($page+1 > $limiter-2) && ($page+1 <= ($num_pages-3))) {

$i=($page+1)-3;

echo '<a href="decrees.php?page=1">1</a>...';

for($i;$i<=$page+3;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="decrees.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

echo '...<a href="decrees.php?page='.$num_pages.'">'.$num_pages."</a>";

}

else if ($page+1 > $num_pages-3 && $page+1 <= ($num_pages)) {

$i=$num_pages-$limiter+1;

echo '<a href="decrees.php?page=1">1</a>...';

for($i;$i<=$num_pages;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="decrees.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

}

}

?>

</table>

</body>

</html>

editDecrees.php

<?php

session_start();

if (!array_key_exists("user", $_SESSION)) {

header('Location: auth.php');

exit;

}

require_once("blocks/db.php");

include "blocks/rights.php";

if ($_SERVER['REQUEST_METHOD'] == "POST") {

if (array_key_exists("back", $_POST)) {

$pages=$_POST['page'];

header("Location: decrees.php?page=$pages");

exit;

}

else if ($_POST["id"] == "") {

$pages=$_POST['page'];

if($_FILES['uploadfile']['name']!= "" && $check_user["right_add"] == "+"){

$uploaddir = "C:/xampp/htdocs/registry/uploads/decrees/";

$uploadfile = $uploaddir.basename($_FILES['uploadfile']['name']);

copy($_FILES['uploadfile']['tmp_name'], $uploadfile);} else {$uploadfile=$_POST["file"];}

regDB::getInstance()->insert_decrees($_POST["doc_view"],$_POST['description'],$_POST["doc_number"],$_POST["date_accept"],$_POST["date_publish"],$uploadfile);

header("Location: decrees.php?page=$pages");

exit;

}

else if ($_POST["id"]!= "" && $check_user["right_edit"] == "+") {

if($_FILES['uploadfile']['name']!= ""){

$uploaddir = "C:/xampp/htdocs/registry/uploads/decrees/";

$uploadfile = $uploaddir.basename($_FILES['uploadfile']['name']);

copy($_FILES['uploadfile']['tmp_name'], $uploadfile);} else {$uploadfile=$_POST["file"];}

regDB::getInstance()->update_decrees($_POST["id"],$_POST["doc_view"],$_POST['description'],$_POST["doc_number"],$_POST["date_accept"],$_POST["date_publish"],$uploadfile);

$pages=$_POST['page'];

header("Location: decrees.php?page=$pages");

exit;

}

}

?>

<html>

<head>

<link href="style.css" type="text/css" rel="stylesheet" media="all" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Постановления</title>

</head>

<body>

<?php include "blocks/menu.php";

if ($_SERVER["REQUEST_METHOD"] == "POST") {

$decrees = array("page" => $_POST["pages"],"doc_view" => $_POST["doc_view"],"description" => $_POST["description"],"doc_number" => $_POST["doc_number"], "date_accept" =>

$_POST["date_accept"],"date_publish" => $_POST["date_publish"],"file" => $_POST["file"]);

}

else if (array_key_exists("id", $_GET)) {

$decrees = mysqli_fetch_array(regDB::getInstance()->edit_decrees($_GET["id"]));

$pages=$_GET['pages'];

} else {

$pages=$_GET['pages'];

$decrees = array("id" => "", "doc_view" => "","description" => "","doc_number" => "", "date_accept" => "","date_publish" => "","file" => "");

}

?>

<div id="name_registry">Редактирование</div>

<div class="edit"><form action="editDecrees.php" method="POST" enctype=multipart/form-data>

Вид документа:</br><input type="search" name="doc_view" value="<?php echo $decrees['doc_view']; ?>" /></br></br>

Описание:</br><textarea name="description" rows="10" cols="40"><?php echo $decrees['description']?></textarea></br></br>

Номер документа:</br><input type="search" name="doc_number" value="<?php echo $decrees['doc_number']; ?>" /></br></br>

Дата принятия:</br><input type="date" name="date_accept" value="<?php echo $decrees['date_accept']; ?>"/></br></br>

Дата опубликования/обнародования:</br><input type="date" name="date_publish" value="<?php echo $decrees['date_publish']; ?>"/><br/></br>

Документ:</br><?php echo basename($decrees["file"]); ?></br>

<input type="hidden" name="file" value="<?php echo $decrees['file']?>">

<input type="hidden" name="id" value="<?php echo $decrees['id']?>">

<input type="hidden" name="page" value="<?php echo $pages ?>">

</br>Загрузить документ:</br><input type=file name=uploadfile></div>

<div class="button_edit"><input type="submit" name="save" value="Сохранить" />

<input type="submit" name="back" value="Назад" /><br/></div>

</form>

home.php

<?php

session_start();

if (isset($_POST["exit_1"])) unset($_SESSION['user']);

if (!array_key_exists("user", $_SESSION)) {

header('Location: auth.php');

exit;

}

?>

<html>

<head>

<link href="style.css" type="text/css" rel="stylesheet" media="all" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Главная страница</title>

</head>

<body>

<?php include "blocks/menu.php";

?>

<div class="home_mes">Вы вошли как:</div>

<div class="home_user"><?php echo $_SESSION['user'];?></div>

<form name = "exit" action = "home.php" method = "POST">

<input type="hidden" name="exit_1" value="exit">

<input type="submit" value="Выйти" />

</form>

<?php if ($_SESSION['user'] == "admin") echo '<a href="users.php">Пользователи</a>'?>

</body>

</html>

phone.php

<!DOCTYPE html>

<?php

error_reporting(0);

require_once("blocks/db.php");

session_start();

if (!array_key_exists("user", $_SESSION)) {

header('Location: auth.php');

exit;

}

include "blocks/rights.php";

Приложение А

if (isset($_POST['full_name'])) $_SESSION['full_name']=$_POST['full_name'];

if (isset($_POST['email'])) $_SESSION['email']=$_POST['email'];

if (isset($_POST['work_phone'])) $_SESSION['work_phone']=$_POST['work_phone'];

if (isset($_POST['mobile_phone'])) $_SESSION['mobile_phone']=$_POST['mobile_phone'];

if ($check_user["right_personal"]!= "+") $flag="disabled";else $flag="";

?>

<html>

<head>

<link href="style.css" type="text/css" rel="stylesheet" media="all" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Телефонный справочник</title>

</head>

<body>

<?php include "blocks/menu.php" ?>

<div id="name_registry">Телефонный справочник</div>

<form action="home.php" method="POST">

<input type="submit" value="Главная страница" name="home_page" />

</form>

<form action="phone.php" method="POST">

</br></br>ФИО:</br><input type="search" name="full_name" value="<?php echo @htmlspecialchars($_SESSION['full_name']); ?>" size="35"/><br/>

<div class ="phone_email">Адрес электронной почты:</br><input type="search" name="email" value="<?php echo @htmlspecialchars($_SESSION['email']); ?>"/><br/></div>

<div class="phone_work">Номер телефона (рабочий):</br><input type="search" name="work_phone" value="<?php echo @htmlspecialchars($_SESSION['work_phone']); ?>" /><br/></div>

<div class="phone_mobile">Номер телефона (сотовый):</br><input type="search" name="mobile_phone" value="<?php echo @htmlspecialchars($_SESSION['mobile_phone']);?>"<?php echo $flag;?>/>

<input type="submit" value="Найти" name="search" />

</div>

</form>

<table>

<tr>

<th width="2%">№ п/п</th>

<th>ФИО</th>

<th>Адрес электронной почты</th>

<th>Номер телефона (рабочий)</th>

<?php if ($check_user["right_personal"] == "+") echo '<th>Номер телефона (сотовый)</th>';?>

</tr>

<ol type="1">

</ol>

<?php

$page_name="phone";

$per_page=10;

$cur_page = 1;

if (isset($_GET['page'])) $page=($_GET['page']-1); else $page=0;

$start=abs($page*$per_page);

$result = regDB::getInstance()->extraction_phone($start,$per_page,$_SESSION['full_name'],$_SESSION['email'],$_SESSION['work_phone'],$_SESSION['mobile_phone']);

$num=(($page+1)*$per_page)-9;

while($row = mysqli_fetch_array($result)):

echo "<tr><td>".$num++."</td>";

echo "<td>". htmlentities($row['full_name']). "</td>";

echo "<td>". htmlentities($row['email']). "</td>";

echo "<td>". htmlentities($row['work_phone']). "</td>";

if ($check_user["right_personal"] == "+") {echo "<td>". htmlentities($row['mobile_phone']). "</td>";}

$id=$row['id'];

$page1=$page+1;

if ($check_user["right_edit"] == "+") {

echo '<td width="8%"><form name="edit" action="editPhone.php" method="GET">

<input type="hidden" name="id" value='.$id.'>

<input type="hidden" name="pages" value='.$page1.'>

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

</form></td>';}

if ($check_user["right_del"] == "+") {

echo '<td width="7%"><form action="delete.php" method="POST">

<input type="hidden" name="id" value='.$id.'>

<input type="hidden" name="pages" value='.$page1.'>

<input type="hidden" name="page_name" value='.$page_name.'>

<input type="submit" name="delete" value="Удалить">

</form></td>';}

echo "</tr>\n";

ENDWHILE;

mysqli_free_result($result);

$res = regDB::getInstance()->extraction_count_phone($_SESSION['full_name'],$_SESSION['email'],$_SESSION['work_phone'],$_SESSION['mobile_phone']);

$row1=mysqli_fetch_row($res);

$total_rows=$row1[0];

$num_pages=ceil($total_rows/$per_page);

if ($check_user["right_add"] == "+") {

echo '<form name="add" action="editPhone.php" method="GET">

<input type="hidden" name="pages" value='.$num_pages.'>

<input type="submit" value="Добавить">

</form><br/>';

}

echo "Найдено записей: <b>$total_rows</b><br/><br/>Страницы: ";

$limiter=6;

if ($num_pages <= $limiter) {

for($i=1;$i<=$num_pages;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="phone.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

}

if ($num_pages > $limiter) {

if ($page+1 <= $limiter-2) {

$i=1;

for($i;$i<=$limiter;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="phone.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

echo '...<a href="phone.php?page='.$num_pages.'">'.$num_pages."</a>";

}

else if (($page+1 > $limiter-2) && ($page+1 <= ($num_pages-3))) {

$i=($page+1)-3;

echo '<a href="phone.php?page=1">1</a>...';

for($i;$i<=$page+3;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="phone.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

echo '...<a href="phone.php?page='.$num_pages.'">'.$num_pages."</a>";

}

else if ($page+1 > $num_pages-3 && $page+1 <= ($num_pages)) {

$i=$num_pages-$limiter+1;

echo '<a href="phone.php?page=1">1</a>...';

for($i;$i<=$num_pages;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="phone.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

}

}

?>

</table>

</body>

</html>

editPhone.php

<?php

session_start();

if (!array_key_exists("user", $_SESSION)) {

header('Location: auth.php');

exit;

}

require_once("blocks/db.php");

include "blocks/rights.php";

if ($_SERVER['REQUEST_METHOD'] == "POST") {

if (array_key_exists("back", $_POST)) {

$pages=$_POST['page'];

header("Location: phone.php?page=$pages");

exit;

}

else if ($_POST["id"] == "" && $check_user["right_add"] == "+") {

$pages=$_POST['page'];

regDB::getInstance()->insert_phone($_POST["full_name"],$_POST['email'],$_POST["work_phone"],$_POST["mobile_phone"]);

header("Location: phone.php?page=$pages");

exit;

}

else if ($_POST["id"]!= "" && $check_user["right_edit"] == "+") {

regDB::getInstance()->update_phone($_POST["id"],$_POST["full_name"],$_POST['email'],$_POST["work_phone"],$_POST["mobile_phone"]);

$pages=$_POST['page'];

header("Location: phone.php?page=$pages");

exit;

}

}

?>

<html>

<head>

<link href="style.css" type="text/css" rel="stylesheet" media="all" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Телефонный справочник</title>

</head>

<body>

<?php include "blocks/menu.php";

if ($_SERVER["REQUEST_METHOD"] == "POST") {

$phone = array("page" => $_POST["pages"],"full_name" => $_POST["full_name"],"email" => $_POST["email"],"work_phone" => $_POST["work_phone"], "mobile_phone" =>

$_POST["mobile_phone"]);

}

else if (array_key_exists("id", $_GET)) {

$phone = mysqli_fetch_array(regDB::getInstance()->edit_phone($_GET["id"]));

$pages=$_GET['pages'];

}

else {

$pages=$_GET['pages'];

$phone = array("id" => "", "full_name" => "","email" => "","work_phone" => "", "mobile_phone" => "");

}

if ($check_user["right_personal"]!= "+") {$flag='style="visibility:hidden"';}else {$flag="";}

?>

<div id="name_registry">Редактирование</div>

<div class="edit"><form action="editPhone.php" method="POST">

ФИО:</br><input type="search" name="full_name" value="<?php echo $phone['full_name']; ?>" size="28"/></br></br>

Адрес электронной почты:</br><input type="search" name="email" value="<?php echo $phone['email']?>"/></br></br>

Номер телефона (рабочий):</br><input type="search" name="work_phone" value="<?php echo $phone['work_phone']; ?>" /></br></br>

Номер телефона (сотовый):</br><input type="search" name="mobile_phone" value="<?php echo $phone['mobile_phone']; ?>" <?php echo $flag?>/></br>

<input type="hidden" name="id" value="<?php echo $phone['id']?>">

<input type="hidden" name="page" value="<?php echo $pages ?>"></div>

<div class="button_phone"><input type="submit" name="save" value="Сохранить" />

<input type="submit" name="back" value="Назад" /></div>

</form>

staff.php

<?php

error_reporting(0);

require_once("blocks/db.php");

include "blocks/menu.php";

session_start();

if (!array_key_exists("user", $_SESSION)) {

header('Location: auth.php');

exit;

}

include "blocks/rights.php";

if (isset($_POST['organisation'])) $_SESSION['organisation']=$_POST['organisation'];

if (isset($_POST['position'])) $_SESSION['position']=$_POST['position'];

if (isset($_POST['full_name'])) $_SESSION['full_name']=$_POST['full_name'];

if (isset($_POST['dob'])) $_SESSION['dob']=$_POST['dob'];

if ($_SESSION['organisation'] == "") $selected="selected"; else $selected="";

if ($_SESSION['organisation'] == "организация") $selected1="selected";else $selected1="";

if ($_SESSION['organisation'] == "организация1") $selected2="selected";else $selected2="";

?>

<html>

<head>

<link href="style.css" type="text/css" rel="stylesheet" media="all" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Штатное расписание</title>

</head>

<body>

<div id="name_registry">Штатное расписание</div>

<form action="home.php" method="POST">

<input type="submit" value="Главная страница" name="home_page" />

</form>

<form action="staff.php" method="POST">

</br></br>Выберете организацию:</br><select name="organisation">

<option <?php echo $selected ?> value=""></option>

<option <?php echo $selected1 ?> value="организация">Воздвиженский сельсовет</option>

<option <?php echo $selected2 ?> value="организация1">Администрация</option>

</select><br/>

</br>ФИО:</br><input type="search" name="full_name" value="<?php echo @htmlspecialchars($_SESSION['full_name']); ?>" size="35"/><br/>

<div class="staff_position">Должность:</br><input type="search" name="position" value="<?php echo @htmlspecialchars($_SESSION['position']); ?>"/><br/></div>

<div class="staff_dob">Дата рождения:</br><input type="date" name="dob" value="<?php echo @htmlspecialchars($_SESSION['dob']); ?>" />

<input type="submit" value="Найти" name="search" /></div>

</form>

<table>

<tr>

<th width="2%">№ п/п</th>

<th>Должность</th>

<th>ФИО</th>

<th>Дата рождения</th>

</tr>

<ol type="1">

</ol>

<?php

$page_name="staff";

$per_page=10;

$cur_page = 1;

if (isset($_GET['page'])) $page=($_GET['page']-1); else $page=0;

$start=abs($page*$per_page);

$result = regDB::getInstance()->extraction_staff($start,$per_page,$_SESSION['position'],$_SESSION['full_name'],$_SESSION['dob'],$_SESSION['organisation']);

$num=(($page+1)*$per_page)-9;

while($row = mysqli_fetch_array($result)):

echo "<tr><td>".$num++."</td>";

echo "<td>". htmlentities($row['position']). "</td>";

echo "<td>". htmlentities($row['full_name']). "</td>";

echo "<td>". htmlentities($row['dob']). "</td>";

$id=$row['id'];

$page1=$page+1;

if ($check_user["right_edit"] == "+") {

echo '<td width="8%"><form name="edit" action="editStaff.php" method="GET">

<input type="hidden" name="id" value='.$id.'>

<input type="hidden" name="pages" value='.$page1.'>

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

if ($check_user["right_del"] == "+") {

echo '<td width="7%"><form action="delete.php" method="POST">

<input type="hidden" name="id" value='.$id.'>

<input type="hidden" name="pages" value='.$page1.'>

<input type="hidden" name="page_name" value='.$page_name.'>

<input type="submit" name="delete" value="Удалить">

</form></td>';}

echo "</tr>\n";

ENDWHILE;

mysqli_free_result($result);

$res = regDB::getInstance()->extraction_count_staff($_SESSION['position'],$_SESSION['full_name'],$_SESSION['dob'],$_SESSION['organisation']);

$row1=mysqli_fetch_row($res);

$total_rows=$row1[0];

$num_pages=ceil($total_rows/$per_page);

if ($check_user["right_add"] == "+") {

echo '<form name="add" action="editStaff.php" method="GET">

<input type="hidden" name="pages" value='.$num_pages.'>

<input type="submit" value="Добавить">

</form><br/>';

}

echo "Найдено записей: <b>$total_rows</b><br/><br/>Страницы: ";

$limiter=6;

if ($num_pages <= $limiter) {

for($i=1;$i<=$num_pages;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="staff.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

}

if ($num_pages > $limiter) {

if ($page+1 <= $limiter-2) {

$i=1;

for($i;$i<=$limiter;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="staff.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

echo '...<a href="staff.php?page='.$num_pages.'">'.$num_pages."</a>";

}

else if (($page+1 > $limiter-2) && ($page+1 <= ($num_pages-3))) {

$i=($page+1)-3;

echo '<a href="staff.php?page=1">1</a>...';

for($i;$i<=$page+3;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="staff.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

echo '...<a href="staff.php?page='.$num_pages.'">'.$num_pages."</a>";

}

else if ($page+1 > $num_pages-3 && $page+1 <= ($num_pages)) {

$i=$num_pages-$limiter+1;

echo '<a href="staff.php?page=1">1</a>...';

for($i;$i<=$num_pages;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="staff.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

}

}

editStaff.php

<?php

session_start();

if (!array_key_exists("user", $_SESSION)) {

header('Location: auth.php');

exit;

}

require_once("blocks/db.php");

include "blocks/rights.php";

if ($_SERVER['REQUEST_METHOD'] == "POST") {

if (array_key_exists("back", $_POST)) {

$pages=$_POST['page'];

header("Location: staff.php?page=$pages");

exit;

}

else if ($_POST["id"] == "" && $check_user["right_add"] == "+") {

$pages=$_POST['page'];

regDB::getInstance()->insert_staff($_POST["position"],$_POST['full_name'],$_POST["dob"],$_POST["organisation"]);

header("Location: staff.php?page=$pages");

exit;

}

else if ($_POST["id"]!= "" && $check_user["right_edit"] == "+") {

regDB::getInstance()->update_staff($_POST["id"],$_POST["position"],$_POST['full_name'],$_POST["dob"],$_POST["organisation"]);

$pages=$_POST['page'];

header("Location: staff.php?page=$pages");

exit;

}

}

?>

<html>

<head>

<link href="style.css" type="text/css" rel="stylesheet" media="all" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Штатное расписание</title>

</head>

<body>

<?php include "blocks/menu.php";

if ($_SERVER["REQUEST_METHOD"] == "POST") {

$staff = array("page" => $_POST["pages"],"position" => $_POST["position"],"full_name" => $_POST["full_name"],"dob" => $_POST["dob"], "organisation" =>

$_POST["organisation"]);

}

else if (array_key_exists("id", $_GET)) {

$staff = mysqli_fetch_array(regDB::getInstance()->edit_staff($_GET["id"]));

$pages=$_GET['pages'];

}

else {

$pages=$_GET['pages'];

$staff = array("id" => "", "position" => "","full_name" => "","dob" => "", "organisation" => "");

}

if ($staff['organisation'] == "") $selected="selected"; else $selected="";

if ($staff['organisation'] == "организация") $selected1="selected";else $selected1="";

if ($staff['organisation'] == "организация1") $selected2="selected";else $selected2="";

?>

<div id="name_registry">Редактирование</div>

<div class="edit"><form action="editStaff.php" method="POST">

ФИО:<br/><input type="search" name="full_name" value="<?php echo $staff['full_name']; ?>" size="28"/><br/><br/>

Должность:<br/><input type="search" name="position" value="<?php echo $staff['position']?>"/><br/><br/>

Дата рождения:<br/><input type="date" name="dob" value="<?php echo $staff['dob']; ?>" /><br/><br/>

Организация:<br/><select name="organisation">

<option <?php echo $selected ?> value=""></option>

<option <?php echo $selected1 ?> value="организация">Воздвиженский сельсовет</option>

<option <?php echo $selected2 ?> value="организация1">Администрация</option>

</select><br/>

<input type="hidden" name="id" value="<?php echo $staff['id']?>">

<input type="hidden" name="page" value="<?php echo $pages ?>"></div>

<div class="button_phone"><input type="submit" name="save" value="Сохранить" />

<input type="submit" name="back" value="Назад" /></div>

</form>

</body>

</html>

users.php

<?php

require_once("blocks/db.php");

session_start();

if (!array_key_exists("user", $_SESSION)) {

header('Location: auth.php');

exit;

}

if ($_SESSION['user']!= "admin") {

header('Location: home.php');

exit;

}

include "blocks/rights.php";

?>

<html>

<head>

<link href="style.css" type="text/css" rel="stylesheet" media="all" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Пользователи</title>

</head>

<body>

<?php include "blocks/menu.php" ?>

<div id="name_registry">Пользователи</div>

<form action="home.php" method="POST">

<input type="submit" value="Главная страница" name="home_page" />

</form>

<table>

<tr>

<th width="2%">№ п/п</th>

<th>Имя пользователя</th>

<th>Пароль</th>

<th>Добавление</th>

<th>Изменение</th>

<th>Удаление</th>

<th>Личная ифнормация</th>

</tr>

<ol type="1">

</ol>

<?php

$page_name="users";

$per_page=10;

$cur_page = 1;

if (isset($_GET['page'])) $page=($_GET['page']-1); else $page=0;

$start=abs($page*$per_page);

$result = regDB::getInstance()->extraction_user($start,$per_page);

$num=(($page+1)*$per_page)-9;

while($row = mysqli_fetch_array($result)):

echo "<tr><td>".$num++."</td>";

echo "<td>". htmlentities($row['user_name']). "</td>";

echo "<td>". htmlentities($row['user_password']). "</td>";

echo "<td>". htmlentities($row['right_add']). "</td>";

echo "<td>". htmlentities($row['right_edit']). "</td>";

echo "<td>". htmlentities($row['right_del']). "</td>";

echo "<td>". htmlentities($row['right_personal']). "</td>";

$id=$row['id'];

?>

<td width="8%">

<form name="edit" action="editUsers.php" method="GET">

<input type="hidden" name="id" value="<?php echo $id; ?>">

<input type="hidden" name="pages" value="<?php echo $page+1?>">

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

</form>

</td>

<td width="7%">

<form action="delete.php" method="POST">

<input type="hidden" name="id" value="<?php echo $id; ?>">

<input type="hidden" name="pages" value="<?php echo $page+1?>">

<input type="hidden" name="page_name" value="<?php echo $page_name?>">

<input type="submit" name="delete" value="Удалить" >

</form>

</td>

<?php

echo "</tr>\n";

ENDWHILE;

mysqli_free_result($result);

$res = regDB::getInstance()->extraction_count_user();

$row1=mysqli_fetch_row($res);

$total_rows=$row1[0];

$num_pages=ceil($total_rows/$per_page);

echo '<form name="add" action="editUsers.php" method="GET">

<input type="hidden" name="pages" value='.$num_pages.'>

<input type="submit" value="Добавить"/>

</form><br/>';

echo "Найдено записей: <b>$total_rows</b><br/><br/>Страницы: ";

$limiter=6;

if ($num_pages <= $limiter) {

for($i=1;$i<=$num_pages;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="users.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

}

if ($num_pages > $limiter) {

if ($page+1 <= $limiter-2) {

$i=1;

for($i;$i<=$limiter;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="users.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

echo '...<a href="users.php?page='.$num_pages.'">'.$num_pages."</a>";

}

else if (($page+1 > $limiter-2) && ($page+1 <= ($num_pages-3))) {

$i=($page+1)-3;

echo '<a href="users.php?page=1">1</a>...';

for($i;$i<=$page+3;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="users.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

echo '...<a href="users.php?page='.$num_pages.'">'.$num_pages."</a>";

}

else if ($page+1 > $num_pages-3 && $page+1 <= ($num_pages)) {

$i=$num_pages-$limiter+1;

echo '<a href="users.php?page=1">1</a>...';

for($i;$i<=$num_pages;$i++) {

if ($i-1 == $page) {

echo "<b>".$i."&nbsp</b>";

} else {

echo '<a href="users.php?page='.$i.'">'.$i."</a> &nbsp";

}

}

}

}

?>

</table>

</body>

</html>

editUsers.php

<?php

session_start();

if (!array_key_exists("user", $_SESSION)) {

header('Location: auth.php');

exit;

}

if ($_SESSION['user']!= "admin") {

header('Location: home.php');

exit;

}

require_once("blocks/db.php");

include "blocks/rights.php";

if ($_SERVER['REQUEST_METHOD'] == "POST") {

if (array_key_exists("back", $_POST)) {

$pages=$_POST['page'];

header("Location: users.php?page=$pages");

exit;

}

else if ($_POST["id"] == "") {

$pages=$_POST['page'];

if (!isset($_POST["right_add"])) $right_add="-";else $right_add=$_POST["right_add"];

if (!isset($_POST["right_edit"])) $right_edit="-";else $right_edit=$_POST["right_edit"];

if (!isset($_POST["right_del"])) $right_del="-";else $right_del=$_POST["right_del"];

if (!isset($_POST["right_personal"])) $right_personal="-";else $right_personal=$_POST["right_personal"];

regDB::getInstance()->insert_user($_POST["user_name"],$_POST['user_password'],$right_add,$right_edit,$right_del,$right_personal);

header("Location: users.php?page=$pages");

exit;

}

else if ($_POST["id"]!= "") {

if (!isset($_POST["right_add"])) $right_add="-";else $right_add=$_POST["right_add"];

if (!isset($_POST["right_edit"])) $right_edit="-";else $right_edit=$_POST["right_edit"];

if (!isset($_POST["right_del"])) $right_del="-";else $right_del=$_POST["right_del"];

if (!isset($_POST["right_personal"])) $right_personal="-";else $right_personal=$_POST["right_personal"];

regDB::getInstance()->update_user($_POST["id"],$_POST["user_name"],$_POST['user_password'],$right_add,$right_edit,$right_del,$right_personal);

$pages=$_POST['page'];

header("Location: users.php?page=$pages");

exit;

}

}

?>

<html>

<head>

<link href="style.css" type="text/css" rel="stylesheet" media="all" />

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Пользователи</title>

</head>

<body>

<?php include "blocks/menu.php";

if ($_SERVER["REQUEST_METHOD"] == "POST") {

$users = array("page" => $_POST["pages"],"user_name" => $_POST["user_name"],"user_password" => $_POST["user_password"],"right_add" => $_POST["right_add"], "right_edit" =>

$_POST["right_edit"],"right_del" => $_POST["right_del"],"right_personal" => $_POST["right_personal"]);

}

else if (array_key_exists("id", $_GET)) {

$users = mysqli_fetch_array(regDB::getInstance()->edit_user($_GET["id"]));

$pages=$_GET['pages'];

}

else {

$pages=$_GET['pages'];

$users = array("id" => "", "user_name" => "","user_password" => "","right_add" => "", "right_edit" => "","right_del" => "","right_personal" => "");

}

if ($users["right_add"] == "+") $add="checked";else $add="";

if ($users["right_edit"] == "+") $edit="checked";else $edit="";

if ($users["right_del"] == "+") $del="checked";else $del="";

if ($users["right_personal"] == "+") $personal="checked";else $personal="";

?>

<div id="name_registry">Редактирование</div>

<div class="edit"><form action="editUsers.php" method="POST">

Имя пользователя:<br/><input type="search" name="user_name" value="<?php echo $users['user_name']; ?>" /><br/><br/>

Пароль:<br/><input type="search" name="user_password" value="<?php echo $users['user_password']?>"/><br/><br/>

Права пользователя:<br/><p><input type="checkbox" name="right_add" value="+" <?php echo $add?>>Добавление<Br>

<input type="checkbox" name="right_edit" value="+" <?php echo $edit?>>Изменение<Br>

<input type="checkbox" name="right_del" value="+" <?php echo $del?>>Удаление<Br>

<input type="checkbox" name="right_personal" value="+" <?php echo $personal?>>Личная информация<Br></p>

<input type="hidden" name="id" value="<?php echo $users['id']?>">

<input type="hidden" name="page" value="<?php echo $pages ?>"></div>

<div class="button_phone"><input type="submit" name="save" value="Сохранить" />

<input type="submit" name="back" value="Назад" /></div>

</form>

</body>

</html>

download.php

<?php

session_start();

if (!array_key_exists("user", $_SESSION)) {

header('Location: auth.php');

exit;

}

$file=$_GET['file'];

header ("Content-Type: application/octet-stream");

header ("Accept-Ranges: bytes");

header ("Content-Length: ".filesize($file));

header ("Content-Disposition: attachment; filename=".basename($file));

readfile($file);

delete.php

<?php

session_start();

if (!array_key_exists("user", $_SESSION)) {

header('Location: auth.php');

exit;

}

require_once("blocks/db.php");

include "blocks/rights.php";

if ($check_user["right_del"] == "+"){

if ($_POST['page_name'] == "decrees") {

regDB::getInstance()->delete_decrees($_POST['id']);

$pages=$_POST['pages'];

unlink($_POST["file_name"]);

header("Location: decrees.php?page=$pages");

} else if ($_POST['page_name'] == "instructions") {

regDB::getInstance()->delete_instructions($_POST['id']);

$pages=$_POST['pages'];

unlink($_POST["file_name"]);

header("Location: instructions.php?page=$pages");

} else if ($_POST["page_name"] == "solutions") {

regDB::getInstance()->delete_solutions($_POST['id']);

$pages=$_POST['pages'];

unlink($_POST["file_name"]);

header("Location: solutions.php?page=$pages");

} else if ($_POST["page_name"] == "phone") {

regDB::getInstance()->delete_phone($_POST['id']);

$pages=$_POST['pages'];

header("Location: phone.php?page=$pages");

} else if ($_POST["page_name"] == "staff") {

regDB::getInstance()->delete_staff($_POST['id']);

$pages=$_POST['pages'];

header("Location: staff.php?page=$pages");

}

else if ($_POST["page_name"] == "users") {

regDB::getInstance()->delete_user($_POST['id']);

$pages=$_POST['pages'];

header("Location: users.php?page=$pages");

}

}

?>

Размещено на Allbest.ru


Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.