Header Part Showing Twice PHP Code

 

Results 1 to 4 of 4
here my full source code to check bulk alexa rank but my header part showing ...
  1. #1
    hostmela's Avatar
    hostmela is offline Junior Member
    Join Date
    Aug 2012
    Posts
    139
    Thanks
    25
    Thanked 81 Times in 41 Posts

    Thumbs up Header Part Showing Twice PHP Code

    here my full source code to check bulk alexa rank but my header part showing in my template twice with this code

    <?php
    $this_script = $_SERVER['PHP_SELF'];

    class GooglePageRankChecker
    {
    private static $instance;
    function getRank($page)
    {
    if (!isset(self::$instance)) {
    self::$instance = new self();
    }
    return self::$instance->check($page);
    }
    function stringToNumber($string, $check, $magic)
    {
    $int32 = 4294967296;
    $length = strlen($string);
    for ($i = 0; $i < $length; $i++) {
    $check *= $magic;
    if ($check >= $int32) {
    $check = ($check - $int32 * (int) ($check / $int32));
    $check = ($check < -($int32 / 2)) ? ($check + $int32) : $check;
    }
    $check += ord($string{$i});
    }
    return $check;
    }

    function createHash($string)
    {
    $check1 = $this->stringToNumber($string, 0x1505, 0x21);
    $check2 = $this->stringToNumber($string, 0, 0x1003F);

    $factor = 4;
    $halfFactor = $factor / 2;

    $check1 >>= $halfFactor;
    $check1 = (($check1 >> $factor) & 0x3FFFFC0) | ($check1 & 0x3F);
    $check1 = (($check1 >> $factor) & 0x3FFC00) | ($check1 & 0x3FF);
    $check1 = (($check1 >> $factor) & 0x3C000) | ($check1 & 0x3FFF);

    $calc1 = (((($check1 & 0x3C0) << $factor) | ($check1 & 0x3C)) << $halfFactor) | ($check2 & 0xF0F);
    $calc2 = (((($check1 & 0xFFFFC000) << $factor) | ($check1 & 0x3C00)) << 0xA) | ($check2 & 0xF0F0000);

    return ($calc1 | $calc2);
    }
    function checkHash($hashNumber)
    {
    $check = 0;
    $flag = 0;

    $hashString = sprintf('%u', $hashNumber);
    $length = strlen($hashString);

    for ($i = $length - 1; $i >= 0; $i--) {
    $r = $hashString{$i};
    if (1 === ($flag % 2)) {
    $r += $r;
    $r = (int) ($r / 10) + ($r % 10);
    }
    $check += $r;
    $flag++;
    }

    $check %= 10;
    if (0 !== $check) {
    $check = 10 - $check;
    if (1 === ($flag % 2)) {
    if (1 === ($check % 2)) {
    $check += 9;
    }
    $check >>= 1;
    }
    }

    return '7' . $check . $hashString;
    }

    function check($page)
    {

    $socket = fsockopen("toolbarqueries.google.com", 80, $errno, $errstr, 30);

    if ($socket) {
    $out = "GET /tbr?client=navclient-auto&ch=" . $this->checkHash($this->createHash($page)) . "&features=Rank&q=info:" . $page . "&num=100&filter=0 HTTP/1.1\r\n";
    $out .= "Host: toolbarqueries.google.com\r\n";
    $out .= "User-Agent: Mozilla/4.0 (compatible; GoogleToolbar 2.0.114-big; Windows XP 5.1)\r\n";
    $out .= "Connection: Close\r\n\r\n";
    fwrite($socket, $out);
    $result = "";
    while (!feof($socket)) {
    $data = fgets($socket, 128);
    $pos = strpos($data, "Rank_");
    if ($pos !== false) {
    $pagerank = substr($data, $pos + 9);
    $result += $pagerank;
    }
    }
    fclose($socket);
    return $result;
    }
    }
    }

    function checkAlexa($domain)
    {
    $result = file_get_contents("http://data.alexa.com/data?cli=10&dat=snbamz&url=http://" . $domain);
    $n = explode("<POPULARITY URL=\"" . $domain . "/\" TEXT=\"", $result);
    @$rest = $n[1];
    $it = explode("\"", $rest);
    $alexa_rank = $it[0];
    if (@$alexa_rank != "") {
    return $alexa_rank;
    } else {
    return "No Alexa";
    }
    }

    if (@$_GET["action"] == "check") {
    if (@$_GET["d"] != "") {
    $rank = GooglePageRankChecker::getRank(@$_GET["d"]);
    if ($rank != "") {
    echo $rank;
    die();
    } else {
    echo "0";
    die();

    }
    } else {
    echo "0";
    die();
    }
    }

    if (@$_GET["action"] == "alexa") {
    echo checkAlexa(@$_GET["d"]);
    die();
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Free Unique SEO Tools</title>
    <script type="text/javascript">
    function checkDomainRank(domain,id)
    {
    var xmlhttp;
    if (window.XMLHttpRequest)
    {
    xmlhttp=new XMLHttpRequest();
    }
    else
    {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById(id).innerHTML='<font color="#FF0000"><b>'+xmlhttp.responseText+'</b></font>';
    if(xmlhttp.responseText.indexOf("No") <= 0){
    if(xmlhttp.responseText != "0"){
    var cur = document.getElementById('prlist').value;
    if(cur.indexOf('PR-'+xmlhttp.responseText+' - '+domain) <=0){
    document.getElementById('prlist').value = cur+'PR-'+xmlhttp.responseText+' - '+domain+'\n';
    document.getElementById(id).innerHTML='<font color="#00FF3f"><b>'+xmlhttp.responseText+'</b></font>';
    }
    }
    }
    }
    }
    xmlhttp.open("GET","<?php echo $this_script; ?>?action=check&d="+domain,true);
    xmlhttp.send();
    }

    function checkAlexaRank(domain,id)
    {
    var xmlhttp;
    if (window.XMLHttpRequest)
    {
    xmlhttp=new XMLHttpRequest();
    }
    else
    {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById(id).innerHTML='Alexa: '+xmlhttp.responseText;
    if(xmlhttp.responseText.indexOf("lex") <= 0){
    var cur = document.getElementById('alexa').value;
    if(cur.indexOf('Alexa: '+xmlhttp.responseText+' - '+domain) <=0){
    document.getElementById('alexa').value = cur+'Alexa: '+xmlhttp.responseText+' - '+domain+'\n';
    document.getElementById(id).innerHTML='Alexa: <font color="#FF0392"><b>'+xmlhttp.responseText+'</b></font>';
    }
    }
    }
    }
    xmlhttp.open("GET","<?php echo $this_script; ?>?action=alexa&d="+domain,true);
    xmlhttp.send();
    }
    </script>
    <style type="text/css">
    body{
    background-color:#FFFFCC;
    }
    textarea{
    background-color:#00CCFF;
    border:1px dashed #6633FF;
    color:#000033;
    }
    </style>
    </head>
    <body>
    <center>
    <table>
    <tr>
    <td>
    <form action='<?php echo $this_script; ?>' method='post'>
    Domain List:<BR />
    <textarea style="height:300px;width:400px;" name='domains' id='domains'><?php echo @$_POST["domains"]; ?></textarea><BR />
    <input type='button' onclick="document.getElementById('domains').value= '';" value='Clear List' name='clr' /> <input type='submit' value='Check Pagerank' name='subby' />
    </form> </td>
    <td>
    <form>
    Domains With a <b>PageRank&reg;</b>:<BR />
    <textarea style="height:300px;width:400px;" name='prlist' id='prlist'></textarea><BR />
    <input type='reset' value='Clear List' />
    </form> </td>
    <td>
    <form>
    Domains with an <b>Alexa</b> Rank:<BR />
    <textarea style="height:300px;width:400px;" name='alexa' id='alexa'></textarea><BR />
    <input type='reset' value='Clear List' />
    </form> </td>
    </tr>
    </table>
    </center>
    <div align="center">
    <?php
    $jay = "";
    if (@$_POST["subby"] != "") {
    if (@$_POST["domains"] != "") {
    $domains = explode("
    ", @$_POST["domains"]);

    echo "<table>";

    for ($i = 0; $i <= count($domains) - 1; $i++) {
    if ($domains[$i] != "") {
    echo "<tr><td>" . trim($domains[$i]) . "</td><td>Google PageRank&reg;</td><td><span id='s" . $i . "'>" . "<span style='cursorointer;' onclick=\"checkDomainRank('" . trim($domains[$i]) . "','s" . $i . "');\">Loading, Click to restart.</span>" . "<script type='text/javascript'>checkDomainRank('" . trim($domains[$i]) . "','s" . $i . "');checkAlexaRank('" . trim($domains[$i]) . "','z" . $i . "');</script></span></td><td><span style='color:#039284; ' id='z" . $i . "'></span></td></tr>";
    }
    }
    }
    }

    echo "</table>";
    ?>
    </div>
    my template header part code is

    <?php
    $title = "Bulk Alexa rank checker tools";
    $page = 2;
    $path = "../../";

    require $path . "structures/header.php";
    ?>
    here the demo script

    http://www.uniqueseotools.com/tools/...cker/index.php

    when i click on check pager rank my header part showing again same page how can i fix it??

    I think problem with this code >>>>

    <?php
    $jay = "";
    if (@$_POST["subby"] != "") {
    if (@$_POST["domains"] != "") {
    $domains = explode("
    ", @$_POST["domains"]);

    echo "<table>";

    for ($i = 0; $i <= count($domains) - 1; $i++) {
    if ($domains[$i] != "") {
    echo "<tr><td>" . trim($domains[$i]) . "</td><td>Google PageRank&reg;</td><td><span id='s" . $i . "'>" . "<span style='cursorointer;' onclick=\"checkDomainRank('" . trim($domains[$i]) . "','s" . $i . "');\">Loading, Click to restart.</span>" . "<script type='text/javascript'>checkDomainRank('" . trim($domains[$i]) . "','s" . $i . "');checkAlexaRank('" . trim($domains[$i]) . "','z" . $i . "');</script></span></td><td><span style='color:#039284; ' id='z" . $i . "'></span></td></tr>";
    }
    }
    }
    }

    echo "</table>";
    ?>
    </div>




  2. #2
    funque is offline Newbies
    Join Date
    Dec 2013
    Posts
    21
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: Header Part Showing Twice PHP Code

    This script works fine for me - no double headers, correct PR!

  3. #3
    bytzu's Avatar
    bytzu is offline Registered Member
    Join Date
    Jun 2011
    Posts
    83
    Thanks
    68
    Thanked 119 Times in 28 Posts

    Default Re: Header Part Showing Twice PHP Code

    try using require_once() function instead of require()

    http://www.php.net/manual/en/function.require-once.php

  4. #4
    barigain is offline Junior Member
    Join Date
    Aug 2012
    Posts
    100
    Thanks
    5
    Thanked 12 Times in 12 Posts

    Default Re: Header Part Showing Twice PHP Code

    Nice PR checker! Works for me too.


Similar Threads

  1. Is there a way to test part of the code?
    By Mutikasa in forum PHP & Perl
    Replies: 5
    Last Post: 01-27-2013, 03:23 PM
  2. Replies: 11
    Last Post: 03-01-2012, 06:46 AM
  3. Prevent GoDaddy code from showing up in source code
    By sfidirectory in forum Black Hat SEO
    Replies: 4
    Last Post: 08-28-2011, 10:59 AM
  4. Need help with WP header code- $5 plus $30 theme
    By TreeWalker in forum Hire a Freelancer
    Replies: 5
    Last Post: 07-13-2011, 04:13 AM
  5. Replies: 7
    Last Post: 05-09-2009, 07:26 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




BlackHatWorld on Twitter BlackHatWorld on FaceBook


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108