Location: PHPKode > scripts > guaranix Rank > guaranix-rank/gRankSimpleTest.php
<?
/*
	This is an small example for show it's works
	hide@address.com - Cesar Rodas
*/

/*
	Create an example of links.	
*/
$SQLuser = "root";
$SQLpass = "";
$SQLdb = "test";
$SQLhost = "localhost";

mysql_connect($SQLhost,$SQLuser,$SQLpass) or die(mysql_error());
mysql_select_db($SQLdb) or die(mysql_error());

/*
	Now We will create 10 Pages;
	1)  http://www.site.com/Main 
	2)  http://www.site.com/Section_1
	3)  http://www.site.com/Section_2
	4)  http://www.site.com/Section_3
	5)  http://www.site.com/Section_4
	6)  http://www.site.com/SubSection_1.1
	7)  http://www.site.com/SubSection_2.1
	8)  http://www.site.com/SubSection_3.1
	9)  http://www.site.com/SubSection_4.1
	10) http://www.site.com/SubSection_4.2
	
	Main Outlinks: 2,3,4,5
	Section_1 Outlinks: 1,3,4,5,6
	Section_2 Outlinks: 1,2,4,5,7
	Section_3 Outlinks: 1,2,3,5,8
	Section_4 Outlinks: 1,2,3,4,9,10
	SubSection_1.1 Outlinks: 1,2
	SubSection_2.1 Outlinks: 1,3
	SubSection_3.1 Outlinks: 1,4
	SubSection_4.1 Outlinks: 1,5,10
	SubSection_4.2 Outlinks: 1,5,9
*/

/* The main outlinks*/
mysql_query("DROP TABLE IF EXISTS pagerank");
mysql_query("CREATE TABLE `pagerank` (
  `master` int(11) NOT NULL default '0',
  `slave` int(11) NOT NULL default '0',
  KEY `m` (`master`),
  KEY `s` (`slave`)
) TYPE=MyISAM");


mysql_query("INSERT INTO pagerank VALUES
(1,2),(1,3),(1,4),(1,5),
(2,1),(2,3),(2,4),(2,5),(2,6),
(3,1),(3,2),(3,4),(3,5),(3,7),
(4,1),(4,2),(4,3),(4,5),(4,8),
(5,1),(5,2),(5,3),(5,4),(5,9),(5,10),
(6,1),(6,2),
(7,1),(7,3),
(8,1),(8,4),
(9,1),(9,5),(9,10),
(10,1),(10,5),(10,9)
") or die(mysql_error());





/* 
	Now calculate the PR
*/
include "gRank.php";
include "mysql.php";
$test = new gRank;

ini_set("memory_limit","64M");

$test->mysql = mysql_connect($SQLhost,$SQLuser,$SQLpass) or die(mysql_error());
mysql_select_db($SQLdb) or die(mysql_error($test->mysql));
$test->dump = 0.85;
$test->sql_limit = 2000;
$test->calculate();

?>
Return current item: guaranix Rank