Mod "login redirect"
Copyright © 2008 by AlexALX
Creators web site: http://alex-php.net
Release date: December 2008 Version: 1.0
Created for php-fusion v7.00
1. Manual

Mod "login redirect" - this modification add redirection to the page where you are login/logout.

Attention! This modification works only with the original user info panel!

2. How to install
  1. Upload the content of the calalogue to the folder:
    • php-files/*
  2. Open file maincore.php and find (~ 215-245 lines):

    if (isset($_POST['login'])) {
    $user_pass = md5($_POST['user_pass']);
    $user_name = preg_replace(array("/\=/","/\#/","/\sOR\s/"), "", stripinput($_POST['user_name']));
    $result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_name='$user_name' AND (user_password='".md5($user_pass)."' OR user_password='$user_pass') LIMIT 1");
    if (dbrows($result)) {
    $data = dbarray($result);
    if ($data['user_password'] == $user_pass) {
    $result = dbquery("UPDATE ".DB_USERS." SET user_password='".md5($user_pass)."' WHERE user_id='".$data['user_id']."'");
    }
    $cookie_value = $data['user_id'].".".$user_pass;
    if ($data['user_status'] == 0) {
    $cookie_exp = isset($_POST['remember_me']) ? time() + 3600 * 24 * 30 : time() + 3600 * 3;
    header("P3P: CP='NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'");
    setcookie(COOKIE_PREFIX."user", $cookie_value, $cookie_exp, "/", "", "0");
    redirect(BASEDIR."setuser.php?user=".$data['user_name'], true);
    } elseif ($data['user_status'] == 1) {
    redirect(BASEDIR."setuser.php?error=1", true);
    } elseif ($data['user_status'] == 2) {
    redirect(BASEDIR."setuser.php?error=2", true);
    }
    } else {
    redirect(BASEDIR."setuser.php?error=3");
    }
    }

    Replace with:

    if (isset($_POST['login'])) {
    $user_pass = md5($_POST['user_pass']);
    $user_name = preg_replace(array("/\=/","/\#/","/\sOR\s/"), "", stripinput($_POST['user_name']));
    $result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_name='$user_name' AND (user_password='".md5($user_pass)."' OR user_password='$user_pass') LIMIT 1");
    if (dbrows($result)) {
    $data = dbarray($result);
    if ($data['user_password'] == $user_pass) {
    $result = dbquery("UPDATE ".DB_USERS." SET user_password='".md5($user_pass)."' WHERE user_id='".$data['user_id']."'");
    }
    $cookie_value = $data['user_id'].".".$user_pass;
    if ($data['user_status'] == 0) {
    $cookie_exp = isset($_POST['remember_me']) ? time() + 3600 * 24 * 30 : time() + 3600 * 3;
    header("P3P: CP='NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'");
    setcookie(COOKIE_PREFIX."user", $cookie_value, $cookie_exp, "/", "", "0");
    redirect(BASEDIR."setuser.php?user=".$data['user_name'].
    "&url=".rawurlencode($_SERVER['REQUEST_URI']), true);
    } elseif ($data['user_status'] == 1) {
    redirect(BASEDIR."setuser.php?error=1&url=".rawurlencode($_SERVER['REQUEST_URI']), true);
    } elseif ($data['user_status'] == 2) {
    redirect(BASEDIR."setuser.php?error=2&url=".rawurlencode($_SERVER['REQUEST_URI']), true);
    }
    } else {
    redirect(BASEDIR."setuser.php?error=3&url=".rawurlencode($_SERVER['REQUEST_URI']));
    }
    }

    Installation completed...
3. Features
    • This modification add redirection to the page where you are login/logout.
4. Support
If you have any questions please contact E-mail or forum.
5. License

Copyright system MUST should remain in place, under license GNU GENERAL PUBLIC LICENSE Version 2 (more information can be found in the file gpl.txt), exceptions:

  • You put one of our banners on the main page of your site.
  • You donate on the development site in the amount of 3$.