Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (get_magic_quotes_gpc())
- {
- function stripslashes_deep($value)
- {
- $value = is_array($value) ?
- array_map('stripslashes_deep', $value) :
- stripslashes($value);
- return $value;
- }
- $_POST = array_map('stripslashes_deep', $_POST);
- $_GET = array_map('stripslashes_deep', $_GET);
- $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
- $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
- }
- if (isset($_GET['additem']))
- {
- include 'form.html.php';
- exit();
- }
- $link = mysqli_connect('localhost', 'root', 'mylibpro');
- if (!$link)
- {
- $error = 'Unable to connect to the database server.';
- include 'error.html.php';
- exit();
- }
- if (!mysqli_set_charset($link, 'utf8'))
- {
- $output = 'Unable to set database connection encoding.';
- include 'output.html.php';
- exit();
- }
- if (!mysqli_select_db($link, 'lendinglibrary'))
- {
- $error = 'Unable to locate the library database.';
- include 'error.html.php';
- exit();
- }
- if (isset($_POST['Title']))
- {
- $Title = mysqli_real_escape_string($link, $_POST['Title']);
- $sql = 'INSERT INTO library SET
- Title="' . $title . '",
- jokedate=CURDATE()';
- {
- $error = 'Error adding submitted item: ' . mysqli_error($link);
- include 'error.html.php';
- exit();
- }
- header('Location: .');
- exit();
- }
- $result = mysqli_query($link, 'SELECT Title FROM library');
- if (!$result)
- {
- $error = 'Error fetching library items: ' . mysqli_error($link);
- include 'error.html.php';
- exit();
- }
- while ($row = mysqli_fetch_array($result))
- {
- $title[] = $row['Title'];
- }
- include 'items.html.php';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement