15 years on The Web
miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Specific miniBB Support Forums / Specific /   

Member integration into site error

Author catty121
Registered
#1 | Posted: 27 Jul 2016 05:30 
Hi! I hope posted this in the right area!
I'm using the synchronizing guide to integrate my forum into the site without having my members sign up again.
I thought I followed everything in the guide to a T when I got this message:
"Operation can not be completed. Either you are trying to access a section of the forums, which you do not have access to, either trying to execute an action, which is not allowed for you. Please, contact forums administrator to ask more about this problem, if you are sure this is a mistake. "

^It happened after I tried editing the bb_cookie.php file. I even used the premade one and still the same thing. I am able to see the information need in both my_session and my_index.php

Author Paul
Lead Developer
#2 | Posted: 27 Jul 2016 14:00 
When exactly have you got this message? Clicking what or entering what kind of area?

This error is mostly related to the access rights, and is not related to synchronization. For example, as a regular member, you could enter the closed forum when there's no access allowed. Or as a regular member, you may try to access some admin option.

Author catty121
Registered
#3 | Posted: 27 Jul 2016 14:35 | Edited by: catty121 
I got this message after adding this code of text, it's longer but I added a snippet.

function user_logged_in() {

$c=array('', '');

if(isset($GLOBALS['cook']) and trim($GLOBALS['cook'])!='') {
$c=explode('|',$GLOBALS['cook']);
if($row=db_simpleSelect(0, $GLOBALS['Tu'], $GLOBALS['dbUserId'], $GLOBALS['dbUserSheme']['username'][1], '=', $c[0], 1)){
$c=array($c[0], $row[0]);
}
}
else $c=getMyCookie();

$username=$c[0];

I was logged in as admin and the error still was there. However, by manually inputting in the url to the bb_admin I was able to access it.

Author Paul
Lead Developer
#4 | Posted: 27 Jul 2016 16:19 | Edited by: Paul 
Obviously there appears some mistake in your code, which resets $user_id or provides some wrong information at the certain stage. You need to debug your code, putting this or that at the certain stages of code execution:

echo $username;

or even better

echo $user_id;

and try to understand if the script is really getting the user_id value from the cookie properly.

Note that in default version of bb_cookie.php, there are different codes for handling the admin and a regular user.

Author catty121
Registered
#5 | Posted: 28 Jul 2016 02:22 | Edited by: catty121 
^ I'm having trouble following...when I log into my_index.php it says: You are logged in as Paul (ID: 2) Logout
When I check the session it says: Array ( [auth] => Paul [ID] => 2 )

When I added this code:

if (!defined('INCLUDED776')) die ('Fatal error.');

$cookieexptime=time()+$cookie_expires;
@session_start();

function user_logged_in() {

$c=array('', '');

if(isset($GLOBALS['cook']) and trim($GLOBALS['cook'])!='') {
$c=explode('|',$GLOBALS['cook']);
if($row=db_simpleSelect(0, $GLOBALS['Tu'], $GLOBALS['dbUserId'], $GLOBALS['dbUserSheme']['username'][1], '=', $c[0], 1)){
$c=array($c[0], $row[0]); echo $username;
}
}
else $c=getMyCookie();
$username=$c[0];

if($username=='') { $returned=FALSE; return; }

echo $username;

if(isset($GLOBALS['loginsCase']) and $GLOBALS['loginsCase']) { $caseComp1=$GLOBALS['caseComp'].'('; $caseComp2=')'; $usernameSql=strtolower($username); } else { $caseComp1=''; $caseComp2=''; $usernameSql=$username; }

if($row=db_simpleSelect(0,$GLOBALS['Tu'],$GLOBALS['dbUserId'].','. $GLOBALS['dbUserSheme']['user_sorttopics'][1].','. $GLOBALS['dbUserSheme']['language'][1].','. $GLOBALS['dbUserAct'] .','. $GLOBALS['dbUserSheme']['user_password'][1] .', '.$GLOBALS['dbUserSheme']['username'][1].', '.$GLOBALS['dbUserSheme']['num_posts'][1],$caseComp1.$GLOBALS['dbUserSheme']['username'][1].$caseComp2,'=',$usernameSql, '',1)){

if($row[0]==$c[1]){
$returned=TRUE;
echo $username;
$GLOBALS['user_sort']=$row[1];
if($row[0]==1) {
$GLOBALS['logged_admin']=1;
$GLOBALS['logged_user']=0;
}
else {
$GLOBALS['logged_admin']=0;
$GLOBALS['logged_user']=1;
}

$GLOBALS['langu']=$row[2];
$GLOBALS['user_activity']=$row[3];
$username=$row[5];
$GLOBALS['user_num_posts']=$row[6];

}
else{
/* Preventing hijack */
$username='';
echo $username;
$returned=FALSE;
}

}
else{
$returned=FALSE;
}

return $returned;
}

function setMyCookie($userName,$userPass,$userExpTime,$encodePass=TRUE){

if($row=db_simpleSelect(0, $GLOBALS['Tu'], $GLOBALS['dbUserId'], $GLOBALS['dbUserSheme']['username'][1], '=', $userName, 1)){
$_SESSION['auth']=$userName;
$_SESSION['ID']=$row[0]; echo $username;
}

}

function getMyCookie(){
if(isset($_SESSION['auth']) and isset($_SESSION['ID'])) {
$cookievalue=array($_SESSION['auth'], $_SESSION['ID']);
}
else $cookievalue=array('','');
return $cookievalue;
}

function deleteMyCookie(){
unset($_SESSION['auth']);
unset($_SESSION['ID']);
}

function writeUserPwd($pwd){
return $pwd;
}

?>

^Once again copy and pasted from the synchronization tutorial

It doesn't display username nor are they logged in. I know you said the tutorial code is different, but can you explain more and maybe how I can change it to fit my forum.
Also when I manually log in it says:
Sorry, it seems like an intrusion attempt or your server doesn't support HTTP referrers!

Author Paul
Lead Developer
#6 | Posted: 28 Jul 2016 16:43 
catty121:
Sorry, it seems like an intrusion attempt or your server doesn't support HTTP referrers!

This error appears if your server/browser do not support $_SERVER['HTTP_REFERER'] variable, at the time they should. What kind of server are you trying to set up this all on?

Regarding synchronizing - I'm not sure what you are trying to achieve. Do you *already* have a pre-existing membership, installed and running for your current website? You must start from that.

Synchronizing guide contains just a pretty simple code example, you should not replicate its parts for getting your own membership to work. Synchronizing doesn't mean you just could copy and paste from somewhere and then it will immediately work.

Actually, at first you should understand how your own membership works, then following the guide, extend its parts for miniBB. If you're novice in coding, there's no quick way for you to get into that easily.

Author catty121
Registered
#7 | Posted: 28 Jul 2016 21:44 
I'll find out from host what server it is but I am hosted on stars.bz, if that helps.
Oh okay, I was thinking that once I was done I would plug all of my information in after. However, when I did input my information in with existing members, it still didn't work. It came up with the same error.

I'm a novice so this might be hard... 🤔

Author catty121
Registered
#8 | Posted: 29 Jul 2016 04:34 
^ Sorry for double posting but I use the edited bbcode and I got this: Warning: include(./bb_codes.php): failed to open stream: No such file or directory in /home/autumnal/public_html/urbanity/forums/bb_func_txt.php on line 10

Warning: include(./bb_codes.php): failed to open stream: No such file or directory in /home/autumnal/public_html/urbanity/forums/bb_func_txt.php on line 10

Warning: include(): Failed opening './bb_codes.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/autumnal/public_html/urbanity/forums/bb_func_txt.php on line 10
dayanara <-- username appears here and then when I logged in again i showed this: Sorry, it seems like an intrusion attempt or your server doesn't support HTTP referrers!

Author Paul
Lead Developer
#9 | Posted: 29 Jul 2016 16:25 
Make sure you have really uploaded this file (bb_codes.php). Errors you mention show that it is physically missing.

I could not determine what server are you using just by the domain name, but .bz domain obviously mean something cheap and not truly reliable.

"Sorry, it seems like an intrusion attempt or your server doesn't support HTTP referrers!" comes from index.php. It's a basic miniBB protection, if it doesn't work on your end, you could disable this line of code for being not executed. However then your forum script will not be safe.

Author DavidBennett
Registered
#10 | Posted: 16 Sep 2016 15:55 
Thanks catty for solving this issue ! I will look after it.

Author samson
Registered
#11 | Posted: 9 Oct 2016 18:01 
Thanks for the solution

Specific miniBB Support Forums / Specific / Member integration into site error Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

 ?
You are welcome to post anonymously, by entering a nickname with no password (if the similar Username has not been taken yet), or by leaving both fields empty. If you have a forums account, you can also sign in from this page without posting a message, or sign in and post at once.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
 
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Check out the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB