<?php
/* 
 * Copyright 2011 Mireiawen
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
// Set up default URL
$url "http://www.google.com/";

// Get URL from browser
if (array_key_exists('page'$_REQUEST))
{
    
$url $_REQUEST['page'];
    
// Make sure URL starts with http(s)://
    
if (!preg_match('|^https?://|i'$url))
    {
        
$url='http://' $url;
    }
}
?>

<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
<title>Anarchy Online Browser</title>
</head>

<body style="padding: 0; margin: 0;">
<div class="navigation">

<!-- Back and Forward buttons with JavaScript -->
<form>
<input type="button" name="back" value="<" onClick="history.back()">
</form>
<form>
<input type="button" name="back" value=">" onClick="history.forward()">
</form>

<!-- Address bar -->
<form method="post" action="">
<input type="url" name="page" size="80" value="<?php print($url); ?>">
<input type="submit" name="go" value="Go">
</form>
</div>

<!-- Iframe showing the page itself -->
<div class="wrapper">
<iframe src="<?php print($url); ?>">
</div>
</body>