Vbulletin User=Label Hack

simur612

Member
May 25, 2018
879
0
16
I share my seedbox with a few mates and to make things easier I have done this hack to use there Vbulletin Username as the label for any newly added torrents

You will need to install Vbull for this to work

In the php directory open addtorrent

find
Code:
$label = null;
Under this add
Code:
define('CWD','/var/www/website/Forum'); // set this as the folder your forum is located
$getcwd = getcwd();
require_once(CWD. '/global.php');
require_once(CWD. '/includes/functions_login.php');
$label=$vbulletin->userinfo['username'];
Now this could be fine on it own but people may not be loged in the forum I hear you say to get around this problem open your index.html file from the rutorrent directory and add this line of code somewhere near the top

Code:
<iframe id="logedin" name="logedin" style="width:0px; height:0px; border: 0px" src="logedin.php"></iframe>I have mine just after the style close

now create a new php script called logedin.php

Code:
<?
define('CWD','/var/www/website/Forum'); // set this as the folder your forum is located
$getcwd = getcwd();
require_once(CWD. '/global.php');
require_once(CWD.'/includes/functions_login.php');
$hh=$vbulletin->userinfo['logouthash'];
if ($hh == '')
{
?>
<script type="text/javascript">
top.window.location = 'login.php';
</script>
have this code in the same folder as you index.html file and your all done if a user is not loged on to the forum it will direct them to the forum login page.

This is a nice basic way to have a semi secure user access for your seedbox and have forums as well.

Now im sure people could chip in with methods too allow this to work with other forums or user front ends.

Oh I forgot I had created a seperate login.php script as well this should be placed in your rtorrent folder

Code:
<?
define('CWD','/var/www/website/Forum'); // set this as the folder your forum is located
$path= "Forum"; // the relative path to where you forum is located
$rtorrenturl= "http://www.YourSite.com"; // your page you want to load after you have loged in.

// Change settings above to relative paths for your site

ini_set('display_errors','Off');
require_once(CWD. '/global.php');

if(!empty($vbulletin->userinfo['userid']))
{
header( 'Location: '.$rtorrenturl ) ;
}
else
{
?>
<!-- <strong class="highlight">login</strong> form -->
<form action="<? echo $path ?>/login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">

<script type="text/javascript" src="Forum/clientscript/vbulletin_md5.js?v=370b5h"></script>

<label for="navbar_username">
<div align="center">User Name
<input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="30" accesskey="u" tabindex="101" value="User Name" onfocus="if (this.value == 'User Name') this.value = '';" />
</div>
</label>
<div align="center"></div>
<label for="cb_cookieuser_navbar">
<div align="center"><br />
<input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />
Remember Me?
</div>
</label>
<label for="navbar_password">
<div align="center"><br />
Password
<input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" id="navbar_password" size="30" tabindex="102" />
</div>
</label>
<div align="center">
<input type="submit" class="button" value="Log in" tabindex="104" title="Enter your username and password in the boxes provided to <strong class="highlight">

<input type="hidden" name="s" value="" />
<input type="hidden" name="do" value="login" />
<input type="hidden" name="vb_login_md5password" />

<input type="hidden" name="vb_login_md5password_utf" />
</div>
</div>
</form>
<!-- / <strong class="highlight">login</strong> form -->
<?
}


Edit (reason added some code)
 

peshua19

Member
May 25, 2018
897
0
16
VERY cool.

you should try to implement this as a plugin....that way people can just drop the plugin in and it would just work.
 

simur612

Member
May 25, 2018
879
0
16
Just starting to get familar with the workings of rutorrent will look at making this a plugin in the near future im sure it could be done and could even make the code more stream line

Would like to even add a button on the interface to load up the forums

my main issue would where and how do I intersect the addtorrent fuction to incorperate the label. would that be java script
 

peshua19

Member
May 25, 2018
897
0
16
That post talks about adding a tab not a button I have added a tab already with a shoutbox

I have seen the code for adding a button that should be easy

just thinking about adding auto label and going to look at autotools addon to see how they do it and attempt to make an addon

Might be a week off though as going away for a few days then back to work 50hrs a week plus doing an online it course and have a 2 year old daughter.