Not sure if this is the best way to submit a news article.
Not sure if I should be using return() or not, mehPHP Code:function PostArticle($title,$message)
{
global $db,$userLoggedIn;
$db->sql_query("INSERT INTO articles (Title, Message, Author, TimeStamp)
VALUES ('".$db->sql_escape($title)."','".$db->sql_escape($message)."','".$db->sql_escape($userLoggedIn->username)."','".time()."')");
}
Works like a treat though, talan.x10.bz/housekeeping/post.article.php
When this CMS when complete?
When I can be arsed to finish it off, lol.
Couldn't be arsed having people messing withe the database so no-one is now rank 3.
A little help.. Sorry for indenting.PHP Code:function PostArticle($title,$message)
{
global $db,$userLoggedIn;
if($db->sql_query("INSERT INTO articles (Title, Message, Author, TimeStamp)
VALUES ('".$db->sql_escape($title)."','".$db->sql_escape($message)."','".$db->sql_escape($userLoggedIn->username)."','".time()."')"))
{ return true; }
return false;
}
if(!PostArticle('lol', 'test')) { echo 'Error making an article'; } else { 'Article has been made'; }
Wouldn't believe how bad I've been stressing on how to get my head around coding this "simple" -_- "extra".
Basically you can now edit your news articles. Looks abit dodgy, still working on the design, just getting the code out of the way. Planning to do the same with ban list, so you can unban a certain user.
Instead of having variables for all my posts, I've decided to delete the variables for the posts and just the $_POST[''] instead. Why am I doing this? Well basically it'll perform faster to operate, instead of using the variable to get the $_POST['']
Yhee 0.00000001 sec faster x.x
Posted via Mobile Device
TUNNY has a nice collection of images.. Index of /habbo/Housekeeping
![]()
Love the CMS already!
Do you want to release the code again from 'index.php'. I want to see it again.
That's a nice collection.
Update: You can remove a single ban from the ban lists and remove an article from the article list, lol.
Index ^PHP Code:<?php
define('SECURITY', true);
require_once("habboweb/templates/config.php");
if(getValidation()) { header("Location: ".ROOT."me"); die; }
if(!empty($_POST))
{
$errors = array();
if(($_POST["username"] == "") && ($_POST["password"] == ""))
{
$errors[] = "Please enter your username and password to log in.";
}
if(count($errors) == 0)
{
if(!usernameExists($_POST["username"]))
{
$errors[] = "Incorrect username or password.";
}
else
{
$result = getUser($_POST["username"]);
if($result["Rank"] < '1')
{
$errors[] = "You have been banned from accessing Habbo Hotel.";
}
else
{
$getPassword = getHash($_POST["password"],$result["Password"]);
if($getPassword != $result["Password"])
{
$errors[] = "Incorrect username or password.";
}
else
{
$userLoggedIn = new userLoggedIn();
$userLoggedIn->active = $result["Active"];
$userLoggedIn->background = $result["Background"];
$userLoggedIn->about = $result["About"];
$userLoggedIn->email = $result["Email"];
$userLoggedIn->password = $result["Password"];
$userLoggedIn->username = $result["Username"];
$userLoggedIn->id = $result["ID"];
$userLoggedIn->updateSignIn();
$_SESSION["User"] = $userLoggedIn;
header("Location: ".ROOT."me"); die;
}
}
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<!-- Designed and coded by Predict on forum.ragezone.com -->
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Design - Login</title>
<link rel="stylesheet" href="<?php echo ROOT; ?>habboweb/styles/login.css" type="text/css" />
</head>
<body>
<?php
if (!empty($_GET['reg']))
{
echo'<div id="header-notification"><li>'.$_GET["reg"].', thank you for registering with us, you can now login.</li></div>';
}
if(!empty($_POST) && count($errors) > 0)
{
?>
<div id="header-notification"><?php getError($errors); ?></div>
<?php } ?>
<div id="header-container">
<div id="header">
<div id="logo">
<b></b>
</div>
<div id="whitebox">
0 members online
</div>
<form action="" method="post">
<div id="login-form">
<div id="login-form-username">
<label class="login-text">Username</label>
<input type="text" name="username" id="login-username" maxlength="16" />
</div>
<div id="login-form-password">
<label class="login-text">Password</label>
<input type="password" name="password" id="login-password" maxlength="50" />
</div>
<div id="login-form-submit">
<input type="submit" value="Login" />
</div>
</div>
</form>
</div>
</div>
<div id="content-container">
<div id="content">
<div id="content-img-container">
<div id="content-img">
<a href="<?php echo ROOT; ?>register"></a>
</div>
</div>
Copyright Habbo Hotel 2011, All rights reserved go to their respective owner(s).
</div>
</div>
</body>
</html>