3 echo "<form method=get action=nth_page.php>Article#:<input name=num />Wiki:<input name=db /><input type=submit /></form>";
12 if(preg_match( '/^[a-z-]{1,10}\(wiktionary|wiki(|books|versity|species|source|quote))$/', $odb )){
13 echo "Invalid wiki<br/>";
14 echo "Wikis <a href='http://noc.wikimedia.org/conf/all.dblist'>here</a> will work";
17 $ts_pw = posix_getpwuid(posix_getuid());
18 $ts_mycnf = parse_ini_file($ts_pw['dir'] . "/.my.cnf");
19 $db = mysql_connect($odb.'-p.db.toolserver.org', $ts_mycnf['user'], $ts_mycnf['password']);
23 mysql_select_db($odb.'_p', $db);
27 $nth=$nth-1; if($nth < 0){ $nth = 0; } // array-values are given with 1 as starting point (database counts 0 as first one)
29 /* Get the nth item */
32 SELECT /* LIMIT:120 */ *
34 WHERE page_namespace=0
35 AND page_is_redirect=0
39 $dbResult = mysql_query($dbQuery,$db);
42 $a = mysql_fetch_assoc($dbResult);
50 echo htmlentities($s, ENT_NOQUOTES
, "UTF-8");
52 echo "Can not select query: \n" . mysql_error();
55 echo "<br/><a href='nth_page.php'>back</a>";