} if (isset($curPage->reqPostOverride[$crit])) { $req_posts[$crit] = $curPage->reqPostOverride[$crit]; } } // For testing Only $req_posts['status'] = '2'; // Figure out which page to use, and __construct it. $req_page = isset($_GET['page']) ? $_GET['page'] : "index"; if (isset($req_page)) { $filetoopen = sprintf('%s.php', $req_page); if (file_exists($filetoopen)) { include $filetoopen; $curPage = new $req_page($req_posts); } else { awshit(sprintf('I don\'t know anything about a page called \'%s\'', $req_page)); } } $headerisprinted = false; // Is set to true by do_header() $poststatus = array('1' => 'Draft', '2' => 'Published', '3' => 'Deleted'); // Set page title /*$pagetitle = ''; foreach ($req_posts as $key => $value) { if ($value) { switch ($key) { case 'mode': if ($value == 'list') { $title['mode'] = 'Listing of '; } break; case 'section': $title['section'] = sprintf('/%s', $section_byid[$value]['name']);
<?php if (strtolower(__FILE__) == strtolower($_SERVER['SCRIPT_FILENAME'])) { header('Location: http://phux0red.net'); exit; } if (!$isloggedin) { awshit('Begone'); } shitbugs(__FILE__ . " loaded!"); // TODO: Make a function for displaying posts. This function should replace the following: // $selectedposts = getreqposts(array ('status' => '1')); // if (!mysql_num_rows($selectedposts)) { // echo "No drafts"; // } else { // while ($row = mysql_fetch_assoc($selectedposts)) list_single_post($row); // } // With something like show_posts('status => '1'); // Image cropper: http://www.webmotionuk.co.uk/php-jquery-image-upload-and-crop/ // You can use the value of a Submit input type to determine what to do. Example: // <input type=submit name=edit_post value = Go> // then, on post, if isset($edit_post) then edit post. // Allowing for attachment of images: NOTE: HOW TO ATTACH AN IMG TO A NEW POST (IT HAS NO POST_ID YET!) // first off, show images already attached! // User clicks "attach an image" // Edit page loads with &attach appended and the post # specified // script looks for &attach and appends a new form for attaching an image // User picks an image, edits it's description, clicks "Attach" button // Script creates thumbnail, and stores it in content/thumbnails // creates 800px wide preview, stores it in content/previews // stores original image in content/images
} // Init function do_page() { } $title['page'] = "Account Stuff"; if (!$_POST & !$_GET) { awshit('Yeah, that isn\'t gonna work.'); } if (isset($_GET['logout'])) { $isloggedin = false; unset($_SESSION); session_destroy(); awshit('You are logged out.'); } else { $result_login = mysql_query(sprintf('SELECT user_id, username, realname FROM users WHERE username="******" AND password="******"', $_POST['u'], sha1($_POST['p']))); if (!$result_login) { awfuck('Something f****d up: %s', mysql_error()); } if ($currentuser = mysql_fetch_array($result_login)) { $_SESSION = $currentuser; if ($_POST['deboog']) { $_SESSION['deboog'] = true; } $isloggedin = true; awshit(sprintf('Welcome, %s!', $currentuser['realname'])); } else { awshit('Die, muthafucka!'); } printf('Welcome, %s!', $currentuser['realname']); }