Пример #1
0
function search($objDb, $sKeywords)
{
    $aRes = $objDb->Search($sKeywords);
    display_results($aRes, $objDb);
    if (!empty($aRes)) {
        printf('<div class="tally">Found %d documents.</div>', count($aRes));
    }
}
             $_POST['Fill'] = 'true';
         } else {
             //Show the record that's about to be deleted.
             echo "Records deleted:<br />";
             echo "Event information:<br />";
             display_results(my_trusted_mysql_query("SELECT * FROM EVENT WHERE Event_ID = {$Event_ID_num}"));
             display_results(my_trusted_mysql_query("SELECT * FROM LOCATION WHERE Event_ID = {$Event_ID_num}"));
             display_results(my_trusted_mysql_query("SELECT * FROM CLASS_DATES WHERE Event_ID = {$Event_ID_num}"));
             echo "<br />Company's association by hosting this event:<br />";
             display_results(my_trusted_mysql_query("SELECT * FROM COMPANY WHERE Email IN (SELECT Email FROM HOSTS WHERE Event_ID={$Event_ID_num})"));
             //display_results(my_trusted_mysql_query( "SELECT Event_ID, Email FROM HOSTS WHERE Event_ID = $Event_ID_num" ));
             //display_results(my_trusted_mysql_query( "SELECT Event_ID, Email FROM S_ATTEND WHERE Event_ID = $Event_ID_num" ));
             //display_results(my_trusted_mysql_query( "SELECT Event_ID, Email FROM C_ATTEND WHERE Event_ID = $Event_ID_num" ));
             echo "<br />People attending this event:<br />";
             display_results(my_trusted_mysql_query("SELECT * FROM SCREEN_PARTICIPANT WHERE Email IN (SELECT Email FROM S_ATTEND WHERE Event_ID={$Event_ID_num})"));
             display_results(my_trusted_mysql_query("SELECT * FROM CLASS_PARTICIPANT WHERE Email IN (SELECT Email FROM C_ATTEND WHERE Event_ID={$Event_ID_num})"));
             my_trusted_mysql_query("DELETE FROM EVENT WHERE Event_ID={$Event_ID_num}");
             my_trusted_mysql_query("DELETE FROM LOCATION WHERE Event_ID={$Event_ID_num}");
             my_trusted_mysql_query("DELETE FROM CLASS_DATES WHERE Event_ID={$Event_ID_num}");
             my_trusted_mysql_query("DELETE FROM HOSTS WHERE Event_ID={$Event_ID_num}");
             my_trusted_mysql_query("DELETE FROM CLASS_PARTICIPANT WHERE Email IN (SELECT Email FROM C_ATTEND WHERE Event_ID={$Event_ID_num})");
             my_trusted_mysql_query("DELETE FROM SCREEN_PARTICIPANT WHERE Email IN (SELECT Email FROM S_ATTEND WHERE Event_ID={$Event_ID_num})");
             my_trusted_mysql_query("DELETE FROM C_ATTEND WHERE Event_ID = {$Event_ID_num}");
             my_trusted_mysql_query("DELETE FROM S_ATTEND WHERE Event_ID = {$Event_ID_num}");
             my_mysql_close();
             $_POST['Fill'] = 'false';
         }
     }
 } else {
     echo "An unexpected selection has been made. <br />";
     my_mysql_close();
Пример #3
0
        header('Content-Length: ' . filesize($script));
        header('ETag: "' . filemtime($script) . '"');
        readfile($script);
    } else {
        header("HTTP/1.1 404 Not Found");
    }
} elseif (!empty($_REQUEST['result'])) {
    display_result_details(!empty($_REQUEST['branch']) ? $_REQUEST['branch'] : $branch, $_REQUEST['result'], true);
} elseif (!empty($_REQUEST['run'])) {
    $output = array();
    exec($cmd = 'php ./caldavtests.php ' . (!empty($_REQUEST['branch']) ? escapeshellarg('--branch=' . $_REQUEST['branch']) . ' ' : '') . escapeshellarg('--run=' . $_REQUEST['run']), $output, $ret);
    error_log($cmd . ' returned ' . $ret);
    // return results
    display_result_details(!empty($_REQUEST['branch']) ? $_REQUEST['branch'] : $branch, $_REQUEST['run'], true);
} else {
    display_results($branch, true);
    // true = return html
}
exit;
/**
 * from here on only functions called from above controlers for cli or webserver
 */
