Jump to content

Adding a username check to new member registration


Hopworks

Recommended Posts

PHPBB2 Related!

 

I feel real stupid asking this, especially considering the flaming hoops I jumped through today. I thought I could figure it out, but alas, I suck, so help is what I will now rely on.  :(

 

Summary of my need(s);

I am doing a World of Warcraft site for our guild. The forums are working just fine, and all is well.

Problem is we have a lot of members, and many of them are kids that like to invite friends to register on the site that are not actually in the guild, so I came up with a solution.

 

Within the game, I wrote an addon that pulls guild information, including members, and a lot of other fields for each member. I took that savedvariable file and uploaded it to my site. Using that file, I parsed it and converted it to a PHP array. Now there, that data was used to populate a database for our roster information. It works great!

 

Now, I want to use that database to compare the new member's username with during registration. If there is nothing found in the Guild Roster database, that means they aren't a member, and deny the registration. I just can't figure how to wedge that into the usercp_register.php file. Can anyone help me with this?

 

I don't need complete code. Obviously, if I populated my Guild Roster database, and used it to check to see if the record existed, I have what I need to access that database, and use the information in it. All that work is done. I just need to know how I can block registration if there isn't the register candidate's username in my Guild Roster database, and maybe direct to a page that states why they were not allowed.

 

I hope I gave enough information for someone to suggest what I need to do.

 

Thanks again for all the help. I try not to ask unless I'm hopelessly stuck.

 

Hop

Link to comment
Share on other sites

A simple example.

 

<?php

  // connect to db.

  if (isset($_POST['uname'] && isset($_POST['upass'])) { // this is the username and password the user is trying to sign up with.
    $sql = "SELECT username FROM guildroster WHERE username = '" . mysql_real_escape_string($_POST['uname']) . "'";
    if ($result = mysql_query($sql)) {
      if (mysql_num_rows($result)) {
        // user is valid, go about adding the new registration.
      } else {
        // user is not a member of guild.
      }
    }
  }

?>

Link to comment
Share on other sites

A simple example.

 

Code:

 

<?php

 

  // connect to db.

 

  if (isset($_POST['uname'] && isset($_POST['upass'])) { // this is the username and password the user is trying to sign up with.

    $sql = "SELECT username FROM guildroster WHERE username = '" . mysql_real_escape_string($_POST['uname']) . "'";

    if ($result = mysql_query($sql)) {

      if (mysql_num_rows($result)) {

        // user is valid, go about adding the new registration.

      } else {

        // user is not a member of guild.

      }

    }

  }

 

?>

That's awesome! But where would I put that? In usercp_register.php? Or elsewhere? And where in that file?

Thanks again for the response

Link to comment
Share on other sites

Its not a copy and paste solution. How would I know what your file structure looks / works like?

Agreed, sorry.

 

I know something gets accessed in the PHPBB2 system when that page comes up that allows a new user to register. I just wanted to know how I can get into that process and add my database check. I tried a place I thought would work for me, and the code I put in there didn't even fire off at all. I have no idea. Maybe if I could study a manual on the inner-workings of PHPBB2 forums, but I haven't found that either, so I have no clue how I can put this guild database check into the forums we use.

 

Sorry if I didn't explain myself more clearly earlier. I'm trying to give you guys all the info you need to help me. It's certainly appreciated!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.