Newbie Spellweaver
- Joined
- Jan 9, 2013
- Messages
- 71
- Reaction score
- 12
Hi There
Last week I decided to make a Habbo CMS with Node.js.
Why? Because I want to get to know node better (I just started trying it a week ago lel (But I do know javascript and PHP and a bit C# so don't worry))
This is what I have planned for the CMS
Technical plans
Here are some snippets (not really interesting or good).
class.core.js
class.users (far far far far far from finished)
It isn't a lot but it's a start yo.
I'm also looking for frontend developers because I am terrible at designing and CSS.
Also if people would like to help me with this project just send me a PM.
Feedback would be appreciated!
Last week I decided to make a Habbo CMS with Node.js.
Why? Because I want to get to know node better (I just started trying it a week ago lel (But I do know javascript and PHP and a bit C# so don't worry))
This is what I have planned for the CMS
- Default functionality (Login, Register, Client etc)
- Minimail
- Tags
- Homes
- Groups
- Custom Layout
- Application System (with questions)
- Housekeeping with a lot of functions
- Language System
- Maybe plugins
Technical plans
- Socket.IO
- Simple DDOS protection against request floods
- Support for Comet and Plus Database structure
- More things
Here are some snippets (not really interesting or good).
class.core.js
Code:
/*
* HabNode v1.0 -VIS000 2016
*/
var mysql = require('mysql2');
var config = require('./config');
var online = null;
var core = function() {
this.conn = null;
this.mysql = mysql;
this.construct = function(){
this.dbConnect();
},
this.dbConnect = function(){
this.conn = mysql.createConnection({
host: config.dbhost,
user: config.dbuser,
password: config.dbpass,
database: config.dbname
});
this.conn.connect();
};
this.getUsersOnline = function(){
console.log('SELECT * FROM server_status');
this.conn.prepare('SELECT * FROM server_status', function(err, statement){
if(err) {
console.log(err);
} else {
statement.execute([], function(err, rows, columns) {
if(err) {
online = 'Error';
} else {
online = rows[0].users_online;
}
});
}
});
return online;
};
};
module.exports = core;
Code:
/*
* HabNode v1.0 -VIS000
*/
var core = require('./class.core');
core = new core();
var time = Date.now || function() {
return +new Date;
};
var habbo = function() {
this.loginUser = function(username, password) {
core.conn.prepare('SELECT * FROM players WHERE password = ? and username = ?', function(err, statement){
if(err) {
console.log(err);
} else {
statement.execute([password, username], function(err, rows){
if(rows === undefined) {
return null;
} else {
return rows;
}
});
}
});
};
this.isBanned = function(username) {
core.conn.prepare('SELECT * FROM bans WHERE data = ?', function(err, statement){
if(err) {
console.log(err);
} else {
statement.execute([username], function(err, rows){
if(rows === undefined) {
return false;
} else {
return true;
}
});
}
});
};
this.addUser = function(username, password, email) {
core.conn.prepare('INSERT INTO users (username, password, email, motto, reg_timestamp, figure) VALUES (?, ?, ?, ?, ?, ?)', function(err, statement){
if(err) {
console.log(err);
} else {
statement.execute([username, password, email, 'Habnode v1.0', time(), ''], function(err){
if(err) {
console.log(err);
return false;
} else {
return true;
}
});
}
});
};
};
It isn't a lot but it's a start yo.
I'm also looking for frontend developers because I am terrible at designing and CSS.
Also if people would like to help me with this project just send me a PM.
Feedback would be appreciated!