PHPBB2 Username Check to WoWRoster 1&2 - PHPBB2-MOD

phpBB integration forum

PHPBB2 Username Check to WoWRoster 1&2 - PHPBB2-MOD

Postby TankGirl » Thu May 03, 2007 6:16 pm

**Original post removed to make finding this MOD easier.

This MOD alters the PHPBB2 registration to first check if the name is a valid Guild Member before letting them complete registration. It will reject all other name attempts to register.
Tested on WoWRoster 1 and should also work for WoWRoster 2. (tables/fields are the same.)
This MOD will NOT work if the PHPBB2 and WoWRoster tables are in seperate databases.
No coding will be done to provide cross database checking.
This has NOT been tested for DF, and no support for DF will be done by me.
DF users, implement/manipulate this mod at own risk.
REMEMBER TO BACK UP YOUR FILES BEFORE MODDING!
Enjoy!
Attachments
rostercheck1.1.txt
PHPBB2 Username Check to WoWRoster 1&2
(1.64 KiB) Downloaded 482 times
Last edited by TankGirl on Mon Apr 28, 2008 3:21 am, edited 6 times in total.
User avatar
TankGirl
WR.net Apprentice
WR.net Apprentice
 
Posts: 51
Joined: Mon Apr 30, 2007 2:14 pm
Location: The bad place in my mind.

phpBB registration check to roster

Postby cynthetiq » Fri May 04, 2007 6:12 am

I use anti-spam ACP 2.06

http://www.lithiumstudios.org/phpBB3/vi ... p?f=25&t=4

it works GREAT!!!!!! I have no spam registrations that are done by script or bot anymore.
cynthetiq
WR.net Apprentice
WR.net Apprentice
 
Posts: 29
Joined: Sat Oct 21, 2006 10:09 am

Re: phpBB registration check to roster

Postby TankGirl » Fri May 04, 2007 1:14 pm

That's already in the latest version phpBB, but you still get people that actually take the time to try to register. The only people that should be signing up at all, are guild members. Thus my request for the roster check.

Since the phpBB and the roster share the same database, with table prefixes to separate them.(phpbb_ and roster_) The Registration is already authenticated to the database.

It would be like a reverse version of how it checks the database if that name is already used for the forums.

You can easily get a list of the roster members with just this simple code.
Code: Select all
<?php
mysql_connect
("localhost""DATABASEUSERNAME""PASSWORD") or die(mysql_error());
mysql_select_db("DATABASENAME") or die(mysql_error());

