Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-14-2011, 12:28 AM
Jaejoong1 Jaejoong1 is offline
 
Join Date: Dec 2010
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 12-14-2011, 02:36 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #3  
Old 12-14-2011, 03:40 AM
Jaejoong1 Jaejoong1 is offline
 
Join Date: Dec 2010
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #4  
Old 12-14-2011, 04:16 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 12-14-2011, 05:01 AM
Jaejoong1 Jaejoong1 is offline
 
Join Date: Dec 2010
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #6  
Old 12-14-2011, 08:40 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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);
Reply With Quote
Благодарность от:
Lynne
  #7  
Old 12-14-2011, 02:48 PM
Jaejoong1 Jaejoong1 is offline
 
Join Date: Dec 2010
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

On top as in under <?php> Correct?
Reply With Quote
  #8  
Old 12-14-2011, 02:51 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 12-14-2011, 07:17 PM
Jaejoong1 Jaejoong1 is offline
 
Join Date: Dec 2010
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It worked! THANKS ALOT!
Reply With Quote
  #10  
Old 12-14-2011, 09:21 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:07 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04841 seconds
  • Memory Usage 2,255KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (8)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete