Manually Add User Banning Hack
to Geeklog v1.3.8

english.php  In the respective language file (e.g. /language/english.php), locate this line in the array $MESSAGE (at line 1022):

    57 => 'Your account has been successfully deleted.'

Replace it with these two lines (new code added is in blue):

    57 => 'Your account has been successfully deleted.',
    58 => 'Your account has been temporarily suspended due to abusive posting'

submit.php  In the function submissionform (located in /public_html/submit.php) find this section of code (starting at line 84):

            $retval .= $loginreq->finish($loginreq->get_var('errormsg'));
            $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
            return $retval;
        } else {
            $retval .= COM_startBlock($LANG12[19])
                . $LANG12[9]
                . COM_endBlock();

Replace it with this (new code added is in blue):

            $retval .= $loginreq->finish($loginreq->get_var('errormsg'));
            $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
            return $retval;
        }
        else if (SEC_inGroup('Banned', $_USER['uid']) && !SEC_inGroup('Root', $_USER['uid'])) {
            $retval = COM_refresh($_CONF['site_url'] . '/users.php?mode=logout&msg=ban');
            return $retval;
        } else {
            $retval .= COM_startBlock($LANG12[19])
                . $LANG12[9]
                . COM_endBlock();

comment.php  In the function commentform (located in /public_html/comment.php) find this section of code (starting at line 96):

        $retval .= $loginreq->finish($loginreq->get_var('errormsg'));
        $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
        return $retval;
    } else {
        COM_clearSpeedlimit ($_CONF['commentspeedlimit'], 'comment');

Replace it with this (new code added is in blue):

        $retval .= $loginreq->finish($loginreq->get_var('errormsg'));
        $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
        return $retval;
    }
    else if (SEC_inGroup('Banned', $_USER['uid']) && !SEC_inGroup('Root', $_USER['uid'])) {
        $retval = COM_refresh($_CONF['site_url'] . '/users.php?mode=logout&msg=ban');
        return $retval;
    } else {
        COM_clearSpeedlimit ($_CONF['commentspeedlimit'], 'comment');

users.php>  In the main program inside /public_html/users.php,

Find this section of code under case 'logout' (starting at line 688):

    setcookie ($_CONF['cookie_name'], '', time() - 10000, $_CONF['cookie_path'],
               $_CONF['cookiedomain'], $_CONF['cookiesecure']);
    $display = COM_refresh($_CONF['site_url'] . '/index.php?msg=8');
    break;

Replace it with this (new code added is in blue):

    setcookie ($_CONF['cookie_name'], '', time() - 10000, $_CONF['cookie_path'],
               $_CONF['cookiedomain'], $_CONF['cookiesecure']);
    $msg = $HTTP_GET_VARS['msg'];
    if ($msg == 'ban')
        $display = COM_refresh($_CONF['site_url'] . '/index.php?msg=58');
    else
        $display = COM_refresh($_CONF['site_url'] . '/index.php?msg=8');
    break;

Find this section of code under 'default' (starting at line 826):

    if (!empty($passwd) && $mypasswd == md5($passwd)) {
        DB_change($_TABLES['users'],'pwrequestid',"NULL",'username',$loginname);
        $userdata = SESS_getUserData($loginname);
        $_USER=$userdata;
        $sessid = SESS_newSession($_USER['uid'], $REMOTE_ADDR, $_CONF['session_cookie_timeout'], 
        $_CONF['cookie_ip']);

Replace it with this (new code added is in blue):

    if (!empty($passwd) && $mypasswd == md5($passwd)) {
        DB_change($_TABLES['users'],'pwrequestid',"NULL",'username',$loginname);
        $userdata = SESS_getUserData($loginname);
        $_USER=$userdata;
        if (SEC_inGroup('Banned', $_USER['uid']) && !SEC_inGroup('Root', $_USER['uid'])) {
            $display = COM_refresh($_CONF['site_url'] . '/users.php?mode=logout&msg=ban');
            break;
        }
        $sessid = SESS_newSession($_USER['uid'], $REMOTE_ADDR, $_CONF['session_cookie_timeout'], 
        $_CONF['cookie_ip']);

group.php  In the function savegroup (located in /public_html/admin/group.php) find this section of code (starting at line 400):

        if (DB_getItem($_TABLES['group_assignments'], 'count(*)',"ug_main_grp_id = $grp_id AND ug_grp_id = 1") == 0) {
            DB_query("INSERT INTO {$_TABLES['group_assignments']} (ug_main_grp_id, ug_grp_id) VALUES ($grp_id, 1)");
        }

Replace it with this (new code added is in blue):


    if ($grp_name != 'Banned') {
        if (DB_getItem($_TABLES['group_assignments'], 'count(*)',"ug_main_grp_id = $grp_id AND ug_grp_id = 1") == 0) {
            DB_query("INSERT INTO {$_TABLES['group_assignments']} (ug_main_grp_id, ug_grp_id) VALUES ($grp_id, 1)");
        }
    }

-- That's it - All Done --