/**
 * Guess config from git clone
 *
 * @param string $git_sources
 */
function config_from_git($git_sources)
{
    global $branch, $revision, $commit_url;
    // only run git stuff, if sources exist, are git and git cli is available
          </tr>

        </table></td>
        <td align="left" width="100%" style="background-color: #FFFFFF" class="style26">
         <center>Current classes in the database:<br /><br /></center>
<?php 
include "includes/functions.php";
//Connect to the database
my_mysql_connect();
display_results(my_trusted_mysql_query("SELECT Event_ID, Event_Name, Start_Date, End_Date, Start_Time, End_Time, Comments FROM EVENT WHERE E_Type = 'c'"));
$total_class = count(my_trusted_mysql_query("SELECT * FROM EVENT WHERE E_Type = 'c'"));
echo "<br />Total classes: ";
echo "{$total_class}";
echo "<br />Average number of people per class: ";
//Displays the avrage number of people attending all classes
display_results(my_trusted_mysql_query("SELECT AVG(Class_Attendees) FROM ( SELECT Event_ID, count(Email) Class_Attendees FROM C_ATTEND GROUP BY Event_ID) AS cnt_table"));
my_mysql_close();
?>

         <br /><br />   
         </td>
      </tr>
      <tr>
        <td colspan="2"><table align="left" border="1" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td height="38" background="/images/index_r17_c9.jpg" class="style21">
        <div align="center">Patents and Copyrights owned by Maelstrom, Not for use by others</span><strong>.</strong><br>
        </div></td>
  </tr>
</table>
</td>
<html>
<title>
Company Test
</title>
<body>

<!-- The php script for generating the table and handling database queries -->
<?php 
include "includes/functions.php";
my_mysql_connect();
echo "<h1><CENTER>Class</CENTER></h1>";
//Displays the total people at each class
display_results(my_trusted_mysql_query("SELECT Event_ID, count(Email) FROM C_ATTEND GROUP BY Event_ID"));
echo "<h1><CENTER>Session</CENTER></h1>";
//Displays the total people at each Session
display_results(my_trusted_mysql_query("SELECT Event_ID, count(Email) FROM S_ATTEND GROUP BY Event_ID"));
my_mysql_close();
?>


</body>
</html> 
                 display_results(my_trusted_mysql_query("SELECT * FROM COMPANY WHERE Email = '{$q['Email']}'"));
                 //display_results( my_trusted_mysql_query( "SELECT Email, Number FROM COMPANY_PHONE WHERE Email = '$q[Email]'" ));
                 my_mysql_close();
                 $_POST['Fill'] = 'false';
             }
         } else {
             if ($_POST['query_type'] == 'delete') {
                 //Company is not in the database.
                 if (count(my_trusted_mysql_query("SELECT Email FROM COMPANY WHERE Email = '{$q['Email']}'")) == 0) {
                     echo "The company with the e-mail " . $q['Email'] . " does not exist in the database. " . "To add this company's information, please select insert.<br /><br />";
                     $_POST['Fill'] = 'true';
                 } else {
                     //Show the record that's about to be deleted.
                     echo "Record deleted:";
                     display_results(my_trusted_mysql_query("SELECT * FROM COMPANY WHERE Email = '{$q['Email']}'"));
                     display_results(my_trusted_mysql_query("SELECT Email, Number FROM COMPANY_PHONE WHERE Email = '{$q['Email']}'"));
                     $company_query = "DELETE FROM COMPANY WHERE Email='{$q['Email']}'";
                     my_trusted_mysql_query($company_query);
                     $company_phone_query = "DELETE FROM COMPANY_PHONE WHERE Email='{$q['Email']}'";
                     my_trusted_mysql_query($company_phone_query);
                     my_mysql_close();
                     $_POST['Fill'] = 'false';
                 }
             } else {
                 echo "An unexpected selection has been made. <br />";
                 my_mysql_close();
                 die;
             }
         }
     }
 }
