#!/usr/bin/perl
use strict;
use FindBin qw($Bin);
use lib $Bin;
use onserver;

setup();

my ($preva) = fetch_uri(
    'install.php',
    {},
    {server => $sqlhost,
     name => $sqluser,
     password => $sqlpass,
     db => $sqldb,
     prefix => 'e107_',
     stage => 3}) =~ /name='previous_steps' value='(.*)'/;

my ($prevb) = fetch_uri(
    'install.php',
    {},
    {stage => 4,
     previous_steps => $preva}) =~ /name='previous_steps' value='(.*)'/;

my ($prevc) = fetch_uri(
    'install.php',
    {},
    {u_name => $admin_username,
     d_name => $admin_username,
     pass1 => $admin_password,
     pass2 => $admin_password,
     email => $email,
     stage => 6,
     previous_steps => $prevb}) =~ /name='previous_steps' value='(.*)'/;

fetch_uri(
    'install.php',
    {},
    {stage => "7",
     previous_steps => $prevc});

unlink 'install.php';
