News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Strange problem with SMF integration hook

Started by yacekt, August 05, 2008, 07:31:01 AM

Previous topic - Next topic

yacekt

Hello

I've got a problem with integration with my CMS. after applying integration hooks
integrate_verify_user and integrate_logout and adding another password encryption method $other_passwords[] in LogInOut.php ewerything works ok, but when i press logout button there goes a blank page (no errors). There is actually a correct logout (after reloading that page it works fine), but there is the same problem, when I try to login to SMF using login/password from my cms, when login/pass is correct blank page shows up.

here's the code for integration hooks, i had to add a session_start() in that file to get logged user data:

error_reporting(E_ALL & ~E_NOTICE);
@set_magic_quotes_runtime(0);
session_start();

define('SMF_INTEGRATION_SETTINGS', serialize(array(

'integrate_verify_user' => 'integrate_verify_user',
'integrate_logout' => 'integrate_logout'

)));


function integrate_logout ()
{
$_SESSION["spaces"]=array();
}


function  integrate_verify_user()
{
global $db_prefix;

if($_SESSION['spaces']['user']['user_id']>0){

$zapyt="SELECT * FROM ".$db_prefix."members WHERE ID_MEMBER='".$_SESSION['spaces']['user']['user_id']."' ";
$result=db_query($zapyt, __FILE__, __LINE__);
if($row = mysql_fetch_assoc($result)){

$memb_ID=$_SESSION['spaces']['user']['user_id'];

}else{

$zapyt2="INSERT ".$db_prefix."members SET
ID_MEMBER='".$_SESSION['spaces']['user']['user_id']."',
memberName='".$_SESSION['spaces']['user']['login']."',
realName='".$_SESSION['spaces']['user']['name']."',
emailAddress='".$_SESSION['spaces']['user']['email']."',
passwd='".$_SESSION['spaces']['user']['pass']."',
ID_GROUP=4,
showOnline=1,
notifyAnnouncements=1,
notifyOnce=1,
notifyTypes=2,
is_activated=1
";
$result2=db_query($zapyt2, __FILE__, __LINE__);
if($result2) $memb_ID=$_SESSION['spaces']['user']['user_id'];
else $memb_ID=0;
}
}else $memb_ID=0;
return $memb_ID;
}


Orstio

A blank page is usually an indication of a PHP error with error suppression turned on.

Check your site control panel for error messages.

yacekt

Wow, that was a fast reply :)

but there are no errors reported... I've got error_reporting(E_ALL & ~E_NOTICE);
And log file for php errors shows no error neither...

Orstio

Can I see the page?

Do you have your CMS and SMF in the same database?

yacekt

ok, here's the adres:

hxxp:www.pta.med.pl/forum/index.php [nonactive]

try to login test/test


Orstio

Yes, you are definitely getting a PHP error.  Nothing in your SMF error log, either?

This link:

http://www.pta.med.pl/forum/index.php

Is not to your CMS, is it?

Can I see the code you've added to LoginOut.php?

In which file did you put the integration hook code you posted above?

yacekt

#6
LogInOut.php

$other_passwords[] = crypt($_REQUEST['passwrd'], '$'.substr(md5($_REQUEST['passwrd']),0,8).'$');


and when I'm not including my bridge (in index.php) this works fine, it checks the pass ok and convert it to SMF style pass.

the include for may bridge goes like that:


...

// Load the settings...
require_once(dirname(__FILE__) . '/Settings.php');

// And important includes.
require_once('pta.php');

...


My CMS is here: hxxp:www.pta.med.pl/ [nonactive]

Maybe there are some error suppression done by @... ?

EDIT:
Well that's funny, even if I include an EMPTY bridge file (just <?php and ?> the rest is comments) it does not work :)


EDIT2:

Ok it WORKS. I don't know what exacly was wrong, but after making new file for bridge and require_once() to require() it started cooperating :)

My guess is that there was a problem with language coding of bridge file. First it was in UTF-8 then by accident it was ISO 8859-2 an in the end in UTF-8.

Orstio

Good job troubleshooting.  :)  Glad it worked out.

Advertisement: