Does not Redirect after register

gochad

Lacrim
Feb 9, 2019
122
20
Hey so i got an custom RevCMS, and when you click submit the account gets created but you dont get redirected and you stay on same page, i can share a snippet of the code when its success but it does not redirect i have tried adding header("Location: home.php");
but it does not work


<?php
require_once('../../includes/config.php');
require_once('../../includes/functions.php');
require_once('../../includes/websockets.php');
require_once('../class/database.php');

// Services
$db = new Database();

// Vérification connecté
session_start();
if(!isset($_SESSION['register'])) {
if(empty($_POST['rusername']) OR empty($_POST['remail']) OR empty($_POST['rpassword']) OR empty($_POST['rpassword_confirm']))
{
echo "LeereFelder";
return;
}

if(strlen($_POST['rusername']) < 4) {
echo "MinUsername";
return;
}

if(strlen($_POST['rusername']) > 11) {
echo "MaxUsername";
return;
}

if(!ctype_alnum($_POST['rusername'])) {
echo "InvalidUsername";
return;
}


if(mb_strtoupper($_POST['rusername']) == "ADMIN" OR mb_strtoupper($_POST['rusername']) == "MOD" OR mb_strtoupper($_POST['rusername']) == "ARCHITECTE") {
echo "PrefixUsername";
return;
}

$username = $_POST['rusername'];
$check_username = $db->executeQuery('SELECT COUNT(*) AS count_row FROM users WHERE username=?', array($username));
if($check_username[0]["count_row"] == 1)
{
echo "UsedUsername";
return;
}

if(!filter_var($_POST['remail'], FILTER_VALIDATE_EMAIL)) {
echo "InvalidEmail";
return;
}

$checkDoubleAccount = $db->executeQuery('SELECT COUNT(*) AS count_row FROM users WHERE ip_last=?', array($_SERVER['REMOTE_ADDR']));
if($checkDoubleAccount[0]["count_row"] >= $RegisterAccounts)
{
echo "DoubleAccount";
return;
}

$check_email = $db->executeQuery('SELECT COUNT(*) AS count_row FROM users WHERE mail=?', array($_POST['remail']));
if($check_email[0]["count_row"] == 1)
{
echo "UsedEmail";
return;
}

if(strlen($_POST['rpassword']) < 6) {
echo "MinPasswort";
return;
}

if($_POST['rpassword'] != $_POST['rpassword_confirm']) {
echo "DifferentPasswort";
return;
}

if($RegisterEnabled == false){
echo "Registerfalse";
return;
}

$motto = $RegisterMotto;
$gender = "M";
$look = "hr-3090-61.lg-280-110.hd-180-2.ch-215-49.sh-290-110";

$sessionKey = $configName.'-'.rand(9,999).'/'.substr(sha1(time()).'/'.rand(9,9999999).'/'.rand(9,9999999).'/'.rand(9,9999999),0,33);
$timestamp = strtotime(date("Y-m-d H:i:s"));
$db->executeInsert('INSERT INTO users (username, password, mail, credits, activity_points, vip_points, auth_ticket, look, gender, motto, account_created, ip_last, ip_reg, home_room, mutuelle_expiration, telForfaitReset) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), NOW())', array($username, password_hash($_POST['rpassword'], PASSWORD_BCRYPT), $_POST['remail'], $RegisterTaler, $RegisterDuckets, $RegisterDiamanten, $sessionKey, $look, $gender, $motto, $timestamp, userIp(), userIp(), $RegisterHomeRoom));
}

?>
Post automatically merged:

if you want payment i can pay...
 
Last edited:

kailani

Member
Sep 26, 2020
30
12
It looks like you're checking a session array and not a post array.
Code:
if(!isset($_SESSION['register'])) {

Do you have a reason for that? Also I don't see any sign of a redirection from your code you posted.
 

Users who are viewing this thread

Top