News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

How to integrate SMF with another user database?

Started by rubix123, February 20, 2012, 01:27:46 AM

Previous topic - Next topic

rubix123

I am using SMF 2.0.2 and the php script here http://www.ampjuke.org/. AmpJuke uses a MySQL database and has its own user system and registration. How would I go about integrating SMF with that user system? Any information to help me get started on the right path would be appreciated.  ::)

Here is the login code for AmpJuke, could I change this to SMF some how and then add the AmpJuke tables to the SMF database?
Quote
$connection=mysql_connect($db_host,$db_user,$db_password) or die('Could not connect.');
mysql_select_db($db_name) or die('Could not select database !');

// 0.3.7: Changed two statements from $HTTP_POST_VARS to $_POST.
// 0.7.2: Ensure we ONLY accept letters+numbers:
$user=ereg_replace('[^a-zA-Z0-9]', "", $_POST['login']);
$pw=ereg_replace('[^a-zA-Z0-9]', "", $_POST['password']);

$qry="SELECT * FROM user WHERE name='$user' AND password='$pw'";

// 0.6.7: Take table-prefixes into account:
if (isset($ampjuke_tbl_prefix)) {
   $qry=str_replace("FROM ", "FROM $ampjuke_tbl_prefix", $qry);
}   
$result=mysql_query($qry)
   or die('Could not select a username from the user-table. Have you installed AmpJuke correctly ?');

Currently you have to make an account for each the forum and AmpJuke script. How can I put them together into 1 account?

Kindred

Look at the integration functions, if you want SMF to be the primary user system, or the SMF API if you want the other system to be the primary
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: