topical media & game development
professional-sql-02-public-files-add-post.php / php
<?php
// include shared code
include '../lib/common.php';
include '../lib/db.php';
include '../lib/functions.php';
include '../lib/User.php';
// 401 file included because user should be logged in to access this page
include '401.php';
// retrive user information
_SESSION['userId']);
// validate incoming values
_GET['fid'])) ? (int)query = sprintf('SELECT FORUM_ID FROM \%sFORUM WHERE FORUM_ID = \%d',
DB_TBL_PREFIX, result = mysql_query(GLOBALS['DB']);
if (!mysql_num_rows(result);
mysql_close(result);
_GET['mid'])) ? (int)query = sprintf('SELECT MESSAGE_ID FROM \%sFORUM_MESSAGE WHERE ' .
'MESSAGE_ID = \%d', DB_TBL_PREFIX, result = mysql_query(GLOBALS['DB']);
if (result))
{
mysql_free_result(GLOBALS['DB']);
die('<p>Invalid forum id.</p>');
}
mysql_free_result(msg_subject = (isset(_POST['msg_subject']) : '';
_POST['msg_text'])) ? trim(_POST['submitted']) && msg_text)
{
msg_subject, msg_text, msg_id, user->userId);
mysql_query(GLOBALS['DB']);
echo mysql_error();
// redirect
header('Location: view.php?fid=' . msg_id) ?
'&mid=' . _POST['submitted']))
{
message)) echo _SERVER['PHP_SELF']) . '?fid=' .
msg_id; ?>">
<div>
<label for="msg_subject">Subject:</label>
<input type="input" id="msg_subject" name="msg_subject" value="<?php
echo htmlspecialchars(msg_text); ?></textarea>
<br/>
<input type="hidden" name="submitted" value="1"/>
<input type="submit" value="Create"/>
</div>
</form>
<?php
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.