Satan
Professional Pornstar
- Aug 27, 2011
- 266
- 106
Hello, today I'll be introducing a new CMS which will have loads of features.
this project started like 20 minutes ago, don't rant about how it's barely done, I'm also looking for coders.
Overall Project Completion - 13%
Login - 100%
User System - 93%
MySQL Functions - 22%
Basic Template Layout - 5%
Admin CP/Management System - 0%
News System (Implemented) - 100%
To avoid spending more time on this thread, all other features are at 0%.
Feature List
- User System
- News System
- Sleek, colorful HTML Template design
- Easy to manage
- Easily customized
- Thread system
- Admin control panel
- Nodes
- Template System
- MUCH MORE.
Snippets (As Of Now).
Login Index:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<?php
// Inialize session
session_start();
// Check, if user is already login, then jump to secured page
if (isset($_SESSION['username'])) {
header('Location: securedpage.php');
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Login Page</title>
<link rel="shortcut icon" href="/favicon.ico">
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<form id="login-form" action="#" method="post">
<fieldset>
<legend>Log in</legend>
<label for="login">Email</label>
<input type="text" id="login" name="login"/>
<div class="clear"></div>
<label for="password">Password</label>
<input type="password" id="password" name="password"/>
<div class="clear"></div>
<label for="remember_me" style="padding: 0;">Remember me?</label>
<input type="checkbox" id="remember_me" style="position: relative; top: 3px; margin: 0; " name="remember_me"/>
<div class="clear"></div>
<br />
<input type="submit" style="margin: -20px 0 0 287px;" class="button" name="commit" value="Log in"/>
</fieldset>
</form>
<form method="POST" action="loginproc.php">
</body>
</html>
Loginproc.php
PHP:
<?php
// Inialize session
session_start();
// Include database connection settings
include('config.inc');
// Retrieve username and password from database according to user's input
$login = mysql_query("SELECT * FROM user WHERE (username = '" . mysql_real_escape_string($_POST['username']) . "') and (password = '" . mysql_real_escape_string(md5($_POST['password'])) . "')");
// Check username and password match
if (mysql_num_rows($login) == 1) {
// Set username session variable
$_SESSION['username'] = $_POST['username'];
// Jump to secured page
header('Location: securedpage.php');
}
else {
// Jump to login page
header('Location: index.html');
}
?>
Config.inc (For login)
PHP:
<?php
$hostname = 'localhost'; // Your MySQL hostname. Usualy named as 'localhost', so you're NOT necessary to change this even this script has already online on the internet.
$dbname = 'dbname'; // Your database name.
$username = 'root'; // Your database username.
$password = 'password'; // Your database password. If your database has no password, leave it empty.
// Let's connect to host
mysql_connect($hostname, $username, $password) or DIE('Connection to host is failed, perhaps the service is down!');
// Select the database
mysql_select_db($dbname) or DIE('Database name is not available!');
?>
Logout.php
Code:
<?php
// Inialize session
session_start();
// Delete certain session
unset($_SESSION['username']);
// Delete all session variables
// session_destroy();
// Jump to login page
header('Location: index.php');
?>
Style.css
Code:
{ margin: 0; padding: 0; }
body { font-family: Georgia, serif; background: url(images/login-page-bg.jpg) top center no-repeat #c4c4c4; color: #3a3a3a; }
.clear { clear: both; }
form { width: 406px; margin: 170px auto 0; }
legend { display: none; }
fieldset { border: 0; }
label { width: 115px; text-align: right; float: left; margin: 0 10px 0 0; padding: 9px 0 0 0; font-size: 16px; }
input { width: 220px; display: block; padding: 4px; margin: 0 0 10px 0; font-size: 18px;
color: #3a3a3a; font-family: Georgia, serif;}
input[type=checkbox]{ width: 20px; margin: 0; display: inline-block; }
.button { background: url(images/button-bg.png) repeat-x top center; border: 1px solid #999;
-moz-border-radius: 5px; padding: 5px; color: black; font-weight: bold;
-webkit-border-radius: 5px; font-size: 13px; width: 70px; }
.button:hover { background: white; color: black; }
Securedpage.php (Redirects to after login)
PHP:
<?php
// Inialize session
session_start();
// Check, if username session is NOT set then this page will jump to login page
if (!isset($_SESSION['username'])) {
header('Location: index.php');
}
?>
<html>
<head>
<title>Secured Page</title>
</head>
<body>
<p>This is secured page with session: <b><?php echo $_SESSION['username']; ?></b>
<br>You can put your restricted information here.</p>
<p><a href="logout.php">Logout</a></p>
</body>
</html>
Register.html (basic layout and sql excluded, being worked on.)
HTML:
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Register</title>
<link href='http://fonts.googleapis.com/css?family=Oswald:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div id="realbody"></div>
<!-- START WRAPPER -->
<div id="wrapper">
<a class="to-top">TOP</a>
<!-- START FIRST LEVEL -->
<div class="first-level">
<!-- start logo and welcome -->
<div class="left-side">
<!-- logo -->
<h1>Register<br /><span class="colored"></span></h1>
<p>
<b>First Name:</b> <input type="text" name="firstname"><br>
</p>
<b>Email Address:</b> <input type="text" name="email">
<p>
<b>Username:</b> <input type="text" name="username">
</p>
<p>
<b>Time Zone:</b> <input type="text" name="timezone">
</p>
</p>
create a news article (implemented).
PHP:
<?php
/*************************************************
* Micro News
* SatanCMS
* Version: 1.8
* Date Updated: 08-19-12
*
*
****************************************************/
if (!isset($_POST['submit'])) {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Micro News</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="js/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
});
</script>
</head>
<body>
<div id="main">
<div id="caption">Add News</div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
News title:<br/>
<input type="text" name="title" size="40"/><br/><br/>
Content:<br/>
<textarea name="newstext" rows="15" cols="67"></textarea><br/>
<center><input type="submit" name="submit" value="Save" /></center>
</form>
<div id="source">Micro News 1.0</div>
</div>
</body>
<?php } else {
$newsTitel = isset($_POST['title']) ? $_POST['title'] : 'Untitled';
$submitDate = date('Y-m-d g:i:s A');
$newsContent = isset($_POST['newstext']) ? $_POST['newstext'] : 'No content';
$filename = date('YmdHis');
$f = fopen('news/'.$filename.".txt","w+");
fwrite($f,$newsTitel."\n");
fwrite($f,$submitDate."\n");
fwrite($f,$newsContent."\n");
fclose($f);
header('Location:news.php');
}
?>
news.php (displays news).
PHP:
<?php
/*************************************************
* Micro News
* SatanCMS
****************************************************/
// This function reads all available news
function getNewsList(){
$fileList = array();
// Open the actual directory
if ($handle = opendir("news")) {
// Read all file from the actual directory
while ($file = readdir($handle)) {
if (!is_dir($file)) {
$fileList[] = $file;
}
}
}
rsort($fileList);
return $fileList;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Micro News</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="main">
<div id="caption">News</div>
<table width="100%">
<?php
$list = getNewsList();
foreach ($list as $value) {
$newsData = file("news/".$value);
$newsTitle = $newsData[0];
$submitDate = $newsData[1];
unset ($newsData['0']);
unset ($newsData['1']);
$newsContent = "";
foreach ($newsData as $value) {
$newsContent .= $value;
}
echo "<tr><th align='left'>$newsTitle</th><th align='right'>$submitDate</th></tr>";
echo "<tr><td colspan='2'>".$newsContent."<br/><hr size='1'/></td></tr>";
}
?>
</table>
<div id="source">Micro News 1.0</div>
</div>
</body>
config.php
PHP:
<?php
//main path to resources
$resources = dirname(__DIR__);
//$root = dirname(dirname(__DIR__));
$root = dirname($resources);
//configuration array to hold
//vital information
$config = array(
"db" => array(
"username" => null,
"password" => null,
"host" => null,
"database" => null
Screenshots
login index
root folder
That's it for now!
Remember: This thread is always updated and looking for coders!