How-To PHPLD 3.2 Deep Link Mod

This modification allows to offer deeplinks in your phpld directory. It is a safe modification but you are better off backing up the database and the following files:
include/tables.php
/detail.php
submit.tpl
detail.tpl

First: we have to add additional fields in the PLD_LINK table:

1. Open include/tables.php
FIND:

'RECPR_EXPIRED' => 'L NOTNULL DEFAULT 0'

REPLACE BY:

'RECPR_EXPIRED' => 'L NOTNULL DEFAULT 0' ,
'TITLE1' => 'C(255) NULL' ,
'URL1' => 'C(255) NULL' ,
'TITLE2' => 'C(255) NULL' ,
'URL2' => 'C(255) NULL' ,
'TITLE3' => 'C(255) NULL' ,
'URL3' => 'C(255) NULL' ,
'TITLE4' => 'C(255) NULL' ,
'URL4' => 'C(255) NULL' ,
'TITLE5' => 'C(255) NULL' ,
'URL5' => 'C(255) NULL'

2. NOW rerun the install script by pointing to install/index.php, this will update the table structure.

Second: Modify the submit form:

in submit.tpl
FIND:

<tr>
   <td class="label">{l}Description{/l}:</td>

ABOVE it, ADD:

<tr>
    <td class="label">TITLE 1</td>
    <td class="field"><input type="text"
 name="TITLE1" value="{$TITLE1|escape|trim}"
 size="40" maxlength="255" class="text"/></td>
  </tr>
  <tr>
    <td class="label">URL 1</td>
    <td class="field"><input type="text"
 name="URL1" value="{$URL1|escape|trim}"
 size="40" maxlength="255" class="text"/></td>
  </tr>
  <tr>
    <td class="label">TITLE 2</td>
    <td class="field"><input type="text"
 name="TITLE2" value="{$TITLE2|escape|trim}"
 size="40" maxlength="255" class="text"/></td>
  </tr>
  <tr>
    <td class="label">URL 2</td>
    <td class="field"><input type="text"
 name="URL2" value="{$URL2|escape|trim}"
 size="40" maxlength="255" class="text"/></td>
  </tr>
  <tr>
    <td class="label">TITLE 3</td>
    <td class="field"><input type="text"
 name="TITLE3" value="{$TITLE3|escape|trim}"
 size="40" maxlength="255" class="text"/></td>
  </tr>
  <tr>
    <td class="label">URL 3</td>
    <td class="field"><input type="text"
 name="URL3" value="{$URL3|escape|trim}"
 size="40" maxlength="255" class="text"/></td>
  </tr>
  <tr>
    <td class="label">TITLE 4</td>
    <td class="field"><input type="text"
 name="TITLE4" value="{$TITLE4|escape|trim}"
 size="40" maxlength="255" class="text"/></td>
  </tr>
  <tr>
    <td class="label">URL 4</td>
    <td class="field"><input type="text"
 name="URL4" value="{$URL4|escape|trim}"
 size="40" maxlength="255" class="text"/></td>
  </tr>
  <tr>
    <td class="label">TITLE 5</td>
    <td class="field"><input type="text"
 name="TITLE5" value="{$TITLE5|escape|trim}"
 size="40" maxlength="255" class="text"/></td>
  </tr>
    <tr>
    <td class="label">URL 5</td>
    <td class="field"><input type="text"
 name="URL5" value="{$URL5|escape|trim}"
 size="40" maxlength="255" class="text"/></td>
  </tr>

Finally Show the additional links in the details page.
To do so, we have to modify detail.php and detail.tpl

1. in detail.tpl
FIND:

<tr>
<td class="label">{l}Description{/l}:</td>
<td class="smallDesc" align="left">
{$DESCRIPTION|escape|trim}</td>
</tr>

BELOW, ADD:

<tr>
<td class="label">{l}Products/Services:{/l}</td>
<td class="smallDesc" align="left">
<a href="{$URL1|escape|trim}">
{$TITLE1|escape|trim}</a>&nbsp;
<a href="{$URL2|escape|trim}">
{$TITLE2|escape|trim}</a>&nbsp;
<a href="{$URL3|escape|trim}">
{$TITLE3|escape|trim}</a>&nbsp;
<a href="{$URL4|escape|trim}">
{$TITLE4|escape|trim}</a>&nbsp;
<a href="{$URL5|escape|trim}">
{$TITLE5|escape|trim}</a>&nbsp;
</td>
</tr>

2. in detail.php
FIND:

$data['META_DESCRIPTION'] = $rdata['META_DESCRIPTION'];

BELOW it, ADD:

$data['TITLE1']    = $rdata['TITLE1'];
$data['URL1']    = $rdata['URL1'];
$data['TITLE2']    = $rdata['TITLE2'];
$data['URL2']    = $rdata['URL2'];
$data['TITLE3']    = $rdata['TITLE3'];
$data['URL3']    = $rdata['URL3'];
$data['TITLE4']    = $rdata['TITLE4'];
$data['URL4']    = $rdata['URL4'];
$data['TITLE5']    = $rdata['TITLE5'];
$data['URL5']    = $rdata['URL5'];

