FunCMS

Status
Not open for further replies.
Junior Spellweaver
Joined
May 5, 2012
Messages
110
Reaction score
10
Hi Ragezone,

Welcome to the development of my CMS called : FunCMS
It's going to be completely coded in PHP.

It's going to have my own design.

I already made the index and register.
The login and register system does already work.

Here are some screens:
KevinZuiker - FunCMS - RaGEZONE Forums

KevinZuiker - FunCMS - RaGEZONE Forums


Here are some snippets:
PHP:
?php

session_start();

if($_SERVER['REQUEST_METHOD'] == 'POST') {

$gebruikersnaam = mysql_real_escape_string($_POST['gebruikersnaam']); 
$wachtwoord = sha1(mysql_real_escape_string($_POST['wachtwoord']));

$sql="SELECT * FROM users WHERE username='$gebruikersnaam' and password='$wachtwoord'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);

if($count==1){
header("location: ingelogd.php");
$_SESSION['ingelogd'] = 1;
$_SESSION['gebruikersnaam'] = $gebruikersnaam;

}else{
echo "Je naam of wachtwoord klopt niet!";


}
	}
PHP:
<?php
if(isset($_POST['gebruikersnaam'])) {
	if(isset($_POST['wachtwoord'])) {
		if(isset($_POST['wachtwoord-opnieuw'])) {
			if(strlen($_POST['gebruikersnaam']) > 1) {
				if(strlen($_POST['wachtwoord']) > 5) {
					if($_POST['wachtwoord'] == $_POST['wachtwoord-opnieuw']){
						if($count == 0) {

							$query = mysql_query("INSERT INTO users(username, password) VALUES ('$gebruikersnaam', '$wachtwoord')");
							$_SESSION['ingelogd'] = 1;
							$_SESSION['gebruikersnaam'] = $gebruikersnaam;
							header('Location: ingelogd.php');
							
						}else{
							echo "Je naam is al in gebruik <br>";
						}}else{
							echo "Je wachtwoorden zijn niet hetzelfde <br>";
						}}else{ 
							echo "Je wachtwoord moet minstens 6 tekens bevatten <br>";
						}}else{
							echo "Je gebruikersnaam moet minstens 2 tekens bevatten <br>";
						}}else{
							echo "Je hebt je wachtwoord niet 2 keer ingevuld <br>";
						}}else{
							echo "Je hebt geen wachtwoord ingevuld<br>";
						}}else{
							echo "Je hebt geen gebruikersnaam ingevuld<br>";
						}} ?>

I hope you guys like my development. If you have any idea's or way's to improve my code, please contact me:
[email protected] (Skype & E-mail).
 
Maybe this can help you out kevin i use this in my old cms's
- MySQLi STMT Library good luck with your dev.
 
What can I use instead?
Have a look at the first awnser

Your if statements might work right. But for another persons eye it could be spageti.

Nested if statements makes your source messy and unreadable. Even more with your coding style.


Personally i put a enter behind if statments so you get this:

Code:
if (condition)
{
}

The same with functions, classes, foreach and whatever more.
 
Thanks for helping me guys. I apreciate it. And at nobrain: Why don't you like the design? I want to improve everything until it's finally good enough.
 
Thanks for helping me guys. I apreciate it. And at nobrain: Why don't you like the design? I want to improve everything until it's finally good enough.

It's mainly the box designs. Maybe you could redesign the site and get some inspiration from ThemeForest or people that have released designs here on Ragezone.
 
Just to show you how else you can do the if statemens.

PHP:
<?php
	
	if (!isset($_POST['gebruikersnaam'], $_POST['wachtwoord'], $_POST['wachtwoord-opnieuw']))
	{
  echo 'Niet alle velden zijn ingevuld <br>';
	}
	else if (strlen($_POST['gebruikersnaam']) < 3)
	{
  echo 'Je gebruikersnaam moet minstens 2 tekens bevatten <br>';
	}
	else if (strlen($_POST['wachtwoord']) < 6)
	{
  echo 'Je wachtwoord moet minstens 6 tekens bevatten <br>';
	}
	else if ($_POST['wachtwoord'] != $_POST['wachtwoord-opnieuw'])
	{
  echo 'Je wachtwoorden zijn niet hetzelfde <br>'
	}
	else if ($count != 0)
	{
  echo 'Je naam is al in gebruik <br>';
	}
	else
	{
  $query = mysql_query("INSERT INTO users(username, password) VALUES ('$gebruikersnaam', '$wachtwoord')"); 
  $_SESSION['ingelogd'] = 1; 
  $_SESSION['gebruikersnaam'] = $gebruikersnaam; 
  header('Location: ingelogd.php'); 
	}
	
?>
 
Status
Not open for further replies.
Back