Jump to content

PHPBB3 External Registration


MathewHood

Recommended Posts

Hey,

 

I have written an external login script for my PHPBB3 forums but I am having trouble writing the script to allow the user to register and have their information added into the table phpbb_users which stores the phpbb account details.

 

I have tried some code and written my own but I cannot seem to get it to input the data into the tables.

 

Has anyone written a script for this or know of a place that I can learn how to do it???

 

Regards,

 

Mathew Hood

Link to comment
Share on other sites

  • 9 months later...

This is the base work around it for handling multiple of the same entry etc. Put it in a file like formSubmit.php and save it in the root directory of the forum. Then have your form action call this using Post and it should all be good.

 

<?php

    $username = $_POST[username];
    $password = $_POST[password];
    $email_address = $_POST[email];

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
require('./includes/functions_user.php');

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewtopic');

    global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;

    $user_row = array(
        'username'                => $username,                //REQUIRED IN FORM
        'user_password'            => md5($password),            //REQUIRED IN FORM
        'user_email'            => $email_address,            //REQUIRED IN FORM
        'group_id'                =>    0,//(int) $group_id,
        'user_timezone'            => $timezone = date(Z) / 3600,//(float) $data[tz],
        'user_dst'                => date(I),//$is_dst,
        'user_lang'                => $user->lang_name,//$data[lang],
        'user_type'                => USER_NORMAL,//$user_type,
        'user_actkey'            => '',//$user_actkey,
        'user_ip'                => $user->ip,
        'user_regdate'            => time(),
        'user_inactive_reason'    => 0,//$user_inactive_reason,
        'user_inactive_time'    => 0,//$user_inactive_time,
    );


// Register user...
    $user_id = user_add($user_row);

?>
<html>
<head> 
<meta http-equiv="REFRESH" content="5;url=http://YourWebsiteForum.com">
</HEAD>
<body>
Thank you For Registering. You will be sent to the forum shortly <br>or you can click <a href="http://YourWebsiteForum.com">here</a> if you do not want to wait.
</body 
</html>

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.