Encoding and saving password during login

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Punkis
    New Member
    • Sep 2008
    • 12

    Encoding and saving password during login

    Hello all.
    I am having some questions about a subject.
    I am running a small social community using SocialEngine and i want to include phpbb3 with an arcade mod or any arcade board that support high scores.
    My problem is that i do not want my users to re-register into the board. So if I manage to encode the password during login, into the encoding system of phpbb3 or just md5, I will make the registrations my self through the database.

    That means they will login every time they want to access the arcade unless they press remember me, but they will not register themselves.

    I know that this is something that is able to be made.
    Also is there any chance to make the login into the arcade automatic?
    There is tutorial and a script that it is used for phpbb2 and it is available here http://www.socialengine.net/tutorial...tutorial_id=44

    Thank you all.
  • Punkis
    New Member
    • Sep 2008
    • 12

    #2
    This is a code i found into the socialengine's plugin.
    I think this does all the work

    Code:
    	// THIS METHOD CREATES A FORUM USER WITH THE SAME USERNAME AS THE CURRENT USER
    	// INPUT: 
    	// OUTPUT: 
    	function forum_user_create() {
    	  global $db, $board_config;
    
    	  // GET NEXT USER ID
    	  $row = $db->sql_fetchrow($db->sql_query("SELECT MAX(user_id) AS max_user_id FROM " . USERS_TABLE));
    	  $forum_user_id = $row['max_user_id'] + 1;
        
    	  // ENCRYPT PASSWORD
    	  $password_md5 = md5(randomcode());
    		
    	  // SET DEFAULT VALUES FOR SOME VARIABLES
    	  $viewemail          = FALSE;
    	  $allowviewonline    = TRUE;
    	  $notifyreply        = FALSE;
    	  $notifypm           = TRUE;
    	  $popup_pm           = TRUE;
    	  $attachsig          = $board_config['allow_sig'];
    	  $allowhtml          = $board_config['allow_html'];
    	  $allowbbcode        = $board_config['allow_bbcode'];
    	  $allowsmilies       = $board_config['allow_smilies'];
    	  $user_style         = $board_config['default_style'];
    	  $user_dateformat    = $board_config['default_dateformat'];
    	  $user_timezone      = $board_config['board_timezone'];
    	  $user_lang          = $board_config['default_lang'];
        
    	  // BEGIN PHPBB2 INSERT
    	  $db->sql_query("INSERT INTO " . USERS_TABLE . "(user_id,
    							username,
    							user_regdate,
    							user_password,
    							user_email,
    							user_viewemail,
    							user_attachsig,
    							user_allowsmile,
    							user_allowhtml,
    							user_allowbbcode,
    							user_allow_viewonline,
    							user_notify,
    							user_notify_pm,
    							user_popup_pm,
    							user_timezone,
    							user_dateformat,
    							user_lang,
    							user_style,
    							user_level,
    							user_allow_pm,
    							user_active,
    							user_actkey
    							) VALUES (
    							'$forum_user_id',
    							'".$this->user_info[user_username]."',
    							'".time()."', 
    							'$password_md5',
    							'".$this->user_info[user_email]."',
    							'$viewemail',
    							'$attachsig',
    							'$allowsmilies',
    							'$allowhtml',
    							'$allowbbcode',
    							'$allowviewonline',
    							'$notifyreply',
    							'$notifypm',
    							'$popup_pm',
    							'$user_timezone',
    							'".str_replace("\'", "''", $user_dateformat)."',
    							'".str_replace("\'", "''", $user_lang)."',
    							'$user_style',
    							0,
    							1,
    							1,
    							'')");

    Comment

    Working...