-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsearch.php
More file actions
61 lines (57 loc) · 1.65 KB
/
search.php
File metadata and controls
61 lines (57 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
$sites = array(
"bastiat.org",
"bastiat.net",
"www.econlib.org",
"bastiat.de"
);
$specializer = " Bastiat ";
$flag = true;
foreach( $sites as $s ) {
if ($flag) { $flag = false; } else { $specializer .= " OR "; }
$specializer .= "site:$s";
}
#$q = $_POST["q"];
if ($q != "") {
$searchq = $q . $specializer;
$esearchq = urlencode($searchq);
$url = "http://www.google.com/search?num=100&q=$esearchq";
# $hl = $_POST["hl"];
if ($hl != "") { $ehl = urlencode($hl); $url .= "&hl=$ehl"; }
header("Location: $url");
# exit;
echo "<meta http-equiv=\"Refresh\" content=\"0;url=$url\">";
# print("<meta http-equiv=\"Refresh\" content=\"0;url=$url\">");
} else {
header("Content-Type: text/html");
# exit;
}
?>
<!DOCTYPE HTML PUBLIC "html.dtd">
<html><head>
<title>Search Bastiat sites on the Web</title>
</head><body>
<h1 align="center">Search Bastiat sites on the Web</h1>
<p align="center">
<table align="center" summary="forms"><tr><td><center>
<form method=get action="http://bastiat.org/search.php">
<input type=text name=q size=31 maxlength=255 value="">
<input type=submit name=btnG value="Bastiat @ Google">
</form></center></td></tr></table>
</p>
<p align="left">
The above form will use <a href="http://www.google.com">Google</a>
to search whatever you're looking for in the Bastiat sites:
<?php
$seps = array(",", ",", " and", ".");
$subdir = array("", "", "/library/classics.html#bastiat", "");
for( $i = 0 ; $i < 4 ; $i ++ ) {
$site = $sites[$i];
$url = "http://".$site.$subdir[$i];
$sep = $seps[$i];
echo "<a href=\"$url\">$site</a>$sep\n";
# print("<a href=\"$url\"">$site</a>$sep\n");
}
?>
</p>
</body></html>