Exemple #1
0
<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//require myconfig file
require 'config/myconfig.php';
if (isset($_POST['submit'])) {
    //Get form post data
    $config['db_name'] = $_POST['db_name'];
    $config['db_username'] = $_POST['db_username'];
    $config['db_password'] = $_POST['db_password'];
    //Create MyConfig instance
    $myconfig = new MyConfig();
    //Write db settings file
    $status = $myconfig->write('config/db_settings.php', $config);
    if ($status == false) {
        //Throw an error while file writing operation fail
        header("Location:install.php?error=file_operation");
    } else {
        require 'db_connection.php';
        try {
            //get db connection
            $db = $capsule->getConnection();
            //create url table
            $capsule->schema()->create('url', function ($table) {
                $table->increments('id');
                $table->string('url')->unique();
                $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
            });
            //add some seed url into url table
Exemple #2
0
if (count($_GET) > 1) {
    $config['en_gram'] = $_GET['en_gram'];
    $config['en_lm'] = $_GET['en_lm'];
    $config['lv_gram'] = $_GET['lv_gram'];
    $config['lv_lm'] = $_GET['lv_lm'];
    $config['de_gram'] = $_GET['de_gram'];
    $config['de_lm'] = $_GET['de_lm'];
    $config['fr_gram'] = $_GET['fr_gram'];
    $config['fr_lm'] = $_GET['fr_lm'];
    $config['google_key'] = $_GET['google_key'];
    $config['yandex_key'] = $_GET['yandex_key'];
    $config['bing_id'] = $_GET['bing_id'];
    $config['bing_se'] = $_GET['bing_se'];
    $config['hugo_pw'] = $_GET['hugo_pw'];
    $config['hugo_em'] = $_GET['hugo_em'];
    MyConfig::write('include/settings.php', $config);
}
$config = MyConfig::read('include/settings.php');
$en_gram = $config['en_gram'];
$en_lm = $config['en_lm'];
$lv_gram = $config['lv_gram'];
$lv_lm = $config['lv_lm'];
$de_gram = $config['de_gram'];
$de_lm = $config['de_lm'];
$fr_gram = $config['fr_gram'];
$fr_lm = $config['fr_lm'];
$google_key = $config['google_key'];
$yandex_key = $config['yandex_key'];
$bing_id = $config['bing_id'];
$bing_se = $config['bing_se'];
$hugo_pw = $config['hugo_pw'];