Exemple #1
0
<?php

define("AJAX", "");
session_start();
if (isset($_SESSION["authOk"])) {
    if (!isset($_REQUEST['type']) || $_REQUEST['type'] != 'news' && $_REQUEST['type'] != 'videos' && $_REQUEST['type'] != 'tabs' && $_REQUEST['type'] != 'pictures' && $_REQUEST['type'] != 'slider') {
        echo 'Переданы не все данные!';
        return;
    }
    require_once '../../classes/MyDBWorker.php';
    $db = new MyDBWorker();
    $params = array();
    foreach ($_REQUEST as $key => $value) {
        if ($key == 'ID' || $key == 'type') {
            continue;
        }
        $params[$key] = $value;
    }
    //обработка загрузки файла
    if (!empty($_FILES) && $_FILES['FILE']['size'] != 0) {
        if ($_REQUEST["type"] == "tabs") {
            $uploaddir = '/upload/tabs/';
        } elseif ($_REQUEST["type"] == "pictures") {
            $uploaddir = '/upload/gallery/';
        } else {
            $uploaddir = '/upload/images/';
        }
        $uploadfile = $uploaddir . basename($_FILES['FILE']['name']);
        if (file_exists("../.." . $uploadfile)) {
            unlink("../.." . $uploadfile);
        }
Exemple #2
0
<?php

require_once 'init.php';
require_once 'classes/MyDBWorker.php';
$db = new MyDBWorker();
?>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="favicon.ico" />
<link href='https://fonts.googleapis.com/css?family=Lobster&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<?php 
require_once "meta.php";
?>
</head>
<body>
<div id="header"  align="center">
	<div id="head">
		<div id="logo">
			<a href="index.php"><img src="images/logo.png" alt="A-Chord Logo" /></a>
		</div>
		<div id="nav">
			<ul>
				<li><a href="/">Главная</a></li>
				<li><a href="/bio.php">Био</a></li>
				<li><a href="/tabs.php">Табулатуры</a></li>
				<li><a href="/gallery.php">Фото</a></li>
Exemple #3
0
<?php

define("AJAX", "");
session_start();
if (isset($_SESSION["authOk"])) {
    if (!isset($_GET['type']) || !isset($_GET['id']) || $_GET['type'] != 'news' && $_GET['type'] != 'videos' && $_GET['type'] != 'tabs' && $_GET['type'] != 'pictures' && $_GET['type'] != 'slider') {
        echo 'Переданы не все данные!';
        return;
    }
    require_once '../../classes/MyDBWorker.php';
    $db = new MyDBWorker();
    $res = $db->GetList($_GET['type'], false, $_GET['id']);
    $fields = $res->fetch_fields();
    if ($_GET['id'] == -1) {
        //случай добавления новой записи
        $row[0] = -1;
        for ($i = 1; $i < count($fields); $i++) {
            if ($fields[$i]->orgname == 'ACTIVE') {
                $row[$i] = '1';
            } elseif ($fields[$i]->orgname == 'DATE') {
                $row[$i] = date('Y-m-d');
            } else {
                $row[$i] = "";
            }
        }
        ?>
<h2>Добавление новой записи</h2><?php 
    } else {
        $row = $res->fetch_row();
        ?>
<h2>Изменение существующей записи</h2><?php 
Exemple #4
0
<?php

define("AJAX", "");
session_start();
if (isset($_SESSION["authOk"])) {
    if (!isset($_GET['type']) || !isset($_GET['id']) || $_GET['type'] != 'news' && $_GET['type'] != 'videos' && $_GET['type'] != 'tabs' && $_GET['type'] != 'pictures' && $_GET['type'] != 'slider') {
        echo 'Переданы не все данные!';
        return;
    }
    require_once '../../classes/MyDBWorker.php';
    $db = new MyDBWorker();
    $res = $db->DeleteNote($_GET['type'], $_GET['id']);
    $db->Close();
    echo 'ok';
} else {
    echo 'Access denied!';
}
Exemple #5
0
<?php

define("AJAX", "");
session_start();
if (isset($_SESSION["authOk"])) {
    if (!isset($_GET['type']) || $_GET['type'] != 'news' && $_GET['type'] != 'videos' && $_GET['type'] != 'tabs' && $_GET['type'] != 'pictures' && $_GET['type'] != 'slider') {
        echo 'Неверно указан тип!';
        return;
    }
    require_once '../../classes/MyDBWorker.php';
    $db = new MyDBWorker();
    $res = $db->GetList($_GET['type'], false);
    $thead = $res->fetch_fields();
    ?>
	<div id="addNew">Добавить новую запись</div>
	<table>
		<thead>
			<?php 
    foreach ($thead as $val) {
        if ($val->name != 'ID') {
            echo '<th>' . $val->name . '</th>';
        }
    }
    ?>
		</thead>
	<?php 
    while ($row = $res->fetch_array(MYSQLI_ASSOC)) {
        ?>
		<tr data-id="<?php 
        echo $row['ID'];
        ?>