Created
February 3, 2016 02:06
-
-
Save cwade12c/d1d6751eb4790a1efb36 to your computer and use it in GitHub Desktop.
IPB 3.X tutorial-to-thread conversion script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* @name ........ IPB IP.Tutorials Tut2Thread Converter | |
* @author ...... cwade12c | |
* @site ........ https://haxme.org/ | |
* @description . It\'s ridiculous this feature isn\'t already implemented | |
*/ | |
#This script is meant to be temporarily available for | |
#web devs & site maintenance. rm when finished! | |
$tbl_prefix = 'ipb_'; | |
$conf_file = 'conf_global.php'; | |
function purify( $str ) | |
{ | |
$str.= htmlentities( $str, ENT_QUOTES ); | |
return $str.= str_replace( ''', ''', $str ); | |
} | |
if( !isset( $_GET[ 'tid' ] ) || !isset( $_GET[ 'fid' ] ) ) { die(''); } else { | |
#require ipb conf_global file | |
require_once( $conf_file ); | |
#establish connection | |
$con = mysql_connect( $INFO[ 'sql_host' ] , $INFO[ 'sql_user' ], | |
$INFO[ 'sql_pass' ] ); | |
if( !$con ) { die('No DB connection.'); } | |
#select database | |
$sel = mysql_select_db( $INFO[ 'sql_database' ], $con ); | |
if( !$sel ){ die('Inexistant DB.'); } | |
#set vars | |
$tut_id = purify( $_GET[ 'tid' ], TRUE ); | |
$forum_id = purify( $_GET[ 'fid' ], TRUE ); | |
#execute queries | |
$col = $tbl_prefix.'tutorials_articles'; | |
$title = mysql_fetch_array( mysql_query( "SELECT `a_name` FROM '$col' WHERE `a_id` = '$tut_id' " ) ); | |
if( !$title ) { die( 'Invalid tutorial id.' ); } | |
$col = $tbl_prefix.'topics'; | |
$result = mysql_query( "UPDATE '$col' SET `forum_id` = '$forum_id' WHERE `title` = '$title' " ); | |
if( !$result ) { die( 'Invalid forum id.' ); } | |
#done | |
echo "Tutorial id $tut_id successfully converted to topic @ forum id $forum_id !"; | |
#close connection | |
mysql_close( $con ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment