I made it even smaller and easier to edit, we really don't need to echo all those html tags:
FrediPHP Code:<?php
$search = trim($_GET['c']);
$splitat = strpos($search,' ');
$command = substr($search,0,$splitat);
$parameter = substr($search,$splitat+1);
function returnsite($url){
global $parameter;
header("Location: ".$url.urlencode($parameter));
exit(0);
}
switch($command){
case 'leo': case 'l':
returnsite("http://dict.leo.org/?search=");
case 'digg': case'd':
returnsite("http://www.digg.com/search?section=news&s=");
case 'reddit': case'r':
returnsite("http://reddit.com/search?q=");
case 'imdb': case 'i':
returnsite("http://www.imdb.com/find?s=all&q=");
case 'wiki' : case 'w':
returnsite("http://en.wikipedia.org/wiki/");
case 'gmail' : case 'g':
returnsite("https://gmail.google.com/gmail?search=query&view=tl&fs=1&q=");
case 'php' : case 'p':
returnsite("http://www.php.net/");
case 'fk' : case 'f':
returnsite("http://board.flashkit.com/board/search.php?do=process&query=");
case 'whois' : case 'wi':
returnsite("http://whois.sc/");
case 'slang' : case 's':
returnsite("http://www.urbandictionary.com/define.php?r=f&term=");
case 'css' : case 'c':
returnsite("http://cssdocs.org/");
case 'lorem' : case 'li':
returnsite("http://www.lipsum.com/feed/html?amount=");
case 'validate' : case 'v':
returnsite("http://validator.w3.org/check?uri=");
case 'product' : case 'ps':
returnsite("http://www.google.com/products?q=");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Web Command Line | Mind Share Projects | Fredi Bach</title>
<style type="text/css">
body { font-family: Verdana, Helvetica, Geneva, Arial, sans-serif; font-size: 12px; line-height: 14pt; color: #333; background-color: #f2f2f2; margin: 0px; }
h1 { font-family: Georgia, "Times New Roman", Times, serif; background-color: #fff; padding: 8px; padding-left: 16px; padding-top: 50px; border-bottom: 2px #ccc solid; margin-top: 0px; }
h2 { font-family: Georgia, "Times New Roman", Times, serif; background-color: #fff; padding: 4px; padding-left: 16px; border-bottom: 2px #ccc solid; border-top: 2px #ccc solid; }
#commandform { margin-left: 60px; }
#commandtable { margin-left: 25px; width: 700px; }
#tabledesc { font-size: 14px; font-weight: bold; background-color: #ddd; }
td { margin: 2px; padding: 2px; padding-left: 6px; background-color: #fff; }
#footer { margin-left: 25px; margin-top: 20px; margin-bottom: 20px; }
</style>
</head>
<body>
<h1>Web Command Line</h1>
<div id="commandform"><form action="webcommandline.php" method="get" name="input_box">
<input type="text" name="c" size="55" value=""/>
<input type="submit" value="Enter" />
</form></div>
<h2>Installation Help (Firefox)</h2>
<ul><li>Right-click the input box above</li>
<li>Click "Add a Keyword for this Search"</li>
<li>For the Name, enter "Web Command Line" and for the Keyword, enter "c" for command</li>
<li>Press OK</li>
<li>Now you can enter "c yourcommand" into the address bar to use this web command line</li></ul>
<h2>Commands</h2>
<table id="commandtable"><tr><td id="tabledesc">Command</td><td id="tabledesc">Short</td><td id="tabledesc">Parameter</td><td id="tabledesc">Explanation</td></tr>
<tr><td><b>leo</b></td><td>l</td><td>word</td><td>Translate from German to English or from English to German</td></tr>
<tr><td><b>digg</b></td><td>d</td><td>searchstring</td><td>Search Digg News</td></tr>
<tr><td><b>reddit</b></td><td>r</td><td>searchstring</td><td>Search Reddit</td></tr>
<tr><td><b>imdb</b></td><td>i</td><td>searchstring</td><td>Search the International Movie Database</td></tr>
<tr><td><b>wiki</b></td><td>w</td><td>page</td><td>Search a Wikipedia page</td></tr>
<tr><td><b>gmail</b></td><td>g</td><td>searchstring</td><td>Search your own Gmail account (if logged in)</td></tr>
<tr><td><b>php</b></td><td>p</td><td>searchstring</td><td>Search the php site</td></tr>
<tr><td><b>fk</b></td><td>f</td><td>searchstring</td><td>Search the Flashkit Forums</td></tr>
<tr><td><b>whois</b></td><td>wi</td><td>domain</td><td>Look up the whois informations for a domain</td></tr>
<tr><td><b>slang</b></td><td>s</td><td>word</td><td>Check the urban dictionary what this slang means</td></tr>
<tr><td><b>css</b></td><td>c</td><td>searchstring</td><td>Search the W3C CSS documentation</td></tr>
<tr><td><b>lorem</b></td><td>li</td><td>paragraphs</td><td>Get a specific number of lorem ipsum paragraphs</td></tr>
<tr><td><b>validate</b></td><td>v</td><td>url</td><td>W3C validate a given url</td></tr>
<tr><td><b>product</b></td><td>p</td><td>name</td><td>Do a Google product search</td></tr>
</table>
<div id="footer">(c) 2007 by Fredi Bach / Mind Share Projects</div>
</body>




Reply With Quote