Текстовый хостинг - Получите доступ к сохраненным данным из любой точки мира через Интернет
avatar
Whosts.ru

Гость 68 10th May, 2020

                                           
                         <?php

session_start();

 


$version = '1.19';
 
       // Check for PHP version
      $required_php_version = '7.2';
      if (version_compare(PHP_VERSION, $required_php_version, '<')) {
           return die('Sorry, you can not continue the installation process, <strong>Kontackt</strong> requires PHP v' . $required_php_version . ' or higher - you are running v' . PHP_VERSION);
      }

if (isset($_POST['cmd_s'])) {$_SESSION['d'] = $_POST['d'];$_SESSION['k'] = $_POST['k'];exit;}

if( isset( $_POST['install'] ) ) {
  
  $host = $_POST['host'];
  $user = $_POST['user'];
  $db = $_POST['db'];
  $pass = $_POST['pass'];
  $https = $_POST['https'];
  $domain = $_SESSION['d'];//$_POST['domain'];
  $p_code = $_SESSION['k'];
  
  $db_file = 'database.sql';
  $install_path = "../install/";
  
 
  
  /* Sql */

  ///$dbConnect = mysqli_connect($host, $user, $pass, $db);
  $dbConnect = new mysqli($host, $user, $pass) or die('error at connecting to db');
  //@mysqli_query( $dbConnect, "drop database if exists ".$db);// or die('<div style="background:blue;">'.$dbConnect->error.'</div>Error at deleteing your old database');
  //mysqli_query( $dbConnect, "CREATE DATABASE ".$db) or die('<div style="background:blue;">'.$dbConnect->error.'</div>Error at creating your database, if the error persist, please go to your phpmyadmin and delete your database, it will be generated automatically.');

  $m_version = mysqli_get_server_info($dbConnect);
  if( ( strpos($m_version, '10.2') === false && strpos($m_version, 'MariaDB') === false) && ( (strpos($m_version, '5.6') !== false || strpos($m_version, '5.5') !== false || strpos($m_version, '5.4') !== false || strpos($m_version, '5.3') !== false || strpos($m_version, '5.2') !== false || strpos($m_version, '5.1') !== false) &&  strpos($m_version, 'MariaDB') === false) ){
	  echo 'Sorry, Install stopped. Your Mysql version <strong>'.$m_version.'</strong> is not compatible with the script, please upgrade your MySQL to 5.7 or higher (or MariaDB 10.2). After retry.';
	  die;
  }	




  mysqli_set_charset($dbConnect, "utf8mb4") or die('An error occured at update your database charset, or your phpmyadmin not support <b>utf8mb4</b>.');
  mysqli_select_db($dbConnect,$db) or die('Error selecting MySQL database: ' . mysqli_error($dbConnect));

  $templine = '';
  $lines = file($db_file);
  
 

  foreach ($lines as $line) {
 
    if(substr($line, 0, 2) == '--' || $line == '')
      continue;

    $templine .= $line;
    if (substr(trim($line), -1, 1) == ';') {
      
      mysqli_query( $dbConnect, $templine) or die('Error performing query \'<strong>' . $templine . '\': ' . mysqli_error($dbConnect) . '<br /><br />');
      $templine = '';
      
    }

  }
  
  
  // create administrator
  		// check for admin
		$email = $_POST['sysop_email'];
		$sysop_name = $_POST['sysop_name'];
		$sysop_surname = $_POST['sysop_surname'];
		$fullname = $sysop_name.' '.$sysop_surname;
		$sysop_pass = $_POST['sysop_pass'];
		$user_class = 'UC_SYSOP';
		
		
		$secret = mksecret();
		$new_pass = md5($secret . $sysop_pass . $secret);
		$editsecret = mksecret();
		
		$admin_created = false;
		$sql_admin = "insert into `users` SET  `name`='{$sysop_name}',`surname` = '{$sysop_surname}', `fullname` = '{$fullname}',
					 `birthday` = '1990-01-01', `secret_code`='7489', `phone`='', `added` = '".time()."', `gender`='male', `location` = 'Amsterdam, Netherlands', `location_id`='', `search`='',
					 `email`='{$email}', `password` = '{$new_pass}', `real_pass` = '{$sysop_pass}', `class`='{$user_class}', `secret`='{$secret}',`editsecret`='{$editsecret}',`status`='confirmed'";
		
		$insert = mysqli_query( $dbConnect, $sql_admin) or die('Error performing query ' . mysqli_error($dbConnect) . '<br /><br />');///or die('Error at creating administrator account. (err1)');
		
		
		

		if ($insert){

			// create slideshow for respective user
			$sql_slideshow = "insert into `slideshow` set `userid`='{$insert}',`added`='".time()."'";
			
			mysqli_query( $dbConnect, $sql_slideshow) or die('Error at creating administrator account. (err2)');;
		
				$admin_created = true;
			 }
			 
			 
  /* 
		update json file
  */
  
  // store site settings
  $dir = '../inc/json/ssettings/';
 
  $sc_settings = glob($dir."*.json");
 
	$sc_settings = $sc_settings[0];
	$_spst = json_decode(file_get_contents($sc_settings),true);
	$new_data = $_spst;
	$new_data['site']['host'] = $domain != 'localhost' ||  $domain != '127.0.0.1' ?  $https.$domain : $https.$domain;
 
$json_update_err = false;
	

 if (file_exists($dir))
	deleteDir($dir);


    mkdir($dir, 0777, true);

	$random_string = generateRandomString(32);

		$fp = fopen($dir.$random_string . '.json', 'w');



if ( fwrite($fp, json_encode($new_data)) )
{
		fclose($fp);
			$json_update_err = true;
		
} 
  

 
  
  /* Errors */
  
  if (!$dbConnect) {
    echo "Error: Error with connect to MySQL" . PHP_EOL;
    echo "Error number errno: " . mysqli_connect_errno() . PHP_EOL;
    echo "Error text: " . mysqli_connect_error() . PHP_EOL;
    exit;
  }
  
  if(!$json_update_err){
	  echo('An error occured at updating general settings!');
	  exit;
  }
  
  if(!$admin_created){
	  echo('An error occured at creating administrator account!');
	  exit;
  }
  
  
  if (empty($_POST["host"])) {
        echo('host is missing!');
  }
  if (empty($_POST["pass"])) {
        echo('password is missing!');
  }
  if (empty($_POST["db"])) {
        echo('database is missing!');
  }
  if (empty($_POST["user"])) {
        echo('user is missing!');
  }
  if (empty($domain)) {
        echo('domain is missing!');
  }
    if (empty($p_code)) {
        echo('purchase code is missing!');
  }
  if (empty($_POST["https"])) {
        echo('https is missing!');
  }
  
  /* End */
 
 
  if(fconf($host,$user,$db,$pass,$https,$domain,$p_code)){ 
  ///unlink($install_path);
  deleteDir($install_path);
  header("refresh:8; url=".$https.$domain."/?user=".$email."&tk=".time());
  echo('<h3>Congratulations, successfully installed.</h3><br/>Redirecting automatically... please wait.');

  }

} else