You are done, now all plans (regular and featured will have the optional 5 additional links.
To modify the number of additional links the code above should be modified accordingly (straightforward).

It’s a pretty good how-to guide, thanks rakCha Blog for the tutorial.

GamingType.com Re-Design

The coders finished integrating the new design for my game directory. It’s now live on site.

The site now also features a cheat database of over 30,000 gaming cheats, viewable here. I have to remind you that the site lists all gaming sites from casino to free online games.

I hope you like it!

PHP Script to Display Pagerank as an Image on your Site

For those who don’t know what Pagerank is, here is how Wikipedia explains PageRank:

http://en.wikipedia.org/wiki/PageRank

Google PageRank is mostly discussed by SEO’s but also webmasters, web advertisers and publishers. For example, webmasters will not exchange links with websites whose PageRank is less then 4 or 5. Often, web publishers will pay less money for ads on websites with lower PageRanks. So how do you know what a PageRank of a website is? Simplest way to do it is to install Google toolbar. There are also various tools and scripts out there that will tell you the PageRank. One of the popular scripts was the one published by www.googlecommunity.com.

Below is modified version of that script. I used the code to create a PHP class that can be easily implemented with your projects. I also included images for visual representation of the PageRank.

Do following:
Save the code above as pagerank.php.
Download or create your own images to display each rank.
Create a directory “images” containing all page rank images.
See code below on how to use the class.

Put wherever you want in your page this code:

<?php

include(“pagerank.php”);

$gpr = new pageRank();

$gpr->printrank(“http://www.yahoo.com”);

//display image

echo $gpr->get_pr();

?>

Then create pagerank.php

<?php 

define(‘GOOGLE_MAGIC’0xE6359A60); 

class pageRank{

var $pr; 

function zeroFill($a$b){ 

$z hexdec(80000000);

  if ($z $a){ 

   $a = ($a>>1); 

   $a &= (~$z); 

   $a |= 0×40000000; 

   $a = ($a>>($b-1)); 

  }else{ 

   $a = ($a>>$b); 

  } 

return $a; 

} 

function mix($a,$b,$c) { 

   $a -= $b$a -= $c$a ^= ($this->zeroFill($c,13));

   $b -= $c$b -= $a$b ^= ($a<<8);

   $c -= $a$c -= $b$c ^= ($this->zeroFill($b,13));

   $a -= $b$a -= $c$a ^= ($this->zeroFill($c,12));

   $b -= $c$b -= $a$b ^= ($a<<16);

   $c -= $a$c -= $b$c ^= ($this->zeroFill($b,5));

   $a -= $b$a -= $c$a ^= ($this->zeroFill($c,3));

   $b -= $c$b -= $a$b ^= ($a<<10);

   $c -= $a$c -= $b$c ^= ($this->zeroFill($b,15));

   return array($a,$b,$c); 

} 

function GoogleCH($url$length=null$init=GOOGLE_MAGIC) { 

  if(is_null($length)) { 

   $length sizeof($url); 

  } 

  $a $b 0×9E3779B9;

  $c $init;

  $k 0;

  $len $length;

  while($len >= 12) { 

   $a += ($url[$k+0] +($url[$k+1]<<8) +($url[$k+2]<<16) +($url[$k+3]<<24));

   $b += ($url[$k+4] +($url[$k+5]<<8) +($url[$k+6]<<16) +($url[$k+7]<<24));

   $c += ($url[$k+8] +($url[$k+9]<<8) +($url[$k+10]<<16)+($url[$k+11]<<24));

   $mix $this->mix($a,$b,$c);

   $a $mix[0]; $b $mix[1]; $c $mix[2];

   $k += 12;

   $len -= 12; 

  }

  $c += $length;

  switch($len){ 

   case 11$c+=($url[$k+10]<<24);

   case 10$c+=($url[$k+9]<<16);

   case $c+=($url[$k+8]<<8);

   /* the first byte of c is reserved for the length */

   case $b+=($url[$k+7]<<24);

   case $b+=($url[$k+6]<<16);

   case $b+=($url[$k+5]<<8);

   case $b+=($url[$k+4]);

   case $a+=($url[$k+3]<<24);

   case $a+=($url[$k+2]<<16);

   case $a+=($url[$k+1]<<8);

   case $a+=($url[$k+0]); 

  } 

  $mix $this->mix($a,$b,$c); 

/* report the result */ 

return $mix[2]; 

} 

function strord($string) { 

  for($i=0;$i<strlen($string);$i++) { 

   $result[$i] = ord($string{$i}); 

  } 

return $result; 

} 

function printrank($url){

  $ch “6″.$this->GoogleCH($this->strord(“info:” $url)); 

  $fp fsockopen(“www.google.com”80$errno$errstr30);

  if (!$fp) {

     echo “$errstr ($errno)<br />\n”;

  } else {

     $out “GET /search?client=navclient-auto&ch=” $ch .  “&features=Rank&q=info:” $url “ HTTP/1.1\r\n”;

     $out .= “Host: www.google.com\r\n”;

     $out .= “Connection: Close\r\n\r\n”; 

     fwrite($fp$out);

     while (!feof($fp)) {

       $data fgets($fp128);

       $pos strpos($data“Rank_”);

         if($pos === false){

         }else{

           $pagerank substr($data$pos 9);

           $this->pr_image($pagerank);

         }

     }

     fclose($fp); 

  }

}

//display pagerank image. Create your own or download images I made for this script. If you make your own make sure to call them pr0.gif, pr1.gif, pr2.gif etc.

function pr_image($pagerank){
   $this->pr = "<img src=\"images/pr" . $pagerank .".gif\" alt=\"PageRank " .$pagerank. " out of 10\">";
}
function get_pr(){
  return $this->pr;
}
}
?>