vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   need some help. Register.php (https://vborg.vbsupport.ru/showthread.php?t=275460)

Jaejoong1 12-14-2011 12:28 AM

need some help. Register.php
 
Currently i am trying to connect my registration for my Maplestory Server, to my forums.
I've successfully connected the database for the server and the forums together (to allow you to register on the forums and make it your game id as well) however when they register , the password is sent as an empty string , so when i try to login there is technically no 'password' to login with which is why i cannot login.

i've noticed that
Code:

$vbulletin->GPC['passwordconfirm'] OR (strlen($vbulletin->GPC['password_md5'])
lets us protect the md5 string but not the r aw string.

Does anyone have a solution as to why it's ending up as a empty string? Better yet does anyone have a solution for me to fix it Here is my register.php

kh99 12-14-2011 02:36 AM

I'm not sure I follow everything you're saying. But my understanding of the code you posted above is that it allows the password to be sent from the browser to the server either as plain text or encrypted with md5 in case the browser doesn't have javascript enabled. So I think the raw password is blank because it isn't sent if the browser has js enabled and is able to encrypt it (because obviously that would defeat the entire purpose of encrypting it).

Jaejoong1 12-14-2011 03:40 AM

What the script is ,is basically you registering for both the GameServer, and the Forums at the same time (thus both being linked together) .

and do you think you could explain this whole javascript thing to me?

Lynne 12-14-2011 04:16 AM

I had to remove the file from your first post. You may not repost a vbulletin file. You may only post the changes you made to the file.

Jaejoong1 12-14-2011 05:01 AM

My apologies.

Under

Code:

$userdata->set('ipaddress', IPADDRESS);
I put

Code:

  /* MapleStory Registration Start */
    $conn = mysql_connect('localhost', 'root', 'passwordhere') or die("An Error Has Occured - Please Contact An Administrator (REF#MC-)");
    mysql_select_db('dbnamehere', $conn) or die("An Error Has Occured - Please Contact An Administrator (REF#MCDB)");
   
        ## Variabless (not really needed :P)
        $IANname = $vbulletin->GPC['username'];
        $IANpassword = sha1($vbulletin->GPC['password']);
        $IANdob = $vbulletin->GPC['year'].'-'.$vbulletin->GPC['year'].'-'.$vbulletin->GPC['year'];
        $IANemail = $vbulletin->GPC['email'];
       
        ## Username Check.
        function checkUsername($++++++ry, $obj)
        {
            $query = sprintf("
            SELECT COUNT('id')
            FROM accounts
            WHERE name = '%s'",
            $++++++ry);
            $result = mysql_query($query, $obj);
            $total = mysql_result($result, 0);
            return $total;
        }

        if (checkUsername($IANname, $conn) > 0) {
            $userdata->error('usernametaken', $vbulletin->GPC['username']);    // Reusing vBulletin's Error :P ?
        }
    /* MapleStory Reg End */

and under

Code:

$show['errors'] = false;
I Put

Code:

/* Save MapleStory Data */
        $query = sprintf("
        INSERT INTO
        accounts (name, password, birthday, email, lastknownip)
        VALUES ('%s', '%s', '%s', '%s', '%s')",
        $IANname, $IANpassword, $IANdob, $IANemail, IPADDRESS);
        if (!mysql_query($query, $conn)) {
            die ('Stuff Hpapens: '.mysql_error());
        }
        mysql_close($conn);
        /* End Data Here */


In

Ajax.php

under
Code:

$userdata->set('username', $vbulletin->GPC['username']);
I put

Code:

  /* MapleStory  #2 */
    $conn = mysql_connect('localhost', 'root', 'passwordhere') or  die("An Error Has Occured - Please Contact An Administrator (REF#MC-)");
    mysql_select_db('dbnamehere', $conn) or  die("An Error Has Occured - Please Contact An Administrator  (REF#MCDB)");

        ##  username check.
        function checkUsername($++++++ry, $obj)
        {
            $query = sprintf("
            SELECT COUNT('id')
            FROM accounts
            WHERE name = '%s'",
            $++++++ry);
            $result = mysql_query($query, $obj);
            $total = mysql_result($result, 0);
            return $total;
        }

        if (checkUsername($vbulletin->GPC['username'], $conn) > 0) {
            $userdata->error('usernametaken', $vbulletin->GPC['username']);    // Reusing vBulletin's Error :P ?
        }

    mysql_close($conn);
    /* MapleStory  Ends... Again */




Basically, what it is , it registers for both the forums, and my gameserver. In this case i connected the forums with the gameserver and i'm trying to make it so that registering for the forums will also register for the gameserver. However, when i register right now the password is sent as an empty string and is blank thus not allowing me to login to the gameserver. That is what i need help with

kh99 12-14-2011 08:40 AM

What I was trying to say is that the password isn't sent as plain text if the browser can encrypt it, that's why the password field is blank. But in any case, it turns out you're not the first one to have this issue - there's a value you can define that should stop the password field from being cleared. Try adding this to the top of your register.php:

Code:

define('DISABLE_PASSWORD_CLEARING', true);

Jaejoong1 12-14-2011 02:48 PM

On top as in under <?php> Correct?

kh99 12-14-2011 02:51 PM

Yes, it probably doesn't matter too much where it is exactly, but I think I'd put it somewhere before any include or require lines.

Jaejoong1 12-14-2011 07:17 PM

It worked! THANKS ALOT! :D

kh99 12-14-2011 09:21 PM

Cool. By the way, someone else was trying to do the same thing and found out that the config.php file is a good place to put the define statement, if you don't want to edit the other vb files.


All times are GMT. The time now is 10:37 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00976 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete