[Adv. mod Rewrite] Can't register anymore!

phpBB2 SEO Advanced mod Rewrite support forum.
This mods performs URL rewriting for phpBB, injecting categories, forums and topic titles in their URLs.

Moderator: Moderators

[Adv. mod Rewrite] Can't register anymore!

Postby dr_somm » Thu Mar 05, 2009 5:36 am

Hi.

After installing your SEO mod (+ Zero duplicate) users can't register anymore. If you click on "accept [terms & conditions]" in -http://www.domain.de/profile.php?mode=register, you will be redirected to -http://www.domain.de/http://www.domain.de :|

usercp_register.php:
Code: Select all
(...)
if ( !defined('IN_PHPBB') )
{
   die("Hacking attempt");
   exit;
}

$unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#');
$unhtml_specialchars_replace = array('>', '<', '"', '&');

// ---------------------------------------
// Load agreement template since user has not yet
// agreed to registration conditions/coppa
//
function show_coppa()
{
   global $userdata, $template, $lang, $phpbb_root_path, $phpEx;

   $template->set_filenames(array(
      'body' => 'agreement.tpl')
   );

   $template->assign_vars(array(
      'REGISTRATION' => $lang['Registration'],
      'AGREEMENT' => $lang['Reg_agreement'],
      //[MOD]Remove COPPA
      //"AGREE_OVER_13" => $lang['Agree_over_13'],
      "AGREE" => $lang['Agree'],
      //[MOD]Remove COPPA
      //"AGREE_UNDER_13" => $lang['Agree_under_13'],
      'DO_NOT_AGREE' => $lang['Agree_not'],

      "U_AGREE" => append_sid("profile.$phpEx?mode=register&amp;agreed=true"))
      //[MOD]Remove COPPA
      //"U_AGREE_UNDER13" => append_sid("profile.$phpEx?mode=register&amp;agreed=true&amp;coppa=true"))
   );

   $template->pparse('body');

}
//
// ---------------------------------------

$error = FALSE;
$error_msg = '';
$page_title = ( $mode == 'editprofile' ) ? $lang['Edit_profile'] : $lang['Register'];

if ( $mode == 'register' && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) )
{
   include($phpbb_root_path . 'includes/page_header.'.$phpEx);

   show_coppa();

   include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}

$coppa = ( empty($HTTP_POST_VARS['coppa']) && empty($HTTP_GET_VARS['coppa']) ) ? 0 : TRUE;
//-- mod : calendar ------------------------------------------------------------
//-- add
include($config->url('includes/class_calendar_settings'));

$user->set();
$calendar_api->set();
$calendar_form = new calendar_profile_form('profile');
$calendar_form->read($userdata);
//-- fin mod : calendar --------------------------------------------------------
(...)
[/url]


[e] Another question: Did you remove the highlight tag after clicking on a search result deliberately?
dr_somm
 
Posts: 29
Joined: Sun Mar 01, 2009 9:27 pm

Advertisement

Re: [Adv. mod Rewrite] Can't register anymore!

Postby SeO » Sat Mar 07, 2009 11:41 am

You're challenging my phpBB2 memories here ;)

Have you found the cause for this ? Because the original code of course did not broke registrations.
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Re: [Adv. mod Rewrite] Can't register anymore!

Postby dr_somm » Sat Mar 07, 2009 6:03 pm

Not yet, but maybe it has something to do with the Remove COPPA mod!?

Code: Select all
(...)

#
#-----[ DIY INSTRUCTIONS ]------------------------------------------
#
#
#I don't know why the following code can't be parsed by EasyMOD although they are valid so you may have to execute it yourself
DELETE FROM phpbb_config WHERE `config_name` = 'coppa_fax';
DELETE FROM phpbb_config WHERE `config_name` = 'coppa_mail';

#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php

#
#-----[ FIND ]------------------------------------------
#
      "AGREE_OVER_13" => $lang['Agree_over_13'],

#
#-----[ REPLACE WITH ]------------------------------------------
#
      //[MOD]Remove COPPA
      //"AGREE_OVER_13" => $lang['Agree_over_13'],
      "AGREE" => $lang['Agree'],

