rendered paste body<?php## Design the page headerfunction pageHeader($title = "general pastebin") { ?> <html> <head> <title>general pastebin<?php if(!empty($title)) print " - ".$title ?></title> <link rel="stylesheet" href="pb.css"/> </head> <body> <h1>general pastebin<?php if(!empty($title)) print " - ".$title ?></h1> <?php}## The error pagefunction pageError($reason, $show_sidebar = true) { if($show_sidebar) pageSidebar(); ?> <div id="main"> Sorry, an error occured. Reason: <b><?php print $reason ?></b> </div> <?php}## Sidebarfunction pageSidebar($posts = "") { print '<div id="sidebar">'; if(!empty($posts)) { ?> <h2>Recent Posts</h2> <ul> <?php for($i = 0; $i < count($posts); $i++) { $post = $posts[$i]; $post["age"] = preg_replace("/@/", "", $post["age"]); print "<li><a href=\"index.php?id=$post[id]\">$post[poster]</a><br/><span class=\"ago\">$post[age] ago</span></li>"; } print "</ul>"; } print "<h2>Stuff to Do</h2>"; print '<ul><li><a href="index.php?a=n">Make a New Post</a></li></ul>'; print "</div>";}## The main source sectionfunction pageMain($post = "") { print '<div id="main">'; if(!empty($post)) { $post["age"] = preg_replace("/@ /","",$post["age"]); print "<h2>Posted by $post[poster] on $post[posted_format] ($post[age] ago)</h2>"; print "<h3>This URL: <span class=\"url\">http://www.netmonks.ca/pb/index.php?id=$post[id]</span></h3>"; print '<div id="source">'; $source = split("\n", $post["content"]); if(preg_match("/^[ \t\n\r]*$/",$source[count($source)-1])) { array_pop($source); } for($i = 0; $i < count($source); $i++) { printf("<code><span class=\"lineno\">%03d</span> <span class=\"line\">%s</span></code><br/>", $i+1, htmlentities($source[$i])); } print "</div>"; print '<div id="form">'; print '<p>Either update this post and resubmit it with changes, or <a href="index.php?a=n">make a new post</a>.</p>'; } else { print '<div id="form">'; print '<p>Please enter your new post below:</p>'; } ?> <form method="post" action="index.php"> <span class="tiny"><b>Note:</b> Please just paste the text into the below text box.<br/>Don't worry about long lines being wrapped in the view.<br/></span> <textarea name="content" cols="80" rows="15"><?php print htmlspecialchars($post["content"])?></textarea><br/> <span class="tiny">Name:</span><br/><input type="text" name="name" size="20" length="20" value="<?php print htmlentities($_COOKIE["nmpb"])?>"/><br/> <span class="tiny"><input type="checkbox" name="save" value="1"/> Save your name in a cookie?</span><br/> <input class="submit" type="submit" name="s" value="Submit Post"/> <input class="reset" type="reset" name="s" value="Reset Text Area"/> </form> </div> </div> <?php}## THe page footerfunction pageFooter() { ?> </body> </html> <?php}?>