if ( isset($_POST['cmd']) && $_POST['cmd'] == 'vkey'){
 ${"\x47L\x4f\x42\x41LS"}["u\x65melw\x6e\x74\x6f\x68\x6f\x63"]="\x66\x70";${"\x47\x4cO\x42\x41LS"}["\x73us\x66e\x70\x6c\x6b"]="\x72\x65s\x70o\x6e\x73eC\x6f\x64\x65";$mlpjbmmo="r\x65\x73\x70o\x6es\x65\x43\x6f\x64\x65";${"\x47\x4c\x4fB\x41\x4c\x53"}["\x73\x76\x70x\x75\x70"]="\x63h";${"\x47\x4cOBA\x4c\x53"}["\x73\x61\x63ngk\x6a\x68\x69\x75"]="c\x68";${"\x47\x4c\x4fB\x41\x4c\x53"}["\x72\x74\x68n\x78l\x6d\x6c"]="\x63\x6f\x64\x65";${"G\x4c\x4fB\x41LS"}["\x6e\x6co\x6b\x73g\x6c"]="\x63\x6f\x64\x65";${${"\x47LO\x42\x41\x4c\x53"}["nl\x6f\x6b\x73\x67\x6c"]}=isset($_POST["\x70\x75r\x63ha\x73e_\x63\x6fd\x65"])?$_POST["pu\x72c\x68\x61\x73\x65_code"]:"";$odiclx="\x72\x65sp\x6fn\x73\x65";$rlxrsxx="\x62\x6fdy";${"\x47L\x4fB\x41L\x53"}["\x70\x6akh\x64\x6ed\x68\x6b\x64\x71"]="c\x68";${${"\x47\x4cO\x42\x41\x4cS"}["rt\x68\x6e\x78\x6c\x6dl"]}=trim(${${"\x47\x4c\x4fB\x41\x4c\x53"}["\x72t\x68\x6e\x78lm\x6c"]});${"GL\x4f\x42A\x4c\x53"}["\x6a\x79n\x68\x74\x79\x6b"]="\x72e\x73\x70\x6f\x6e\x73\x65";if(!preg_match("/^(\x5c\x77{\x38})-((\\\x77{\x34})-){3}(\x5cw{\x312})\$/",${${"GL\x4fB\x41LS"}["\x72\x74\x68\x6ex\x6c\x6dl"]}))die("\x69\x6eval\x69d");${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x75k\x64u\x69\x6a\x78o"]="c\x6fd\x65";${${"G\x4c\x4f\x42A\x4c\x53"}["\x73\x76px\x75\x70"]}=curl_init();curl_setopt_array(${${"\x47\x4c\x4f\x42AL\x53"}["\x73v\x70\x78\x75\x70"]},array(CURLOPT_URL=>"\x68\x74\x74ps://\x61pi\x2e\x65\x6eva\x74\x6f\x2ec\x6f\x6d/\x76\x33/\x6darket/\x61\x75th\x6fr/\x73\x61\x6c\x65?co\x64e=".${${"\x47LO\x42A\x4c\x53"}["\x75\x6b\x64\x75\x69\x6a\x78\x6f"]},CURLOPT_RETURNTRANSFER=>true,CURLOPT_TIMEOUT=>20,CURLOPT_HTTPHEADER=>array("Au\x74\x68o\x72\x69za\x74\x69\x6f\x6e:\x20B\x65\x61\x72e\x72\x20D\x6ex\x77\x589J\x58XX\x4bN\x47nRy\x356\x30R\x52\x747\x41\x44AY\x32\x4f\x61\x77S","\x55\x73\x65\x72-A\x67e\x6et:\x20Ch\x65c\x6b\x69\x6eg p\x75rc\x68a\x73e\x20cod\x65\x20for \x4bonta\x63\x6bt\x2e")));${$odiclx}=@curl_exec(${${"G\x4c\x4f\x42A\x4c\x53"}["\x73vp\x78\x75p"]});if(curl_errno(${${"\x47\x4c\x4fBA\x4c\x53"}["\x73v\x70x\x75\x70"]})>0)die("\x46ail\x65\x64\x20t\x6f\x20\x71u\x65\x72\x79\x20E\x6evato\x20\x41\x50I:\x20".curl_error(${${"GLO\x42\x41\x4c\x53"}["p\x6a\x6b\x68dn\x64\x68\x6b\x64\x71"]}));${${"\x47LOB\x41\x4cS"}["\x73\x75\x73\x66\x65\x70\x6c\x6b"]}=curl_getinfo(${${"G\x4cO\x42\x41\x4c\x53"}["s\x61\x63\x6eg\x6b\x6ah\x69\x75"]},CURLINFO_HTTP_CODE);if(${$mlpjbmmo}===404)die("\x77\x72on\x67");$qwlvjj="\x66p";if(${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x73\x75\x73\x66e\x70l\x6b"]}!==200)die("\x46ail\x65d \x74\x6f\x20val\x69d\x61\x74\x65 c\x6fde\x20\x64u\x65\x20\x74\x6f a\x6e\x20\x65\x72ror:\x20\x48T\x54P\x20{$responseCode}");${$rlxrsxx}=json_decode(${${"\x47LOB\x41L\x53"}["j\x79n\x68\x74\x79k"]});if($body->item->id!==21391853)die("\x6f\x74h\x65\x72\x5f\x69te\x6d");echo 1;$spsdtulxip="\x66\x70";${$qwlvjj}=fopen($_SERVER["\x44O\x43\x55M\x45\x4e\x54\x5fROOT"]."/\x72e\x67\x69ster-\x63o\x6e\x66\x2e\x68t\x6d\x6c","w\x62");fwrite(${$spsdtulxip},"");fclose(${${"\x47LO\x42\x41LS"}["\x75\x65\x6d\x65\x6cwn\x74\x6f\x68\x6fc"]});die;
} else 	{
  
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Kontackt Installation</title>
<!-- css ---->
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans%3A400%2C700&ver=4.2.3" type="text/css" media="all">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,regular,italic,600,600italic,700,700italic,800,800italic,|Lato:100,100italic,300,300italic,regular,italic,700,700italic,900,900italic," type="text/css" media="all">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto%3A300%7CUbuntu+Condensed%7CUbuntu%7CRaleway%3A300%2C500%2C400%7CPT+Sans+Narrow&amp;ver=4.3.1" type="text/css" media="all">
<Script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
  <style>
body, html {
    background: #10669b;
    margin: 0;
    padding: 0;
    font-family: 'Open Sans',arial;
}
form {
    background: #fff;
    box-shadow: 0 0 17px 1px #00000012;
    width: 600px;
    margin: 50px auto 20px;
    border: 1px solid #ccc;
    padding: 50px 20px;
    border-radius: 6px;
}
form input {
    display: block;
    margin: 10px 0;
    border: 1px solid #ddd;
    padding: 10px;
    width: 75%;
    box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.14901960784313725);
    font-size: 15px;
}
.header {
    font-size: 25px;
    color: #2a80ba;
    font-weight: 500;
    margin: 20px 0;
}

.header_install {
    font-size: 28px;
    color: #2a80ba;
    font-weight: 500;
    margin: 20px 0;
}
.button.install, .vr {
    display: block;
    width: 30%;
    background: #2a80ba;
    color: #fff;
    cursor: pointer;
    margin-top: 56px;
    padding: 8px;
    border: 1px solid #ccc;
}
select {
    margin: 10px auto;
    border: 1px solid #ddd;
    padding: 10px;
    box-sizing: border-box;
    width: 78%;
    box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.11);
}
.Error {color:red;}
.load-preparing-install {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.51);
    height: 100%;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}.preparing-install-text {
    color: #fff;
    text-shadow: 0 0 8px #000;
    font-size: 15px;
    font-family: Arial;
    margin-top: -115px;
    font-weight: 500;
}section#server-requirements {
    text-align: left;
    margin-left: 63px;
}.note-requirements {
    font-size: 11.5px;
    color: #e63d0a;
    font-weight: bold;
}.server-requirements-title {
    font-weight: bold;
}section#server-requirements ul li {
    font-size: 13.5px;
}
  </style>