#
#-----[ FIND ]------------------------------------------
#
      "AGREE_UNDER_13" => $lang['Agree_under_13'],

#
#-----[ REPLACE WITH ]------------------------------------------
#
      //[MOD]Remove COPPA
      //"AGREE_UNDER_13" => $lang['Agree_under_13'],

#
#-----[ FIND ]------------------------------------------
#
      "U_AGREE_OVER13" => append_sid("profile.$phpEx?mode=register&amp;agreed=true"),

#
#-----[ REPLACE WITH ]------------------------------------------
#
      "U_AGREE" => append_sid("profile.$phpEx?mode=register&amp;agreed=true"))

#
#-----[ FIND ]------------------------------------------
#
      "U_AGREE_UNDER13" => append_sid("profile.$phpEx?mode=register&amp;agreed=true&amp;coppa=true"))

#
#-----[ REPLACE WITH ]------------------------------------------
#
      //[MOD]Remove COPPA
      //"U_AGREE_UNDER13" => append_sid("profile.$phpEx?mode=register&amp;agreed=true&amp;coppa=true"))

(...)

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/agreement.tpl

#
#-----[ FIND ]------------------------------------------
#
         <tr>
            <td><span class="genmed"><br />{AGREEMENT}<br /><br />
#
#-----[ IN-LINE FIND ]------------------------------------------
#
<a href="{U_AGREE_OVER13}" class="genmed">{AGREE_OVER_13}</a>

#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
<a href="{U_AGREE}" class="genmed">{AGREE}</a>

#
#-----[ IN-LINE FIND ]------------------------------------------
#
<a href="{U_AGREE_UNDER13}" class="genmed">{AGREE_UNDER_13}</a><br /><br />

#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
<!-- <a href="{U_AGREE_UNDER13}" class="genmed">{AGREE_UNDER_13}</a><br /><br /> -->

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/board_config_body.tpl

#
#-----[ FIND ]------------------------------------------
#
   <tr>
     <th class="thHead" colspan="2">{L_COPPA_SETTINGS}</th>
   </tr>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
#    
   <!-- [MOD]Remove COPPA
#
#-----[ FIND ]------------------------------------------
#
   <tr>
      <td class="row1">{L_COPPA_MAIL}<br /><span class="gensmall">{L_COPPA_MAIL_EXPLAIN}</span></td>
      <td class="row2"><textarea name="coppa_mail" rows="5" cols="30">{COPPA_MAIL}</textarea></td>
   </tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
    -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM


Or maybe due to the Login Redirection Suite!? :oops:
dr_somm
 
Posts: 29
Joined: Sun Mar 01, 2009 9:27 pm

Re: [Adv. mod Rewrite] Can't register anymore!

Postby dcz » Tue Mar 10, 2009 1:25 pm

I'd bet on the Login Redirection Suite. Since it looks like the domain is added two times in url.
You could try this :
Code: Select all
#
#-----[ OPEN ]------------------------------------------------
#
usercp_register.php

#
#-----[ FIND ]------------------------------------------------
#
if ( !defined('IN_PHPBB') )
{
   die("Hacking attempt");
   exit;
}

#
#-----[ AFTER, ADD ]------------------------------------------
#
define('NO_REDIRECT', true);

should deactivate fancy redirect upon registering.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Re: [Adv. mod Rewrite] Can't register anymore!

Postby dr_somm » Tue Mar 10, 2009 2:29 pm

Unfortunately, that didn't work. I think it's already disabled in profile.php.
dr_somm
 
Posts: 29
Joined: Sun Mar 01, 2009 9:27 pm

Re: [Adv. mod Rewrite] Can't register anymore!

Postby dcz » Tue Mar 10, 2009 2:38 pm

Please post here you redirect() function's code.
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Re: [Adv. mod Rewrite] Can't register anymore!

Postby dr_somm » Tue Mar 10, 2009 4:49 pm

Thanks a lot for helping me out! Btw: It'll work if I remove the Terms & Conditions page.

