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