Пример #7
0
} else {
    echo "<p>\$mysqli is NOT instance of mysqli</p>";
}
if (isset($mysqli)) {
    echo "<p>\$mysqli is set</p>";
} else {
    echo "<p>\$mysqli is NOT set</p>";
}
// Verify connection
if ($mysqli->connect_errno) {
    echo "<p class='status-error'>Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error . "</p>";
    unset($mysqli);
    // No really necessary
    exit;
} else {
    echo "<p class='status-success'>Connected ok!</p>";
}
// Establish character encoding
$mysqli->set_charset('utf-8');
// Make query
$query = "select host,user from user";
if ($res = $mysqli->query($query, MYSQLI_STORE_RESULT)) {
    display_results($res);
    $res->free();
} else {
    // If no records were returned.
    echo "<p class='status-error'>Query failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
$mysqli->close();
unset($mysqli);
// Not really necessary
                        echo "<br />New updated record:";
                        display_results(my_trusted_mysql_query("SELECT * FROM SCREEN_PARTICIPANT WHERE Email = '{$q['Email']}'"));
                        my_mysql_close();
                        $_POST['Fill'] = 'false';
                    }
                } else {
                    if ($_POST['query_type'] == 'delete') {
                        //Person is not in the database.
                        if (count(my_trusted_mysql_query("SELECT Email FROM SCREEN_PARTICIPANT WHERE Email = '{$q['Email']}'")) == 0) {
                            echo "The person with the e-mail " . $q['Email'] . " is not currently in the database as a screening participant. " . "To add this person's information, please select insert.<br /><br />";
                            $_POST['Fill'] = 'true';
                        } else {
                            //Show the record that's about to be deleted.
                            echo "Records deleted:";
                            display_results(my_trusted_mysql_query("SELECT * FROM SCREEN_PARTICIPANT WHERE Email = '{$q['Email']}'"));
                            display_results(my_trusted_mysql_query("SELECT * FROM S_ATTEND WHERE Email = '{$q['Email']}'"));
                            $query = "DELETE FROM SCREEN_PARTICIPANT WHERE Email='{$q['Email']}'";
                            my_trusted_mysql_query($query);
                            my_mysql_close();
                            $_POST['Fill'] = 'false';
                        }
                    } else {
                        echo "An unexpected selection has been made. <br />";
                        my_mysql_close();
                        die;
                    }
                }
            }
        }
    }
}
         <?php 
include "includes/functions.php";
my_mysql_connect();
echo "<br />Staff list: ";
$results_staff = my_trusted_mysql_query("SELECT * FROM STAFF");
display_results($results_staff);
echo "<br />Number of Staff: ";
$total_staff = count(my_trusted_mysql_query("SELECT * FROM STAFF"));
echo "{$total_staff}<br />";
echo "<br />Screening participant list: ";
display_results(my_trusted_mysql_query("SELECT * FROM SCREEN_PARTICIPANT"));
echo "<br />Number of screening participants: ";
$total_screening = count(my_trusted_mysql_query("SELECT * FROM SCREEN_PARTICIPANT"));
echo "{$total_screening}<br />";
echo "<br />Class participant list: ";
display_results(my_trusted_mysql_query("SELECT * FROM CLASS_PARTICIPANT"));
echo "<br />Number of class participants: ";
$total_class = count(my_trusted_mysql_query("SELECT * FROM CLASS_PARTICIPANT"));
echo "{$total_class}";
my_mysql_close();
?>

         <br /><br />   
         </td>
      </tr>
      <tr>
        <td colspan="2"><table align="left" border="1" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td height="38" background="/images/index_r17_c9.jpg" class="style21">
        <div align="center">Patents and Copyrights owned by Maelstrom, Not for use by others</span><strong>.</strong><br>
        </div></td>
