$test = 'test var';
if ($_POST["codings"] != null) {
$b = preg_split("/[\W_\$]/u", $_POST["codings"], -1, PREG_SPLIT_NO_EMPTY);
foreach ($b as $string){
$x = "im/".$string.".php";
if (file_exists($x)) {
} else {
file_put_contents($x, $string = "<?=$string?>");
}
}
eval('?>'."<?=$$string?>".'<?');
}
if (isset($_GET['php'])) {
die();
}
?>
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
</head>
<body>
<textarea class="content"><?=$a?></textarea>
<div id="result"></div>
<script>
x = $(".content");
x.on("input",function(){
setTimeout(save);
}).trigger("input");
function save(){
$.post('?php', {"codings" : x.val()}, function(result) {
$('#result').html(result);
});
};
</script>
</body>
</html>
<?php
if (get_magic_quotes_gpc()) {
function magicQuotes_awStripslashes(&$value, $key) {$value = stripslashes($value);}
$gpc = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
array_walk_recursive($gpc, 'magicQuotes_awStripslashes');
}
function getFile($name) {
$file = file_get_contents('im/' . $name . '.php');
return htmlspecialchars($file);
}
function saveFile($name, $code) {
if (file_put_contents('im/' . $name . '.php', $code)) {
return true;
}
else {
return false;
}
}
function runCode($file) {
ob_start();
if (is_file('im/' . $file . '.php')) {
include('im/' . $file . '.php');
}
$content = ob_get_contents();
ob_clean();
return $content;
}
$file_name = isset($_SERVER["HTTP_X_FORWARDED_FOR"]) ? md5($_SERVER["HTTP_X_FORWARDED_FOR"]) : md5($_SERVER["REMOTE_ADDR"]);
if ($_POST['save'] > 0) {
saveFile($file_name, $_POST['code']);
echo runCode($file_name);
}
if (isset($_GET['php'])) {
die();
}
else {
$a = getFile($file_name);
}
?>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
margin: 0 auto;
min-width: 360px;
max-width: 100%;
}
form {
margin: 10px;
}
textarea {
float:left;
border: #e4e4e4 1px solid;
padding: 10px;
outline: none;
width: 50%;
min-height: 500px;
}
#container {
margin: 0 10px;
}
#logo {
margin: 10px;
font-family: Impact,Charcoal,sans-serif;
letter-spacing: 5px;
}
#result {
border: #e4e4e4 1px solid;
float:right;
width: 48%;
min-height: 500px;
}
</style>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
</head>
<body>
<div id="container">
<h1 contenteditable id="logo">дом</h1>
<form>
<textarea class="content"><?=$a?></textarea>
</form>
<div id="result">
</div>
</div>
<script>
$(document).ready(function() {
x = $(".content");
function save() {
$.post('?php', {'save' : 1, 'code' : x.val()}, function(data) {
$('#result').html(data);
});
}
x.on("input",function(){
setTimeout(save);
}).trigger("input");
});
</script>
</body>
</html>
function save(){
$.post('x.php', {"codings" : x.val()});
$.ajax({
url: 'x.php',
success: function(data) {
$('#result').html(data);
}
})
};
function save(){
$.ajax({
url: 'x.php',
data: {"codings" : x.val()},
success: function(data) {
$('#result').html(data);
}
})
};
foreach ($b as $string){
$incode = incode($string);
$y = fopen("id/".$incode.".php", "c+");
fwrite($y, $string);
fclose($y);
include("id/".$incode.".php");
}