This code is for the phpBB forums and it does work but it leaves the user inactive and they're username is [first name][lastname][pilot no.]. How can I put gaps between that stuff and get the user active?
This is the code I have in the ForumRegister module as ForumRegister.php
<?php
class ForumRegister extends CodonModule
{
public function __construct()
{
CodonEvent::addListener('ForumRegister');
}
public function EventListener($eventinfo)
{
if($eventinfo[0] == 'registration_complete')
{
$userinfo = $eventinfo[2];
$fname = $userinfo['firstname'];
$lname = $userinfo['lastname'];
$pass = $userinfo['password1'];
$email = $userinfo['email'];
$code = $userinfo['code'];
//mysql_query("INSERT INTO phpbb_users (username, user_password, group_id, user_timezone, user_dst, user_lang, user_type, user_actkey, user_dateformat, user_style, user_regdate) VALUES ($userr, $pass, '2','1.0', '0','en','0','','d M Y H:i', '1', time())");
$get_uinfo = mysql_query("SELECT * FROM phpvms_pilots WHERE firstname='".$fname."' AND lastname='".$lname."' AND email='".$email."'");
echo "Result Select: ".mysql_error()."<br>";
$uinfo = mysql_fetch_array( $get_uinfo );
//echo "Uinfo: ".$uinfo['pilotid'];
$str = $uinfo['pilotid'];
$pilot_id = str_pad ($str,4,"0",STR_PAD_LEFT);
$pilot_id = $fname.$lname.$code.$pilot_id;
$pilot_id_klein = strtolower($pilot_id);
//echo "Pass: ".$pass."<br>";
$passMD5 = md5($pass);
//echo "Pass MD5: ".$passMD5."<br>";
echo "PilotID: ".$str."<br>";
$tm = time();
mysql_query("INSERT INTO phpbb_users (username, username_clean, user_password, user_email, group_id, user_timezone, user_dst, user_rank, user_lang, user_colour, user_type, user_actkey, user_dateformat, user_style, user_regdate) VALUES ('".$pilot_id."', '".$pilot_id_klein."', '".$passMD5."', '".$email."', '9','0.0', '0', '2','en','0099FF','1','5BN4938HB2','D M d, Y g:i a', '2', '".$tm."')");
//mysql_query("INSERT INTO phpbb_users (username, user_password) VALUES ('".$pilot_id."', '".md5($userinfo['password'])."')");
//echo "Result: ".mysql_error()."<br>";
//print_r($userinfo);
}
}
}
?>
cheers,
roboa
p.s I have phpBB and phpVMS in the same db if it helps