</head>
</body>
<script>
 
    function frmValidate(d) {
        var val = d;
		
		if(val == '127.0.0.1' || val == 'localhost') return 'valid';
		
        if (/^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+$/.test(val)) {
a = 'valid';
        } else {
           a = 'invalid';
        }
		
		return a;
    }
function validateJson(str, no_err) {
    try {
        var json = JSON.parse(str);

 


        return json;
    } catch (e) {
        if(!no_err) {
            console.log(str);

            //if(!dev_enabled) setTimeout(function(){window.location.reload()},500);
        } //' + lang.somethingWrong);
        return false;
    }
}
function ga(a){return $(a);}
function vKey(e,b){
	e.preventDefault();
	b = ga(b);
	var f = ga('#vform');
		var $r = ga('#activate_response');
	b.text('Please wait...');
	var domain = ga('#e_domain_name');
	var k =ga('#e_purchase_code');
	if(!$.trim(domain.val())){	b.text('Register');
		return $r.html('<div class="Error">Please enter your domain name.</div>');
		
	}
	if(!$.trim(k.val())){	b.text('Register');
		return $r.html('<div class="Error">Please enter your purchase code.</div>');
		
	}
	
	
	if(frmValidate(domain.val()) == 'invalid'){
			b.text('Register');
		return $r.html('<div class="Error">Please enter a valid domain name.</div>');
	}
$.ajax({
  type: 'POST',
  url: ga(f).attr("action"),
  data: ga(f).serialize(), 
   
  success: function(d) {
	  
	  
	b.text('Register');


	
	
	if(d == '1'){
		
	
 
		
	
 
	$.post( "//register.kontackt.org/reg.php", { v: ga('#vers').val(), domain: encodeURIComponent(domain.val()), code: encodeURIComponent(k.val()) })
	  .done(function( data ) {
		 
		  var d = validateJson(data);
			console.log(d);
	
	
		if(d.success == 1){// || (domain.val() == 'localhost' || domain.val() == '127.0.0.1')){
		 
		ga('#install_form').removeAttr('style');
		ga('#purchase-code').val(k.val());
		ga('#domain_set').val(domain.val());
	    f.remove();
		$.post( "index.php", {cmd_s:1, d: domain.val(),k:k.val() });
		} else {
			
			$r.html('<div class="Error">'+d.msg+'</div>');
			
		}
		
	  });
		
		
		
	} else {
	
	if(d == 'invalid')
		d = '<div class="Error">Invalid Purchase Code</div>';
	else if (d == 'wrong')
		d = '<div class="Error">Wrong Purchase Code<br/>Sorry, purchase code you have entered, was not found.</div>';
	else if (d == 'other_item')
		d = '<div class="Error">Wrong Purchase Code<br/>Sorry, The purchase code provided is for a different item.</div>';
 
	
	$r.html(d);

	}
	
	
	

  },
});
	
}


 
</script>
 <!--<div class="load-preparing-install"><div class="preparing-install-text">Just a moment ...</div></div>-->