//Connect to the database
my_mysql_connect();
//Delete all previous records in company table.
my_trusted_mysql_query("DELETE FROM COMPANY");
my_trusted_mysql_query("DELETE FROM EVENT");
my_trusted_mysql_query("DELETE FROM CLASS_PARTICIPANT");
my_trusted_mysql_query("DELETE FROM SCREEN_PARTICIPANT");
my_trusted_mysql_query("DELETE FROM STAFF");
my_trusted_mysql_query("DELETE FROM C_ATTEND");
my_trusted_mysql_query("DELETE FROM S_ATTEND");
//The array that stores each INSERT query as an element.
//Can run through them in a loop later, easy-peasy
$population = array("INSERT INTO COMPANY (Email, Name, Address, City, State, Zip)\r\nVALUES ('*****@*****.**', 'Maelstrom', '321 Money Ln', 'Rolla', 'MO', 64014)", "INSERT INTO COMPANY (Email, Name, Address, City, State, Zip)\r\nVALUES ('*****@*****.**', 'Mage_Killer', '456 Rock Face Rd', 'Middle-earth', 'TX', 22215)", "INSERT INTO COMPANY (Email, Name, Address, City, State, Zip)\r\nVALUES ('*****@*****.**', 'br?', 'Dirt Road', 'Brazil', 'BR', 11111)", "INSERT INTO COMPANY (Email, Name, Address, City, State, Zip)\r\nVALUES ('*****@*****.**', 'Efsie', 'Rich Pl', 'Gojira', 'JP', 01235)", "INSERT INTO STAFF (Fname, Lname, Email, Address, City, State, Zip, Comments, Password)\r\nVALUES ( 'James', 'Bond', '*****@*****.**', '1803 awesome Rd', 'Rolla', 'MO', 65401, NULL, 12345)", "INSERT INTO STAFF (Fname, Lname, Email, Address, City, State, Zip, Comments, Password)\r\nVALUES ( 'Frank', 'Sims', '*****@*****.**', 'Ice cap', 'North Pole', 'NP', 71374, NULL, 123123)", "INSERT INTO SCREEN_PARTICIPANT (Email, Fname, Lname, Address, City, State, Zip, Comments, Time)\r\nVALUES ('*****@*****.**', 'Pope', 'Joe', '123 Holy Rd', 'Vatican', 'Vatican', 77777, NULL, 7 )", "INSERT INTO CLASS_PARTICIPANT (Email, Fname, Lname, Address, City, State, Zip, Comments, BCBSNum, BCBSSuffix, Birth_Date)\r\nVALUES ('*****@*****.**', 'Peter', 'Parker', '20 Ingram Street', 'Queens', 'NY', 11428, 'AKA spiderman', 7, 8, '4/3/1962' )", "INSERT INTO EVENT (EVENT_ID, Event_Name, Start_Date, End_Date, Start_Time, End_Time, Comments, E_Type, S_Type, Session_Length)\r\nVALUES (101,'Health Fair', 6, 9, 7, 8, NULL, 's', 'Fair', 15 )", "INSERT INTO EVENT (EVENT_ID, Event_Name, Start_Date, End_Date, Start_Time, End_Time, Comments, E_Type, S_Type, Session_Length)\r\nVALUES (102,'Quit Smoking', 6, 9, 7, 8, NULL, 'c', NULL, NULL )", "INSERT INTO C_ATTEND (Email, Event_ID)\r\nVALUES ('*****@*****.**', 102)", "INSERT INTO S_ATTEND (Email, Event_ID)\r\nVALUES ('*****@*****.**', 101)");
//Perform the queries, huzzah
foreach ($population as $query) {
    echo "> " . $query . "<br />";
    my_trusted_mysql_query($query);
}
//Confirm the insertions
display_results(my_trusted_mysql_query("SELECT * FROM COMPANY"));
display_results(my_trusted_mysql_query("SELECT * FROM EVENT"));
display_results(my_trusted_mysql_query("SELECT * FROM CLASS_PARTICIPANT"));
display_results(my_trusted_mysql_query("SELECT * FROM SCREEN_PARTICIPANT"));
display_results(my_trusted_mysql_query("SELECT * FROM STAFF"));
display_results(my_trusted_mysql_query("SELECT * FROM C_ATTEND"));
display_results(my_trusted_mysql_query("SELECT * FROM S_ATTEND"));
//Close connection to database
my_mysql_close();
?>
 
