[Rev] Unable to post news articles

Status
Not open for further replies.

TheJoshy

PlusHost.org -> GOGOGO
Jul 4, 2010
287
56
Hi there,

After attempting to post an article, and selecting the image... this happens:

My cms_news table:

Thanks.

EDIT:

/app/tpl/skins/Habbo/hk/news.php
Code:
  <div id="main">
    <div id="links"></div>
    <div id="header">
      <div id="logo">
        <div id="logo_text">
          <!-- class="logo_colour", allows you to change the color of the logo text -->
          <h1>ASE</h1>
        </div>
      </div>
    </div>
    <div id="site_content">
      <div id="sidebar_container">
        <!-- insert your sidebar items here -->
        <div class="sidebar">
          <div class="sidebar_top"></div>
          <div class="sidebar_item">
          <br />
  [ <a href='dash'>Return to Dashboard</a> ] [ <a href='logout.php'>Log out</a> ]<br /> <br />
            <p>
<?php if(mysql_result(mysql_query("SELECT rank FROM users WHERE id = '" . $_SESSION['user']['id'] . "'"), 0) >= 7)
{ ?>
Player Management <br /> <img src='../app/tpl/skins/<?php echo $_CONFIG['template']['style']; ?>/hk/images/line.png'> <br />
&raquo; <a href='sub'>Last 50 VIP purchases</a> <br />
&raquo; <a href='vip'>Give a user Regular VIP</a> <br />
&raquo; <a href='svip'>Give a user Super VIP</a> <br />
&raquo; <a href='edit'>Edit a users account</a> <br />
<br />
Administration <br /> <img src='../app/tpl/skins/<?php echo $_CONFIG['template']['style']; ?>/hk/images/line.png'> <br />
&raquo; <a href='news'>Post news article</a><br />
<br />
<?php } if(mysql_result(mysql_query("SELECT rank FROM users WHERE id = '" . $_SESSION['user']['id'] . "'"), 0) >= 5) { ?>
Moderation <br /> <img src='../app/tpl/skins/<?php echo $_CONFIG['template']['style']; ?>/hk/images/line.png'> <br />
&raquo; <a href='banlist'>Ban List</a> <br />
&raquo; <a href='ip'>IP lookup</a> <br />
<br />
 
<?php } ?>
<br />
Statistics<br />
<img src='../app/tpl/skins/<?php echo $_CONFIG['template']['style']; ?>/hk/images/line.png'> <br />
Server Status:
{status} <br />
{online} user(s) online <br />
 
</p>
          </div>
          <div class="sidebar_base"></div>
        </div>
      </div>
      <div id="content_container">
 
        <div id="content">
          <!-- insert the page content here -->
          <br />       
        <?php
 
if(mysql_result(mysql_query("SELECT rank FROM users WHERE id = '" . $_SESSION['user']['id'] . "'"), 0) >= 7)
{
if(isset($_GET["done"]))
{
$get = filter($_GET["done"]);
if($get == true)
{
echo '<h3>Article posted.</h3>';
exit;
}
}
if(isset($_POST["step1"]))
{
if($_POST["title"] == NULL || $_POST["shortstory"] == NULL || $_POST["longstory"] == NULL)
{
echo "<h2>Please fill in all the fields!</h2>";
}
else
{
$_SESSION["title"] = filter($_POST["title"]);
$_SESSION["shortstory"] = filter($_POST["shortstory"]);
$_SESSION["longstory"] = mysql_real_escape_string($_POST["longstory"]);
 
header("Location: ".$_CONFIG['hotel']['url']."/ase/news2");
exit;
}
 
}
else
{ ?>
 
<script type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
tinyMCE.init({
          mode : "textareas",
          theme : "simple",
          editor_selector : "mceEditor",
          editor_deselector : "mceNoEditor"
});
</script>
 
<form method="post">
Title of the news article <br />
<input type="text" name="title"/> <br /> <br />
Short story <br />
<input type="text" name="shortstory"/> <br /> <br />
Main story <br />
<textarea id="content1" name="longstory"  cols="85" rows="10" class="mceEditor"></textarea>
<br /> <br /> <input type="submit" value="  Proceed to next step (Image chooser)  " name="step1" />
</form>
<?php
}
}
 
?>

/app/tpl/skins/Habbo/hk/news2.php
Code:
  <div id="main">
    <div id="links"></div>
    <div id="header">
      <div id="logo">
        <div id="logo_text">
          <!-- class="logo_colour", allows you to change the color of the logo text -->
          <h1>ASE</h1>
        </div>
      </div>
    </div>
    <div id="site_content">
      <div id="sidebar_container">
        <!-- insert your sidebar items here -->
        <div class="sidebar">
          <div class="sidebar_top"></div>
          <div class="sidebar_item">
          <br />
  [ <a href='dash'>Return to Dashboard</a> ] [ <a href='logout.php'>Log out</a> ]<br /> <br />
            <p>
