<?php

/////////////////////////////////
//13 news by jakez       		/
//Email: thirteen@hackermail.com/
//Website: http://www.jakez.net /
/////////////////////////////////
include dirname(__FILE__) . "/config.php";
func_mysqlconnect();
$sql = 'CREATE TABLE `news` ( 
`subject` VARCHAR( 255 ) NOT NULL, 
`text` TEXT NOT NULL, 
`id` VARCHAR( 255 ) NOT NULL, 
`date` VARCHAR( 255 ) NOT NULL, 
PRIMARY KEY ( `id` )
)';
mysql_query($sql, $connection) or die("<font face=verdana>Error installing tables, please make sure you have set the correct information in config.php: " . mysql_error());
echo "Successfully created table 'news'!<br>";
$sql = 'CREATE TABLE `comments` ( 
`comment` TEXT NOT NULL, 
`newsid` VARCHAR( 255 ) NOT NULL, 
`commentid` VARCHAR( 255 ) NOT NULL, 
`commentname` VARCHAR( 255 ) NOT NULL, 
`commentemail` VARCHAR( 255 ) NOT NULL, 
`commentwebsite` VARCHAR( 255 ) NOT NULL, 
`commentaim` VARCHAR( 255 ) NOT NULL, 
`commentposttime` VARCHAR( 255 ) NOT NULL, 
`commentip` VARCHAR( 255 ) NOT NULL, 
PRIMARY KEY ( `commentposttime` )
)';
mysql_query($sql, $connection) or die("<font face=verdana>Error installing tables, please make sure you have set the correct information in config.php: " . mysql_error());
     $sql = "SELECT * FROM news WHERE id='{$id}'";
     $num = mysql_numrows(mysql_query($sql));
     if ($num == 0) {
         $message = "News post #{$id} does not exist!";
     } else {
         $deleteresult = mysql_query("DELETE FROM news WHERE id = {$id}");
         $result = mysql_query($deleteresult, $connection);
         $affected_rows = mysql_affected_rows($connection);
         $deleteresult = mysql_query("DELETE FROM comments WHERE newsid = {$id}");
         $result = mysql_query($deleteresult, $connection);
         $affected_rows = mysql_affected_rows($connection);
         $message = "News post #{$id} was deleted successfully!";
     }
 }
 if ($page == "") {
     $connection = func_mysqlconnect();
     mysql_select_db($dbname);
     $sql = "SELECT id FROM news";
     $num = mysql_numrows(mysql_query($sql));
     $newstotal = $num;
     $sql = "SELECT commentid FROM comments";
     $num = mysql_numrows(mysql_query($sql));
     $commentstotal = $num;
     if ($newstotal == "1") {
         $a = "is";
         $b = "post";
     } else {
         $a = "are";
         $b = "posts";
     }
     if ($commentstotal == "1") {