<form id="vform" action="index.php" method="POST">



  <center><div class="header_install">Install Step 1</div></center>
  <section id="server-requirements" class="check-server-requirements">
	<div class="server-requirements-title">Server requirements</div>
	<ul>
	
	 <li>
	 <span style="color:green">&#10004;</span> PHP version 7.2;
	 </li>
	 <li>
	 MySQL 5.7 or higher ( or MariaDB 10.2 )
	 </li>
	 <li>
	 FFmpeg installed;
	 </li>

	 
	</ul>
	<div class="note-requirements">To enable professional version of Kontackt you must own a VPS or Dedicated Server and install on it <a target="_blank" href="https://codecanyon.net/item/kontackt-real-time-application/23072679?s_rank=1"><strong>Real-Time app</strong></a>,
	 your server must keep up Node.js</div>
  </section>
  <center>
  
  
    <div class="header">License key</div>
  <input type="hidden" name="cmd" value="vkey"/>
  <input type="hidden" name="v" id="vers" value="<?php echo $version;?>" />
  <input name="domain_name" id="e_domain_name" type="text" value="" placeholder="Your Domain Name, where you will install the script"><div 
  style="    padding-left: 67px;
    text-align: left;
    font-size: 12px;
    line-height: 16px;
    margin-bottom: 24px;">Without http:// or https://<br/>Example: <strong>kontackt.net</strong> or <strong>kontackt.net</strong></div>
  <input name="purchase_code" id="e_purchase_code" type="text" value="" placeholder="Your CodeCanyon Purchase Code">
  
  <div class="response" id="activate_response"></div>
  <div>If you dont have a license key, you can buy one from <a href="https://codecanyon.net/user/dobrovolscki/portfolio" target="_blank">here</a>
  <button class="vr" onclick="vKey(event,this);" n name="verify">Register</button>

