Announcement

Collapse
No announcement yet.

External incoming links

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #91
    Originally posted by Gabrielt View Post
    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:
    
    <?
    $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;
    }
    ?>


    Then I added the following code at the beginning of my index.php:

    Code:
    // 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


    And also created the file below and saved as index.php under /lofiversion:

    Code:
    
    <?
    $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"); 
    }
    ?>


    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.
    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


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

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

      Comment


      • #93
        What forum type are you migrating from?

        Comment


        • #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


          • #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


            • #96
              Originally posted by quasar View Post
              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


              • #97
                Originally posted by Ronan View Post
                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


                • #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 23rd Jan '08, 5:19am.

                  Comment


                  • #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

                    http://www.vbulletin.org/forum/showthread.php?t=176964
                    I wrote ImpEx.

                    Blog | Me

                    Comment

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