Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("83int_index.php");
- require_once("83int_search.php");
- $time_start = microtime(true);
- echo "<html>\n
- <head>\n
- <title>Daily Programmer 83 Intermediate</title>\n
- <meta http-equiv=\"content-type\" content=\"text/html;charset=UTF-8\" />
- </head>\n
- <body>\n";
- if(isset($_SERVER['REQUEST_METHOD']))
- {
- if(isset($_GET['index']))
- {
- $index = new Index();
- $index->begin_index();
- }
- else if(isset($_GET['search']))
- {
- $search = new Search();
- $search_terms = explode("%20",filter_var($_GET['search_term'], FILTER_SANITIZE_ENCODED));
- foreach($search_terms as $term)
- {
- $results = $search->search($term);
- if(count($results) > 0)
- {
- echo "Found " . count($results). " occurances of " . $term ."<br /><br />";
- foreach($results as $item)
- {
- echo "File: " . $item["file"]." Line: " . $item["line"] . "<br />Context: " . $item['word'] ."<br /><hr /><br />";
- }
- }
- }
- }
- }
- echo "</body>\n</html>";
- $end_time = microtime(true);
- $time = $end_time - $time_start;
- echo "Execution Time: ".$time." seconds<br />";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement