Baevus
the names ethan
- Nov 4, 2012
- 565
- 47
simpleCMS ~ A simple content management system!
What is simpleCMS?
A little / simple content management system created (put together) by me!
You will notice less noobyness & more credits by me!
What does simpleCMS have?
- Usersystem [100%] ~ Credits to; Me for variable fixes
and
- Database Structure [80%] ~ Credits to; Me for fixing up the users column and whole of news column
and
- User Panel [100%] ~ Credits to; Me for some BASIC (and I mean it) html fixes & separating files so its not all messy on 1 page.
and
- Theme [100%] ~ Credits to; Me & Sheldos (base design)
What does simpleCMS do?
It is more of a framework then a CMS but.. IT DOES ANYTHING!
You can covert it into a website for gaming or a theme for a habbo retro!
What will I be adding?
- Multi Themes
- An updated configuration!
Snippets?
What is simpleCMS?
A little / simple content management system created (put together) by me!
You will notice less noobyness & more credits by me!
What does simpleCMS have?
- Usersystem [100%] ~ Credits to; Me for variable fixes
and
You must be registered for see links
- Database Structure [80%] ~ Credits to; Me for fixing up the users column and whole of news column
and
You must be registered for see links
- User Panel [100%] ~ Credits to; Me for some BASIC (and I mean it) html fixes & separating files so its not all messy on 1 page.
and
You must be registered for see links
- Theme [100%] ~ Credits to; Me & Sheldos (base design)
What does simpleCMS do?
It is more of a framework then a CMS but.. IT DOES ANYTHING!
You can covert it into a website for gaming or a theme for a habbo retro!
What will I be adding?
- Multi Themes
- An updated configuration!
Snippets?
PHP:
<?php
define('INCLUDE_CHECK',true);
require 'connect.php';
require 'functions.php';
// Those two files can be included only if INCLUDE_CHECK is defined
session_name('Login');
// Starting the session
session_set_cookie_params(2*7*24*60*60);
// Making the cookie live for 2 weeks
session_start();
if($_SESSION['id'] && !isset($_COOKIE['Remember']) && !$_SESSION['rememberMe'])
{
// If you are logged in, but you don't have the Remember cookie (browser restart)
// and you have not checked the rememberMe checkbox:
$_SESSION = array();
session_destroy();
// Destroy the session
}
if(isset($_GET['logoff']))
{
$_SESSION = array();
session_destroy();
header("Location: index.php");
exit;
}
if($_POST['submit']=='Login')
{
// Checking whether the Login form has been submitted
$err = array();
// Will hold our errors
if(!$_POST['username'] || !$_POST['password'])
$err[] = 'All the fields must be filled in!';
if(!count($err))
{
$_POST['username'] = mysql_real_escape_string($_POST['username']);
$_POST['password'] = mysql_real_escape_string($_POST['password']);
$_POST['rememberMe'] = (int)$_POST['rememberMe'];
// Escaping all input data
$row = mysql_fetch_assoc(mysql_query("SELECT id,username FROM users WHERE username='{$_POST['username']}' AND password='".md5($_POST['password'])."'"));
if($row['username'])
{
// If everything is OK login
$_SESSION['username']=$row['username'];
$_SESSION['id'] = $row['id'];
$_SESSION['rememberMe'] = $_POST['rememberMe'];
// Store some data in the session
setcookie('Remember',$_POST['rememberMe']);
}
else $err[]='Wrong username and/or password!';
}
if($err)
$_SESSION['msg']['login-err'] = implode('<br />',$err);
// Save the error messages in the session
header("Location: index.php");
exit;
}
else if($_POST['submit']=='Register')
{
// If the Register form has been submitted
$err = array();
if(strlen($_POST['username'])<4 || strlen($_POST['username'])>32)
{
$err[]='Your username must be between 3 and 32 characters!';
}
if(preg_match('/[^a-z0-9\-\_\.]+/i',$_POST['username']))
{
$err[]='Your username contains invalid characters!';
}
if(!checkEmail($_POST['email']))
{
$err[]='Your email is not valid!';
}
if(!count($err))
{
// If there are no errors
$password = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6);
// Generate a random password
$_POST['email'] = mysql_real_escape_string($_POST['email']);
$_POST['username'] = mysql_real_escape_string($_POST['username']);
// Escape the input data
mysql_query(" INSERT INTO users(username,password,email,regIP,dt)
VALUES(
'".$_POST['username']."',
'".md5($password)."',
'".$_POST['email']."',
'".$_SERVER['REMOTE_ADDR']."',
NOW()
)");
if(mysql_affected_rows($link)==1)
{
send_mail( '',
$_POST['email'],
'simpleCMS ~ Your new password is!',
'Your password is: '.$password);
$_SESSION['msg']['reg-success']='Your account has been created! Check your email for a password!';
}
else $err[]='There was an error with your registration! Try a different username or password!';
}
if(count($err))
{
$_SESSION['msg']['reg-err'] = implode('<br />',$err);
}
header("Location: index.php");
exit;
}
$script = '';
if($_SESSION['msg'])
{
// The script below shows the sliding panel on page load
$script = '
<script type="text/javascript">
$(function(){
$("div#panel").show();
$("#toggle a").toggle();
});
</script>';
}
?>
Screenshots?
You must be registered for see images attach
You must be registered for see images attach
Credits have been placed in thread!
-itsEthan