$result mysql_query("SELECT * FROM roster_members"
or die(
mysql_error());  

echo 
"<table border='1'>";
echo 
"<tr> <th>Character Names</th></tr>";
while(
$row mysql_fetch_array$result )) {
    
// Print out the contents of each row into a table
    
echo "<tr><td>"
    echo 
$row['name'];
    echo 
"</td></tr>"


echo 
"</table>";
?>


Now how do I get that check against the username they entered during registration? lol

If I figure it out first I'll keep you posted.
Any php guru input, to set me of in the right direction would be great too.
User avatar
TankGirl
WR.net Apprentice
WR.net Apprentice
 
Posts: 51
Joined: Mon Apr 30, 2007 2:14 pm
Location: The bad place in my mind.

phpBB registration check to roster

Postby dhirmadi » Fri May 04, 2007 7:54 pm

i did play wit a similar idea, but what about poeple wanting to apply to the guild? we have registrating set to admin approve, so the admins need to approve every regsitration anyways. no wrong signups and registrations anymore, and no need to code anything, plus approved accounts can post in the recruitement section.
User avatar
dhirmadi
WR.net Apprentice
WR.net Apprentice
 
Posts: 15
Joined: Sun Aug 06, 2006 9:01 pm

phpBB registration check to roster

Postby TankGirl » Sat May 05, 2007 12:54 pm

I do have it set to admin activation. I then have to check the roster list manually, which I have blond moments, and I could miss someones name, and deny them. I get about 2 people a day trying to access the forums, and they are just trying to spam some porn or something. I don't like that they show as a new member either, whether I approve them or not.
We don't require an application, your initial rank IS your application.

A code is a more efficient, and accurate way of doing what I do everyday.

BTW I enjoy all the attempts to discourage me from continuing my project.
I'm a girl who has her mind set, this is what I want, and I will get it. lol

I refuse to abandon this project until I make it work.
User avatar
TankGirl
WR.net Apprentice
WR.net Apprentice
 
Posts: 51
Joined: Mon Apr 30, 2007 2:14 pm
Location: The bad place in my mind.

phpBB registration check to roster

Postby dhirmadi » Sat May 05, 2007 3:47 pm

tg,

it's a matter of effort versus gained profit. if you want to do it for the sake of seeing how it works, that is a good thing. i suppose it just depends on how a guild is run, whether a mechanism like yours is applicable or not. :)
regards
User avatar
dhirmadi
WR.net Apprentice
WR.net Apprentice
 
Posts: 15
Joined: Sun Aug 06, 2006 9:01 pm

Re: phpBB registration check to roster

Postby TankGirl » Sun May 06, 2007 6:44 pm

MOD SOLVED!

I'm going to post it, for the slim chance someone might want it.

Code: Select all
//ROSTER CHECK MOD by tankgirl
//This will check your WoWRoster for the guild member, before they can register for yout phpBB forums.
//Special thanks sneakimp from PHPBuilder for all the help!
//Only works in WoWRoster/phpBB tables sharing the same database.

OPEN
forums/language/lang_english/lang_main.php

LOOK FOR
##################################

$lang['Empty_message_email'] = 'You must enter a message to be e-mailed.';

##################################

AFTER ADD
##################################

//
//------------------- WoWRoster Check BEGIN ------------------
//

$lang['GuildMember_invalid'] = 'This username  is not yet a valid Guild Member.';

//
//------------------- WoWRoster Check END ------------------
//

##################################

OPEN
forums/includes/functions_validate.php

LOOK FOR
##################################

   $username = phpbb_clean_username($username);

##################################

AFTER ADD
##################################

//
//------------------- WoWRoster Check BEGIN ------------------
//

$rostersql=" SELECT name
        FROM roster_members
        WHERE LOWER(name)='" . strtolower($username) . "'";
    if ($result = $db->sql_query($rostersql))
    {
        if ($db->sql_numrows($result) < 1)
        {
            $db->sql_freeresult($result);
            return array('error' => true, 'error_msg' => $lang['GuildMember_invalid']);
        }
    }
    $db->sql_freeresult($result);

//
//------------------- WoWRoster Check END ------------------
//

##################################

SAVE AND CLOSE ALL
User avatar
TankGirl
WR.net Apprentice
WR.net Apprentice
 
Posts: 51
Joined: Mon Apr 30, 2007 2:14 pm
Location: The bad place in my mind.

Re: phpBB registration check to roster

Postby jkibbles » Sun May 06, 2007 9:01 pm

TankGirl wrote:BTW I enjoy all the attempts to discourage me from continuing my project.
I'm a girl who has her mind set, this is what I want, and I will get it. lol

I refuse to abandon this project until I make it work.


LMAO. Gratz on getting the code working. I don't use phpbb, as I've been using e107 since it's inception and am more used to it, but I love seeing someone with the perseverance to get the job done.
Memento mori
User avatar
jkibbles
WR.net Apprentice
WR.net Apprentice
 
Posts: 20
Joined: Wed Feb 21, 2007 7:05 am

phpBB registration check to roster

Postby TAGuild » Sat Jun 09, 2007 2:48 am

For those of you using the phpbb users mod.

Code: Select all
// Kick out those who do not belong
if ($userdata['username'] == "Anonymous")
   message_die(GENERAL_ERROR, "You need to be logged in to be able to access this page.");
TAGuild
WR.net Apprentice
WR.net Apprentice
 
Posts: 9
Joined: Sat Apr 28, 2007 12:15 am

Re: phpBB registration check to roster

Postby Ardraaken » Mon Jun 11, 2007 3:45 pm

I would like to use this code on my forum however my Roster information is in a different mySQL database to my forum information, can someone give me an idea of what I'd need to modify to get it to work for this setup?

Code: Select all
//ROSTER CHECK MOD by tankgirl
//This will check your WoWRoster for the guild member, before they can register for yout phpBB forums.
//Special thanks sneakimp from PHPBuilder for all the help!
//Only works in WoWRoster/phpBB tables sharing the same database.

OPEN
forums/language/lang_english/lang_main.php

LOOK FOR
##################################

$lang['Empty_message_email'] = 'You must enter a message to be e-mailed.';

##################################

AFTER ADD
##################################

//
//------------------- WoWRoster Check BEGIN ------------------
//

$lang['GuildMember_invalid'] = 'This username  is not yet a valid Guild Member.';

//
//------------------- WoWRoster Check END ------------------
//

##################################

OPEN
forums/includes/functions_validate.php

LOOK FOR
##################################

   $username = phpbb_clean_username($username);

##################################

AFTER ADD
##################################

//
//------------------- WoWRoster Check BEGIN ------------------
//

$rostersql=" SELECT name
        FROM roster_members
        WHERE LOWER(name)='" . strtolower($username) . "'";
    if ($result = $db->sql_query($rostersql))
    {
        if ($db->sql_numrows($result) < 1)
        {
            $db->sql_freeresult($result);
            return array('error' => true, 'error_msg' => $lang['GuildMember_invalid']);
        }
    }
    $db->sql_freeresult($result);

//
//------------------- WoWRoster Check END ------------------
//

##################################

SAVE AND CLOSE ALL
Ardraaken
WR.net Apprentice
WR.net Apprentice
 
Posts: 4
Joined: Fri Apr 13, 2007 10:58 pm

phpBB registration check to roster

Postby Ezik » Fri Jun 15, 2007 10:17 pm

Got a problem with that mini-mod.

Guests could not post anything (in "Guild Application" forum), because posting use same validate_username() function, that we change in /includes/functions_validate.php

So, i realized that we should use different functions for posting and user registration. Solution:

in /includes/functions_validate.php create one more validate_username() function via copy-paste. Rename one function to smth like validate_username_roster(). Make sure renamed function have "WoWRoster check" block, and delete it from origin function (if you already installed mod).

So now you have smth like that in /includes/functions_validate.php:
Code: Select all
function validate_username($username)
{
    global 
$db$lang$userdata;

    
// Remove doubled up spaces
    
$username preg_replace('#\s+#'' 'trim($username)); 
    
$username phpbb_clean_username($username);

    
$sql "SELECT username 
        FROM " 
USERS_TABLE "
        WHERE LOWER(username) = '" 
strtolower($username) . "'";
// etc, etc, etc..  till function end ----------->>>>>>>>>>>
}

function 
validate_username_roster($username)
{
    global 
$db$lang$userdata;

    
// Remove doubled up spaces
    
$username preg_replace('#\s+#'' 'trim($username)); 
    
$username phpbb_clean_username($username);
//
//------------------- WoWRoster Check BEGIN ------------------
//
$rostersql=" SELECT name
        FROM roster_members
        WHERE LOWER(name)='" 
strtolower($username) . "'";
    if (
$result $db->sql_query($rostersql))
    {
        if (
$db->sql_numrows($result) < 1)
        {
            
$db->sql_freeresult($result);
            return array(
'error' => true'error_msg' => $lang['GuildMember_invalid']);
        }
    }
    
$db->sql_freeresult($result); 
//
//------------------- WoWRoster Check END ------------------
//

    
$sql "SELECT username
        FROM " 
USERS_TABLE "
        WHERE LOWER(username) = '" 
strtolower($username) . "'";
// etc, etc, etc..  till function end ----------->>>>>>>>>>>


Then, open /includes/usercp_register.php, find line
"$result = validate_username($username);"
(aboult line #428) and replace with
"$result = validate_username_roster($username);".

Now, for registering we use function with wowroster check,
but for posting (/includes/functions_post.php) we use default function.
Ezik
WR.net Apprentice
WR.net Apprentice
 
Posts: 1
Joined: Wed May 02, 2007 1:21 am

phpBB registration check to roster

Postby elucas3689 » Wed Jul 25, 2007 11:05 am

im sorry i didnt follow you ezik, i have been teaching myself php, but still not that great.

i also need guest to be able to post to recruitment forums.

what code do i need to change?
elucas3689
WR.net Apprentice
WR.net Apprentice
 
Posts: 10
Joined: Sun Aug 06, 2006 7:19 am

Re: phpBB registration check to roster

Postby Melina » Sun Oct 21, 2007 9:36 pm

where does the function validate_username($username) end? I'm not familiar with php at all!
User avatar
Melina
WR.net Apprentice
WR.net Apprentice
 
Posts: 49
Joined: Fri Aug 03, 2007 6:49 am

phpBB registration check to roster

Postby irvanovich » Sat Dec 22, 2007 10:45 am

any ideas on how to do this in phpBB3? it's setup a little differently, and i can't figure out how to make it work >.<
irvanovich
WR.net Apprentice
WR.net Apprentice
 
Posts: 1
Joined: Wed Dec 05, 2007 7:06 pm

Re: phpBB registration check to roster

Postby Melina » Sun Dec 23, 2007 3:32 am

would love to see this for phpbb3 also.
User avatar
Melina
WR.net Apprentice
WR.net Apprentice
 
Posts: 49
Joined: Fri Aug 03, 2007 6:49 am

Next

Return to phpBB

Who is online

Users browsing this forum: No registered users and 1 guest

cron