$nextSortBy = "LNAME"; } else { $nextSortBy = "FNAME"; } } if (!isset($_GET) || strtoupper($_GET['sort']) !== "ASC" && strtoupper($_GET['sort']) !== 'DESC') { $_GET['sort'] = 'DESC'; $nextSort = "ASC"; } else { if (strtoupper($_GET['sort']) === "ASC") { $nextSort = "DESC"; } else { $nextSort = "ASC"; } } $searchHtml = createSearchTable(searchFor($procFunction, $keyword, $_GET['sort'], $_GET['by']), $errMsgs, $nextSort, $nextSortBy, $keyword, $option); if (count($errMsgs) > 0) { $htmlStr .= generateErrorHtml($errMsgs); } else { $htmlStr .= "<div class='animated zoomInUp'><div class='successFilterLbl' style='margin-top: 0; text-align: center'>SEARCH - {$keyword}</div>"; $htmlStr .= "<label><div class='filterLbl' style='text-align: center'>FILTER - {$fullOptions}</div></label><br><br><br>"; $htmlStr .= $searchHtml . "</div>"; $_SESSION['searchFilter'] = $option; $_SESSION['searchValue'] = $keyword; $_SESSION['htmlResult'] = $htmlStr; header("Location: search.php"); exit; } } else { $htmlStr .= generateErrorHtml($errMsgs); }
<html> <body> <div> <?php $database = array(array("username" => "pippo", "password" => "123456", "id" => "1", "role" => "guest", "name" => "mattia", "surname" => "contini", "email" => "*****@*****.**", "address" => "via monte 20", "payment" => "1234123412341234"), array("username" => "pluto", "password" => "123456", "id" => "2", "role" => "dealer", "name" => "matteo", "surname" => "cocco", "email" => "*****@*****.**", "address" => "via monte 30", "payment" => "1234123412341234", "piva" => "x5za93i")); function searchUserIntoFakeDatabase($username, $password, $array) { foreach ($array as $user) { if ($user["username"] === $username && $user["password"] === $password) { return $user; } } return null; } $user = searchFor("pluto", "123456", $database); print $user["email"]; ?> </div> </body> </html>
print "<b>Results from <a href=\"http://www.twitter.com\">Twitter</a>...</b>"; searchTwitterFor($term, $start, $count, $type); print "</div>"; print "</div>"; printFoot(); } else { if ($term && $type == 'twitter') { $count = $count * $twitMulti; print "<div id=\"single\">"; searchTwitterFor($term, $start, $count, $type); print "</div>"; print "</div>"; printFoot(); } else { if ($term) { print "<div id=\"single\">"; searchFor($term, $start, $count, $appid, $type); print "</div>"; print "</div>"; printFoot(); } else { print "all the goodness of <a href=\"http://ysearch.com\">yahoo! search</a> and <a href=\"http://www.twitter.com\">twitter</a>, none of the <a href=\"index.php?q=fat&type=both&s=0\">fat</a>."; print "</div>"; } } } ?> </body> </html>
echo "</div>"; } ?> <html> <head> <?php if ($term) { echo "<title>" . rawurldecode($term) . " - mookie's minisearch</title>"; } else { echo "<title>mookie's minisearch</title>"; } ?> <link rel="stylesheet" type="text/css" media="screen" href="style.css"/> <link rel="search" type="application/opensearchdescription+xml" title="moookie's minisearch" href="minisearch.xml"> </head> <body> <div class="main"> <?php printForm($term); if ($term) { searchFor($term, $start, $count, $appid); } else { print "all the goodness of <a href=\"http://ysearch.com\">yahoo! search</a>, none of the fat."; } ?> </div> </body> </html>