1 (edited by Connorhd 2005-01-13 20:56)

Topic: Go back in time (e.g. reset post indicators)

ok i think a couple people wanted this (and so did I wink) basically it allows you to go back a set number of hours per click.
open misc.php
find

else
    message($lang_common['Bad request']);

before add

else if (isset($_GET['go_back']))
{
    $go_back_time = $pun_user['last_visit'] - (3600 * intval($_GET['go_back']));
    $db->query('UPDATE '.$db->prefix.'users SET last_visit='.$go_back_time.' WHERE id='.$pun_user['id']) or error('Unable to go back in time', __FILE__, __LINE__, $db->error());
    redirect('index.php', 'Gone Back '.$_GET['go_back'].' hours');
}

open index.php
find

echo "\t\t\t\t".'<dd><a href="search.php?action=show_user&user_id='.$pun_user['id'].'">'.$lang_common['Show your posts'].'</a></dd>'."\n\t\t\t".'</dl>'."\n";

replace with

echo "\t\t\t\t".'<dd><a href="search.php?action=show_user&user_id='.$pun_user['id'].'">'.$lang_common['Show your posts'].'</a></dd>'."\n";
echo "\t\t\t\t".'<dd><a href="misc.php?go_back=24">Go Back 24 Hours</a></dd>'."\n\t\t\t".'</dl>'."\n";

that will add a go back 24 hours button to the homepage and you can use misc.php?go_back=<hours> replacing <hours> with the number of hours you want to go back wink, i don't think there are any "side effects" of this but there could be if you have any problems post here and as usually make a backup wink

Re: Go back in time (e.g. reset post indicators)

I would write the $_GET variable as intval($_GET['go_back']) (force it to be an integer)  ... perhaps in this case it won't be a security leak (as it's a multiplier in there), but I'm not sure ... everytime I use SQL and using variables outside, I try to limit what I can get into the script ...

Re: Go back in time (e.g. reset post indicators)

good point wink