<?php if(mysql_result(mysql_query("SELECT rank FROM users WHERE id = '" . $_SESSION['user']['id'] . "'"), 0) >= 7)
{ ?>
Player Management <br /> <img src='../app/tpl/skins/<?php echo $_CONFIG['template']['style']; ?>/hk/images/line.png'> <br />
&raquo; <a href='sub'>Last 50 VIP purchases</a> <br />
&raquo; <a href='vip'>Give a user Regular VIP</a> <br />
&raquo; <a href='svip'>Give a user Super VIP</a> <br />
&raquo; <a href='edit'>Edit a users account</a> <br />
<br />
Administration <br /> <img src='../app/tpl/skins/<?php echo $_CONFIG['template']['style']; ?>/hk/images/line.png'> <br />
&raquo; <a href='news'>Post news article</a><br />
<br />
<?php } if(mysql_result(mysql_query("SELECT rank FROM users WHERE id = '" . $_SESSION['user']['id'] . "'"), 0) >= 5) { ?>
Moderation <br /> <img src='../app/tpl/skins/<?php echo $_CONFIG['template']['style']; ?>/hk/images/line.png'> <br />
&raquo; <a href='banlist'>Ban List</a> <br />
&raquo; <a href='ip'>IP lookup</a> <br />
<br />
 
<?php } ?>
<br />
Statistics<br />
<img src='../app/tpl/skins/<?php echo $_CONFIG['template']['style']; ?>/hk/images/line.png'> <br />
Server Status:
{status} <br />
{online} user(s) online <br />
 
</p>
          </div>
          <div class="sidebar_base"></div>
        </div>
      </div>
      <div id="content_container">
 
        <div id="content">
          <!-- insert the page content here -->
          <br />       
<?php
 
if(!isset($_SESSION["longstory"]))
{
header("Location: ".$_CONFIG['hotel']['url']."/ase/news");
exit;
}
 
if(isset($_POST["proceed"]))
{
$author = mysql_result(mysql_query("SELECT username FROM users WHERE id = '".$_SESSION['user']['id']."' LIMIT 1"), 0);
mysql_query("INSERT INTO cms_news (title,shortstory,longstory,published,image) VALUES ('" . filter($_SESSION["title"]) . "', '" . filter($_SESSION["shortstory"]) . "', '" . filter($_SESSION["longstory"]) . "', '" . time() . "', '" . filter($_POST["topstory"]) . "', '" . filter($author) . "')") or die(mysql_error());
unset($_SESSION["title"], $_SESSION["shortstory"], $_SESSION["longstory"]);
header("Location: ".$_CONFIG['hotel']['url']."/ase/");
exit;
}
echo '<center><b>It\'s time to choose the image for your story. Choose one from the drop down list and click "Check Image"';
echo '<form method="post">';
echo '<br />';
echo '<select name="topstory" id="topstory" style="font-size: 14px;"';
 
if ($handle = opendir('ts/'))
{
while (false !== ($file = readdir($handle)))
{
if ($file == '.' || $file == '..')
{
continue;
}
 
echo '<option value="' . $file . '"';
 
if (isset($_POST['topstory']) && $_POST['topstory'] == $file)
{
echo ' selected';
}
 
echo '>' . $file . '</option>';
}
}
 
echo '</select>';
 
if(isset($_POST["check"]))
{
echo '<br /> <br /> <input type="submit" value="  Check image  " name="check" /> <br /><br />';
echo '<font size="3">Topstory image<br /></font><img src="ts/' . $_POST["topstory"] . '" align="right />';
echo '</center> <align="right"> <br /> <br /> <input type="submit" value="  Proceed (use image)  " name="proceed" /> <br />';
echo '</form>';
}
else
{
echo '<br /> <br /> <input type="submit" value="  Check image  " name="check" /> <br />';
echo "</form>";
}
 
?>
 

Ink

Member
Jun 4, 2010
61
11
Can you post snippets of news.php and news2.php also, I personally would change where it says text on author to varchar(50) just a suggestion.
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,132
2,456
Run this query:

Code:
DROP TABLE IF EXISTS `cms_news`;
CREATE TABLE `cms_news` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `shortstory` text COLLATE latin1_general_ci,
  `longstory` text COLLATE latin1_general_ci,
  `published` int(10) NOT NULL DEFAULT '0',
  `image` varchar(255) COLLATE latin1_general_ci DEFAULT '/Public/Images/news/TS_Web60.png',
  `campaign` int(1) NOT NULL DEFAULT '0',
  `campaignimg` varchar(255) COLLATE latin1_general_ci NOT NULL,
  `author` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
 

TheJoshy

PlusHost.org -> GOGOGO
Jul 4, 2010
287
56
Can you post snippets of news.php and news2.php also, I personally would change where it says text on author to varchar(50) just a suggestion.
I've updated thread with the files.
Run this query:

Code:
DROP TABLE IF EXISTS `cms_news`;
CREATE TABLE `cms_news` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `shortstory` text COLLATE latin1_general_ci,
  `longstory` text COLLATE latin1_general_ci,
  `published` int(10) NOT NULL DEFAULT '0',
  `image` varchar(255) COLLATE latin1_general_ci DEFAULT '/Public/Images/news/TS_Web60.png',
  `campaign` int(1) NOT NULL DEFAULT '0',
  `campaignimg` varchar(255) COLLATE latin1_general_ci NOT NULL,
  `author` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
Thanks, I just tried this but it hasn't fixed the issue.
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,195
3,906
I'm dying no sleep but it says it column count doesn't match check the query the values.
 
Status
Not open for further replies.

Users who are viewing this thread

Top