From 7d736c102b956bf9dfaf3cb7bae0e8a130393801 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Wed, 13 Apr 2011 20:02:58 +1000 Subject: [PATCH] poster IDs --- inc/config.php | 8 +++++++- inc/display.php | 18 ++++++++++++++---- inc/functions.php | 11 +++++++++-- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/inc/config.php b/inc/config.php index 54790d91..ef9adb80 100644 --- a/inc/config.php +++ b/inc/config.php @@ -62,7 +62,7 @@ $config['cookies']['salt'] = 'wefaw98YHEWUFuo'; // How long should moderators should remain logged in (0=browser session) (in seconds) $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'; // 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 $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) $config['genpassword_chars'] = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+'; diff --git a/inc/display.php b/inc/display.php index 33a64ed4..b6722348 100644 --- a/inc/display.php +++ b/inc/display.php @@ -240,9 +240,14 @@ $built .= ' ' . date($config['post_date'], $this->time); // End delete - $built .= ''; + $built .= '' - $built .= ' ip, $this->thread) + : '') + + . ' No.' . @@ -416,9 +421,14 @@ $built .= ' ' . date($config['post_date'], $this->time); // End delete - $built .= ''; + $built .= '' + + // Poster ID + . ($config['poster_ids'] ? + ' ID: ' . poster_id($this->ip, $this->id) + : '') - $built .= ' No.' . diff --git a/inc/functions.php b/inc/functions.php index 8f36cfb5..e37a367d 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1159,9 +1159,16 @@ reset($objects); rmdir($dir); } - } + } + + 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 ) { + function generate_tripcode($name, $length = 10){ global $config; $name = stripslashes ( $name ); $t = explode('#', $name);