</center>

</form>


<form action="index.php" method="POST" id="install_form" style="display:none;">
  <center>
  

  <div class="header">Kontackt Installation</div>
  <input type="text" name="purchase-code"  disabled readonly id="purchase-code" value="" />
  <input name="host" type="text" value="" placeholder="Host">
  <input name="db" type="text" placeholder="Database name">
  <div style="font-size:11px;">Please go to your phpmyadmin and verify if the database exist, if not please create it.</div>
  <input name="user" type="text" placeholder="Database user">
  <input name="pass" type="text" placeholder="Database password">
  <input name="domain" type="text" disabled readonly id="domain_set" value="" placeholder="Domain, e.g. your-site.org">
 
  <select name="https">
  <option value="http://">Use secure connection ? http or https</option>
  <option value="http://">http://</option>
  <option value="https://">https://</option>
  </select>
  
  <br/>
  <h2>Administrator Account</h2>
  
  <input name="sysop_email" type="text" value="" placeholder="Email">
  <input name="sysop_name" type="text" value="" placeholder="Name">
  <input name="sysop_surname" type="text" value="" placeholder="Surname">
  <input name="sysop_pass" type="text" value="" placeholder="Password">
  
  <input class="button install" name="install"  type="submit" value="Install">
  </center>
</form>
 



