All pastes #901860 Raw Edit

Miscellany

public php v1 · immutable
·published 2008-02-12 23:57 UTC
rendered paste body
<?phpif (!defined('in_tt-admin')) {	die ("Hacking Attempt!");}if (isset($_POST['submit'])) {	if (stripslashes(trim($_POST['title'])) != '' && stripslashes(trim($_POST['data'])) != '') {		stripslashes($_POST['data']);		stripslashes($_POST['author']);		$result = $db->query("INSERT INTO `".$config->database['prefix']."books` (`title`, `author`, `description`) VALUES ('".mysql_real_escape_string(stripslashes($_POST['title']))."', '".mysql_real_escape_string(stripslashes($_POST['author'])."', '".mysql_real_escape_string(stripslashes($_POST['data']))));		$db->log($_SESSION['tt-admin-username'], 'Created New Book: '.$_POST['title']." (".mysql_insert_id($link).")");?>				<div class="page-block">					<div class="header">						<h2>Message</h2>					</div>					<div class="contents">						The new book was successfully created!						<div class="center">							<a href="<?php print $config->baseurl; ?>index.php?page=library&amp;manage=books">Add Chapters</a>						</div>					</div>				</div><?php		return;	} else {?>				<div class="error-block">					<div class="header">						<h2>An Error has Occured!</h2>					</div>					<div class="contents">						None of the fields can be left blank!					</div>				</div><?php	}}?>				<div class="page-block">					<div class="header">						<h2>New Book</h2>					</div>					<div class="contents">						<form action="<?php print $config->baseurl; ?>index.php?page=library&amp;manage=books&amp;do=new" method="post">							<dl class="form">								<dt class="label">									<label for="title">Title</label>								</dt>								<dd class="input">									<input type="text" length="20" maxlength="255" name="title" id="title" class="input" />								</dd>							</dl>							<dl class="form">								<dt class="label">									<label for="author">Author</label>								</dt>								<dd class="input">									<input type="text" length="20" maxlength="255" name="author" id="author" class="input" />								</dd>							</dl>							<textarea name="data" id="data" rows="10" cols="50" class="textarea"></textarea>							<div class="center">								<input type="submit" value="Edit Book" name="submit" id="submit" class="input" />							</div>						</form>					</div>				</div>