PHP Classes

File: install.php

Recommend this page to a friend!
  Classes of Roman Shneer  >  PHP Web Application Firewall  >  install.php  >  Download  
File: install.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Web Application Firewall
Block malicious requests using a white list
Author: By
Last change: Added validation of web configuration on install.

Added checking injected code in htaccess.php

For Old users : update interesting only for new users
Date: 5 years ago
Size: 4,271 bytes


Class file image Download
 * script for install wizard
 * License: GNU
 * Copyright 2016 WebAppFirewall RomanShneer <>
#require_once "libs/";

require_once "libs/";

$WI=new WafInstaller;

$errors[]='SetEntIf blocked or not available.';
in_array('mod_rewrite', apache_get_modules()))$errors[]='Mod_Rewrite disabled.';
$warnings[]='unknown if mod_rewrite enabled on your server, try use for your risk.';
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" xml:lang="en" lang="en">
<?php require_once 'include/head.php';?>
        <div class='header'></div>
        <h1 class='title'>Wellcome to W.A.F.</h1>
                <div class='box'>
                        <?php if(count($errors)==0):?>
                                <h5>Install Easy</h5>
                        <form action="" method='POST'>
                <?php foreach($warnings as $warning) echo "<p style='color:#ccc'>".$warning."</p>"; ?>
                <?php if(!empty($err))echo '<div style="color:red">'.$err.'</div>';?>
                                        <tr><th colspan="2">Database parameters</th></tr>
                                                <td>DB Host:</td>
                                                <td><input type="text" name="dbhost" placeholder="localhost" class="inset" value="<?php echo $post['dbhost']?>"></td>
                                                <td>DB User:</td>
                                                <td><input type="text" name="dbuser" placeholder="root" class="inset" value="<?php echo $post['dbuser']?>"></td>
                                                <td>DB Password:</td>
                                                <td><input type="text" name="dbpass" placeholder="" class="inset" value="<?php echo $post['dbpass']?>"></td>
                                                <td>DB Name:</td>
                                                <td><input type="text" name="dbname" placeholder="waf" class="inset" value="<?php echo $post['dbname']?>"></td>
                                                <td>Create New DB:</td>
                                                <td><input type="checkbox" name="new_db" <?php if(isset($_POST['new_db'])):?> checked="checked"<?php endif;?>></td>
                                                <td>Save Old Data:</td>
                                                <td><select name="keep_db" class="inset">
                                                                <option value="new"<?php if(isset($_POST['keep_db'])&&($_POST['keep_db']=='new')):?> selected<?php endif;?>>New Installation</option>
                                                                <option value="keep<?php if(isset($_POST['keep_db'])&&($_POST['keep_db']=='keep')):?> selected<?php endif;?>">Keep old data</option>
                                        <tr><th colspan="2">First User</th></tr>
                                                <td><input type="text" name="email" placeholder="" class="inset" value="<?php echo $post['email']?>"></td>
                                                <td><input type="password" name="password" placeholder="12345" class="inset" value="<?php echo $post['password']?>"></td>
                                                <td>Confirm Password:</td>
                                                <td><input type="password" name="password1" placeholder="12345" class="inset" value="<?php echo $post['password']?>"></td>
                                        <tr><th><input type="submit" class="add_user" value="Save" name="op"></th></tr>
                        <?php else:?>
<h1>Sorry, cannot work on your webserver configurations</h1>
                        <?php foreach($errors as $error) echo "<p style='color:Red'>".$error."</p>"; ?>
<?php foreach($warnings as $warning) echo "<p style='color:#ccc'>".$warning."</p>"; ?>
<br><br><p>Contact you web-provider about changing configuration</p>
                        <?php endif;?>

For more information send a message to info at phpclasses dot org.