JackFrost
08.10.2006, 10:47
Hallo ,
nach erfolgreichem Import meines phpBB2 Boardes konnte ich die Links bei Google und Co nicht mehr nutzen da sich die IDs ja verschoben haben.
Für alle die das selbe Problem haben, gibts hier eine Lösung.
Vorraussetzung für das geschriebene php-Script ist , das die TOPICS und POSTS Tabellen des phpBB2 noch vorhanden sind und in der selben Datenbank wie die vBulletin Tabellen sind.
<?php
$praefixphpbb="";
$praefixvb="";
$dbhost = "localhost";
$dbuser = "";
$dbpassword = "";
$dbname = "";
$forumurl ="http://";
$parametert=$_REQUEST['p'];
if($parametert > 0)
{
$db = mysql_connect ($dbhost, $dbuser, $dbpassword);
if (!$db) {
die('keine Verbindung möglich: ' . mysql_error());
}
mysql_select_db($dbname);
$suche = intval($_GET['p']);
$table = $praefixphpbb;
$table .= 'posts';
$result = mysql_query("SELECT * FROM $table WHERE `post_id` = '$suche'") or die(mysql_error());
while($row = mysql_fetch_array($result)){
$suche = $row['topic_id'];
}
$table = $praefixphpbb;
$table .= 'topics';
$result = mysql_query("SELECT * FROM $table WHERE `topic_id` = '$suche'") or die(mysql_error());
while($row = mysql_fetch_array($result)){
$suche = $row['topic_title'];
}
$table = $praefixvb;
$table .= 'thread';
$result = mysql_query("SELECT * FROM $table WHERE `title` = '$suche'") or die(mysql_error());
$count=mysql_num_rows($result);
if($count > 0){
while($row = mysql_fetch_array($result)){
$thread = $row['threadid'];
}
header("location:$forumurl/showthread.php?t=".$thread);
}else{
header("HTTP/1.0 404 Not Found");
header("location:$forumurl");
}
mysql_close ($db);
}
$parametert=$_REQUEST['t'];
if($parametert > 0)
{
$db = mysql_connect ("localhost", "jackfrost", "freexworld");
if (!$db) {
die('keine Verbindung möglich: ' . mysql_error());
}
mysql_select_db("jackfrost");
$suche = intval($_GET['t']);
$table = $praefixphpbb;
$table .= 'topics';
$result = mysql_query("SELECT * FROM $table WHERE `topic_id` = '$suche'") or die(mysql_error());
while($row = mysql_fetch_array($result)){
$suche = $row['topic_title'];
echo $suche;
}
$table = $praefixvb;
$table .= 'thread';
$result = mysql_query("SELECT * FROM table WHERE `title` = '$suche'") or die(mysql_error());
$count=mysql_num_rows($result);
if($count > 0){
while($row = mysql_fetch_array($result)){
$thread = $row['threadid'];
}
header("location:$forumurl/showthread.php?t=".$thread);
}else{
header("HTTP/1.0 404 Not Found");
header("location:$forumurl");
}
mysql_close ($db);
}
?>
Ich habe die Weiterleitung zu dieses Script per .htaccess gemacht da ich das phpBB2 für Joomla genutzt habe.
Bei dem "orginal" phpBB2 sollte es reichen das man das Script viewtopics.php nennt.
Gruss JackFrost
nach erfolgreichem Import meines phpBB2 Boardes konnte ich die Links bei Google und Co nicht mehr nutzen da sich die IDs ja verschoben haben.
Für alle die das selbe Problem haben, gibts hier eine Lösung.
Vorraussetzung für das geschriebene php-Script ist , das die TOPICS und POSTS Tabellen des phpBB2 noch vorhanden sind und in der selben Datenbank wie die vBulletin Tabellen sind.
<?php
$praefixphpbb="";
$praefixvb="";
$dbhost = "localhost";
$dbuser = "";
$dbpassword = "";
$dbname = "";
$forumurl ="http://";
$parametert=$_REQUEST['p'];
if($parametert > 0)
{
$db = mysql_connect ($dbhost, $dbuser, $dbpassword);
if (!$db) {
die('keine Verbindung möglich: ' . mysql_error());
}
mysql_select_db($dbname);
$suche = intval($_GET['p']);
$table = $praefixphpbb;
$table .= 'posts';
$result = mysql_query("SELECT * FROM $table WHERE `post_id` = '$suche'") or die(mysql_error());
while($row = mysql_fetch_array($result)){
$suche = $row['topic_id'];
}
$table = $praefixphpbb;
$table .= 'topics';
$result = mysql_query("SELECT * FROM $table WHERE `topic_id` = '$suche'") or die(mysql_error());
while($row = mysql_fetch_array($result)){
$suche = $row['topic_title'];
}
$table = $praefixvb;
$table .= 'thread';
$result = mysql_query("SELECT * FROM $table WHERE `title` = '$suche'") or die(mysql_error());
$count=mysql_num_rows($result);
if($count > 0){
while($row = mysql_fetch_array($result)){
$thread = $row['threadid'];
}
header("location:$forumurl/showthread.php?t=".$thread);
}else{
header("HTTP/1.0 404 Not Found");
header("location:$forumurl");
}
mysql_close ($db);
}
$parametert=$_REQUEST['t'];
if($parametert > 0)
{
$db = mysql_connect ("localhost", "jackfrost", "freexworld");
if (!$db) {
die('keine Verbindung möglich: ' . mysql_error());
}
mysql_select_db("jackfrost");
$suche = intval($_GET['t']);
$table = $praefixphpbb;
$table .= 'topics';
$result = mysql_query("SELECT * FROM $table WHERE `topic_id` = '$suche'") or die(mysql_error());
while($row = mysql_fetch_array($result)){
$suche = $row['topic_title'];
echo $suche;
}
$table = $praefixvb;
$table .= 'thread';
$result = mysql_query("SELECT * FROM table WHERE `title` = '$suche'") or die(mysql_error());
$count=mysql_num_rows($result);
if($count > 0){
while($row = mysql_fetch_array($result)){
$thread = $row['threadid'];
}
header("location:$forumurl/showthread.php?t=".$thread);
}else{
header("HTTP/1.0 404 Not Found");
header("location:$forumurl");
}
mysql_close ($db);
}
?>
Ich habe die Weiterleitung zu dieses Script per .htaccess gemacht da ich das phpBB2 für Joomla genutzt habe.
Bei dem "orginal" phpBB2 sollte es reichen das man das Script viewtopics.php nennt.
Gruss JackFrost