コード例 #1
0
ファイル: actions.php プロジェクト: A1esandr/swan
    $data = array('name' => $name, 'author' => $author, 'genre' => $genre, 'year' => $year);
    $id = $db->insert('books', $data);
    if ($id) {
        echo 'Книга была добавлена';
    }
}
//Чтение действия из ajax-запроса
$action = html_entity_decode(strip_tags($_POST['action']));
//Выполнение действий
if ($action == 'show') {
    displayAll();
}
if ($action == 'delete') {
    $id = html_entity_decode(strip_tags($_POST['id']));
    deleteBook($id);
}
if ($action == 'edit') {
    $id = html_entity_decode(strip_tags($_POST['id']));
    $name = html_entity_decode(strip_tags($_POST['name']));
    $author = html_entity_decode(strip_tags($_POST['author']));
    $genre = html_entity_decode(strip_tags($_POST['genre']));
    $year = html_entity_decode(strip_tags($_POST['year']));
    editBook($id, $name, $author, $genre, $year);
}
if ($action == 'add') {
    $name = html_entity_decode(strip_tags($_POST['name']));
    $author = html_entity_decode(strip_tags($_POST['author']));
    $genre = html_entity_decode(strip_tags($_POST['genre']));
    $year = html_entity_decode(strip_tags($_POST['year']));
    addBook($name, $author, $genre, $year);
}
コード例 #2
0
ファイル: index.php プロジェクト: Devenet/MyBooks
}
// admin asked
if (isset($_GET['admin'])) {
    administration();
}
// login asked
if (isset($_GET['signin'])) {
    signin();
}
// logout asked
if (isset($_GET['signout'])) {
    signout();
}
// new book asked
if (isset($_GET['add'])) {
    addBook();
}
// edit book asked
if (isset($_GET['edit']) && !empty($_GET['edit'])) {
    editBook();
}
// delete book asked
if (isset($_GET['delete']) && !empty($_GET['delete'])) {
    deleteBook();
}
// display writted log asked
if (isset($_GET['logs'])) {
    logsPage();
}
// display settings log asked
if (isset($_GET['settings'])) {
コード例 #3
0
ファイル: add_book.php プロジェクト: javasch/selibapp
    }
    // Allow certain file formats
    if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "JPG" && $imageFileType != "GIF") {
        echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
        $uploadOk = 0;
    }
    // Check if $uploadOk is set to 0 by an error
    if ($uploadOk == 0) {
        echo "Sorry, your file was not uploaded.";
        // if everything is ok, try to upload file
    } else {
        if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
            //echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
            $cover_picture = "uploads/" . $_FILES["fileToUpload"]["name"];
            // do crud
            addBook($shelf_id, $cover_picture, $category_id, $title, $author, $type, $publish_year, $isbn_number, $pdf_link);
        } else {
            echo "Sorry, there was an error uploading your file.";
        }
    }
}
?>

<div class="row">
	<div class="col-lg-12">
		<h3 class="">Books</h3>
		<hr/>
	</div>
	<!-- /.col-lg-12 -->
</div>
コード例 #4
0
ファイル: add_book.php プロジェクト: AlexandrosKal/mylib
<?php

require 'models/connect.php';
require 'models/book_add.php';
require 'models/genres_functions.php';
require 'models/redirect.php';
if (!isset($_SESSION['userid'])) {
    standardRedirect('login.php', ['ref' => 'add_book']);
}
if (!empty($_POST)) {
    //In this case adds the book
    $errors = bookDataErrors($_POST);
    require 'views/header.php';
    if (!$errors) {
        $bid = addBook($_POST, $_FILES);
        dynamicRedirect('add_bookcp.php', ['bid' => $bid]);
    } else {
        require 'views/form_errors.php';
        require 'views/book/add_form.php';
    }
    require 'views/footer.php';
} else {
    //Make sure thatuser request at max 4 fields for author and at maxt 4 fields fot genres
    $authors = getAuthorsNum($_GET);
    if ($authors != $_GET['authors']) {
        standardRedirect('add_book.php', ['authors' => 1], ['red']);
    }
    $genres = getGenres();
    $authorsNum = getAuthorsNum($_GET);
    $title = 'Προσθήκη Βιβλίου';
    require 'views/header.php';
コード例 #5
0
ファイル: save_upload.php プロジェクト: 9px/BookShare
	if ($_FILES['file_01']['tmp_name']) {
		$f = handleUpload('file_01');
		if(!$f){
				message('Error occur when uploading the image!');
				return redirect('upload.php');		
			}
	}else{
		$f = '';
	}
	
	
	$db = getDBInstance();
	$name = $_REQUEST['name'];
	$desc = $_REQUEST['description'];
	$short_desc = $_REQUEST['short_description'];
	$point = 1;
	$create_by = $_SESSION['user']->id;

	addBook($db, $name, $desc, $short_desc, $f, $point, $create_by);
	
	// add the point once the user upload the book
	updateUserPoints($db, $_SESSION['user']->id, $point);
	$new_points = $_SESSION['user']->points + $point;	
	$_SESSION['use']->points = $new_points;

	
	$db->debug();
	message('Upload successfully!');
	redirect('index.php');
	
?>