From MediaWiki.org
Jump to: navigation, search

RPEDAPIReader.php[edit | edit source]

 * Remote Page Existence Detection (RPED) API extension by Tisane
 * URL: http://www.mediawiki.org/wiki/Extension:RemotePageExistenceDetection
 * This program is free software. You can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version. You can also redistribute it and/or
 * modify it under the terms of the Creative Commons Attribution 3.0 license.
 * This file gets parameters from a URL and parses them into records to be added or deleted from
 * the page title table in the database.
$url=urldecode  ($_SERVER['QUERY_STRING']);
//global $wgRRAnonOnly, $wgUser,$wgOut,$wgDBserver,$wgDBuser,$wgDBpassword;
$con = mysql_connect($yourHost,$yourUsername,$yourPassword);
if (!$con){
	die('Could not connect: ' . mysql_error());
mysql_select_db("page_title_db", $con);
for ($count=0; $count<strlen($url); $count++){
	if (substr($url,$count,1)=='|'){
	} else {
		if (!isset($myInput[$myInputNum])){
		if (substr($url,$count,1)==' '){
		} else {
$sql = "CREATE TABLE password_table(
		password text(1000)
$sql="SELECT * FROM password_table";
// echo('<br />Your password: '.$myInput[0].'<br />');
// echo('My password: '.$result3.'<br />');
if ($result3==$myInput[0]){ // The password matches.
	for ($count=1; $count<=$myInputNum; $count++){
		$sql='Bad command';
		if (isset($myInput[$count])){
				if (substr($myInput[$count],0,4)=='ins='){
					$myQuery=sprintf("SELECT * FROM page_title_table WHERE page_title='%s'",
					if ($matches==0){ // If it's not already in the table...
						$matches=mysql_num_rows  ( $result  ); // Is this already in the table?
						$sql=sprintf("INSERT INTO page_title_table (page_title) VALUES ('%s'",
			elseif (substr($myInput[$count],0,4)=='del='){
				$sql=sprintf("DELETE FROM page_title_table WHERE page_title=('%s')",
		if ($sql!='Bad command'){
			//echo ($sql);
	echo ('Access granted! '.$myInputNum.' records received and processed.');
else{ // The password doesn't match.
	echo("Access denied; the correct password was not provided.");