poster IDs

This commit is contained in:
Savetheinternet 2011-04-13 20:02:58 +10:00
parent d57bbaf496
commit 7d736c102b
3 changed files with 30 additions and 7 deletions

View File

@ -62,7 +62,7 @@
$config['cookies']['salt'] = 'wefaw98YHEWUFuo'; $config['cookies']['salt'] = 'wefaw98YHEWUFuo';
// How long should moderators should remain logged in (0=browser session) (in seconds) // How long should moderators should remain logged in (0=browser session) (in seconds)
$config['mod']['expire'] = 15778463; //6 months $config['mod']['expire'] = 15778463; //6 months
// Used to salt secure tripcodes (##trip) // Used to salt secure tripcodes (##trip) and poster IDs (if enabled)
$config['secure_trip_salt'] = '@#$&^@#)$(*&@!_$(&329-8347'; $config['secure_trip_salt'] = '@#$&^@#)$(*&@!_$(&329-8347';
// How many seconds before you can post, after the first visit // How many seconds before you can post, after the first visit
@ -533,6 +533,12 @@
// Always act as if they had typed "noko" in the email field no mattter what // Always act as if they had typed "noko" in the email field no mattter what
$config['always_noko'] = false; $config['always_noko'] = false;
// Assign each poster in a thread a unique ID, shown by "ID: {id}" before the post number.
$config['poster_ids'] = false;
// Number of characters in the poster ID (maximum is 40)
$config['poster_id_length'] = 5;
// Characters used to generate a random password (with Javascript) // Characters used to generate a random password (with Javascript)
$config['genpassword_chars'] = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+'; $config['genpassword_chars'] = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+';

View File

@ -240,9 +240,14 @@
$built .= ' ' . date($config['post_date'], $this->time); $built .= ' ' . date($config['post_date'], $this->time);
// End delete // End delete
$built .= '</label>'; $built .= '</label>'
$built .= ' <a class="post_no"' . // Poster ID
. ($config['poster_ids'] ?
' ID: ' . poster_id($this->ip, $this->thread)
: '')
. ' <a class="post_no"' .
// JavaScript highlight // JavaScript highlight
($index?'':' onclick="highlightReply(' . $this->id . ');"') . ($index?'':' onclick="highlightReply(' . $this->id . ');"') .
' href="' . $this->root . $board['dir'] . $config['dir']['res'] . $this->thread . '.html' . '#' . $this->id . '">No.</a>' . ' href="' . $this->root . $board['dir'] . $config['dir']['res'] . $this->thread . '.html' . '#' . $this->id . '">No.</a>' .
@ -416,9 +421,14 @@
$built .= ' ' . date($config['post_date'], $this->time); $built .= ' ' . date($config['post_date'], $this->time);
// End delete // End delete
$built .= '</label>'; $built .= '</label>'
$built .= ' <a class="post_no"' . // Poster ID
. ($config['poster_ids'] ?
' ID: ' . poster_id($this->ip, $this->id)
: '')
. ' <a class="post_no"' .
// JavaScript highlight // JavaScript highlight
($index?'':' onclick="highlightReply(' . $this->id . ');"') . ($index?'':' onclick="highlightReply(' . $this->id . ');"') .
' href="' . $this->root . $board['dir'] . $config['dir']['res'] . $this->id . '.html' . '#' . $this->id . '">No.</a>' . ' href="' . $this->root . $board['dir'] . $config['dir']['res'] . $this->id . '.html' . '#' . $this->id . '">No.</a>' .

View File

@ -1161,7 +1161,14 @@
} }
} }
function generate_tripcode ( $name, $length = 10 ) { function poster_id($ip, $thread) {
global $config;
// Confusing, hard to brute-force, but simple algorithm
return substr(sha1(sha1($ip . $config['secure_trip_salt'] . $thread) . $config['secure_trip_salt']), 0, $config['poster_id_length']);
}
function generate_tripcode($name, $length = 10){
global $config; global $config;
$name = stripslashes ( $name ); $name = stripslashes ( $name );
$t = explode('#', $name); $t = explode('#', $name);