Show DevBest OS Fight! - Script

Status
Not open for further replies.

Kryptos

prjRev.com
Jul 21, 2010
2,205
1,252
I made this little script so you can tease your friends who like the OS you hate!

PHP:
<?php
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), strtolower('Mac'))) 			
{ 				
	echo 'You have common sense';		
} 		
elseif(strpos(strtolower($_SERVER['HTTP_USER_AGENT']), strtolower('Windows')))
{
	echo 'You do not have common sense';
}
elseif(strpos(strtolower($_SERVER['HTPP_USER_AGENT']), strtolower('Linux')))
{
        echo 'lol'; 
}
?>

Have fun!
 

Jo$h

Posting Freak
Jul 7, 2010
1,030
79
*tweaked* here's a better edit. im a windows fanboy fyi

PHP:
[FONT=monospace][COLOR=#0000bb]<?php[/COLOR][/FONT]
[FONT=monospace][COLOR=#007700]if ([/COLOR][COLOR=#0000bb]strpos[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]strtolower[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$_SERVER[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'HTTP_USER_AGENT'[/COLOR][COLOR=#007700]]), [/COLOR][COLOR=#0000bb]strtolower[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'Mac'[/COLOR][COLOR=#007700])))
{
    echo [/COLOR][COLOR=#dd0000]'You have wasted your time and money buying a piece of shit restrictive computer'[/COLOR][COLOR=#007700];
}
elseif([/COLOR][COLOR=#0000bb]strpos[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]strtolower[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$_SERVER[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'HTTP_USER_AGENT'[/COLOR][COLOR=#007700]]), [/COLOR][COLOR=#0000bb]strtolower[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'Windows'[/COLOR][COLOR=#007700])))
{
    echo [/COLOR][COLOR=#dd0000]'You paid for a nice piece of reasonable equipment'[/COLOR][COLOR=#007700];
}
elseif([/COLOR][COLOR=#0000bb]strpos[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]strtolower[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$_SERVER[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'HTPP_USER_AGENT'[/COLOR][COLOR=#007700]]), [/COLOR][COLOR=#0000bb]strtolower[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'Linux'[/COLOR][COLOR=#007700])))
{
        echo [/COLOR][COLOR=#dd0000]'You just happen to be 1337'[/COLOR][COLOR=#007700]; [/COLOR]
[COLOR=#007700]}[/COLOR]
[/FONT]
[FONT=monospace][COLOR=#0000bb]?>[/COLOR][/FONT]
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,638
2,393
I liked the idea of this and thought it was fun so I optimised it a little:

PHP:
<?php
$agent  = $_SERVER['HTTP_USER_AGENT'];
$os_arr  = array( "Mac", "Windows", "Linux" );
$os_text = array( "Mac"    => "You have sense.",
                  "Windows" => "You have sense too.",
                  "Linux"  => "Fuck off."
              );
foreach( $os_arr as $os )
{
    if ( preg_match( "/" . $os . "/", $agent ) )
    {
        echo "<strong>" . $os . "</strong>: " . $os_text[ $os ];
    }
}
?>

Live demo:
 

Adil

DevBest CEO
May 28, 2011
1,278
716
Linux is awesome ^^
Mac and Linux are based off the same kernel, lol
They are practically the same, except for a few architectural differences, and some GUI differences
 

Heaplink

Developer & Designer
Nov 9, 2011
510
173
Guys you're doing it all wrong. Give them a health then use their top 4 function Pokemon style. Leveling your OS each time you defeat and opponent.

I like that idea, why write about what OS is best when you can fight!
 
Status
Not open for further replies.

Users who are viewing this thread

Top