Example #1
0
}
.ricoLG_bottom div.ricoLG_cell {
  height:      1.6em;
}
</style>
</head>


<body>

<?php 
$action = isset($_POST["action"]) ? $_POST["action"] : "";
if ($action == "") {
    DisplayForm();
} else {
    DisplayResult();
}
function DisplayResult()
{
    echo "<table id='results' border='1' cellspacing='0' cellpadding='4'>";
    echo "<tr><th>Problem<th>Your answer<th>Result";
    foreach ($_POST as $k => $answer) {
        $a = explode("_", $k);
        switch ($a[0]) {
            case "p":
                CheckResult($a[1], $a[2], $answer, "+", intval($a[1]) + intval($a[2]));
                break;
            case "t":
                CheckResult($a[1], $a[2], $answer, "x", intval($a[1]) * intval($a[2]));
                break;
        }
    $Tab = findSyst($syst1, $syst2, $syst3, $dist11, $dist21, $dist31);
    if ($Pla1) {
        $out = DisplayResult($Tab, $Planete1);
        //$tpl->PushOutput($out);
    }
    $Tab = findSyst($syst1, $syst2, $syst3, $dist12, $dist22, $dist32);
    if ($Pla2) {
        $out = $out . DisplayResult($Tab, $Planete2);
    }
    $Tab = findSyst($syst1, $syst2, $syst3, $dist13, $dist23, $dist33);
    if ($Pla3) {
        $out = $out . DisplayResult($Tab, $Planete3);
    }
    $Tab = findSyst($syst1, $syst2, $syst3, $dist14, $dist24, $dist34);
    if ($Pla4) {
        $out = $out . DisplayResult($Tab, $Planete4);
    }
    $Tab = findSyst($syst1, $syst2, $syst3, $dist15, $dist25, $dist35);
    if ($Pla5) {
        $out = $out . DisplayResult($Tab, $Planete5);
    }
    $tpl->PushOutput($out);
}
//------------------------------------------------
// Un petit menu perso pour l'addons
$menu = array('carte' => array('%ROOT_URL%Carte.php', '%BTN_URL%carte.png', 160, 'DataEngine::CheckPerms(AXX_MEMBER)', array()), 'triangulation' => array('%ADDONS_URL%triangulation/index.php', '%BTN_URL%triangulation1.png', 160, 'DataEngine::CheckPerms(AXX_MEMBER)', array()), 'triangulation2' => array('%ADDONS_URL%triangulation/triangulateur2.php', '%BTN_URL%triangulation2.png', 160, 'DataEngine::CheckPerms(AXX_MEMBER)', array()));
$tpl->DoOutput($menu, true);
// stoppe toute execution du script et transmet les sorties html/xml/...
// les deux 'true' étant
// 1- Inclusion du menu (html, sans effet sur xml/img)
// 2- Inclusion de l'entete de base (html, sans effet sur xml/img)
             // the compare string is set to less than
             $comparestring = "<";
         } elseif ($_POST['typeOfSearch'] == "during") {
             // the compare string is set to equal
             $comparestring = "=";
         }
         // sql query string is stored into a string variable selecting all of the books
         // where the year published concatinated with the modifier and the year for more user control
         $queryString = "SELECT * FROM books WHERE yearPublished " . $comparestring . " " . $_POST['year'];
         // the query result array is returned using the QueryDatabase function which
         // accepts the query string as a paramater
         $result = QueryDatabase($queryString);
         // header output
         echo "<h2>All books published " . $_POST['typeOfSearch'] . " " . $_POST['year'] . " in inventory</h2>";
         // the result of the query is displayed using the display result function.
         DisplayResult($result);
     }
 } else {
     if (isset($_POST['delete'])) {
         // value of the button is stored in a string variable
         $processString = $_POST['delete'];
         // if the string variable = delete book
         if ($processString == "Delete book") {
             echo "<h2> Delete Book</h2>";
             // query string that selects all titles of the books from the table
             $queryString = "SELECT title FROM books";
             // stores the result array from the query  that is returned by the
             // Query Database function
             $result = QueryDatabase($queryString);
             // gets the number of rows from the result array
             $rows = $result->num_rows;