Пример #11
0
    $player_choice = "Stone";
    if ($rand_num == 1) {
        $npc_score = $npc_score + 1;
        //mysql_query("UPDATE phaos_characters SET stamina = '$stamina_reduce' WHERE username = '******'");
        $npc_choice = "Scroll";
        display_results($npc_score, $player_choice, $npc_choice, lost, $ad_array);
    }
    if ($rand_num == 2) {
        //mysql_query("UPDATE phaos_characters SET stamina = '$stamina_reduce' WHERE username = '******'");
        $npc_choice = "Dagger";
        display_results($npc_score, $player_choice, $npc_choice, won, $ad_array);
    }
    if ($rand_num == 3) {
        //mysql_query("UPDATE phaos_characters SET stamina = '$stamina_reduce' WHERE username = '******'");
        $npc_choice = "Stone";
        display_results($npc_score, $player_choice, $npc_choice, drew, $ad_array);
    }
}
echo "</p>\n<p align='center'>" . $lang_added["ad_please-select"] . ": <a href='" . $_SERVER[PHP_SELF] . "?guess=1&npcscore={$npc_score}'>" . $lang_added["ad_scroll"] . "</a>, <a href='" . $_SERVER[PHP_SELF] . "?guess=2&npcscore={$npc_score}'>" . $lang_added["ad_dagger"] . "</a> or <a href='" . $_SERVER[PHP_SELF] . "?guess=3&npcscore={$npc_score}'>" . $lang_added["ad_stone"] . "</a>?\n<br>\n</p>";
echo "<br><div align=center><a href='inn.php'> " . $lang_clan["back"] . " </a></td></div>";
echo '</body>
</html>';
function display_results($npc_score, $player_choice, $npc_choice, $game_result, $ad_array)
{
    global $character, $PHP_PHAOS_CHARID, $PHP_PHAOS_USER;
    //Added by dragzone---
    if ($player_choice == "Scroll") {
        $player_choice = $ad_array["scroll"];
    }
    if ($player_choice == "Dagger") {
        $player_choice = $ad_array["dagger"];
 foreach ($pages as $key => $page) {
     if (!is_object($page['before']) || !is_object($page['after'])) {
         continue;
     }
     $count++;
     $class = $count % 2 ? 'odd' : 'even';
     $classkey = substr($key, 0, 8);
     if ($mostcommononly) {
         $page['before']->strip_to_most_common_only($organiseby);
         $page['after']->strip_to_most_common_only($organiseby);
     }
     echo "<div class='pagecontainer {$class} page-{$classkey}'>";
     echo "<h1 class='pagetitle'>" . $page['before']->name . "</h1>";
     echo "<h2 class='pagesubtitle'><a href='" . $page['before']->url . "'>" . $page['before']->url . "</a></h2>";
     echo "<div class='statistical'>";
     list($output, $stats) = display_results($page['before'], $page['after']);
     echo $stats;
     echo $output;
     $statsarray[] = $stats;
     display_organised_results($organiseby, $page['before'], $page['after']);
     echo "<div class='graphdiv'>";
     foreach ($PROPERTIES as $PROPERTY) {
         if (!property_exists($page['before'], $PROPERTY)) {
             continue;
         }
         $graphfile = produce_page_graph($PROPERTY, $before, $page['before'], $after, $page['after'], $width, $height, array('x' => $mostcommononly));
         echo "<a href='webapp/graph.php?before={$before}&after={$after}&property={$PROPERTY}&page={$key}' class='largegraph'>";
         echo "<img src='./cache/" . $graphfile . "' alt='{$PROPERTY}' style='width:{$width}px;height:{$height}px;' />";
         echo "</a>";
     }
     echo "</div>";
</td>
          </tr>

        </table></td>
        <td align="left" width="100%" style="background-color: #FFFFFF" class="style26">
         <center>Current screenings in the database:<br /><br /></center>
         <?php 
include "includes/functions.php";
my_mysql_connect();
display_results(my_trusted_mysql_query("SELECT Event_ID, Event_Name, Start_Date, End_Date, Start_Time, End_Time, Comments, S_Type, Session_Length FROM EVENT WHERE E_Type = 's'"));
$total_screening = count(my_trusted_mysql_query("SELECT * FROM EVENT WHERE E_Type = 's'"));
echo "<br />Total screenings: ";
echo "{$total_screening}";
echo "<br />Average number of people per screening: ";
//Displays the avrage number of people attending all screening
display_results(my_trusted_mysql_query("SELECT AVG(Screening_Participants) FROM ( SELECT Event_ID, count(Email) Screening_Participants FROM S_ATTEND GROUP BY Event_ID) AS cnt_table"));
my_mysql_close();
?>

         <br /><br />   
         </td>
      </tr>
      <tr>
        <td colspan="2"><table align="left" border="1" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td height="38" background="/images/index_r17_c9.jpg" class="style21">
        <div align="center">Patents and Copyrights owned by Maelstrom, Not for use by others</span><strong>.</strong><br>
        </div></td>
  </tr>
</table>
</td>
if (isset($_POST['submit'])) {
    //Copy $_POST data, sanitizing it to prevent SQL injection attacks.
    $q = safe_inputs($_POST);
    //Force event ID into a number
    $Event_ID_num = (int) $q['Event_ID'];
    my_mysql_connect();
    //event ID can't be blank
    if ($Event_ID_num == 0) {
        echo "Invalid Event ID entered. Event ID cannot be blank and must be a number. <br />";
    } else {
        if (count(my_trusted_mysql_query("SELECT Event_ID FROM EVENT WHERE Event_ID = {$Event_ID_num}")) == 0) {
            echo "The event with the ID " . $q['Event_ID'] . " does not exist in the database. " . "<br />To add this event's information, please go <a href='http://group13.x10hosting.com/event_manip.php'>[here]</a> and select insert.<br /><br />";
            $_POST['Fill'] = 'true';
        } else {
            echo "Dates and times for event {$Event_ID_num}: <br />";
            display_results(my_trusted_mysql_query("SELECT Event_ID, Event_Name, Start_Date, Start_Time, End_Date, End_Time FROM EVENT WHERE Event_ID={$Event_ID_num}"));
            my_mysql_close();
            $_POST['Fill'] = 'false';
        }
    }
}
?>
          </div>
          <div class="style35">
            <ul>
              <strong>View all times and dates associated with a specific class or screening:</strong><br />
              <li>The event ID must already be in the database.</li>
            </ul>
          </div>

<!-- The HTML for receiving user input from text boxes and such -->
                    if (count(my_trusted_mysql_query("SELECT Email FROM STAFF WHERE Email = '{$q['Email']}'")) == 0) {
                        echo "The person with the e-mail " . $q['Email'] . " is not currently in the database as a staff member. " . "To add this person's information, please select insert.<br /><br />";
                        $_POST['Fill'] = 'true';
                    } else {
                        //Show the record that's about to be deleted.
                        echo "Records deleted:";
                        display_results(my_trusted_mysql_query("SELECT * FROM STAFF WHERE Email = '{$q['Email']}'"));
                        $query = "DELETE FROM STAFF WHERE Email='{$q['Email']}'";
                        my_trusted_mysql_query($query);
                        if (count(my_trusted_mysql_query("SELECT Email FROM TEACH WHERE Email = '{$q['Email']}'")) > 0) {
                            display_results(my_trusted_mysql_query("SELECT * FROM TEACH WHERE Email = '{$q['Email']}'"));
                            $query = "DELETE FROM TEACH WHERE Email='{$q['Email']}'";
                            my_trusted_mysql_query($query);
                        }
                        if (count(my_trusted_mysql_query("SELECT Email FROM ADMINISTER WHERE Email = '{$q['Email']}'")) > 0) {
                            display_results(my_trusted_mysql_query("SELECT * FROM ADMINISTER WHERE Email = '{$q['Email']}'"));
                            $query = "DELETE FROM ADMINISTER WHERE Email='{$q['Email']}'";
                            my_trusted_mysql_query($query);
                        }
                        my_mysql_close();
                        $_POST['Fill'] = 'false';
                    }
                } else {
                    echo "An unexpected selection has been made. <br />";
                    my_mysql_close();
                    die;
                }
            }
        }
    }
}
//See if the page was called with POST data, meaning this page has been called before
if (isset($_POST['submit'])) {
    //Copy $_POST data, sanitizing it to prevent SQL injection attacks.
    $q = safe_inputs($_POST);
    my_mysql_connect();
    //Check various conditions to make sure input is valid.
    if (!preg_match('/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\\.[a-zA-Z.]{2,5}$/', $_POST['Email'])) {
        echo "Invalid E-mail entered. E-mail must be in the format \"name@server.com\"<br />";
    }
    //Company is not in the database.
    if (count(my_trusted_mysql_query("SELECT Email FROM COMPANY WHERE Email = '{$q['Email']}'")) == 0) {
        echo "The company with the e-mail " . $q['Email'] . " does not exist in the database. " . "To add this company's information, please select insert instead of update.<br /><br />";
        $_POST['Fill'] = 'true';
    } else {
        echo "All events hosted by the company with e-mail " . $q['Email'] . ": <br />";
        display_results(my_trusted_mysql_query("SELECT * FROM EVENT WHERE Event_ID IN (SELECT Event_ID FROM HOSTS WHERE Email='{$q['Email']}')"));
        my_mysql_close();
        $_POST['Fill'] = 'false';
    }
}
?>
          </div>
          <div class="style35">
            <ul>
              <strong>View all classes or screenings hosted by a specific company:</strong><br />
              <li>The company must already be in the database.</li>
            </ul>
          </div>

