<?php
echo '<div class="row-fluid">
<div class="span12">
<h3 class="heading">TVstreamScript installation - Step 1</h3>
<br /><br />
<div class="row-fluid">
<div class="span1"></div>
<div class="span10">
';
if (isset( $_GET['step'] )) {
$_GET['step'];
$step = ;
}
else {
if (isset( $_POST['step'] )) {
$_POST['step'];
$step = ;
}
else {
$step = 1068;
}
}
if (!in_array( $step, array( 1, 2, 3, 4, 5 ) )) {
$step = 1068;
}
if (isset( $_POST['process'] )) {
if ($step == 1) {
$step1_errors = array( );
if (( !isset( $_POST['mysql_user'] ) || !$_POST['mysql_user'] )) {
$step1_errors[1] = 'Please enter your mysql username';
}
if (( !isset( $_POST['mysql_pass'] ) || !$_POST['mysql_pass'] )) {
$step1_errors[2] = 'Please enter your mysql password';
}
if (( !isset( $_POST['mysql_name'] ) || !$_POST['mysql_name'] )) {
$step1_errors[3] = 'Please enter your mysql database name';
}
if (( !isset( $_POST['mysql_host'] ) || !$_POST['mysql_host'] )) {
$step1_errors[4] = 'Please enter your mysql database host';
}
if (!count( $step1_errors )) {
@mysql_connect( $_POST['mysql_host'], $_POST['mysql_user'], $_POST['mysql_pass'] );
$conn = ;
if ($conn) {
$step1_errors[3] = 'Can\'t select database';
( mysql_select_db( $_POST['mysql_name'], $conn ) || );
if (!count( $step1_errors )) {
$_SESSION['mysql_host'] = $_POST['mysql_host'];
$_SESSION['mysql_user'] = $_POST['mysql_user'];
$_SESSION['mysql_pass'] = $_POST['mysql_pass'];
$_SESSION['mysql_name'] = $_POST['mysql_name'];
$step = 1069;
}
}
else {
$step1_errors[4] = 'Can\'t connect to database';
}
}
}
else {
if ($step == 2) {
$step2_errors = array( );
if (( !isset( $_POST['site_title'] ) || !$_POST['site_title'] )) {
$step2_errors[1] = 'Please enter your site\'s title';
}
if (( !isset( $_POST['site_url'] ) || !$_POST['site_url'] )) {
$step2_errors[2] = 'Please enter your site\'s url';
}
if (( !isset( $_POST['site_path'] ) || !$_POST['site_path'] )) {
$step2_errors[3] = 'Please enter your site\'s root path';
}
if (!count( $step2_errors )) {
$_SESSION['site_title'] = $_POST['site_title'];
$_SESSION['site_url'] = $_POST['site_url'];
$_SESSION['site_path'] = $_POST['site_path'];
$step = 1070;
}
}
else {
if ($step == 3) {
$step3_errors = array( );
if (( !isset( $_POST['license_key'] ) || !$_POST['license_key'] )) {
$step3_errors[1] = 'Please enter your license key';
}
else {
$home_url_site = 'http://tvstreamscript.com';
$home_url_port = 1147;
$home_url_iono = '/clients/license_server/remote.php';
$user_defined_string = '00c18aee3119e7a6f4d96774767f06d4';
$comm_terminate = false;
$license_terminate = true;
$product_license_id = 1067;
if (!empty( $product_license_id )) {
explode( '-', $license_key );
$key_parts = ;
$product_id = array( substr( md5( $product_license_id ), 0, 8 ) );
if (!in_array( $key_parts[4], $product_id )) {
echo $error_text['wrong_product'];
($license_terminate ? true : NULL);
}
}
$request = 'remote=licenses&type=3&license_key=' . urlencode( base64_encode( $_POST['license_key'] ) );
$request .= '&host_ip=' . urlencode( base64_encode( $_SERVER['SERVER_ADDR'] ) ) . '&host_name=' . urlencode( base64_encode( $_SERVER['SERVER_NAME'] ) );
$request .= '&hash=' . urlencode( base64_encode( md5( $request ) ) );
$request = $home_url_site . $home_url_iono . '?' . $request;
curl_init( );
$ch = ;
curl_setopt( $ch, CURLOPT_URL, $request );
curl_setopt( $ch, CURLOPT_PORT, $home_url_port );
curl_setopt( $ch, CURLOPT_HEADER, false );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_USERAGENT, 'iono (www.olate.co.uk/iono)' );
curl_exec( $ch );
$content = ;
curl_close( $ch );
if (!$content) {
($comm_terminate ? true : NULL);
}
explode( '-', $content );
$content = ;
$content[0];
$status = ;
$content[1];
$hash = ;
if ($status != 1) {
$step3_errors[1] = 'Invalid license key provided';
}
else {
$_SESSION['license_key'] = $_POST['license_key'];
$step = 1071;
}
}
}
else {
if ($step == 4) {
$step4_errors = array( );
if (( !isset( $_POST['admin_user'] ) || !$_POST['admin_user'] )) {
$step4_errors[1] = 'Please enter the admin username';
}
else {
preg_match( '/[^a-zA-Z0-9_]/i', $_POST['admin_user'], $matches );
if (count( $matches )) {
$step4_errors[1] = 'Admin username contains invalid characters';
}
else {
if (strlen( $_POST['admin_user'] ) < 5) {
$step4_errors[1] = 'Admin username must be at least 5 characters long';
}
}
}
if (( !isset( $_POST['admin_pass1'] ) || !$_POST['admin_pass1'] )) {
$step4_errors[2] = 'Please enter the admin password';
}
else {
if (strlen( $_POST['admin_pass1'] ) < 5) {
$step4_errors[2] = 'Admin password must be at least 5 characters long';
}
}
if (( !isset( $_POST['admin_pass2'] ) || !$_POST['admin_pass2'] )) {
$step4_errors[3] = 'Please confirm the admin password';
}
if (( ( isset( $_POST['admin_pass1'] ) and& isset( $_POST['admin_pass2'] ) ) and& $_POST['admin_pass1'] != $_POST['admin_pass2'] )) {
$step4_errors[3] = 'Password confirmation doesn\'t match';
}
if (!count( $step4_errors )) {
$_SESSION['admin_pass'] = $_POST['admin_pass1'];
$_SESSION['admin_user'] = $_POST['admin_user'];
$step = 1072;
}
}
}
}
}
}
if ($step == 1) {
$dir = '../cachefiles';
@base_convert( @fileperms( $dir ), 10, 8 );
$perms = ;
$errors = array( );
if (( substr_count( $perms, '777' ) == 0 and& $perms != 666 )) {
$errors[1] = 'Please make sure the <strong>/cachefiles</strong> directory is writeable';
}
$dir = '../thumbs';
@base_convert( @fileperms( $dir ), 10, 8 );
$perms = ;
$errors = array( );
if (( substr_count( $perms, '777' ) == 0 and& $perms != 666 )) {
$errors[1] = 'Please make sure the <strong>/thumbs</strong> directory is writeable';
}
$dir = '../vars.php';
@base_convert( @fileperms( $dir ), 10, 8 );
$perms = ;
$errors = array( );
if (( substr_count( $perms, '777' ) == 0 and& substr_count( $perms, '666' ) == 0 )) {
$errors[1] = 'Please make sure the <strong>/vars.php</strong> is writeable';
}
}
if ($step == 2) {
if (( ( ( !isset( $_SESSION['mysql_host'] ) || !isset( $_SESSION['mysql_user'] ) ) || !isset( $_SESSION['mysql_pass'] ) ) || !isset( $_SESSION['mysql_name'] ) )) {
$step = 1068;
}
else {
if (isset( $_SERVER['DOCUMENT_ROOT'] )) {
$_SESSION['site_path'] = $_SERVER['DOCUMENT_ROOT'];
}
else {
if (isset( $_SERVER['SCRIPT_FILENAME'] )) {
$_SESSION['site_path'] = str_replace( '/install/index.php', '', $_SERVER['SCRIPT_FILENAME'] );
}
}
if (isset( $_SERVER['HTTP_HOST'] )) {
$_SESSION['site_url'] = 'http://' . $_SERVER['HTTP_HOST'];
if (isset( $_SERVER['SCRIPT_NAME'] )) {
$_SESSION->site_url .= str_replace( '/install/index.php', '', $_SERVER['SCRIPT_NAME'] );
}
}
}
}
if ($step == 3) {
if (( ( ( !isset( $_SESSION['mysql_host'] ) || !isset( $_SESSION['mysql_user'] ) ) || !isset( $_SESSION['mysql_pass'] ) ) || !isset( $_SESSION['mysql_name'] ) )) {
$step = 1068;
}
else {
if (( ( !isset( $_SESSION['site_url'] ) || !isset( $_SESSION['site_title'] ) ) || !isset( $_SESSION['site_path'] ) )) {
$step = 1069;
}
}
}
if ($step == 4) {
if (( ( ( !isset( $_SESSION['mysql_host'] ) || !isset( $_SESSION['mysql_user'] ) ) || !isset( $_SESSION['mysql_pass'] ) ) || !isset( $_SESSION['mysql_name'] ) )) {
$step = 1068;
}
else {
if (( ( !isset( $_SESSION['site_url'] ) || !isset( $_SESSION['site_title'] ) ) || !isset( $_SESSION['site_path'] ) )) {
$step = 1069;
}
else {
if (!isset( $_SESSION['license_key'] )) {
$step = 1070;
}
}
}
}
if ($step == 5) {
if (( ( ( !isset( $_SESSION['mysql_host'] ) || !isset( $_SESSION['mysql_user'] ) ) || !isset( $_SESSION['mysql_pass'] ) ) || !isset( $_SESSION['mysql_name'] ) )) {
$step = 1068;
}
else {
if (( ( !isset( $_SESSION['site_url'] ) || !isset( $_SESSION['site_title'] ) ) || !isset( $_SESSION['site_path'] ) )) {
$step = 1069;
}
else {
if (!isset( $_SESSION['license_key'] )) {
$step = 1070;
}
else {
if (( !isset( $_SESSION['admin_user'] ) || !isset( $_SESSION['admin_pass'] ) )) {
$step = 1071;
}
}
}
}
}
require_once( 'step' . $step . '.php' );
echo '
</div>
</div>
</div>
</div>';
?>