vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB5 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=263)
-   -   Class 'vB_Router' not found (https://vborg.vbsupport.ru/showthread.php?t=319844)

eleetoburrito 08-12-2015 12:35 PM

Class 'vB_Router' not found
 
I'm using this code from another thread

Code:

<?php

chdir("forum/core/"); // change to your core folder location
require_once("global.php");

function create_random_user(){
    $dataman =& datamanager_init('User', $vbulletin); 
    $dataman->set('username', "user".rand());
    $dataman->set('email', rand()."@domain.com");
    $dataman->set('password', "leighf");
    return $dataman->save();
}

function log_user_in($userid){
    $user = fetch_userinfo($userid);
    $auth = vB_User::verifyAuthentication($user['username'], "leighf", $user['password'], $user['password']);
    $res = vB_User::processNewLogin($auth);
    vbsetcookie('userid', $res['userid']);
    vbsetcookie('password', $res['password']);
    vbsetcookie('sessionhash', $res['sessionhash']);
}

// create random user
$userid = create_random_user();

// log them in
log_user_in($userid);

Everything works fine, but when I try to login a user from the existing database, if the password is bad and the auth doesn't work, this error shows up

Fatal error: Class 'vB_Router' not found in /home/public_html/forum/core/vb/exception/user.php on line 40

Why is that? How do I fix this?

Lynne 08-13-2015 02:50 AM

What thread are you getting that code from? No vB3 or vB4 code will work in vB5.


All times are GMT. The time now is 10:46 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.00906 seconds
  • Memory Usage 1,709KB
  • 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_code_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