<!-- The HTML for receiving user input from text boxes and such -->
<!-- For proper HTML rendering, the php scripts must be left completely left-aligned! -->
Пример #17
0
// 2. Get player last name
// 3. Build and execute query
// 4. Display results
// Check for form submission:
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // Check for name
    // more robust input checking than just using empty()
    if (!(filter_has_var(INPUT_POST, 'last_name') && strlen(filter_input(INPUT_POST, 'last_name')) > 0)) {
        echo "<p class='error'>Please enter player's last name</p>";
    } else {
        $lastname = mysqli_real_escape_string($dbc, trim($_POST['last_name']));
        // Define the query:
        $q = "SELECT ilkid as player_id, concat(lastname, ', ',firstname) as name,\n            concat(firstname, '_', lastname) as fname,\n            firstseason as fs, lastseason as ls, position as pos,\n            college\n            FROM players\n            WHERE lastname = '{$lastname}'\n            ORDER BY lastname ASC";
        $r = @mysqli_query($dbc, $q);
        // Count the number of returned rows:
        $num = mysqli_num_rows($r);
        if ($num > 0) {
            // If it ran OK, display the records.
            display_results($num, $r);
            mysqli_free_result($r);
        } else {
            // If no records were returned.
            echo "<p class='error'>No players with last name " . htmlentities($lastname) . " found.</p>";
        }
    }
}
mysqli_close($dbc);
?>

