Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-Type application/xhtml+xml; charset=utf-8");
- session_start();
- $database_user = "root";
- $database_pass = "uvekjenajgorenista";
- $db = new PDO('mysql:host=localhost;dbname=bookmarker', $database_user, $database_pass);
- function msg_error($string)
- {
- die('<div class="error"><b>Error:</b> ' . $string . '</div>');
- }
- function only_logged()
- {
- if (! $_SESSION['user'])
- {
- msg_error("Only logged users can see this page");
- }
- }
- function show_bookmark($bid)
- {
- $result = $db->query("SELECT title,content,uid,private FROM bookmarks WHERE id = '$bid'");
- echo "fetching...";
- $row = $result->fetch();
- if (! $row)
- {
- msg_error("Cannot read bookmark specifiee by ID $bid, maybe it does not exist.");
- }
- echo "$row[0]";
- echo '<div class="bookmark-entry">';
- echo '<p><h2>' . $row[0] . '</h2></p>';
- echo '<p>';
- echo $row[1];
- echo '</p>';
- echo '</div>';
- }
- ?>
Add Comment
Please, Sign In to add comment