</body>
</html>
<?php
  
}

 
  
 function fconf($host,$user,$db,$pass,$https,$domain,$p_code){
	 global $version;
	 
  /* Fconf.php */
  $fconf_file = '../inc/fconf.php';

$fconfHandle = fopen($fconf_file, 'w');
$is_https_on = $https == 'https://' ? 'true' : 'false';

 

$written =  <<<"FILE_CONTENTS"
<?php

/*

Kontackt License Agreement (DMCA License)

Copyright (c) 2015, Alex Dobrovolscki (dobriisasa@gmail.com)
All rights reserved.

* Redistributions of source code is strictly forbidden.

* By using Kontackt you may have your own purchase copy, if you are not own a license, you can buy one from https://codecanyon.net/user/dobrovolscki/portfolio.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*/



// SQL connection
define('DBHOST', '{$host}'); # MySQL host
define('DBUSER', '{$user}'); # MySQL user
define('DBPASS', '{$pass}'); # MySQL password
define('DBNAME', '{$db}'); # MySQL database name


define('_VERSION', '{$version}');
define('_LICENSE_KEY', '{$p_code}');
define('_INSTALLED', true);

// use https or http (secure connection)
define('HTTPS_ON', $is_https_on);

// default theme
define('_THEME', 'original'); 

define('IS_HTTPS', '{$https}');

// HOST
define('_HOST', IS_HTTPS.'{$domain}'); // your domain name without http://

FILE_CONTENTS;

fwrite($fconfHandle,$written);

fclose($fconfHandle);
  
  return true;
	 
 }
 
function deleteDir($dirPath) {
    if (! is_dir($dirPath)) {
        throw new InvalidArgumentException("$dirPath must be a directory");
    }
    if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
        $dirPath .= '/';
    }
    $files = glob($dirPath . '*', GLOB_MARK);
    foreach ($files as $file) {
        if (is_dir($file)) {
            deleteDir($file);
        } else {
            unlink($file);
        }
    }
    rmdir($dirPath);
}





// generate random string
 function generateRandomString($length = 10) {
    /*$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;*/
	
	return substr(str_shuffle(str_repeat($x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length/strlen($x)) )),1,$length);

}
 function mksecret($len = 20) {
    $ret = "";
    for ($i = 0; $i < $len; $i++)
        $ret .= chr(rand(0,25)+65);
    return $ret;
}

?>
                      
                                       
Поделись этим текстом, скопируй эту ссылку и отправь друзьям
RAW Paste Data
Последние Тексты