External incoming links

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Coop1979
    New Member
    • Sep 2006
    • 12
    • 3.8.x

    #91
    Originally posted by Gabrielt
    Hi there,

    I created my new scripts and they are working fine now. Instead of consulting the database what I did was to create a fixed table containing the old threadid's (importthreadid) and the new ones (threadid). In order to improve performance (bigest issue I had) I created several tables.

    First you need to run the script below to create the files (tables).

    Code:
    [SIZE=2]
    <?
    $dbhost1 = 'localhost';
    $dbusername1 = 'username';
    $dbuserpassword1 = 'password';
    $vbul1 = mysql_pconnect($dbhost1, $dbusername1, $dbuserpassword1);
    if (!$vbul1) {
    die('Could not connect: ' . mysql_error());
    }
    mysql_select_db("vbulletin",$vbul1);
    $count=0;
    $step = 1000;
    $query=mysql_query("SELECT importthreadid FROM thread ORDER BY importthreadid DESC LIMIT 1");
    $row=mysql_fetch_row($query);
    $total=$row[0];
    while ($count<$total)
    {
    $query=mysql_query("SELECT importthreadid,threadid FROM thread WHERE importthreadid>$count AND importthreadid<$count+$step");
    $result="";
    while ($row=mysql_fetch_array($query))
    {
    $result .= serialize($row);
    $result .="\n";
    }
    $cachefile="/www/forum/converter/".$count.".php";
    // open the cache file for writing
    $fp = @fopen($cachefile, 'w'); 
    // save the contents of output buffer to the file
    @fwrite($fp, $result);
    // close the file
    @fclose($fp);
    $count += $step;
    }
    ?>[/SIZE]
    Code:
    [SIZE=2]// Converter Start
    if ($_GET['showtopic'])
    {
    $showtopic=$_GET['showtopic'];
    $file=floor($showtopic/1000)*1000;
    $cachefile="/www/forum/converter/".$file.".php";
    $dados=file($cachefile);
    while (list($key,$value) = each($dados))
    {
    $row=unserialize($value);
    $importthreadid=$row['importthreadid'];
    $threadid=$row['threadid'];
    if ($importthreadid==$showtopic)
    {
    break;
    }
    }
    Header( "HTTP/1.1 301 Moved Permanently" ); 
    Header( "Location: http://forum.clubedohardware.com.br/showthread.php?t=".$threadid); 
    exit();
    }
    // Converter End
     
    Then I added the following code at the beginning of my index.php:
     
    
    Code:
    [SIZE=2]
    <?
    $url=$_SERVER['REQUEST_URI'];
    $result=explode("/lofiversion/index.php/t",$url);
    $result=explode(".html",$result[1]);
    $showtopic=$result[0];
    if ($showtopic)
    {
    $file=floor($showtopic/1000)*1000;
    $cachefile="/www/forum/converter/".$file.".php";
    $dados=file($cachefile);
    while (list($key,$value) = each($dados))
    {
    $row=unserialize($value);
    $importthreadid=$row['importthreadid'];
    $threadid=$row['threadid'];
    if ($importthreadid==$showtopic)
    {
    break;
    }
    }
    Header( "HTTP/1.1 301 Moved Permanently" ); 
    Header( "Location: http://forum.clubedohardware.com.br/showthread.php?t=".$threadid); 
    }
    else
    {
    Header( "HTTP/1.1 301 Moved Permanently" ); 
    Header( "Location: http://forum.clubedohardware.com.br"); 
    }
    ?>
     
    And also created the file below and saved as index.php under /lofiversion:
     
    


    I am not a real programmer myself, so this code may need a fine tuning, especially on the part that the script looks for a match inside the file, because right now it has to go to each entry until it finds a match instead of going directly to a match (I didn't know how to do differently).

    Suggestions are welcome!

    Cheers,
    Gabriel.
    [/SIZE][/SIZE]
    Can someone help me figure out exactly how Gabriel did this? I'm moving from IPB to VB and have been unsuccessful so far using the 404.php file.

    Comment

    • compunerdy
      New Member
      • Dec 2007
      • 11
      • 3.6.x

      #92
      I followed the instructions but this is what gets displayed.

      Code:
      [B]Notice[/B]: Undefined index: REQUEST_URI in [B]D:\hshome\***\***\404.php[/B] on line [B]119[/B]
      
      Action :: 
      SQL :: 
      [B]Notice[/B]: Undefined index: REQUEST_URI in [B]D:\hshome\***\***\404.php[/B] on line [B]353[/B]
      
      REQUEST_URI ::
      I edited the url where the *** are

      Comment

      • quasar
        Member
        • Aug 2007
        • 83
        • 5.0.0

        #93
        What forum type are you migrating from?

        Comment

        • Ronan
          Member
          • Aug 2007
          • 58

          #94
          Ok, this is driving me insane

          Is this what i am supposed to be doing?

          - Put in .htaccess file in old phpBB2 root folder

          - In the .htaccess file do a 301 redirect to the 404.php file (dont know how to do this)

          I dont know how to do this and its not mentioned in the readme. I have tried a few different scripts, some do nothing, some bring me to the 404.php page but just redirect me to the "not_found.php" page.

          Any help would be greatly appreciated.

          Comment

          • quasar
            Member
            • Aug 2007
            • 83
            • 5.0.0

            #95
            The .htaccess in my post above was for the root server folder, i.e. in the html_public or www section of the site.

            I'm not sure about 301 redirect, it's not something I've had to use atm.

            Hope it helps.

            Comment

            • Ronan
              Member
              • Aug 2007
              • 58

              #96
              Originally posted by quasar
              The .htaccess in my post above was for the root server folder, i.e. in the html_public or www section of the site.

              I'm not sure about 301 redirect, it's not something I've had to use atm.

              Hope it helps.
              Thanks, but that it must mean it should go into the root folder of the origional phpBB2 folder. I still havent got it working, would be nice if the tutorial told you how to write the 301 redirect because i would say alot of people using this will never have used one.

              My forum has now been down all evening

              Comment

              • Jerry
                Senior Member
                • Dec 2002
                • 9137
                • 1.1.x

                #97
                Originally posted by Ronan
                Thanks, but that it must mean it should go into the root folder of the origional phpBB2 folder. I still havent got it working, would be nice if the tutorial told you how to write the 301 redirect because i would say alot of people using this will never have used one.

                My forum has now been down all evening
                This script is here as an example of how to accomplish something that I was chatting to the origional thread starter about.

                As it isn't being accepted that way, I'm going to remove it and post it on vbulletin.org.
                I wrote ImpEx.

                Blog | Me

                Comment

                • steely
                  New Member
                  • Jan 2008
                  • 7

                  #98
                  Just a question

                  will 404.php work for a phpbb3 "link translation"? ... or it's only developped for phpbb2?.

                  Thanks for support.
                  Last edited by steely; Wed 23 Jan '08, 4:19am.

                  Comment

                  • Jerry
                    Senior Member
                    • Dec 2002
                    • 9137
                    • 1.1.x

                    #99
                    This script was made as an example for people to modify and customise and complete for their own sites, not as a complete and working solution that is supported, only (as this thread covered) a suggestion and example for those who wished to write something to develop something for their site.

                    It was developed before phpBB3.

                    As it can not be taken as such, It will now be removed and this thread closed.

                    The script itself has been moved to vbulletin.org

                    I wrote ImpEx.

                    Blog | Me

                    Comment

                    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                    Working...