Administrators Nabeel Posted February 8, 2009 Administrators Report Posted February 8, 2009 There's a conflict with class names in using their routine Quote
RogerB Posted February 8, 2009 Report Posted February 8, 2009 I hate PHPBB, I use SMF....did you guys get this working? Quote
STF-DIR Posted February 8, 2009 Report Posted February 8, 2009 Have a look on the phpbb3 forums, it is possible but not easy, you have to use their routine because its links to all other settings and stuff, if you fill in a username and email in this template code it does work the password files is the tricky one however you can register new users without password and they can use the forgot / reset password to set a new one. <?php /** * Created on 22-nov-2008 17:10:39 * * Phpbb3 -- register_extern.php * @author Ramon Fincken http://www.ramonfincken.com/permalink/topic82.html * @author Mr Kirkland http://www.mrkirkland.com/adding-a-user-to-phpbb3-from-an-external-script/ */ define('IN_PHPBB', true); $phpbb_root_path = ''; // Your path here $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.php'); // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup(); require($phpbb_root_path .'includes/functions_user.php'); $username = ''; $password = ''; // Do NOT encrypt ! $email = ''; // Please validate this email yourself ! Phpbb will accept non-valid emails. // Do a check if username is allready there, same for email, otherwhise a nasty error will occur $user_row = array( 'username' => $username, 'user_password' => md5($password), 'user_email' => $email, 'group_id' => 2, #Registered users group 'user_timezone' => '1.00', 'user_dst' => 0, 'user_lang' => 'en', 'user_type' => '0', 'user_actkey' => '', 'user_dateformat' => 'd M Y H:i', 'user_style' => 1, 'user_regdate' => time(), ); $phpbb_user_id = user_add($user_row); echo "New user id = ".$phpbb_user_id; /code] ?> So you can see above that all that needs to be filled in is the, $username = ''; $password = ''; // Do NOT encrypt ! $email = ''; // Please validate this email yourself ! Phpbb will accept non-valid emails. Presto new account created, so if you manually typed in $username = 'username'; $password = ''; // Do NOT encrypt ! $email = 'you@yourdomain.com'; // Please validate this email yourself ! Phpbb will accept non-valid emails. That would be enough to create the new account Hello, thanks for the Answer, but when i use this code inside the ForumRegistration.php there is a conflict with the template classe i think. I will say if i copy and paste this code inside the registered Module i become a error. Can you help pls ? Matthias Quote
Moderators mark1million Posted February 8, 2009 Author Moderators Report Posted February 8, 2009 Yes it does thats because as Nabeel siad there's a conflict with class names in using their routine. I think its a bit unfair to ask for support here on this matter, Nabeel has done a fantastic job in creation of this VA admin software which is ongoing and you have to agree its fantastic. Im sure its possible but i dont have the answers and im sure Nabeel hasn't got the time to develop this at the moment as well, but if he has a chance then im sure he will but its not a priority. Quote
STF-DIR Posted February 8, 2009 Report Posted February 8, 2009 Yes it does thats because as Nabeel siad there's a conflict with class names in using their routine. I think its a bit unfair to ask for support here on this matter, Nabeel has done a fantastic job in creation of this VA admin software which is ongoing and you have to agree its fantastic. Im sure its possible but i dont have the answers and im sure Nabeel hasn't got the time to develop this at the moment as well, but if he has a chance then im sure he will but its not a priority. Wowwowwow...yes, i'm absolutely with you !!! He has done a absolutely fantastic job with phpVMS !!!! But i only need to find a solution, not only from hm, also from other users here. I think here are other user using the phpBB3 with an automatic user registration. I think its also possible to open a new connection to the phpBB3 Database and then fill in the UserData or not ? I only not have the expirience about php and sql. Matthias Quote
Leiserson Posted February 8, 2009 Report Posted February 8, 2009 Why open a new connection when you could just use the same one. merging the DB's is no trouble at all...The table name im sure are different than that of phpvms...just use the same database. Quote
STF-DIR Posted February 9, 2009 Report Posted February 9, 2009 ok, ihave reinstalled the phpBB3 and it uses now the same database as phpVMS. But as i sayd before, i am not the crack of php and so on. So can you please give me an example of code how i can add a user in phpBB3's user table and how i can find the name of the registering user from phpVMS ? Thanks Matthias Quote
Administrators Nabeel Posted February 9, 2009 Administrators Report Posted February 9, 2009 Table names do differ, that's why there's the table prefixes also. To get the name etc of the registered user in the event: if($eventinfo[0] == 'registration_complete') { $userinfo = $eventinfo[2]; $userinfo->firstname; $userinfo->lastname; $userinfo->password; $userinfo->email etc, That's probably all you need, but do print_r($userinfo) to get all the fields. You can open a new DB connection if phpBB is a different DB. That's not a problem. I usually keep different apps on different DBs. Quote
STF-DIR Posted February 9, 2009 Report Posted February 9, 2009 Hello, ok, i have found a solution to create a user for the phpBB3. <?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 = $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_lang, user_type, user_actkey, user_dateformat, user_style, user_regdate) VALUES ('".$pilot_id."', '".$pilot_id_klein."', '".$passMD5."', '".$email."', '2','1.0', '0','de','0','','d M Y H:i', '1', '".$tm."')"); //mysql_query("INSERT INTO phpbb_users (username, user_password) VALUES ('".$pilot_id."', '".md5($userinfo['password'])."')"); echo "Result: ".mysql_error()."<br>"; print_r($userinfo); } } } Sorry, i will sort the code later. For them moment i need a code that a user ( i have created or alway is in the phpBB3 Database ) is automaticly logged in after he clicked a link to reach the Forum. I have searched in the php Forum , but nothin found. Can anyone help about this ? Matthias Quote
Administrators Nabeel Posted February 9, 2009 Administrators Report Posted February 9, 2009 I'm not sure if you can automatically log-in, since phpBB does send a confirmation link until they are activated Quote
STF-DIR Posted February 9, 2009 Report Posted February 9, 2009 I'm not sure if you can automatically log-in, since phpBB does send a confirmation link until they are activated Hello, the user is activated, thats not the Problem. Its only the automatic login. Matthias Quote
Moderators mark1million Posted February 9, 2009 Author Moderators Report Posted February 9, 2009 Hi Matthias, i have tried your code above and its not working for some reason, any ideas? Quote
Moderators mark1million Posted February 9, 2009 Author Moderators Report Posted February 9, 2009 For them moment i need a code that a user ( i have created or alway is in the phpBB3 Database ) is automaticly logged in after he clicked a link to reach the Forum. I have searched in the php Forum , but nothin found. Can anyone help about this ? Matthias I remember seeing the code for this on the forums in phpbb3 mods, when you login to say phpvms you are logged in at the same time to the forum, its there somewhere because i came across it looking for the code above. Quote
STF-DIR Posted February 9, 2009 Report Posted February 9, 2009 Hi Matthias, i have tried your code above and its not working for some reason, any ideas? Hello, whats the Problem exactly with the code ? Any Error Messages ? ( i must go to work now ... but i will try to answer ) Matthias Quote
STF-DIR Posted February 9, 2009 Report Posted February 9, 2009 I remember seeing the code for this on the forums in phpbb3 mods, when you login to say phpvms you are logged in at the same time to the forum, its there somewhere because i came across it looking for the code above. Thanks for answer. Where have you see the code for automated login in phpBB Forum ? Have you a link for me ? I have nothing found. Matthias Quote
Moderators mark1million Posted February 9, 2009 Author Moderators Report Posted February 9, 2009 Right i have made a couple of changes, so now the code will register firstname lastname and pilot number, however for some reason it inserts in to the table ok but doesn't correctly register the new account as type 2 even though its in the script, users can log in but they are not registered properly for some reason. Im looking for you other code now, will post here when i find it. Quote
Administrators Nabeel Posted February 9, 2009 Administrators Report Posted February 9, 2009 For usertype its '2', try doing 2 without the quotes Quote
STF-DIR Posted February 10, 2009 Report Posted February 10, 2009 Hello again, i have the next Problem : I have now changed the core_navigation template and have here a Link "Forum" to core/modules/forum/login.php login.php is my automatic login script to phpBB3. Here i need the Pilot ID and password and thats the Problem. i can not take a link to the login.php eg core..login.php?pilotID=STF0001&password=userpassword :-) so all can see the password. What can i do ? Sessions ? But i need help here. I have no expirience about php and sessions. Or how can i change the Link eg. to /index.php/ForumLogin as example ? same as the other navigation links eg. Pilots as /index.php/pilots ? How can i do this ? Matthias Quote
Administrators Nabeel Posted February 10, 2009 Administrators Report Posted February 10, 2009 Err, passing in the password? You can access the logged in userdata as: Auth::$userinfo->email, Auth::$userinfo->password, etc Quote
STF-DIR Posted February 10, 2009 Report Posted February 10, 2009 Hello, yes, but as i sayd, i will not do something like that : core/modules/forum/login.php?pilotID=STF0001&password=userpassword to call the automatic login script. I will hidde the part with username an password. Matthias Quote
Moderators mark1million Posted February 11, 2009 Author Moderators Report Posted February 11, 2009 Hi Guys sorry to keep banging on about this thread but i have managed to get this to work for SMF forums, the only problem i have is i want to put a space in the username of the forum, currently when someone registers it registers the following, flrstnamelastnamegtsxxx what i want is firstname lastname gtsxxx but im unsure how to put a space between the code i have to get the values, $pilot_id = $fname.$lname.$code.$pilot_id; Hope you know what im trying to say. Thanks Quote
Administrators Nabeel Posted February 12, 2009 Administrators Report Posted February 12, 2009 $pilot_id = $fname.' '.$lname.' '.$code.$pilot_id; To get the properly formatted pilot ID (with the proper # of zeros, etc), call: $pilot_id = PilotData::GetPilotCode($code, $pilot_id); $pilot_id = $fname .' '.$lname. ' ' . $pilot_id; Though I'm not sure if you're still "inside" phpVMS to be able to access the PilotData class. Quote
Moderators mark1million Posted February 15, 2009 Author Moderators Report Posted February 15, 2009 Right guys, i thought id post my code, now i got to tell you i have no experience in coding, so i make no excuses now. This is what im using to interface with phpVMS, i have a few settings in the forum as well for this to work, you must have admin approval set in the forum this is a good idea as it stops nasty people registering on your forum and spamming. I have also created another user group "pilots" which is why you see group id 9, the normal registered user group in 2. Like i said im no coder but this works for me. Must also mention that both databases are in one, if yours are separate then just connect before. SMF users just rename the php_users to your members table and change other settings as required. <?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); } } } ?> Quote
Administrators Nabeel Posted February 15, 2009 Administrators Report Posted February 15, 2009 Must also mention that both databases are in one, if yours are separate then just connect before. SMF users just rename the php_users to your members table and change other settings as required. Wait, what? Are you renaming tables? Quote
Moderators mark1million Posted February 15, 2009 Author Moderators Report Posted February 15, 2009 No no..... if you use phpbb then the members tables are phpbb_users and smf they are smf_users , i think, no phpvms tables are renamed Quote
Administrators Nabeel Posted February 15, 2009 Administrators Report Posted February 15, 2009 Oh ok... read it wrong. Yeah, don't rename tables lol Quote
Haxbypilot Posted February 26, 2009 Report Posted February 26, 2009 Ahhh! theres so much code im getting confused Can you include it in the next update or kindly write a step by step guide on where and what codes to put in ;D Quote
Wayne Posted April 22, 2009 Report Posted April 22, 2009 So to get this to work we just need to add this into the registering form that is on phpvms right? Do we somehow add it to the submit link/button? Quote
nexiss Posted April 23, 2009 Report Posted April 23, 2009 I think if I read it right that code goes in a new module called ForumRegister Quote
RogerB Posted April 23, 2009 Report Posted April 23, 2009 That would be great if this works, I use SMF also. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.