The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
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
?>
|
|
#2
|
|||
|
|||
|
Anyone know if they can help?
|
|
#3
|
|||
|
|||
|
Untested, upload to the root of your vBulletin forum.
PHP Code:
|
| 2 благодарности(ей) от: | ||
| MarkFL, RichieBoy67 | ||
|
#4
|
|||
|
|||
|
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.
|
|
#5
|
|||
|
|||
|
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:
|
|
#6
|
|||
|
|||
|
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 Scratch that, I was using the wrong syntax. |
|
#7
|
|||
|
|||
|
That's caused by a plugin you have installed, more specifically at the login_verify_failure_username hook.
|
|
#9
|
|||
|
|||
|
No problem.
|
|
#10
|
|||
|
|||
|
Quote:
Please advise, |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|