Topic: login form on other page

I've been using Pun for a few days, and I was able to code a special dohickey that lists the most recent posts on my main page. I'm proud of myself. tongue I also found enough code from the pages to display the "most recent user" thing near the top of my main page.

I also have a login form that you can choose where to be redirected to, either to the main page or to the forum when logging in.

I sifted through the files, trying to find how the forum decodes the cookie to display the username. I spent about an hour doing so, but gave up. Does anyone know where the code lies that decodes the cookie? (I thought it was in header.php, but I guess I'm not experienced enough yet to know where all the functions are coming from.)

Basically all I need is the capability of showing the "logged in as..." thing on the main page. Then from this I can display special notices, like "new artwork here" or "new animation there".

Also, I had just recently coded my own member script, which worked very well, until I decided to switch over to Pun because I needed a forum. It's easier to make a secure area script from a forum rather than the other way around.

Well, I hope someone can help me out.

~creaturecorp

I don't HAVE a signature, ok?

Re: login form on other page

Sorry, forgot to mention that my main page is
http://creaturecorp.ca
and my forum page is
http://forum.creaturecorp.ca

I don't HAVE a signature, ok?

Re: login form on other page

It's in include/functions.php in the function check_cookie().

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: login form on other page

<?php
include "../forum/config.php";
include "../forum/include/functions.php";

check_cookie(&$cur_user);

if ($cookie['is_guest'])
    $tpl_temp = $lang_common['Not logged in'];
else
    $tpl_temp = $lang_common['Logged in as'].' <b>'.pun_htmlspecialchars($cur_user['username']).'</b>.<br>'.$lang_common['Last visit'].': '.format_time($cur_user['last_visit']);

if ($cur_user['status'] > PUN_USER)
{
    $result_header = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'reports WHERE zapped IS NULL') or error('Unable to fetch reports info', __FILE__, __LINE__, $db->error());

    if ($db->result($result_header, 0))
        $tpl_temp .= '<br><a class="punhot" href="admin_reports.php">There are new reports</a>';

    if ($pun_config['o_maintenance'] == '1')
        $tpl_temp .= '<br><a class="punhot" href="admin_options.php#maintenance"><b>Maintenance mode is enabled!</b></a>';
}
?>

Should this work? It doesnt.

I don't HAVE a signature, ok?

Re: login form on other page

instead of
include "../forum/config.php";
include "../forum/include/functions.php";
it might be better to set PUN_ROOT and include common.php

Re: login form on other page

<?php
$pun_root = './';
define('PUN', 1);
include "include/common.php";

echo $cookie['username'];
?>

despite if I'm logged in or not, it still returns guest. What am I missing?

I don't HAVE a signature, ok?

Re: login form on other page

try

<?php
$pun_root = './';
define('PUN', 1);
include "include/common.php";

echo $cur_user['username'];
?>

Re: login form on other page

This time it returns fully blank. By the way, sorry for being so oblivious to the system. smile

I don't HAVE a signature, ok?

Re: login form on other page

*bump*

I don't HAVE a signature, ok?

Re: login form on other page

just wait your turn someone will get back to you if and when they can