View Single Post
Old 05-31-2009, 07:52 PM   #6 (permalink)
Sirupsen
The Contributor
 
Sirupsen's Avatar
 
Join Date: May 2009
Posts: 53
Thanks: 2
Sirupsen is on a distinguished road
Default

So this looks good then..?

PHP Code:
        <?php
             
include_once("_class/database.php");
             include_once(
"_class/news.php");

            
$DB = new DB;
            
$NEWS = new news;
            
$DB->setup_db('localhost','root','','db');

          if (
$_POST['title'])
            
$NEWS->admin_write($_POST);

            if (
$_GET ['post'] == 1) {
              echo 
'<form method="post" action="index.php">';
              echo 
'<h1>Post something!</h1>';
              echo 
'<input type="text" name="title"><br>';
              echo 
'<input type="text" name="content"></textarea><br>';
              echo 
'<input type="submit" name="submit">';
              echo 
'</form>';
             } else {
                
$sql "SELECT * FROM slimplCMS_posts";
                
                foreach (
$DB->select($sql) AS $row) {
                    echo
                    
"<div id='post_".$row['id']."'>
                    <p>
                        "
.$row['title']."
                    </p><p>
                        "
.$row['bodytext']."
                    </p>
                        "
.$row['created']."
                    </p></div><br>"
;
                }
                echo 
'<a href="?post=1" title="Write an entry!" />Write an entry!</a>';
            }
        
?>
Send a message via AIM to Sirupsen Send a message via MSN to Sirupsen Send a message via Yahoo to Sirupsen Send a message via Skype™ to Sirupsen
Sirupsen is offline  
Reply With Quote