Re: Create a external form for login

mmm ok thanks alot for your help.

MyFootballCafe.com  is Now Online!

27

Re: Create a external form for login

Just for future reference, precede requires/includes with FORUM_ROOT, not hard coded paths.

This line:

include '../sitetools/pages/login.php';

should be:

include FORUM_ROOT.'sitetools/pages/login.php';

That constant is defined in every script so will always point to the correct location.

Re: Create a external form for login

I think this code is placed into a Wordpress plugin and then is eval'ed. And there is no defined FORUM_ROOT constant in Wordpress.

29

Re: Create a external form for login

Parpalak wrote:

I think this code is placed into a Wordpress plugin and then is eval'ed. And there is no defined FORUM_ROOT constant in Wordpress.

Ah, I thought he was doing it the opposite way around. My apologies. big_smile

Re: Create a external form for login

does anyone know how this error was fixed?

Call to a member function escape() on a non-object in /include/functions.php on line 1350

im still getting it and have no idea how to fix it..

31

Re: Create a external form for login

Are you sure the file "<FORUM_ROOT>/include/common.php" is included in your code?

Re: Create a external form for login

I am having the same error with a call to a member function on 1350

Re: Create a external form for login

If you mean this solution, it worked fine when I tested it. Try to turn on displaying warnings and notices (function error_reporting()). Maybe there are ones.

Re: Create a external form for login

Parpalak wrote:

If you mean this solution, it worked fine when I tested it. Try to turn on displaying warnings and notices (function error_reporting()). Maybe there are ones.

this one has an error, i tried to use this with textpattern:

it shows that just above the form:

'', 'redirect_url'    => '', 'csrf_token'    => '' ); ?>

And when i try to click on login button, the link of the site becomes:

http://sports2all.com/textpattern/%3C?p … forum_page['form_action']%20?%3E

My site url: http://sports2all.com/
my forum url: http://sports2all.com/community/

the form that i used:

<?php
 
// Define the path to the forum root
define('FORUM_ROOT', './community/');
require FORUM_ROOT.'include/common.php';
 
// Where will we go after login?
$forum_page['redirect_url'] = 'http://sports2all.com/community/';
 
$forum_page['form_action'] = forum_link($forum_url['login']);
 
$forum_page['hidden_fields'] = array(
    'form_sent'    => '<input type="hidden" name="form_sent" value="1" />',
    'redirect_url'    => '<input type="hidden" name="redirect_url" value="'.forum_htmlencode($forum_page['redirect_url']).'" />',
    'csrf_token'    => '<input type="hidden" name="csrf_token" value="'.generate_form_token($forum_page['form_action']).'" />'
);
 
?>
<form method="post" action="<?php echo $forum_page['form_action'] ?>">
    <?php echo implode("\n\t\t", $forum_page['hidden_fields'])."\n" ?>
 
    Username:
    <input type="text" id="fld1" name="req_username" value="" />
    <br />
 
    Password:
    <input type="password" id="fld2" name="req_password" value="" />
    <br />
 
    <input type="checkbox" id="fld3" name="save_pass" value="1" />
    <label for="fld3">Log me in automatically each time I visit.</label>
    <br />
 
    <input type="submit" name="login" value="Login" />
</form>
MyFootballCafe.com  is Now Online!

Re: Create a external form for login

If one just copies that code into an empty PHP file and sets $forum_page['redirect_url'] properly, he will obtain a working login form. Therefore, an error is in your way of using that code. I'm not familiar with textpattern, so I can't suggest a solution. Maybe it's incorrect string escaping or something else.

Re: Create a external form for login

sad

i am just unlucky, i have been trying to get this login work since ages, first it was wordpress now textpattern, just unlucky.

anyway thanks for ur help.

MyFootballCafe.com  is Now Online!