<?php 
include 'includes/footer.html';
          </tr>



        </table></td>

        <td align="left" width="100%" style="background-color: #FFFFFF" class="style26">

         <center>Current companies in the database:<br /><br /></center>

<?php 
include "includes/functions.php";
//Connect to the database
my_mysql_connect();
display_results(my_trusted_mysql_query("SELECT * FROM COMPANY"));
$total_company = count(my_trusted_mysql_query("SELECT * FROM COMPANY"));
echo "<br />Total Companies: ";
echo "{$total_company}";
my_mysql_close();
?>

         <br /><br />   

         </td>

      </tr>

      <tr>

        <td colspan="2"><table align="left" border="1" cellpadding="0" cellspacing="0" width="100%">
Пример #19
0
function module_poll()
{
    $activepolls = display_results();
    if (strlen($activepolls) > 160) {
        echo '<div class="poll">';
    }
    if (isset($_SESSION['valid_user'])) {
        if (!isset($_REQUEST['pollaction'])) {
            $pollaction = "";
        } else {
            $pollaction = $_REQUEST['pollaction'];
        }
        if ($pollaction == "votecast") {
            $pollid = $_REQUEST['pollid'];
            $regvote = "INSERT INTO vote VALUES (" . $pollid . ", '" . $_SESSION['valid_user'] . "'," . $_REQUEST['chosenalt'] . ");";
            $result = DB_insert($regvote);
            if ($result) {
                echo "Takk for din stemme. Resultatet under oppdateres neste gang du viser siden.";
            } else {
                echo "Databaseproblem - din stemme ble ikke registrert. Skriv gjerne en lynforumpost om nøyaktig hva som skjedde, her er en bug et sted.";
            }
        }
        $current_time = date('Y-m-d H:i');
        //echo $current_time;
        $findpolls = "SELECT pollid, title FROM poll WHERE time_opened < '" . $current_time . "' AND time_closed > '" . $current_time . "';";
        $pollresult = DB_get_table($findpolls);
        //echo $findpolls;
        $num_polls = DB_rows_affected($pollresult);
        while ($rowpoll = DB_next_row($pollresult)) {
            $pollid = $rowpoll['pollid'];
            if (!has_voted($_SESSION['valid_user'], $pollid)) {
                if (!isset($findalt)) {
                    echo '<table class="polltable">';
                    echo '<tr><td colspan=2 class="pollheader">Stem!</td></tr>';
                }
                echo '<tr><td colspan=2 class="polltitle">' . $rowpoll['title'] . '</td></tr>';
                $findalt = "SELECT pollid, question,questionid FROM pollquestion WHERE pollid =" . $pollid . ";";
                $result = DB_get_table($findalt);
                $num_results = DB_rows_affected($result);
                if ($num_results > 0) {
                    form_start_post();
                    form_hidden("pollid", $pollid);
                    form_hidden("pollaction", "votecast");
                    while ($row = DB_next_row($result)) {
                        echo '<tr><td class="pollquestion">' . $row['question'];
                        echo '</td><td><input type="radio" value="' . $row['questionid'] . '" name="chosenalt"></td></tr>';
                    }
                    echo '<tr><td colspan=2 class="pollinput">';
                    form_submit("s", "Stem");
                    echo '</td></tr>';
                    form_end();
                }
            }
        }
        if (isset($findalt)) {
            echo '</table>';
        }
    }
    // Vis resultater for alle aktive polls
    if (strlen($activepolls) > 160) {
        echo $activepolls . '</div>';
    }
}
Пример #20
0
<?php

