PHP Classes
elePHPant
Icontem

File: sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Setec Astronomy  >  Google Dancer  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Sample file
Class: Google Dancer
Check whether Google is updating their index
Author: By
Last change: Some bug fixes.
Date: 10 years ago
Size: 6,108 bytes
 

Contents

Class file image Download
<html>
<head>
<title>Google Dancer Class</title>
<style><!--
body, td {
    font-family: arial,sans-serif;
    font-size: 10pt
}
div.nav {
    margin-top: 1ex
}
div.nav A {
    font-size: 10pt;
    font-family: arial, sans-serif;
    font-style: normal;
}
span.nav {
    font-size: 10pt;
    font-family: arial,sans-serif;
    font-weight: bold
}
div.nav A,span.big {font-size: 12pt; color: #0000cc}
div.nav A {font-size: 10pt; color: black}
A.l:link {color: #6f6f6f}
A.u:link {color: green}
.btn {
    background-color: #7C9CDE;
    border: 1px solid #3366CC;
}
input {
    font-family: arial, sans-serif;
    font-size: 12px;
}
-->
</style>
</head>
<body text=#000000 bgcolor=#ffffff>
<table border=0 cellpadding=2 cellspacing=0 width=100%>
  <tr>
    <td rowspan=3 width=1% nowrap> <b><font face=times color=#0039b6 size=10>G</font><font face=times color=#c41200 size=10>o</font><font face=times color=#f3c518 size=10>o</font><font face=times color=#0039b6 size=10>g</font><font face=times color=#30a72f size=10>l</font><font face=times color=#c41200 size=10>e</font><font face=times color=#0039b6 size=10>
      D</font><font color="#c41200" size="10" face="times">a</font><font color="#f3c518" size="10" face="times">n</font><font color="#0039b6" size="10" face="times">c</font><font color="#30a72f" size="10" face="times">e</font><font color="#c41200" size="10" face="times">r</font>&nbsp;&nbsp;</b>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor=#3366cc><b><font color="#FFFFFF">&nbsp;Check if Google is updating
      its indexes!</font></b></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<form action="<?php print ($_SERVER['PHP_SELF']); ?>" method="post">
<table border="0">
  <tr>
    <td>Keywords:</td>
    <td><input name="keywords2" type="text" value="setec astronomy" /></td>
  </tr>
  <tr>
    <td>Backlinks:</td>
    <td><input type="checkbox" name="backlinks" value="checkbox" /></td>
  </tr>
  <tr>
    <td>Indexed pages:</td>
    <td><input type="checkbox" name="indexedpages" value="checkbox" /></td>
  </tr>
  <tr>
    <td>Results:</td>
    <td><input type="checkbox" name="results" value="checkbox" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" align="center"><input name="Input" type="submit" value="Check!" class="btn" />
      <input type="hidden" name="IDAction" value="1" /></td>
  </tr>
</table>
<br />
</form>
<?php
// include the googledancer class
require_once (dirname (__FILE__) . '/googledancer.class.php');
// set the time limit so the script doesn't fails
set_time_limit (0);

if (isset (
$_POST['IDAction']) && ($_POST['IDAction'] == 1)) {
   
$_POST['keywords'] = isset ($_POST['keywords']) ? $_POST['keywords'] : 'setec astronomy';
   
$_POST['backlinks'] = isset ($_POST['backlinks']) ? true : false;
   
$_POST['indexedpages'] = isset ($_POST['indexedpages']) ? true : false;
   
$_POST['results'] = isset ($_POST['results']) ? true: false;

   
// create a new object
   
$googledancer = new googledancer ();
   
// grab the information from google servers
   
   
if ($_POST['backlinks']) {
       
$backlinks = $googledancer->getBackLinks ();
       
$backlinks_value = $googledancer->analizeResults ($backlinks);
        print (
'Looking at the backlinks there is a probability of the ' .
              
sprintf ('%01.0f', $backlinks_value) .
              
'% that google is dancing!<br />');
       
$backlinks_percentage = (sprintf ('%01f', $backlinks_value) * 3) + 1;
    }
    if (
$_POST['indexedpages']) {
       
$indexedpages = $googledancer->getIndexedPages ();
       
$indexedpages_value = $googledancer->analizeResults ($indexedpages);
        print (
'Looking at the indexed pages there is a probability of the ' .
              
sprintf ('%01.0f', $indexedpages_value) .
              
'% that google is dancing!<br />');
       
$indexedpages_percentage = (sprintf ('%01f', $indexedpages_value) * 3) + 1;
    }
    if (
$_POST['results']) {
       
$results = $googledancer->getResults ('setec astronomy');
       
$results_value = $googledancer->analizeResults ($results);
        print (
'Looking at the results there is a probability of the ' .
              
sprintf ('%01.0f', $results_value) .
              
'% that google is dancing!<br />');
       
$results_percentage = (sprintf ('%01f', $results_value) * 3) + 1;
    }
?>
<br />

<table width="450" border="0">
  <tr align="center">
    <td colspan="3">Google is dancing?</td>
  </tr>
  <?php if ($_POST['backlinks']) { ?>
<tr>
    <td>Backlinks</td>
    <td>&nbsp;</td>
    <td width="300"><table width="100%" border="1" bordercolor="#000000">
        <tr>
          <td width="<?php print ($backlinks_percentage); ?>%" align="center" bgcolor="#003399"><font color="#FFFFFF"><?php print (sprintf ('%01.0f', $backlinks_value)); ?>%</font></td>
          <td bordercolor="#FFFFFF">&nbsp;</td>
        </tr>
      </table></td>
  </tr>
  <?php } ?>
<?php if ($_POST['indexedpages']) { ?>
<tr>
    <td>Indexed pages</td>
    <td>&nbsp;</td>
    <td width="300"><table width="100%" border="1" bordercolor="#000000">
        <tr>
          <td width="<?php print ($indexedpages_percentage); ?>%" align="center" bgcolor="#003399"><font color="#FFFFFF"><?php print (sprintf ('%01.0f', $indexedpages_value)); ?>%</font></td>
          <td bordercolor="#FFFFFF">&nbsp;</td>
        </tr>
      </table></td>
  </tr>
  <?php } ?>
<?php if ($_POST['results']) { ?>
<tr>
    <td>Results</td>
    <td>&nbsp;</td>
    <td width="300"><table width="100%" border="1" bordercolor="#000000">
        <tr>
          <td width="<?php print ($results_percentage); ?>%" align="center" bgcolor="#003399"><font color="#FFFFFF"><?php print (sprintf ('%01.0f', $results_value)); ?>%</font></td>
          <td bordercolor="#FFFFFF">&nbsp;</td>
        </tr>
      </table></td>
  </tr>
  <?php } ?>
</table>
<br />
<?php
} // if (isset ($_POST['IDAction']) && ($_POST['IDAction'] == 1)) {
?>
<table width=100% cellpadding=0 cellspacing=0>
  <tr>
    <td bgcolor=#3366cc><img alt="" width=1 height=4></td>
  </tr>
</table>
</body>
</html>