Location: PHPKode > scripts > WH Social > wh_social/setup/install.php
<style type="text/css">
<!--
    html, body
    {
    background: #ffffff;
    font-family: lucida sans unicode, sans-serif;
    font-size: 12px;
    color: #444444;
    line-height: 1em;
    margin: 20px auto;
    }

    h1
    {
    font-size: 18px;
    color: #444444;
    font-weight: normal;
    text-decoration: none;
    }

    a
    {
    font-size: 12px;
    color: #808080;
    font-weight: normal;
    text-decoration: underline;
    }
    a:visited
    {
    color: #808080;
    font-weight: normal;
    text-decoration: underline;
    }
    a:active
    {
    color: #444444;
    font-weight: normal;
    text-decoration: underline;
    }
    a:hover
    {
    color: #444444;
    font-weight: normal;
    text-decoration: underline;
    }

    #install_wrapper
    {
    position: relative;
    display: block;
    background: #efefef;
    background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#efefef));
    background: -webkit-linear-gradient(top, #ffffff, #efefef);
    background: -moz-linear-gradient(top, #ffffff, #efefef);
    background: -ms-linear-gradient(top, #ffffff, #efefef);
    background: -o-linear-gradient(top, #ffffff, #efefef);
    background: linear-gradient(top, #ffffff, #efefef);
    width: 500px;
    min-height: 500px;
    padding: 5px 20px 5px 20px;
    margin: 0px auto;
    text-align: left;
    border: 1px solid #cecece;
    border-radius: 4px;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
    -khtml-border-radius: 4px;
    -ms-border-radius: 4px;
    -o-border-radius: 4px;
    }

    .success
    {
    background: #c7ffc7 url('../style/images/positive.png') no-repeat +5px;
    color: #5bb016;
    font-size: 12px;
    font-weight: normal;
    width: 92%;
    padding: 8px 5px 8px 32px;
    border: 1px solid #bcbcbc;
    border-radius: 2px;
    -moz-border-radius: 2px;
    -webkit-border-radius: 2px;
    -khtml-border-radius: 2px;
    -ms-border-radius: 2px;
    -o-border-radius: 2px;
    text-shadow: 0px 1px 0px rgba(255,255,255,.5);
    }

    .false
    {
    background: #ffcfcf url('../style/images/negative.png') no-repeat +5px;
    color: #c23d1f;
    font-size: 12px;
    font-weight: normal;
    width: 92%;
    padding: 8px 5px 8px 32px;
    border: 1px solid #bcbcbc;
    border-radius: 2px;
    -moz-border-radius: 2px;
    -webkit-border-radius: 2px;
    -khtml-border-radius: 2px;
    -ms-border-radius: 2px;
    -o-border-radius: 2px;
    text-shadow: 0px 1px 0px rgba(255,255,255,.5);
    }

    .textfields
    {
    outline: none;
    background: #ffffff;
    font-size: 14px;
    color: #808080;
    width: 200px;
    padding: 3px;
    border: 1px solid #cecece;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    -khtml-border-radius: 3px;
    -ms-border-radius: 3px;
    -o-border-radius: 3px;
    }
    .textfields:hover
    {
    outline: none;
    background: #ffffff;
    font-size: 14px;
    color: #808080;
    width: 200px;
    padding: 3px;
    border: 1px solid #b9b9b9;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    -khtml-border-radius: 3px;
    -ms-border-radius: 3px;
    -o-border-radius: 3px;
    box-shadow: 0px 0px 4px rgba(204,204,204,.8);
    }
    .textfields:focus
    {
    outline: none;
    background: #ffffff;
    font-size: 14px;
    color: #808080;
    width: 200px;
    padding: 3px;
    border: 1px solid #b9b9b9;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    -khtml-border-radius: 3px;
    -ms-border-radius: 3px;
    -o-border-radius: 3px;
    box-shadow: 0px 0px 4px rgba(204,204,204,.8);
    }

    .buttons_big
    {
    background: #ffffff;
    background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#efefef));
    background: -webkit-linear-gradient(top, #ffffff, #efefef);
    background: -moz-linear-gradient(top, #ffffff, #efefef);
    background: -ms-linear-gradient(top, #ffffff, #efefef);
    background: -o-linear-gradient(top, #ffffff, #efefef);
    background: linear-gradient(top, #ffffff, #efefef);
    font-size: 14px;
    color: #808080;
    font-weight: normal;
    text-decoration: none;
    padding: 5px 8px;
    border: 1px solid #cecece;
    border-bottom: 1px solid #acacac;
    border-radius: 8px;
    -moz-border-radius: 8px;
    -webkit-border-radius: 8px;
    -khtml-border-radius: 8px;
    -ms-border-radius: 8px;
    -o-border-radius: 8px;
    text-shadow: 0px 1px 0px rgba(255,255,255,.8);
    }
    .buttons_big:hover
    {
    background: #f1f1f1;
    background: -webkit-gradient(linear, left top, left bottom, from(#f1f1f1), to(#f2f2f2));
    background: -webkit-linear-gradient(top, #f1f1f1, #f2f2f2);
    background: -moz-linear-gradient(top, #f1f1f1, #f2f2f2);
    background: -ms-linear-gradient(top, #f1f1f1, #f2f2f2);
    background: -o-linear-gradient(top, #f1f1f1, #f2f2f2);
    background: linear-gradient(top, #f1f1f1, #f2f2f2);
    font-size: 14px;
    color: #808080;
    font-weight: normal;
    text-decoration: none;
    }
-->
</style>

<?php

    define('INCLUDE_CHECK',1);
    define('MYSQL_CHECK',1);

    $configuration = '../framework/config.php';
    $database = '../framework/mysql.php';
    $security = '../framework/security.php';

    echo '<div id="install_wrapper">';

    if(file_exists($configuration) && file_exists($database) && file_exists($security) == TRUE) {

        require($configuration);
        require($database);

        include($security);

        if($language == "de") {
            require('../language/de.php');

        }elseif ($language == "en") {
            require('../language/en.php');
            }

    }else{

    echo '<p class="false">' . $lang['config_not_found'] . '!</p>';
    exit;
    }

    echo '<h1>' . $lang['isoc_install'] . '</h1><br><br>';

    $step = $_GET['step'];

    if(!isset($step)) {
        echo '<p><strong>' . $lang['start_assistant'] . '</strong></p>
        <p><em>' . $lang['edited_config'] . '</em></p><br><br>';

        echo '<a href="install.php?step=1">' . $lang['go_to_step'] . ' 2</a>';
        }

    /* Tabellenerzeugung - Table creation */

    if($step == '1') {
        echo '<p>' . $lang['table_creation'] . '</p>';

        $errors = array();

        require('sql.php');

        if(!empty($errors)) {

        echo '<p class="false">' . $lang['an_error_occurred'] . '! ' . $lang['these_tables_failed'] . ':</p>';
        echo '<ul>';

        foreach($errors as $key => $value) {
            echo '<li><em></em>' . $value . '</li>';
            }

            echo '</ul>
            <p>MySQL ' . $lang['error_msg'] . ':</p>' . mysql_error();
            exit();

            }else{

            echo '<a href="install.php?step=2">' . $lang['go_to_step'] . '3</a>';
            }
        }

    /* Admin-Account anlegen - Create admin account */

    if($step == '2') {
        echo '<p>' . $lang['new_admin_create'] . '</p>';
        
        if($_SERVER['REQUEST_METHOD'] != 'POST') {

        echo '<form method="post" action="">
        <p><input type="text" name="name" size="40" required class="textfields"> ' . $lang['re_name'] . '</p>
        <p><input type="password" name="password" size="40" required class="textfields"> ' . $lang['password'] . '</p>
        <p><input type="password" name="pass_check" size="40" required class="textfields"> ' . $lang['repeat_passwort'] . '</p>
        <p><input type="email" name="email" size="40" required class="textfields"> ' . $lang['e_mail_adress'] . '</p>
        <p><input type="submit" name="' . $lang['new_admin_create'] . '" id="' . $lang['new_admin_create'] . '" value="' . $lang['new_admin_create'] . '" class="buttons_big"></p>
        </form>';

            }else{

            $errors = array();

            if(isset($_POST['name'])) {
    		if(strlen($_POST['name']) > 30) {
    		$errors[] = $lang['not_be_longer'];
    		}

    			}else{
    			$errors[] = $lang['name_must_be_filled'];
                }

            if(isset($_POST['password'])) {
    		if(trim($_POST['password']) == "") {
    		$errors[] = $lang['enter_a_password'];
    		}

    		if($_POST['password'] != $_POST['pass_check']) {
    		$errors[] = $lang['repetition_does_not_match'];
    		}

    			}else{
    			$errors[] = $lang['pw_must_be_filled'];
    			}

            if(isset($_POST['email'])) {
    		$email = mysql_escape_string($_POST['email']);

    		if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $email)) {
    		$errors[] = $lang['invalid_syntax'];
    		}

    			}else{
    			$errors[] = $lang['email_must_be_filled'];
    			}

            if(!empty($errors)) {

    		echo '<p class="false">' . $lang['not_filled_in_all_fields'] . ' - <a href="install.php?step=2" class="false_link">' . $lang['back'] . '</a></p>';
    		echo '<ul>';

    		foreach($errors as $key => $value) {
    		echo '<li>&#8226; ' . $value . '</li>';
    		}
    		echo '</ul>';

        }else{

        $hash = mt_rand(0, 1000);

        $sql = "INSERT INTO
                    members(name, password, email, date, level, active, hash)
                VALUES('" . mysql_real_escape_string($_POST['name']) . "',
                    '" . mysql_real_escape_string(sha1($_POST['password'])) . "',
                    '" . mysql_real_escape_string($_POST['email']) . "',
                    NOW(),
                    '1',
                    '1',
                    '" . mysql_real_escape_string($hash) . "')";

        $result = mysql_query($sql) OR die(mysql_error());

        if(!$result) {

            echo '<p class="false">' . $lang['couldnot_admin_account'] . '</p>';

                }else{

                echo '<p class="success">' . $lang['success_admin_account'] . '</p>';
                echo '<a href="install.php?step=3">' . $lang['completing_installation'] . '</a>';
                }
            }
        }
        }

    /* Installation abschlie├čen - Completing installation */

    if($step == '3') {

        chmod("../uploads", 0777);
        chmod("../uploads/avatars", 0777);
        chmod("../uploads/photos", 0777);
        chmod("../protocol.php", 0777);

        echo '<p class="success">' . $lang['installation_complete'] . '</p>
        <p><strong>! ' . $lang['delete_setup_folder'] . '</strong></p><br><br>';

        echo '<p align="center"><a href="../admin/"><img src="../style/images/avatar.png" border="0" width="40" height="40" vspace="10" alt="Admin">
        <br>' . $lang['link_admin'] . '</a></p>';
        }

    echo '</div>';

?>
Return current item: WH Social