include "../_include/header.php";
include $_INCLUDES . "navbar.php";
include $_PHP . "search_function.php";
require_once $_INCLUDES . "footer.php";
?>

<div class="container">
    <?php 
display_results();
?>
</div>
    

<?php 
require_once $_INCLUDES . "footer.php";
Пример #21
0
    // 1. Get letter value
    // based on letter value, display appropriate player list page
    if (!isset($_GET['lt'])) {
        $lt = 'A';
        // default
    } else {
        $lt = $_GET['lt'];
    }
    // is_string($lt) ? print('<p>$lt is a string</p>') :
    //  print('<p>$lt is not a string</p>');
    // echo "<p>letter is $lt</p>";
    // 2. Based on letter value, build appropriate sql query
    // Define the query:
    $q = "SELECT ilkid as player_id, concat(lastname, ', ',firstname) as name,\n        concat(firstname, '_', lastname) as fname,\n        firstseason as fs, lastseason as ls, position as pos,\n        college\n        FROM players\n        WHERE lastname LIKE '{$lt}%'\n        ORDER BY lastname ASC";
    $r = @mysqli_query($dbc, $q);
    // Count the number of returned rows:
    $num = mysqli_num_rows($r);
    if ($num > 0) {
        // If it ran OK, display the records.
        display_results($num, $r, $lt);
        mysqli_free_result($r);
    } else {
        // If no records were returned.
        echo '<p class="error">No players found.</p>';
    }
}
mysqli_close($dbc);
?>

<?php 
include 'includes/footer.html';
<html>
<title>
Company Test
</title>
<body>

<!-- The php script for generating the table and handling database queries -->
<?php 
include "includes/functions.php";
my_mysql_connect();
echo "<h1><CENTER>Class</CENTER></h1>";
//Displays the class with the most amount of people
display_results(my_trusted_mysql_query("SELECT Event_ID, min(people) FROM ( SELECT Event_ID, count(Email) people FROM C_ATTEND GROUP BY Event_ID) AS cnt_table"));
echo "<h1><CENTER>Session</CENTER></h1>";
//Displays the session with the most amount of people
display_results(my_trusted_mysql_query("SELECT Event_ID, min(people) FROM ( SELECT Event_ID, count(Email) people FROM S_ATTEND GROUP BY Event_ID) AS cnt_table"));
my_mysql_close();
?>


</body>
</html> 
Пример #23
0
}
// Begin to process the page...
$iSearchString = $_POST['iSearchString'];
if (empty($_POST['iSearchType'])) {
    if (empty($_GET['searchType'])) {
        $iObjectType = "user";
    } else {
        $iObjectType = $_GET['searchType'];
    }
} else {
    $iObjectType = $_POST['iSearchType'];
}
?>
    <h2>Search for objects</h2>
<?php 
/*echo "\$_POST['iSearchString']=".$_POST['iSearchString']."\n<br />";
  echo "\$_POST['iSearchType']=".$_POST['iSearchType']."\n<br />";
  echo "\$_GET['searchType']=".$_GET['searchType']."\n<br />";
  echo "\$iSearchString=$iSearchString\n<br />";
  echo "\$iObjectType=$iObjectType\n<br />";*/
?>
    <h3>Help</h3>
    <p>Some help...</p>
<?php 
display_search_form($iObjectType, $iSearchString);
if (!empty($_POST['iSearchString'])) {
    echo "    <h3>Results</h3>\n";
    DB_connect($DB_host, $DB_login, $DB_pass);
    DB_select($DB_db);
    display_results($iSearchString, $iObjectType);
}
          </tr>



        </table></td>

        <td align="left" width="100%" style="background-color: #FFFFFF" class="style26">

         <center>Events currently in the database:<br /><br /></center>

<?php 
include "includes/functions.php";
//Connect to the database
my_mysql_connect();
display_results(my_trusted_mysql_query("SELECT * FROM EVENT"));
$total_event = count(my_trusted_mysql_query("SELECT * FROM EVENT"));
echo "<br />Total Events: ";
echo "{$total_event}";
my_mysql_close();
?>

         <br /><br />   

         </td>

      </tr>

      <tr>

        <td colspan="2"><table align="left" border="1" cellpadding="0" cellspacing="0" width="100%">