[REL] LightCMS 2 [MySQLi, PHP, OOP, Scratch, Phx, Bfly]

Status
Not open for further replies.

Clit

Posting Freak
Feb 25, 2012
1,065
103
Open register.php and find
PHP:
$users->addUser($user_name, $user_password, $user_email, $light->default_rank, $light->default_motto, $light->default_gender, $light->default_motto, $light->default_homeroom);

Replace it with

PHP:
$users->addUser($user_name, $user_password, $user_email, $light->default_rank, $light->default_motto, $light->default_gender, $light->default_motto, $light->default_homeroom) or $db->databaseError($db->error);
LightCMS MySQLi Engine Error
 

Jonty

Active Member
Aug 7, 2010
194
65
BUG FOUND!
I have found the issue with the register. Let me fix my copy and i'll give you the fix.
 

Jonty

Active Member
Aug 7, 2010
194
65
Getting LightCMS MySQLi Engine Error all over the website now. Reload after Reload :/ 

... 

Even with that change, nothing in database.

:(

Do you have the points column in the users table?

FIX FOR REGISTER.PHP
PHP:
<?php
 
require_once "required.php";
 
if($users->isLogged()) {
header ("Location: " . WWW . "/me");
}
else if(!$light->reg_enabled) {
header ("Location: " . WWW . "/index.php?registerDisabled");
}
else if(isset($_GET["_error"])) {
$gerr = $db->real_escape_string($_GET["_error"]);
$err = str_replace('-', ' ', $gerr);
$tpl->assign('errorSpace', '<div id="error-messages-container" class="cbb">
          <div class="rounded" style="background-color: #cb2121;">
             <div id="error-title" class="error">
                 ' . $err . ' <br />
</div>
 </div>
 </div>');
}
else {
$tpl->assign('errorSpace', '<div id="error-placeholder"></div>');
}
 
if($db->lnumrows("SELECT null FROM users WHERE ip_last = '" . $_SERVER["REMOTE_ADDR"] . "' OR ip_reg = '" . $_SERVER["REMOTE_ADDR"] . "'") >= $light->max_per_ip) {
header ("Location: " . WWW . "/index.php?maxAccountsReached");
}
 
$tpl->assign('title', 'Register an account');
 
if(isset($_GET["_register_step"])) {
$s = $db->real_escape_string($_GET["_register_step"]);
if($s == 1) {// Birth date, gender
$tpl->draw('quickregister-step1');
}
else if($s == 2) { // age_gate_submit - verify birthdate and gender
if(isset($_POST["bean_month"]) && isset($_POST["bean_day"]) && isset($_POST["bean_year"]) && isset($_POST["bean_gender"])) {
$m = $db->real_escape_string($_POST["bean_month"]);
$d = $db->real_escape_string($_POST["bean_day"]);
$y = $db->real_escape_string($_POST["bean_year"]);
$g = $db->real_escape_string($_POST["bean_gender"]);
 
$_SESSION["_ageGatePass"] = true;
$_SESSION["_userAge"] = $d . "/" . $m . "/" . $y;
$_SESSION["_userGender"] = $g;
header ("Location: " . WWW . "/quickregister/email_password");
}
}
else if($s == 3) { // email_password - get their email and their password for future logins
if(!isset($_SESSION["_ageGatePass"]) || !isset($_SESSION["_userAge"]) || !isset($_SESSION["_userGender"])) {
header ("Location: " . WWW . "/quickregister/age_gate/error");
}
else {
$tpl->draw('quickregister-step2');
}
}
else if($s == 4) { // email_password_submit
if(isset($_POST["bean_username"]) && isset($_POST["bean_email"]) && isset($_POST["bean_retypedEmail"]) && isset($_POST["bean_password"]) && isset($_POST["bean_termsOfServiceSelection"])) {
$u1 = $db->real_escape_string($_POST["bean_username"]);
$u = $users->forceFormat($u1);
$e = $db->real_escape_string($_POST["bean_email"]);
$e2 = $db->real_escape_string($_POST["bean_retypedEmail"]);
$pwlen = strlen($_POST["bean_password"]);
$p =$users->userHash($_POST["bean_password"], $u);
$t = $db->real_escape_string($_POST["bean_termsOfServiceSelection"]);
if(!$users->isUsernameValid($u)) {
header("Location: " . WWW . "/quickregister/email_password_submit/invalid_username");
}
else {
if($e == $e2 && $users->isEmailValid($e)) {
if($pwlen >= 6) {
$_SESSION["_captcha"] = rand(1,9) . rand(1,9) . rand(1,9) . rand(1,9);
$_SESSION["_emailGatePass"] = true;
$_SESSION["_userEmail"] = $e;
$_SESSION["_userPassword"] = $p;
$_SESSION["_userName"] = $u;
header("Location: " . WWW . "/quickregister/captcha");
}
else {
header("Location: " . WWW . "/quickregister/email_password_submit/invalid_password");
}
}
else {
header("Location: " . WWW . "/quickregister/email_password_submit/invalid_email");
}
}
}
else {
header ("Location: " . WWW . "/quickregister/email_password_submit/fields");
}
}
else if($s == 5) {
if(!isset($_SESSION["_emailGatePass"])) { header ("Location: " . WWW . "/quickregister/start"); }
$_SESSION["_captcha"] = rand(1,9) . rand(1,9) . rand(1,9) . rand(1,9) . rand(1,9);
$tpl->assign('captcha', '<font color="white" size="6">' . $_SESSION["_captcha"] . '</font>');
$tpl->draw('quickregister-step3');
}
else if($s == 6) {
if(isset($_POST["captchaResponse"])) {
$r = $_POST["captchaResponse"];
$rc = $_SESSION["_captcha"];
 
if($r == $rc)
{
// Lets recap all the user vars we need, add the user and then unset everything.
$user_age = $_SESSION["_userAge"];
$user_name = $_SESSION["_userName"];
$user_gender = $_SESSION["_userGender"];
$user_email = $_SESSION["_userEmail"];
$user_password = $_SESSION["_userPassword"];
$user_signupip = $_SERVER["REMOTE_ADDR"];
 
$users->addUser($user_name, $user_password, $user_email, $light->default_rank, $light->default_look, $light->default_gender, $light->default_motto, $light->default_homeroom);
 
unset($user_age);
unset($user_gender);
unset($user_email);
unset($user_betakey);
unset($_SESSION["_captcha"]);
unset($_SESSION["_emailGatePass"]);
unset($_SESSION["_ageGatePass"]);
 
$_SESSION["Username"] = $user_name;
unset($user_name);
 
$_SESSION["HashedPassword"] = $user_password;
unset($user_password);
 
header ("Location: " . WWW . "/me");
}
else {
header ("Location: " . WWW . "/quickregister/captcha/error");
}
}
}
else {
header("Location: " . WWW . "/quickregister/captcha");
}
}
?>

It was inserting a wrong value into the look column and because of that the rest of the vars were broken. This fixed it for me anyway.
 

Evian

Helping noobs since 1996
Feb 17, 2012
139
38
Any screenies of the HK Jonty?

Off topic: Y U NO REPLY TO MY FB. I wanted to buy a VPS ahha.
 

Jonty

Active Member
Aug 7, 2010
194
65
Any screenies of the HK Jonty?

Off topic: Y U NO REPLY TO MY FB. I wanted to buy a VPS ahha.

No screenies of HK, haha. I cba logging in, i'd rather keep coding. and I dont use my FB much, my real one got banned so I don't remember to go on anymore
 

AlexFallen

Developer
Jul 19, 2011
490
64
Do you have the points column in the users table?

FIX FOR REGISTER.PHP
PHP:
<?php
 
require_once "required.php";
 
if($users->isLogged()) {
header ("Location: " . WWW . "/me");
}
else if(!$light->reg_enabled) {
header ("Location: " . WWW . "/index.php?registerDisabled");
}
else if(isset($_GET["_error"])) {
$gerr = $db->real_escape_string($_GET["_error"]);
$err = str_replace('-', ' ', $gerr);
$tpl->assign('errorSpace', '<div id="error-messages-container" class="cbb">
          <div class="rounded" style="background-color: #cb2121;">
            <div id="error-title" class="error">
                ' . $err . ' <br />
</div>
</div>
</div>');
}
else {
$tpl->assign('errorSpace', '<div id="error-placeholder"></div>');
}
 
if($db->lnumrows("SELECT null FROM users WHERE ip_last = '" . $_SERVER["REMOTE_ADDR"] . "' OR ip_reg = '" . $_SERVER["REMOTE_ADDR"] . "'") >= $light->max_per_ip) {
header ("Location: " . WWW . "/index.php?maxAccountsReached");
}
 
$tpl->assign('title', 'Register an account');
 
if(isset($_GET["_register_step"])) {
$s = $db->real_escape_string($_GET["_register_step"]);
if($s == 1) {// Birth date, gender
$tpl->draw('quickregister-step1');
}
else if($s == 2) { // age_gate_submit - verify birthdate and gender
if(isset($_POST["bean_month"]) && isset($_POST["bean_day"]) && isset($_POST["bean_year"]) && isset($_POST["bean_gender"])) {
$m = $db->real_escape_string($_POST["bean_month"]);
$d = $db->real_escape_string($_POST["bean_day"]);
$y = $db->real_escape_string($_POST["bean_year"]);
$g = $db->real_escape_string($_POST["bean_gender"]);
 
$_SESSION["_ageGatePass"] = true;
$_SESSION["_userAge"] = $d . "/" . $m . "/" . $y;
$_SESSION["_userGender"] = $g;
header ("Location: " . WWW . "/quickregister/email_password");
}
}
else if($s == 3) { // email_password - get their email and their password for future logins
if(!isset($_SESSION["_ageGatePass"]) || !isset($_SESSION["_userAge"]) || !isset($_SESSION["_userGender"])) {
header ("Location: " . WWW . "/quickregister/age_gate/error");
}
else {
$tpl->draw('quickregister-step2');
}
}
else if($s == 4) { // email_password_submit
if(isset($_POST["bean_username"]) && isset($_POST["bean_email"]) && isset($_POST["bean_retypedEmail"]) && isset($_POST["bean_password"]) && isset($_POST["bean_termsOfServiceSelection"])) {
$u1 = $db->real_escape_string($_POST["bean_username"]);
$u = $users->forceFormat($u1);
$e = $db->real_escape_string($_POST["bean_email"]);
$e2 = $db->real_escape_string($_POST["bean_retypedEmail"]);
$pwlen = strlen($_POST["bean_password"]);
$p =$users->userHash($_POST["bean_password"], $u);
$t = $db->real_escape_string($_POST["bean_termsOfServiceSelection"]);
if(!$users->isUsernameValid($u)) {
header("Location: " . WWW . "/quickregister/email_password_submit/invalid_username");
}
else {
if($e == $e2 && $users->isEmailValid($e)) {
if($pwlen >= 6) {
$_SESSION["_captcha"] = rand(1,9) . rand(1,9) . rand(1,9) . rand(1,9);
$_SESSION["_emailGatePass"] = true;
$_SESSION["_userEmail"] = $e;
$_SESSION["_userPassword"] = $p;
$_SESSION["_userName"] = $u;
header("Location: " . WWW . "/quickregister/captcha");
}
else {
header("Location: " . WWW . "/quickregister/email_password_submit/invalid_password");
}
}
else {
header("Location: " . WWW . "/quickregister/email_password_submit/invalid_email");
}
}
}
else {
header ("Location: " . WWW . "/quickregister/email_password_submit/fields");
}
}
else if($s == 5) {
if(!isset($_SESSION["_emailGatePass"])) { header ("Location: " . WWW . "/quickregister/start"); }
$_SESSION["_captcha"] = rand(1,9) . rand(1,9) . rand(1,9) . rand(1,9) . rand(1,9);
$tpl->assign('captcha', '<font color="white" size="6">' . $_SESSION["_captcha"] . '</font>');
$tpl->draw('quickregister-step3');
}
else if($s == 6) {
if(isset($_POST["captchaResponse"])) {
$r = $_POST["captchaResponse"];
$rc = $_SESSION["_captcha"];
 
if($r == $rc)
{
// Lets recap all the user vars we need, add the user and then unset everything.
$user_age = $_SESSION["_userAge"];
$user_name = $_SESSION["_userName"];
$user_gender = $_SESSION["_userGender"];
$user_email = $_SESSION["_userEmail"];
$user_password = $_SESSION["_userPassword"];
$user_signupip = $_SERVER["REMOTE_ADDR"];
 
$users->addUser($user_name, $user_password, $user_email, $light->default_rank, $light->default_look, $light->default_gender, $light->default_motto, $light->default_homeroom);
 
unset($user_age);
unset($user_gender);
unset($user_email);
unset($user_betakey);
unset($_SESSION["_captcha"]);
unset($_SESSION["_emailGatePass"]);
unset($_SESSION["_ageGatePass"]);
 
$_SESSION["Username"] = $user_name;
unset($user_name);
 
$_SESSION["HashedPassword"] = $user_password;
unset($user_password);
 
header ("Location: " . WWW . "/me");
}
else {
header ("Location: " . WWW . "/quickregister/captcha/error");
}
}
}
else {
header("Location: " . WWW . "/quickregister/captcha");
}
}
?>

It was inserting a wrong value into the look column and because of that the rest of the vars were broken. This fixed it for me anyway.
Still didn't work... Still shows no new users in database.
 

Evian

Helping noobs since 1996
Feb 17, 2012
139
38
on: Ah you lazy fucker.

off: Ah you fail (n) you selling VPS's? Ever get the web setup? + Got Twitter ;3?

Edit:

Still didn't work... Still shows no new users in database.
Maybe you have no users ;o?
 

Jonty

Active Member
Aug 7, 2010
194
65
Still didn't work... Still shows no new users in database.

Code:
/*
Navicat MySQL Data Transfer
 
Source Server         : Zap Hotel
Source Server Version : 50525
Source Host           : 192.168.0.2:3306
Source Database       : zaphotel
 
Target Server Type    : MYSQL
Target Server Version : 50525
File Encoding         : 65001
 
Date: 2012-08-11 08:24:39
*/
 
SET FOREIGN_KEY_CHECKS=0;
 
-- ----------------------------
-- Table structure for `users_struc`
-- ----------------------------
DROP TABLE IF EXISTS `users_struc`;
CREATE TABLE `users_struc` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `real_name` varchar(100) NOT NULL DEFAULT '',
  `password` varchar(50) NOT NULL,
  `mail` varchar(50) NOT NULL DEFAULT '[email protected]',
  `auth_ticket` text NOT NULL,
  `rank` int(11) unsigned NOT NULL DEFAULT '1',
  `credits` int(11) NOT NULL DEFAULT '25000',
  `vip_points` int(11) NOT NULL DEFAULT '0',
  `activity_points` int(11) NOT NULL DEFAULT '0',
  `activity_points_lastupdate` double NOT NULL DEFAULT '0',
  `look` varchar(500) NOT NULL DEFAULT 'hr-115-42.hd-190-1.ch-215-62.lg-285-91.sh-290-62',
  `gender` enum('M','F') NOT NULL DEFAULT 'M',
  `motto` varchar(50) NOT NULL DEFAULT 'Zap Newbie',
  `about` varchar(1000) DEFAULT NULL,
  `account_created` varchar(50) NOT NULL DEFAULT 'NULL',
  `last_online` varchar(50) NOT NULL DEFAULT 'Never',
  `online` enum('0','1') NOT NULL DEFAULT '0',
  `ip_last` varchar(120) NOT NULL,
  `ip_reg` varchar(120) NOT NULL,
  `home_room` int(10) unsigned NOT NULL DEFAULT '0',
  `respect` int(11) NOT NULL DEFAULT '0',
  `daily_respect_points` int(11) NOT NULL DEFAULT '5',
  `daily_pet_respect_points` int(11) NOT NULL DEFAULT '5',
  `newbie_status` int(11) NOT NULL DEFAULT '0',
  `is_muted` enum('0','1') NOT NULL DEFAULT '0',
  `mutant_penalty` enum('0','1','2') NOT NULL DEFAULT '0',
  `mutant_penalty_expire` int(11) NOT NULL DEFAULT '0',
  `block_newfriends` enum('0','1') NOT NULL DEFAULT '0',
  `hide_online` enum('0','1') NOT NULL DEFAULT '0',
  `hide_video` enum('0','1') NOT NULL DEFAULT '1',
  `hide_inroom` enum('0','1') NOT NULL DEFAULT '0',
  `vip` enum('0','1') NOT NULL DEFAULT '0',
  `mail_verified` varchar(6) NOT NULL DEFAULT 'true',
  `expert` varchar(1) NOT NULL,
  `points` int(3) NOT NULL DEFAULT '1',
  `temp` int(1) NOT NULL DEFAULT '0',
  `forumname` varchar(30) NOT NULL DEFAULT 'NewUser',
  `mod_leader` varchar(2) NOT NULL DEFAULT '0',
  `adm_leader` varchar(2) NOT NULL DEFAULT '0',
  `founder` varchar(1) NOT NULL DEFAULT '0',
  `c_h` int(1) NOT NULL DEFAULT '0',
  `volume` int(3) NOT NULL DEFAULT '100',
  `logged_today` varchar(30) DEFAULT '0',
  `has_voted` varchar(30) NOT NULL DEFAULT '0',
  `newcrypto` varchar(30) NOT NULL DEFAULT '0',
  `lastdailycredits` char(18) NOT NULL DEFAULT '0',
  `currentquestid` int(11) NOT NULL DEFAULT '0',
  `currentquestprogress` int(11) NOT NULL DEFAULT '0',
  `achievement_points` int(11) NOT NULL DEFAULT '0',
  `last_offline` varchar(50) DEFAULT '0',
  `crystals` int(11) NOT NULL DEFAULT '0',
  `block_trade` varchar(30) NOT NULL DEFAULT '0',
  `trial_admin` enum('0','1') NOT NULL DEFAULT '0',
  `playermod` enum('0','1') NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`) USING BTREE,
  KEY `rank` (`rank`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=575456 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
 
-- ----------------------------
-- Records of users_struc
-- ----------------------------
Here is my structure as it is on Zap Hotel.
 

AlexFallen

Developer
Jul 19, 2011
490
64
Edit:


Maybe you have no users ;o?
LOL No I just signed up for my hotel again, and still didn't show my user. 
Code:
/*
Navicat MySQL Data Transfer
 
Source Server        : Zap Hotel
Source Server Version : 50525
Source Host          : 192.168.0.2:3306
Source Database      : zaphotel
 
Target Server Type    : MYSQL
Target Server Version : 50525
File Encoding        : 65001
 
Date: 2012-08-11 08:24:39
*/
 
SET FOREIGN_KEY_CHECKS=0;
 
-- ----------------------------
-- Table structure for `users_struc`
-- ----------------------------
DROP TABLE IF EXISTS `users_struc`;
CREATE TABLE `users_struc` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `real_name` varchar(100) NOT NULL DEFAULT '',
  `password` varchar(50) NOT NULL,
  `mail` varchar(50) NOT NULL DEFAULT '[email protected]',
  `auth_ticket` text NOT NULL,
  `rank` int(11) unsigned NOT NULL DEFAULT '1',
  `credits` int(11) NOT NULL DEFAULT '25000',
  `vip_points` int(11) NOT NULL DEFAULT '0',
  `activity_points` int(11) NOT NULL DEFAULT '0',
  `activity_points_lastupdate` double NOT NULL DEFAULT '0',
  `look` varchar(500) NOT NULL DEFAULT 'hr-115-42.hd-190-1.ch-215-62.lg-285-91.sh-290-62',
  `gender` enum('M','F') NOT NULL DEFAULT 'M',
  `motto` varchar(50) NOT NULL DEFAULT 'Zap Newbie',
  `about` varchar(1000) DEFAULT NULL,
  `account_created` varchar(50) NOT NULL DEFAULT 'NULL',
  `last_online` varchar(50) NOT NULL DEFAULT 'Never',
  `online` enum('0','1') NOT NULL DEFAULT '0',
  `ip_last` varchar(120) NOT NULL,
  `ip_reg` varchar(120) NOT NULL,
  `home_room` int(10) unsigned NOT NULL DEFAULT '0',
  `respect` int(11) NOT NULL DEFAULT '0',
  `daily_respect_points` int(11) NOT NULL DEFAULT '5',
  `daily_pet_respect_points` int(11) NOT NULL DEFAULT '5',
  `newbie_status` int(11) NOT NULL DEFAULT '0',
  `is_muted` enum('0','1') NOT NULL DEFAULT '0',
  `mutant_penalty` enum('0','1','2') NOT NULL DEFAULT '0',
  `mutant_penalty_expire` int(11) NOT NULL DEFAULT '0',
  `block_newfriends` enum('0','1') NOT NULL DEFAULT '0',
  `hide_online` enum('0','1') NOT NULL DEFAULT '0',
  `hide_video` enum('0','1') NOT NULL DEFAULT '1',
  `hide_inroom` enum('0','1') NOT NULL DEFAULT '0',
  `vip` enum('0','1') NOT NULL DEFAULT '0',
  `mail_verified` varchar(6) NOT NULL DEFAULT 'true',
  `expert` varchar(1) NOT NULL,
  `points` int(3) NOT NULL DEFAULT '1',
  `temp` int(1) NOT NULL DEFAULT '0',
  `forumname` varchar(30) NOT NULL DEFAULT 'NewUser',
  `mod_leader` varchar(2) NOT NULL DEFAULT '0',
  `adm_leader` varchar(2) NOT NULL DEFAULT '0',
  `founder` varchar(1) NOT NULL DEFAULT '0',
  `c_h` int(1) NOT NULL DEFAULT '0',
  `volume` int(3) NOT NULL DEFAULT '100',
  `logged_today` varchar(30) DEFAULT '0',
  `has_voted` varchar(30) NOT NULL DEFAULT '0',
  `newcrypto` varchar(30) NOT NULL DEFAULT '0',
  `lastdailycredits` char(18) NOT NULL DEFAULT '0',
  `currentquestid` int(11) NOT NULL DEFAULT '0',
  `currentquestprogress` int(11) NOT NULL DEFAULT '0',
  `achievement_points` int(11) NOT NULL DEFAULT '0',
  `last_offline` varchar(50) DEFAULT '0',
  `crystals` int(11) NOT NULL DEFAULT '0',
  `block_trade` varchar(30) NOT NULL DEFAULT '0',
  `trial_admin` enum('0','1') NOT NULL DEFAULT '0',
  `playermod` enum('0','1') NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`) USING BTREE,
  KEY `rank` (`rank`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=575456 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
 
-- ----------------------------
-- Records of users_struc
-- ----------------------------
Here is my structure as it is on Zap Hotel.
Ok

EDIT:
Nope. Maybe I have a corrupt database??
 

Jonty

Active Member
Aug 7, 2010
194
65
LOL No I just signed up for my hotel again, and still didn't show my user. 

Ok

EDIT:
Nope. Maybe I have a corrupt database??

I doubt it. I'll look for you on TeamViewer tomorrow if you still don't have it working by then.
 
Status
Not open for further replies.

Users who are viewing this thread

Top