Login in and out via the API [message #31112] |
Sun, 02 April 2006 20:36 |
matt(at)bikernight(dot)co(dot)uk
Messages: 20 Registered: March 2006
Karma: 0
|
Junior Member |
|
|
HI
I've managed to get my own registration script to insert a corresponding record in the fud registration table using fud_add_user. I've also disabled users from being able to register directly to the fud forum as I want them to use my own registration and login. When a user logins into my site I also call external_fud_login to set the correct information for the forum. Then they log out of my site I also call external_fud_logout.
Is this correct? I think it is.
However, I don't want them to see the logout link within the forum templates. Nor do I want them to be able to view or change their SETTING ( they can if they click on the User_CP link)!
Also if they are NOT logged in and looking at the forums and suddenly decide to post a comment, they are show
"Login Form
ERROR: Insufficient Privileges
Anonymous users are not allowed to create topics."
followed by the fud forum login.
I need them to be redirected to my login.
I'm almost there, just a few things to iron out and I'll have completed my mission. Not bad as I've never coded before.
If anyone can please help, I'd be very greatful.
Matt
|
|
|
Re: Login in and out via the API [message #31119 is a reply to message #31112] |
Mon, 03 April 2006 13:51 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
matt(at)bikernight(dot)co(dot)uk wrote on Sun, 02 April 2006 16:36 | HI
I've managed to get my own registration script to insert a corresponding record in the fud registration table using fud_add_user. I've also disabled users from being able to register directly to the fud forum as I want them to use my own registration and login. When a user logins into my site I also call external_fud_login to set the correct information for the forum. Then they log out of my site I also call external_fud_logout.
|
That's is correct.
Quote: |
However, I don't want them to see the logout link within the forum templates. Nor do I want them to be able to view or change their SETTING ( they can if they click on the User_CP link)!
|
The simple solution is to edit the usercp.tmpl template and remove the User CP and the Logout links.
Quote: |
Also if they are NOT logged in and looking at the forums and suddenly decide to post a comment, they are show
"Login Form
ERROR: Insufficient Privileges
Anonymous users are not allowed to create topics."
followed by the fud forum login.
I need them to be redirected to my login.
|
The permissions error is handled via invl_inp_err() function inside err.inc.t, change it to redirect the to the desired page.
FUDforum Core Developer
|
|
|
|
Re: Login in and out via the API [message #31166 is a reply to message #31146] |
Thu, 06 April 2006 02:38 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Don't use # to comment out lines with template code, use /* ... */ or remove the line all together.
FUDforum Core Developer
|
|
|
Re: Login in and out via the API [message #31178 is a reply to message #31166] |
Thu, 06 April 2006 09:45 |
matt(at)bikernight(dot)co(dot)uk
Messages: 20 Registered: March 2006
Karma: 0
|
Junior Member |
|
|
OK
I've done that.
I edited the file locally and uploaded via dreamweaver.
I've rebuilt my theme in the admin control panel.
Result is as follows :
Now I get the fud forum login page again!
Better then a white screen but still not my login page! ahhh
Any ideas ?
function invl_inp_err()
{
/* error_dialog('{TEMPLATE: core_err_invinp_title}', '{TEMPLATE: core_err_invinp_err}'); */
header("Location: http://www.mydomain.co.uk/user/");
}
Login Form
ERROR: Insufficient PrivilegesAnonymous users are not allowed to create topics.
You are not logged in. This could be due to one of several reasons: etc
[Updated on: Thu, 06 April 2006 11:31] Report message to a moderator
|
|
|
|
Re: Login in and out via the API [message #31201 is a reply to message #31191] |
Sat, 08 April 2006 13:09 |
matt(at)bikernight(dot)co(dot)uk
Messages: 20 Registered: March 2006
Karma: 0
|
Junior Member |
|
|
HI
I've put this inplace (see below) think it's right, I've rebuild my Theme, but I still get the fud login not the one that I need.
I just don't know what I'm doing wrong!
Matt
<?php
/**
* copyright : (C) 2001-2006 Advanced Internet Designs Inc.
* email : forum(at)prohost(dot)org
* $Id: err.inc.t,v 1.51 2005/12/07 18:07:45 hackie Exp $
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
**/
function error_dialog($title, $msg, $level='WARN', $ses=null)
{
if (!$ses) {
$ses = (int) $GLOBALS['usr']->sid;
}
$error_msg = '[Error] '.$title.'<br />';
$error_msg .= '[Message Sent to User] '.trim($msg).'<br />';
$error_msg .= '[User IP] '.get_ip().'<br />';
$error_msg .= '[Requested URL] http://';
$error_msg .= isset($_SERVER['HTTP_HOST']) ? htmlspecialchars($_SERVER['HTTP_HOST']) : '';
$error_msg .= isset($_SERVER['REQUEST_URI']) ? htmlspecialchars($_SERVER['REQUEST_URI']) : '';
$error_msg .= !empty($_POST) ? '<br />[Post-Data] '.base64_encode(serialize($_POST)) : '';
$error_msg .= '<br />';
if (isset($_SERVER['HTTP_REFERER'])) {
$error_msg .= '[Referring Page] '.htmlspecialchars($_SERVER['HTTP_REFERER']).'<br />';
}
$pfx = sprintf("?%-10d?%-10d?", strlen($error_msg) + 1, __request_timestamp__);
ini_set('log_errors_max_len', 0);
error_log($pfx.$error_msg."\n", 3, $GLOBALS['ERROR_PATH'].'fud_errors');
/* no need to redirect, we just want to log the error */
if ($level == 'ATCH') {
return;
}
ses_putvar($ses, array('er_msg' => $msg, 'err_t' => $title));
if (is_int($ses)) {
if ($GLOBALS['FUD_OPT_2'] & 32768) {
header('Location: {FULL_ROOT}{ROOT}/e/'._rsidl);
} else {
header('Location: {FULL_ROOT}{ROOT}?t=error&'._rsidl);
}
} else {
if ($GLOBALS['FUD_OPT_2'] & 32768) {
header('Location: {FULL_ROOT}{ROOT}/e/0/'.$ses);
} else {
header('Location: {FULL_ROOT}{ROOT}?t=error&S='.$ses);
}
}
exit;
}
function std_error($type)
{
if (!isset($_SERVER['HTTP_REFERER'])) {
$_SERVER['HTTP_REFERER'] = 'unknown';
}
$ses_id = s;
$usr_d->email = $GLOBALS['usr']->email;
if ($type == 'login') {
if (__fud_real_user__) {
$type = 'perms';
} else {
ses_anonuser_auth($GLOBALS['usr']->sid, '{TEMPLATE: ERR_login_msg}');
}
}
if ($type == 'perms'){
header("Location: http://www.bikernight.co.uk/user/");
exit;
}
$err_array = array(
'ERR_disabled'=>array('{TEMPLATE: ERR_disabled_ttl}', '{TEMPLATE: ERR_disabled_msg}'),
'ERR_access'=>array('{TEMPLATE: ERR_access_ttl}', '{TEMPLATE: ERR_access_msg}'),
'ERR_registration_disabled'=>array('{TEMPLATE: ERR_registration_disabled_ttl}', '{TEMPLATE: ERR_registration_disabled_msg}'),
'ERR_user'=>array('{TEMPLATE: ERR_user_ttl}', '{TEMPLATE: ERR_user_msg}'),
'ERR_perms'=>array('{TEMPLATE: permission_denied_title}', '{TEMPLATE: permission_denied_msg}'),
'ERR_systemerr'=>array('{TEMPLATE: ERR_systemerr_ttl}', '{TEMPLATE: ERR_systemerr_msg}'),
'ERR_emailconf'=>array('{TEMPLATE: ERR_emailconf_ttl}', '{TEMPLATE: ERR_emailconf_msg}')
);
if (isset($err_array['ERR_'.$type])) {
$err = $err_array['ERR_'.$type];
error_dialog($err[0], $err[1]);
}
error_dialog('{TEMPLATE: err_inc_criticaltitle}', '{TEMPLATE: err_inc_criticalmsg}');
}
function invl_inp_err()
{
/* error_dialog('{TEMPLATE: core_err_invinp_title}', '{TEMPLATE: core_err_invinp_err}'); */
header("Location: http://www.bikernight.co.uk/user/");
exit;
}
?>
|
|
|
|
Re: Login in and out via the API [message #31217 is a reply to message #31214] |
Sun, 09 April 2006 18:02 |
matt(at)bikernight(dot)co(dot)uk
Messages: 20 Registered: March 2006
Karma: 0
|
Junior Member |
|
|
Hello
Thanks for the helps so far.
I've done what you said, but I still fail to get this work, so can I check a few things.
firstly I'm editing the file \forum-data\src\err.inc.t
This is the correct file right?
secondly this file contains the changes that I belive I'm supposed to be making shown in bold below?
Then I upload the file and rebuild my Theme.
I do this but I get no joy!
Cheers Matt
function std_error($type)
{
if (!isset($_SERVER['HTTP_REFERER'])) {
$_SERVER['HTTP_REFERER'] = 'unknown';
}
$ses_id = s;
$usr_d->email = $GLOBALS['usr']->email;
if ($type == 'login') {
if (__fud_real_user__) {
$type = 'perms';
} else {
/* ses_anonuser_auth($GLOBALS['usr']->sid, '{TEMPLATE: ERR_login_msg}'); */
header("Location: http://www.bikernight.co.uk/user/");
exit;
}
}
if ($type == 'perms'){
header("Location: http://www.bikernight.co.uk/user/");
exit;
}
$err_array = array(
'ERR_disabled'=>array('{TEMPLATE: ERR_disabled_ttl}', '{TEMPLATE: ERR_disabled_msg}'),
'ERR_access'=>array('{TEMPLATE: ERR_access_ttl}', '{TEMPLATE: ERR_access_msg}'),
'ERR_registration_disabled'=>array('{TEMPLATE: ERR_registration_disabled_ttl}', '{TEMPLATE: ERR_registration_disabled_msg}'),
'ERR_user'=>array('{TEMPLATE: ERR_user_ttl}', '{TEMPLATE: ERR_user_msg}'),
'ERR_perms'=>array('{TEMPLATE: permission_denied_title}', '{TEMPLATE: permission_denied_msg}'),
'ERR_systemerr'=>array('{TEMPLATE: ERR_systemerr_ttl}', '{TEMPLATE: ERR_systemerr_msg}'),
'ERR_emailconf'=>array('{TEMPLATE: ERR_emailconf_ttl}', '{TEMPLATE: ERR_emailconf_msg}')
);
if (isset($err_array['ERR_'.$type])) {
$err = $err_array['ERR_'.$type];
error_dialog($err[0], $err[1]);
}
error_dialog('{TEMPLATE: err_inc_criticaltitle}', '{TEMPLATE: err_inc_criticalmsg}');
}
function invl_inp_err()
{
/* error_dialog('{TEMPLATE: core_err_invinp_title}', '{TEMPLATE: core_err_invinp_err}'); */
header("Location: http://www.bikernight.co.uk/user/");
exit;}
|
|
|
Re: Login in and out via the API [message #31237 is a reply to message #31217] |
Mon, 10 April 2006 21:09 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
The change appear to be correct, on what page do you see login error being generated and not redirect to the desired page?
FUDforum Core Developer
|
|
|
|
|
|
|