vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=34)
-   -   Age Locked Forums (https://vborg.vbsupport.ru/showthread.php?t=93438)

stuie_b 08-01-2005 10:00 PM

Age Locked Forums
 
Ok this is my first hack and since i dont want to make people angre a posted it in here

Quote:

Provent unauthorized access ot a forum by an underaged user, Age Limit Will provent anyone
who isn't old enough to view the forum while allows those who are.

Features
+ Admins/mods are excempt from age limitation
+ User Defined age and forum to lock
+ Prevents access to post files aswell as forum
+ Removes Birthday date changing via profile (now only admin can change it)
+ Provents Searching to access posts
+ Provents Guest viewing of locked forums while other forums are open to guests
+ Provents Accessing thread/posts directly
+ Provents Access by using Forum Jump
+ Checks Age by using all D.O.B values


Thanks to KirbyDE for optimizations, sketch42 for bug testing, nexialys for bug testing
Version History
--- 0.2
-- Added Template edit thanks to sketch42
-- Changed method of age checking to check the day and month
--- 0.1E
-- Fixed Installer typo
-- Removed image relations in install.html
--- 0.1D
-- Optimized code thanks to KirbyDE


Please let me know what you all think

stuie_b :ermm:

Andreas 08-02-2005 12:14 PM

Optimization suggestion
PHP Code:

function check_age($userid,$forumid)
{
    global 
$forumcache;
    
$userinfo fetch_userinfo($userid);
    
$now date('d-m-Y');
    
$bday explode("-"$userinfo['birthday']);
    
$now explode("-"$now);
    
$j $now[2] - $bday[2];
    return (int)(
$j >= $forumcache["$forumid"]['age_value']);
}


function 
check_lock($forumid)
{
    global 
$forumcache;
    return 
$forumcache["forumid"]['age_locked'];


Furthermore, you could remove the Locked Yes/No setting and define 0 being unlocked, would save memory.
And your age-check does only check the Year, should also check month/day.

stuie_b 08-02-2005 01:17 PM

Thanks alot KirbyDE i've updated the code with your suggests, The check is still performed on the year for now but all other suggests were applied

thanks again

stuie_b

nexialys 08-02-2005 01:35 PM

in your install file, there is a typo:
PHP Code:

$DB_site->query("ALTER TABLE forum ADD age_value? varchar(10) DEFAULT ''"); 

just after age_value ...

and for your install.html, please don't add anything related to your own website... the actual style, icons and images are linked to your site, and will give you too much trafic and too much lag if your site is down one day...

stuie_b 08-02-2005 02:19 PM

thanks nexialys for the heads up on the installer typo fixed

thanks

stuie_b

sketch42 08-02-2005 02:26 PM

will this remove the birthday from the public profile as well?

stuie_b 08-02-2005 02:27 PM

no the birthday will still be displayed in the public profile

stuie_b

sketch42 08-02-2005 02:28 PM

the reason i asked is because i want to change this ..
Quote:

If you enter your birth date using the controls provided here, other forum visitors will be able to see your birthday on the forum calendar and in your profile. Adding your year of birth is optional.
this is what it shows during registration, and i wanted to word it in a way where it would discourage users from inputing a fake birthday from the start

sketch42 08-02-2005 02:40 PM

k i found where it is in MEMBERINFO template

just find this

Code:

<div class="fieldset">
                        <if condition="$show['extrainfo']">
                                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                                <if condition="$userinfo['birthday']">
                                <tr>
                                        <td>
                                                <strong>$vbphrase[birthday]</strong>:<br />
                                                $userinfo[birthday]
                                        </td>
                                </tr>
                                </if>
                                $customfields
                                </table>
                        <else />

and change it to this

Code:

<div class="fieldset">
                        <if condition="$show['extrainfo']">
                                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">

                                                              $customfields
                                </table>
                        <else />

in case anyone else wants to do this

and than just edit that phrase

stuie_b 08-02-2005 03:02 PM

Fixed the check procedure now checks against all three values, day month and year and added template edit thanks sketch42

stuie_b


All times are GMT. The time now is 08:38 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01032 seconds
  • Memory Usage 1,748KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete