vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=5)
-   -   Change UserGroupID automaticaly after specified time (https://vborg.vbsupport.ru/showthread.php?t=34007)

holev 01-10-2002 10:00 PM

This hack checks every hour (-using a cronjob) the user db and checks every user to see if the user is regged for over a week (can be changed), if over a week - given a certain usergroupid, if not, also a certain usergroupid.

this helps me gives new users on the board limited access to forums.

Here is the code for the main and only file behind this hack:
PHP Code:

<?
#!/usr/local/bin/php -q

## MySQL Vars: ## 
$mysql_host = "localhost";
$mysql_user = "";
$mysql_pass = "";
$mysql_db = "";
## MySQL Vars End ##

mysql_connect($mysql_host,$mysql_user,$mysql_pass);
mysql_select_db($mysql_db);

// EDIT //
$nuser = 15; // User Group ID for newbie user
$tuser = 2; // User Group ID for normal users 
$timepass = 60*60*24*7; // Requires u to be regged for one week
// ---- //

$x=0;
$y=0;
$query = mysql_query("select * from user where usergroupid=$nuser") or die(mysql_error());
while($r = mysql_fetch_array($query)) {
    echo $r["username"] . " ";
    $updatedate = $r[joindate] + ($timepass);
    if(($updatedate >= time()) || ($r[posts] < 15)) {
        $disalow = mysql_query("update user set usergroupid=$nuser where userid=" . $r["userid"]) or die(mysql_error());
        if($disalow) {
            echo ".... <b><font color=red>Failed.</font></b>";
            $x++;
        }
    } else {
        $alow = mysql_query("update user set usergroupid=$tuser where userid=" . $r["userid"]) or die(mysql_error());
        if($alow) {
            echo ".... <b><font color=green>Passed.</font></b>";
            $y++;
        }
    }
    echo "<br>";
}
echo "Passed: $y | Failed: $x";
?>

This hack can work with no connection to vbb and will work nomatter where u put it on your server.

Now just create the cronjob and make it call the php and execute it as a CGI every couple of minds u decide of.

Requirements: Crontab
(you must have axx to crontab on your server)

kreftt 01-11-2002 07:57 PM

thanks a lot for this

kreftt


All times are GMT. The time now is 06:05 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01002 seconds
  • Memory Usage 1,714KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete