|
-
Information Architect
My Web Command Line
I was so frustrated today that YubNub had a lot of cryptic commands for the services I'm using and the short ones are all taken, so what do you do? Yes, you create your own web command line. 
http://www.mindshareprojects.com/webcommandline.php
Here's the php code for everyone that wants to do the same:
PHP Code:
<?php
$search = trim($_GET['c']);
$splitat = strpos($search,' ');
$command = substr($search,0,$splitat);
$parameter = substr($search,$splitat+1);
if ($command == 'leo' || $command == 'l'){
header("Location: http://dict.leo.org/?search=".urlencode($parameter));
exit(0);
}
if ($command == 'digg' || $command == 'd'){
header("Location: http://www.digg.com/search?section=news&s=".urlencode($parameter));
exit(0);
}
if ($command == 'reddit' || $command == 'r'){
header("Location: http://reddit.com/search?q=".urlencode($parameter));
exit(0);
}
if ($command == 'imdb' || $command == 'i'){
header("Location: http://www.imdb.com/find?s=all&q=".urlencode($parameter));
exit(0);
}
if ($command == 'wiki' || $command == 'w'){
header("Location: http://en.wikipedia.org/wiki/".urlencode($parameter));
exit(0);
}
if ($command == 'gmail' || $command == 'g'){
header("Location: https://gmail.google.com/gmail?search=query&q=".urlencode($parameter)."&view=tl&fs=1");
exit(0);
}
if ($command == 'php' || $command == 'p'){
header("Location: http://www.php.net/".urlencode($parameter));
exit(0);
}
if ($command == 'fk' || $command == 'f'){
header("Location: http://board.flashkit.com/board/search.php?do=process&query=".urlencode($parameter));
exit(0);
}
if ($command == 'whois' || $command == 'wi'){
header("Location: http://whois.sc/".urlencode($parameter));
exit(0);
}
if ($command == 'slang' || $command == 's'){
header("Location: http://www.urbandictionary.com/define.php?term=".urlencode($parameter)."&r=f");
exit(0);
}
if ($command == 'css' || $command == 'c'){
header("Location: http://cssdocs.org/".urlencode($parameter));
exit(0);
}
if ($command == 'lorem' || $command == 'li'){
header("Location: http://www.lipsum.com/feed/html?amount=".urlencode($parameter));
exit(0);
}
if ($command == 'validate' || $command == 'v'){
header("Location: http://validator.w3.org/check?uri=".urlencode($parameter));
exit(0);
}
if ($command == 'product' || $command == 'ps'){
header("Location: http://www.google.com/products?q=".urlencode($parameter));
exit(0);
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">'."\n";
echo '<html>'."\n";
echo '<head>'."\n";
echo ' <title>Web Command Line | Mind Share Projects | Fredi Bach</title>'."\n";
echo ' <style type="text/css">'."\n";
echo ' body { font-family: Verdana, Helvetica, Geneva, Arial, sans-serif; font-size: 12px; line-height: 14pt; color: #333; background-color: #f2f2f2; margin: 0px; }'."\n";
echo ' 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; }'."\n";
echo ' 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; }'."\n";
echo ' #commandform { margin-left: 60px; }'."\n";
echo ' #commandtable { margin-left: 25px; width: 700px; }'."\n";
echo ' #tabledesc { font-size: 14px; font-weight: bold; background-color: #ddd; }'."\n";
echo ' td { margin: 2px; padding: 2px; padding-left: 6px; background-color: #fff; }'."\n";
echo ' #footer { margin-left: 25px; margin-top: 20px; margin-bottom: 20px; }'."\n";
echo ' </style>'."\n";
echo '</head>'."\n";
echo '<body>'."\n";
echo '<h1>Web Command Line</h1>'."\n";
echo '<div id="commandform"><form action="redirect.php" method="get" name="input_box">'."\n";
echo '<input type="text" name="c" size="55" value=""/>'."\n";
echo '<input type="submit" value="Enter" />'."\n";
echo '</form></div>'."\n";
echo '<h2>Installation Help (Firefox)</h2>'."\n";
echo '<ul><li>Right-click the input box above</li>'."\n";
echo '<li>Click "Add a Keyword for this Search"</li>'."\n";
echo '<li>For the Name, enter "Web Command Line" and for the Keyword, enter "c" for command</li>'."\n";
echo '<li>Press OK</li>'."\n";
echo '<li>Now you can enter "c yourcommand" into the address bar to use this web command line</li></ul>'."\n";
echo '<h2>Commands</h2>'."\n";
echo '<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>'."\n";
echo '<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>'."\n";
echo '<tr><td><b>digg</b></td><td>d</td><td>searchstring</td><td>Search Digg News</td></tr>'."\n";
echo '<tr><td><b>reddit</b></td><td>r</td><td>searchstring</td><td>Search Reddit</td></tr>'."\n";
echo '<tr><td><b>imdb</b></td><td>i</td><td>searchstring</td><td>Search the International Movie Database</td></tr>'."\n";
echo '<tr><td><b>wiki</b></td><td>w</td><td>page</td><td>Search a Wikipedia page</td></tr>'."\n";
echo '<tr><td><b>gmail</b></td><td>g</td><td>searchstring</td><td>Search your own Gmail account (if logged in)</td></tr>'."\n";
echo '<tr><td><b>php</b></td><td>p</td><td>searchstring</td><td>Search the php site</td></tr>'."\n";
echo '<tr><td><b>fk</b></td><td>f</td><td>searchstring</td><td>Search the Flashkit Forums</td></tr>'."\n";
echo '<tr><td><b>whois</b></td><td>wi</td><td>domain</td><td>Look up the whois informations for a domain</td></tr>'."\n";
echo '<tr><td><b>slang</b></td><td>s</td><td>word</td><td>Check the urban dictionary what this slang means</td></tr>'."\n";
echo '<tr><td><b>css</b></td><td>c</td><td>searchstring</td><td>Search the W3C CSS documentation</td></tr>'."\n";
echo '<tr><td><b>lorem</b></td><td>li</td><td>paragraphs</td><td>Get a specific number of lorem ipsum paragraphs</td></tr>'."\n";
echo '<tr><td><b>validate</b></td><td>v</td><td>url</td><td>W3C validate a given url</td></tr>'."\n";
echo '<tr><td><b>product</b></td><td>ps</td><td>name</td><td>Do a Google product search</td></tr>'."\n";
echo '</table>'."\n";
echo '<div id="footer">(c) 2007 by Fredi Bach / Mind Share Projects</div>'."\n";
echo '</body>';
?>
Enjoy. 
Fredi
Last edited by Subway; 06-10-2007 at 01:48 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|