lainchan-webring

Code for the unofficial lainchan webring.
git clone git://git.concealed.world/lainchan-webring
Log | Files | Refs | README | LICENSE

commit 96af2b5b9cc8dce07222d42c151ad86e3b190f1e
parent 937139778acf1e19df32e775ab2e08db6daaeb81
Author: Nixx <nixx@firemail.cc>
Date:   Sun, 22 Aug 2021 21:57:15 +0100

webring.php - disable banner mode on random

Diffstat:
Mwebring.php | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/webring.php b/webring.php @@ -61,6 +61,8 @@ if(!in_array($action, $valid_action)) die('ERROR: Invalid action \''.$action.'\' // Store and check banner mode $banner = isset($_GET['banner']) ? $_GET['banner'] : 'false'; if(!in_array($banner, array('true', 'false'))) die('ERROR: Invalid banner mode \''.$banner.'\'.'); +// No banners with random mode +if($banner == 'true' && $action == "random") die('ERROR: Cannot use banners with random mode.'); // Perform requested action if($action == 'next'){ // Get next site in list @@ -73,6 +75,12 @@ if($action == 'next'){ // Get next site in list if($redirkey < 0){ // Fix underflow $redirkey = $length; } +} + +// Show banner +if($banner == 'true'){ + header('Location: ../images/banners/'.$list[$redirkey][1].'.'.$list[$redirkey][3]); + exit; }elseif($action == 'random'){ // Get random site $redirkey = rand(0, $length); if($length + 1 > 1){ // Don't waste CPU @@ -82,12 +90,6 @@ if($action == 'next'){ // Get next site in list } } -// Show banner -if($banner == 'true'){ - header('Location: ../images/banners/'.$list[$redirkey][1].'.'.$list[$redirkey][3]); - exit; -} - // Finally, do the redirect header('Location: '.$list[$redirkey][2]);