PDA

View Full Version : Hooking into registration process. Check for validity


minifisch
07-31-2012, 05:30 PM
Hey guys!

I'm the owner of an upcoming german Minecraft community and I'm the web developer for our main site, running on the newest vBulletin 4.
My problem explained:
I need to check a custom field (field5, MC-Account) for validity with the following url (http://www.minecraft.net/haspaid.jsp?user=minifisch") - if the answer from the request ist true, the registration is complete. If the answer from the minecraft.net site is false, the user cant register and some error message is showing up.

So, my question is:
Is there a documentation about the registration process? I'm very new to PHP and its very difficult for me to learn new script languages.

Can someone help me with my "minecraft-user-validation" code?

kh99
07-31-2012, 11:02 PM
There isn't much in the way of detailed documentation. You can look in the article section for somethign related to registration, but the best way (IMHO) is to look at register.php and see what's going on.

In your case, I think you could create a plugin using hook register_addmember_process and something like this:

if (!empty($vbulletin->GPC['userfield']['field5']))
{
$url = 'http://www.xminecraft.net/haspaid.jsp?user=' . urlencode($vbulletin->GPC['userfield']['field5']);
$reply = @file_get_contents($url);
if ($reply === 'false')
{
// hasn't paid
eval(standard_error(fetch_error('not_paid', $vbulletin->GPC['userfield']['field7'])));
}
else if ($reply !== 'true')
{
// couldn't complete check (site is down or whatever)
eval(standard_error(fetch_error('check_failed')));
}
}




and then you'd have to create the phrases 'not_paid' and 'check_failed' (you can chnage those varnames to whatever you want, of course).

minifisch
08-04-2012, 04:28 PM
*Looking for any kind of thank button :3*

Thank you very much! This help us alot from preventing trolls und fakers.
Now, there is only one thing left to check for:
field5 should be unique in our database, if any one have already the same content in field5 (MC-User) there should show up a message like: "The Minecraft.net account is already in use by: <nameofuser>"

Edit:
Got it to work, now there is another problem:
Could not find phrase 'account_in_use'.

Phrase "account_in_use" is created and filled with text. :(

kh99
08-05-2012, 12:34 AM
Now, there is only one thing left to check for:
field5 should be unique in our database, if any one have already the same content in field5 (MC-User) there should show up a message like: "The Minecraft.net account is already in use by: <nameofuser>"

Maybe something like (goes just inside the first 'if':

$result = $vbulletin->db->query_first("SELECT userid FROM " . TABLE_PREFIX . "userfield WHERE field5='" . $vbulletin->db->escape_string($vbulletin->GPC['userfield']['field5']) . "' LIMIT 1");
if ($result)
{
eval(standard_error(fetch_error('account_in_use')) );
}


Got it to work, now there is another problem:
Could not find phrase 'account_in_use'.

Phrase "account_in_use" is created and filled with text. :(

What phrase type did you make that phrase? It has to be one that's loaded for that page.

minifisch
08-05-2012, 01:13 AM
I tried it with type GLOBAL and type "Benutzeroberfl?che: Registrierung" - userinterface: register

I have set up the field text and the transation field for german.
Still showing me that he cant find the correct phrases.