1 (edited by hoang83vu 2012-01-17 18:10)

Topic: Include does not work

Hi supporters,

I am running into a problem where I have created a login box. Every time a user is successfully logged in, POST, DELETE, EDIT functions stop working. I could not create a new post, could not edit or delete. When I take out the include code block in main.tpl, its back to normal. I wonder if anyone sees anything wrong with the codes?

link to site: http://vphansite.com/forum



This is the main.tpl

<!-- forum_include "customlogin.php" -->



This is the "customlogin.php" I created. I put this file in include/user/

<?php
    $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']).'" />'
    );
?>

<div id="customlogin">
    <form method="post" action="<?php echo $forum_page['form_action'] ?>">
   
        <?php echo implode("\n\t\t", $forum_page['hidden_fields'])."\n" ?>
       
        <p><label class="label">Username:</label></p>
        <p><input id="fld1" type="text" name="req_username" value="" maxlength="320" tabindex="1" class="input" /></p>
       
        <p><label class="label">Password:</label></p>
        <p><input id="fld2" type="password" name="req_password" value="" maxlength="320" tabindex="2" class="input" /></p>
                 
        <div>
            <input type="submit" name="login" value="Login" />
            <label><span><input id="fld3" type="checkbox" name="remember" tabindex="3" /></span>Keep me logged in</label>       
        </div>
       
    </form>
</div>

P.S. I know for sure its something to do with the token.

Re: Include does not work

I have the same problem, did you figure this out yet?

Re: Include does not work

I had issues with <!-- include etc, try <?php include("file.ext") ?>