-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverLibro.php
More file actions
64 lines (61 loc) · 2.08 KB
/
verLibro.php
File metadata and controls
64 lines (61 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
session_start();
if (!isset($_SESSION["id"])) {
header("location: login.php");
exit();
}
require_once("privado/configDB.php");
if (!isset($_GET["id"])) {
header("location: index.php");
exit();
}
$id = $base->real_escape_string(filter_input(INPUT_GET, "id"));
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="shortcut icon" href="img/icon-book.png">
<link rel="stylesheet" href="css/si.css">
<meta charset="UTF-8">
<title>Inicio</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
</head>
<body background="img/libreria.jpg">
<?php require_once("privado/modulos/navbar.php");
$res = $base->query("SELECT * FROM `libros` WHERE `id` = $id");
if ($res) {
if ($res->num_rows == 1) {
$datos = $res->fetch_assoc();
$linkVista = str_replace("/view", "/preview", $datos["link_google"]);
$cadena = explode("/", $datos["link_google"]);
$idGoogle = $cadena[5];
$linkDescarga = "https://drive.google.com/u/1/uc?id=$idGoogle&export=download";
$base->query("INSERT INTO `visitas_libro`(`id_libro`) VALUES ('$id')");
?>
<div class="contenedor-iframe">
<div class="Centrar">
<h1 class="title2"><?php echo $datos["titulo"] ?></h1>
</div>
<div class="Centrar">
<h5><?php echo $datos["fecha"] ?></h5>
</div>
<div class="Centrar"><iframe src="<?php echo $linkVista?>"></iframe></div>
<!-- <div class="Centrar"><a href="<?php echo $linkDescarga ?>"><button class="boton">Descargar</button></a></div> -->
<a href="<?php echo $linkDescarga ?>"><button class="boton">Descargar</button></a>
</div>
<?php
$res->free_result();
}
else{ ?>
<div class="Centrar">
<h1>Libro No Encontado...</h1>
</div>
<?php }
}
else {
header("location: index.php");
}
$base->close();
?>
</body>
</html>