This is what the code in functions.php looks like:
Code: Select all
//-- mod : Login Redirection Suite ---------------------------------------------
//-- add
function get_redirect($link=false, $amp=false)
{
   global $HTTP_SERVER_VARS;
   global $phpEx;

   $url_page = '';

   //
   // Borrowed code from login.php
   //
   $url_to = $HTTP_SERVER_VARS['QUERY_STRING'];

   if ( preg_match("/^redirect=([a-z0-9\.#\/\?&=\+\-_]+)/si", $url_to, $url_matches) )
   {
      $url_to = ( !empty($url_matches[3]) ) ? $url_matches[3] : $url_matches[1];
      $url_match = explode('&', $url_to);

      if ( count($url_match) > 1 )
      {
         for ($i = 1; $i < count($url_match); $i++)
         {
            if ( !ereg("sid=", $url_match[$i]) )
            {
               if ( $url_page != '' )
               {
                  $url_page .= ( $amp ? '&amp;' : '&' );
               }

               $url_page .= $url_match[$i];
            }
         }

         $url_page = $url_match[0] . ( $link ? ( $amp ? '&amp;' : '&' ) : '?' ) . $url_page;
      }
      else
      {
         $url_page = $url_match[0];
      }
   }
   else if ( preg_match("/^logout=true&redirect=([a-z0-9\.#\/\?&=\+\-_]+)/si", $url_to, $url_matches) )
   {
      $url_to = ( !empty($url_matches[3]) ) ? $url_matches[3] : $url_matches[1];
      $url_match = explode('&', $url_to);

      if ( count($url_match) > 1 )
      {
         for ($i = 1; $i < count($url_match); $i++)
         {
            if ( !ereg("sid=", $url_match[$i]) )
            {
               if ( $url_page != '' )
               {
                  $url_page .= ( $amp ? '&amp;' : '&' );
               }

               $url_page .= $url_match[$i];
            }
         }

         $url_page = $url_match[0] . ( $link ? ( $amp ? '&amp;' : '&' ) : '?' ) . $url_page;
      }
      else
      {
         $url_page = $url_match[0];
      }
   }

   if ( strstr(urldecode($url_page), "\n") || strstr(urldecode($url_page), "\r") )
   {
      message_die(GENERAL_ERROR, 'Tried to redirect to potentially insecure url.');
   }

   if ( empty($url_page) )
   {
      $url_page = "index." . $phpEx;
   }

   return $url_page;
}

function get_url($amp=false)
{
   global $HTTP_POST_VARS, $HTTP_GET_VARS, $HTTP_SERVER_VARS;
   global $board_config;

   //
   // Extract the query variables from the url
   //
   parse_str($HTTP_SERVER_VARS['QUERY_STRING'], $outputs);

   foreach ($outputs as $var => $string)
   {
      //
      // Remove the sid variable from the url
      //
      if ($string != $outputs['sid'])
      {
         $query_vars[] = $var . '=' . $string;
      }
   }

   //
   // Don't whine if thier is an error, any urls that don't have query's
   //
   $queryVars = @implode(( $amp ? '&amp;' : '&' ), $query_vars);

   //
   // Replace the script_path with nothing since the link is always going to be in the same place as the path of the file
   //
   $php_self_var = str_replace($board_config['script_path'], '', $HTTP_SERVER_VARS['PHP_SELF']);

   //
   // Put the url back together
   //
   $url = (!empty($query_vars)) ? $php_self_var . ( $amp ? '&amp;' : '&' ) . $queryVars : $php_self_var;

   return $url;
}
//-- fin mod : Login Redirection Suite -----------------------------------------

// www.phpBB-SEO.com SEO TOOLKIT BEGIN
/**
* tell if user is a bot on ip match
*/
function is_bot($user_ip) {
   global $bot_ips;
   if ( !empty($bot_ips) ) {
      foreach ( $bot_ips as $bot_id => $bot_ip) {
         if ( strpos(trim($user_ip), $bot_ip) === 0) {
            return $bot_id;
         }
      }
   }
   return -1;
}
// www.phpBB-SEO.com SEO TOOLKIT END


All changes: http://www.quentintarantino.de/redirection.txt
dr_somm
 
Posts: 29
Joined: Sun Mar 01, 2009 9:27 pm


Return to phpBB2 Advanced mod Rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 3 guests