Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-11-2016, 07:09 AM
Alice Alice is offline
 
Join Date: Mar 2013
Location: Great Lakes Area
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Converting from Xenforo to vBulletin

Hey,

I was wondering if someone might be willing to give me a hand with converting this matter of code to be cross-compatible with vbulletin?

Thanks,

Code:
<?php
 
// **************************************************************************************************
//      IMPORTANT CONFIGURATION ITEMS
// **************************************************************************************************
 
$enabled = true;
$serverip = '127.0.0.1';
 
// **************************************************************************************************
//      END OF IMPORTANT CONFIGURATION ITEMS
//      DO NOT EDIT ANYTHING BEYOND THIS POINT!
// **************************************************************************************************
 
// Necessary XenForo Hooks
require($fileDir . 'library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . 'library');
XenForo_Application::initialize($fileDir . 'library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);
 
// Assistance in placing file in correct directory w/o include/require.
$proxyfile = 'proxy.php';
$adminfile = 'admin.php';
if (!file_exists($proxyfile)) {
    die('This file is not in the correct directory. Please contact a website administrator.');
};
if (!file_exists($adminfile)) {
    die('This file is not in the correct directory. Please contact a website administrator.');
};
 
// Checks to make sure accessing IP is server IP.
$acuntite = $_SERVER['REMOTE_ADDR'];
if (strlen($_SERVER['REMOTE_ADDR'])<6) {
die ('Access denied.');
};
if ($acuntite != $serverip) {
die('Access denied.');
};
 
// Post get items
$username = $_GET['un'];
$password = $_GET['pw'];
 
// If no info specified
if(is_null($username) && is_null($password)) return;
$error = "";
$ph = new XenForo_Model_User();
$result = $ph->validateAuthentication($username, $password, $error);
 
// Ensures system is enabled before continuing. If not, returns error
if ($enabled != true) {
    die('3');
}
 
// Final get id
if(is_numeric($result) && $result > 0 && !(strpos($username, '@') !== false))
{
    $user = $ph->getFullUserById($result);
   
    // ensures user is not banned
    $banned = $user['is_banned'];
    // if banned, return error 2
    if($banned == 1) echo "2";
   
    // if not banned, successful login
    else echo "1";
}
 
// and if all else fails, the shit you provided is wrong so return error 0
else echo "0";
 
// Echo 0 = Incorrect user/pass
// Echo 1 = Successful Login
// Echo 2 = Banned User
// Echo 3 = System disabled
 
?>
Reply With Quote
  #2  
Old 01-11-2016, 03:31 PM
Alice Alice is offline
 
Join Date: Mar 2013
Location: Great Lakes Area
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone know if they can help?
Reply With Quote
  #3  
Old 01-11-2016, 03:55 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Untested, upload to the root of your vBulletin forum.

PHP Code:
<?php
require('./global.php');
require(
'includes/functions_login.php');

$enabled true;
$serverip '127.0.0.1';
  
// Checks to make sure accessing IP is server IP.
$acuntite $_SERVER['REMOTE_ADDR'];
if (
strlen($_SERVER['REMOTE_ADDR']) < || $acuntite != $serverip || !$enabled) {
    die(
3);
}
 
// Post get items
$username $_GET['un'];
$password $_GET['pw'];
 
// If no info specified
if(is_null($username) && is_null($password)) return;

$error "";
$result verify_authentication($username$passwordmd5($password), md5($password), ''false);
 
// Final get id
if($result === true && !(strpos($username'@') !== false)){
    if(
$vbulletin->userinfo['usergroupid'] == 8){
        echo 
2// Banned
    
}else{
        echo 
1// Not banned.
    
}
}else{
    echo 
0// and if all else fails, the shit you provided is wrong so return error 0
}
 
// Echo 0 = Incorrect user/pass
// Echo 1 = Successful Login
// Echo 2 = Banned User
// Echo 3 = System disabled
Reply With Quote
2 благодарности(ей) от:
MarkFL, RichieBoy67
  #4  
Old 01-11-2016, 04:12 PM
Alice Alice is offline
 
Join Date: Mar 2013
Location: Great Lakes Area
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First off, thank you so much for being willing to help me with this project. Now, I uploaded the code to the root of the forums, and in Xenforo its supposed to print either a 0,1 or 2 and this only shows a completely blank page. But no errors we're printed, so go you.
Reply With Quote
  #5  
Old 01-11-2016, 04:17 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's because of the check that checks if the current IP matches the $serverip variable.
You probably want it to be something like this in that case:

PHP Code:
<?php 
require('./global.php'); 
require(
'includes/functions_login.php'); 
   
// Post get items 
$username urldecode($_GET['un']); 
$password urldecode($_GET['pw']); 
  
// If no info specified 
if(is_null($username) && is_null($password)){
    die(
'No login provided.');


$result verify_authentication($username$passwordmd5($password), md5($password), ''false);
  
// Final get id 
if($result === true && !(strpos($username'@') !== false)){ 
    if(
$vbulletin->userinfo['usergroupid'] == 8){ 
        echo 
2// Banned 
    
}else{ 
        echo 
1// Not banned. 
    

}else{ 
    echo 
0// and if all else fails, the shit you provided is wrong so return error 0
}
Then you execute it as follows: http://example.com/script.php?un=Dave&pw=password
Reply With Quote
  #6  
Old 01-11-2016, 04:21 PM
Alice Alice is offline
 
Join Date: Mar 2013
Location: Great Lakes Area
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That code is producing the following error

Code:
Parse error: syntax error, unexpected 'if' (T_IF) in /home4/swgnge/public_html/forums/includes/functions_login.php(209) : eval()'d code on line 3
0
--------------- Added [DATE]1452536737[/DATE] at [TIME]1452536737[/TIME] ---------------

Scratch that, I was using the wrong syntax.
Reply With Quote
  #7  
Old 01-11-2016, 04:26 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's caused by a plugin you have installed, more specifically at the login_verify_failure_username hook.
Reply With Quote
  #8  
Old 01-11-2016, 04:26 PM
Alice Alice is offline
 
Join Date: Mar 2013
Location: Great Lakes Area
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you so much Your my hero!!
Reply With Quote
Благодарность от:
MarkFL
  #9  
Old 01-11-2016, 04:26 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No problem.
Reply With Quote
  #10  
Old 01-11-2016, 07:48 PM
Alice Alice is offline
 
Join Date: Mar 2013
Location: Great Lakes Area
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Seraphyn View Post
That code is producing the following error

Code:
Parse error: syntax error, unexpected 'if' (T_IF) in /home4/swgnge/public_html/forums/includes/functions_login.php(209) : eval()'d code on line 3
0
--------------- Added [DATE]1452536737[/DATE] at [TIME]1452536737[/TIME] ---------------

Scratch that, I was using the wrong syntax.
This is still an issue, specifically when you input a username that doesn't exist... like swglegends.com/forums/auth.php?un=username&pw=password

Please advise,
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:33 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04121 seconds
  • Memory Usage 2,291KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (3)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete