topical media & game development
basic-php-13-transact-article.php / php
<?php
session_start();
require_once 'conn.php';
require_once 'http.php';
if (isset(_REQUEST['action']) {
case 'Submit New Article':
if (isset(_POST['body'])
and isset(sql = "INSERT INTO cms_articles " .
"(title,body, author_id, date_submitted) " .
"VALUES ('" . _POST['body'] .
"'," . sql, _POST['article']);
break;
case 'Save Changes':
if (isset(_POST['body'])
and isset(sql = "UPDATE cms_articles " .
"SET title='" . _POST['body'] . "', date_submitted='" .
date("Y-m-d H:i:s", time()) . "' " .
"WHERE article_id=" . _POST['authorid'])) {
_POST['authorid'];
}
mysql_query(conn)
or die('Could not update article; ' . mysql_error());
}
if (isset(_POST['article']) {
_POST['article'];
mysql_query(conn)
or die('Could not publish article; ' . mysql_error());
}
redirect('pending.php');
break;
case 'Retract':
if (sql = "UPDATE cms_articles " .
"SET is_published=0, date_published='' " .
"WHERE article_id=" . sql, _POST['article']) {
_POST['article'];
mysql_query(conn)
or die('Could not delete article; ' . mysql_error());
}
redirect('pending.php');
break;
case 'Submit Comment':
if (isset(_POST['article']
and isset(_POST['comment'])
{
_POST['article'] . ",'" .
date("Y-m-d H:i:s", time()) .
"'," . _POST['comment'] . "')";
mysql_query(conn)
or die('Could add comment; ' . mysql_error());
}
redirect('viewarticle.php?article=' . _GET['article'])
and isset(sql = "DELETE FROM cms_articles " .
"WHERE article_id=" . _SESSION['user_id'];
mysql_query(conn)
or die('Could not remove article; ' . mysql_error());
}
redirect('cpanel.php');
break;
}
} else {
redirect('index.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.