Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Regarding News?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="GalaxyRetro" data-source="post: 355360" data-attributes="member: 11828"><p>class.forms.php</p><p>[PHP]<?php</p><p></p><p>namespace Revolution;</p><p>if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }</p><p>class forms implements iForms</p><p>{</p><p></p><p> public $error;</p><p></p><p> final public function setData()</p><p> {</p><p> global $engine;</p><p> foreach($_POST as $key => $value)</p><p> {</p><p> if($value != null)</p><p> {</p><p> $this->$key = $engine->secure($value);</p><p> }</p><p> else</p><p> {</p><p> $this->error = 'Please fill in all fields';</p><p> return;</p><p> }</p><p> }</p><p> </p><p> }</p><p> </p><p> final public function unsetData()</p><p> {</p><p> global $template;</p><p> foreach($this as $key => $value)</p><p> {</p><p> unset($this->$key); </p><p> } </p><p> }</p><p> </p><p> final public function writeData($key)</p><p> {</p><p> global $template;</p><p> echo $this->$key;</p><p> }</p><p> </p><p> final public function outputError()</p><p> {</p><p> global $template;</p><p> if(isset($this->error))</p><p> {</p><p> echo "<div id='message'> " . $this->error . " </div>";</p><p> }</p><p> }</p><p> </p><p> /* Manage different pages */</p><p> </p><p> final public function getPageNews()</p><p> {</p><p> global $template, $engine;</p><p> </p><p> if(!isset($_GET['id']) || !is_numeric($_GET['id']))</p><p> {</p><p> $_GET['id'] = 1;</p><p> }</p><p> $result = mysql_query("SELECT title, id FROM cms_news WHERE published ORDER BY id DESC");</p><p> </p><p> while($news1 = mysql_fetch_array($result))</p><p> {</p><p> $template->setParams('newsList', '<a href="/news/'.$news1["id"].'">' . $news1['title'] . '</a><br/>');</p><p> }</p><p> </p><p> $news = $engine->fetch_assoc("SELECT title, shortstory, longstory, author, published, author_id FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");</p><p> $template->setParams('newsTitle', $news['title']);</p><p> $template->setParams('newsContent', $news['longstory']);</p><p> $template->setParams('newsAuthor', $news['author']);</p><p> $template->setParams('newsDate', date("d-m-y", $news['published']));</p><p> $template->setParams('newsPreview', $news['shortstory']);</p><p> $template->SetParams('newsAuthorID', $news['author_id']);</p><p></p><p> </p><p> unset($result);</p><p> unset($news1);</p><p> unset($news);</p><p> }</p><p> </p><p> final public function getPageHome()</p><p> {</p><p> global $template, $engine;</p><p> $a = 1;</p><p> $data = mysql_query("SELECT title, id, published, shortstory, image FROM cms_news ORDER BY id DESC LIMIT 5");</p><p> </p><p> while($news = mysql_fetch_array($data, MYSQL_ASSOC))</p><p> {</p><p> $template->setParams('newsTitle-' . $a, $news['title']);</p><p> $template->setParams('newsID-' . $a, $news['id']);</p><p> $template->setParams('newsDate-' . $a, date("d-m-y", $news['published']));</p><p> $template->setParams('newsCaption-' . $a, $news['shortstory']);</p><p> $template->setParams('newsIMG-' . $a, $news['image']);</p><p> $a++;</p><p> }</p><p> </p><p> unset($news);</p><p> unset($data);</p><p> }</p><p> </p><p>}</p><p></p><p>?>[/PHP]</p><p>And yes, Rev!</p><p>[doublepost=1446567424,1446123439][/doublepost]still looking for help on this.</p></blockquote><p></p>
[QUOTE="GalaxyRetro, post: 355360, member: 11828"] class.forms.php [PHP]<?php namespace Revolution; if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); } class forms implements iForms { public $error; final public function setData() { global $engine; foreach($_POST as $key => $value) { if($value != null) { $this->$key = $engine->secure($value); } else { $this->error = 'Please fill in all fields'; return; } } } final public function unsetData() { global $template; foreach($this as $key => $value) { unset($this->$key); } } final public function writeData($key) { global $template; echo $this->$key; } final public function outputError() { global $template; if(isset($this->error)) { echo "<div id='message'> " . $this->error . " </div>"; } } /* Manage different pages */ final public function getPageNews() { global $template, $engine; if(!isset($_GET['id']) || !is_numeric($_GET['id'])) { $_GET['id'] = 1; } $result = mysql_query("SELECT title, id FROM cms_news WHERE published ORDER BY id DESC"); while($news1 = mysql_fetch_array($result)) { $template->setParams('newsList', '<a href="/news/'.$news1["id"].'">' . $news1['title'] . '</a><br/>'); } $news = $engine->fetch_assoc("SELECT title, shortstory, longstory, author, published, author_id FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1"); $template->setParams('newsTitle', $news['title']); $template->setParams('newsContent', $news['longstory']); $template->setParams('newsAuthor', $news['author']); $template->setParams('newsDate', date("d-m-y", $news['published'])); $template->setParams('newsPreview', $news['shortstory']); $template->SetParams('newsAuthorID', $news['author_id']); unset($result); unset($news1); unset($news); } final public function getPageHome() { global $template, $engine; $a = 1; $data = mysql_query("SELECT title, id, published, shortstory, image FROM cms_news ORDER BY id DESC LIMIT 5"); while($news = mysql_fetch_array($data, MYSQL_ASSOC)) { $template->setParams('newsTitle-' . $a, $news['title']); $template->setParams('newsID-' . $a, $news['id']); $template->setParams('newsDate-' . $a, date("d-m-y", $news['published'])); $template->setParams('newsCaption-' . $a, $news['shortstory']); $template->setParams('newsIMG-' . $a, $news['image']); $a++; } unset($news); unset($data); } } ?>[/PHP] And yes, Rev! [doublepost=1446567424,1446123439][/doublepost]still looking for help on this. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Regarding News?
Top