Customizing SMF > Portals, Bridges, and Integrations

New tools to help integrating SMF with something else

<< < (5/27) > >>

ankifreeze:
yeah I have deleted $_SESSION['USER_AGENT'] == $_SERVER['HTTP_USER_AGENT']  yesterday and it works now....I have enable Use subdomain independent cookies  in admin center but still doesn't work... :(

ankifreeze:
also how to remove register and login form?I have removed one in tempate function but I didn't find in another place......I have removed login and register link but if someone using url like index.php?action=login or index.php?action=register site will calling  login and registration function and  login or register form still appear and if session or cookie has expired  the site will called login form or register form too... :(

Andre N:
Run a test script in both site/forum and site


--- Code: ---require_once('path/to/api');
global $cookiename;
echo $cookiename;
echo '<br /><pre>';
print_r($_COOKIE[$cookiename]);
echo '</pre><br />';
$data = unserialize($_COOKIE[$cookiename]);
if (!$data) {
    echo 'Unable to unserialize cookie';
} else {
    echo '<pre>';
    print_r($data);
    echo '</pre>';
}

--- End code ---

for the login and register link, if you want to remove them and redirect to something else, you'd look in /index.php. It shows:

--- Code: ---'login' => array('LogInOut.php', 'Login'),

--- End code ---
and

--- Code: ---'register' => array('Register.php', 'Register'),

--- End code ---

so login maps to /Sources/LogInOut.php function Login() and register maps to /Sources/Register.php function Register()

go to those files and at the top of the function redirect to your other login and register page :)


--- Code: ---// Ask them for their login information.
function Login()
{
        //redirect to other login
        header('Location: http://www.somewhere.com/login.php');

global $txt, $context, $scripturl;

// In wireless?  If so, use the correct sub template.
if (WIRELESS)
$context['sub_template'] = WIRELESS_PROTOCOL . '_login';
// Otherwise, we need to load the Login template/language file.
else
{
loadLanguage('Login');
    ...

--- End code ---

ankifreeze:
I have tested it.....I think it doesn't work in site folder...

http://localhost/site/test.php [nofollow]

--- Code: ---SMFCookie956
Notice:  Undefined index: SMFCookie956 in C:\xampp\htdocs\site\test.php on line 8
Notice: Undefined index: SMFCookie956 in C:\xampp\htdocs\site\test.php on line 10
Unable to unserialize cookie
--- End code ---

http://localhost/site/forum/test.php [nofollow]

--- Code: ---SMFCookie956

a:4:{i:0;s:1:"1";i:1;s:40:"9188720a1bfe3a5bd315d7cbb4e9f84a6f140e4d";i:2;i:1356238923;i:3;i:3;}


Array
(
    [0] => 1
    [1] => 9188720a1bfe3a5bd315d7cbb4e9f84a6f140e4d
    [2] => 1356238923
    [3] => 3
)

--- End code ---


I have put header('Location: http://localhost/site/login.php [nofollow]') in login function and it works but how about login form?  login form is appear when session expired? where I can delete it? :(

Andre N:
Ok, I have 2 ideas as to what might be causing the API to not work outside your /forum directory.

1. The cookie is set for /forum. Can you manually verify the cookie path, either by using firecookie or opening your browser settings to view the cookies and check your SMFCookie956 to make sure the path is '/'. If you aren't sure how to see, please pm me a link to your site and a test user login.

2. The API might not be locating your Settings.php file. It will search for smfapi_settings.txt file first, which is a save file it creates with the location of your Settings.php file. Then it will check if you've specified the location of the file, around line 574. Then it will see if Settings.php is in the same directory it is. Then it will start searching for it. The search might time out if your server resources are low or you have lots of files and directories, so it's possible that the API finds your Settings file when it is in the same directory, but times out looking for it when it is not. You can specify the path to your SMF Settings.php file on about line 574 (depending on which version of the API you have).
You'll see a line that looks like:

--- Code: ---// specify the settings path here if it's not in smf root and you want to speed things up
//$settings_path = $_SERVER['DOCUMENT_ROOT'] . /path/to/Settings.php

--- End code ---

Let me know :)

The login form is located at /Themes/default/Login.template.php

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version