PDA

View Full Version : Disallow registration when cookies not enabled


StewardManscat
10-11-2004, 09:00 PM
At our site we require cookies.
Avoid support issues by turning people away at the door.


In register.php find

if (empty($_REQUEST['do']) AND empty($_REQUEST['a']))
{
$_REQUEST['do'] = 'signup';
}


Replace with


if (empty($_REQUEST['do']) AND empty($_REQUEST['a']))
{
$_REQUEST['do'] = 'cookie';
}


Find


if ($_REQUEST['do'] == 'signup')



Replace with


if ($_REQUEST['do'] == 'cookie')
{
vbsetcookie('signup', 'ok', 0);
exec_header_redirect("register.php?do=signup");
}

if ($_REQUEST['do'] == 'signup')
{
if ($_COOKIE[COOKIE_PREFIX . 'signup'] != 'ok' )
{
eval('print_output("' . fetch_template('manNeedsCookie') . '");');
}


Finally, create a template which informs the user why they cannot register. You'll want to include some links to help them out....

http://www.google.com/cookies.html
http://webmaster.info.aol.com/cookieguide.html

http://www.allaboutcookies.org/manage-cookies
http://www.cookiecentral.com/

???`S?LV?R???`
10-12-2004, 07:38 PM
nice one

Remi
10-12-2004, 08:06 PM
Thanks

Can I use the same method with browsing the forum.

and it will be fantastic if there was an option to swich it on and off from CP :)

nexialys
10-12-2004, 09:50 PM
would be better instead of having a template loaded to have an error message....

Boofo
10-12-2004, 11:35 PM
would be better instead of having a template loaded to have an error message....
How would you incorporate that into this?

nexialys
10-13-2004, 08:09 AM
Boofo.. you're the one to ask... hummm

ok, let's see: $DB_site->query ( "INSERT INTO " . TABLE_PREFIX . "phrase VALUES ( NULL, '-1', 'error_no_reg_on_disabled_cookie', 'The Administrator has required that all visitors requiring to register have their Cookies Enabled, to add more security to the board.', '1000' )" ) ;...this will add the error phrase... i suppose Stewart can handle this in a install script or give the mysql in the howto.
and change this:eval('print_output("' . fetch_template('manNeedsCookie') . '");'); to this:eval ( print_standard_error ( 'error_no_reg_on_disabled_cookie' ) ) ;

Boofo
10-13-2004, 08:38 AM
I only asked so others might get the code they needed if they wanted it. ;)