Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if ($_SESSION['loggedin'] == true)
- {
- if (isset($_POST['postnews']))
- {
- $content = htmlspecialchars($_POST['content']);
- $author = htmlspecialchars($_POST['author']);
- $date = htmlspecialchars($_POST['date']);
- $sql_host = '*********';
- $sql_user = '*********';
- $sql_pass = '*********';
- $sql_db = '*********';
- $db = new mysqli($sql_host, $sql_user, $sql_pass, $sql_db);
- $query = "insert into kfs_news (content, author, date) values ($content, $author, $date);";
- if ($result = $db->query($query))
- {
- echo('Success! Newsitem posted.');
- echo('<br /><br /><p><a href="news.php" title="Go back">Go back to post more news</a></p><br />');
- echo('<p><a href="post.php?session=close" title="Log out">Press here to log out</a></p><br />');
- }
- else
- {
- echo('Error while inserting data into database. Please try again later. If the problem persists, contact webmaster.');
- }
- }
- elseif ($_GET['session'] == 'close')
- {
- session_destroy();
- echo('Successfully logged out!');
- }
- else
- {
- echo('Nothing to post... please use the admin page to specify a newsitem to be posted.');
- }
- }
- else
- {
- echo('You\'re not logged in, please login before using this service.');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement