Файл: myCode/createfile/createcontent.php
Строк: 135
<?php
session_start();
require_once('../Login.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Create</title>
<link rel="stylesheet" type="text/css" href="../css/style.css" />
<script type="text/javascript" src="../js/jquery.js"></script>
<script language="javascript">
function getURLParam(strParamName){
var strReturn = "";
var strHref = window.location.href;
if ( strHref.indexOf("?") > -1 ){
var strQueryString = strHref.substr(strHref.indexOf("?"));
var aQueryString = strQueryString.split("&");
for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
var aParam = aQueryString[iParam].split("=");
strReturn = aParam[1];
break;
}
}
}
return strReturn;
}
$(document).ready(function() {
$(".notify").click(function(e) {
// we want to store the values from the form input box, then send via ajax below
var content = $('#content').attr('value');
$.ajax({
type: "POST",
url: "createfile.php?folder="+getURLParam('folder')+"&filename="+getURLParam('filename'),
data: "content="+ content,
success: function(){
e.preventDefault();
$("#notification").animate({top: 0}, 300, null);
//for css positioning prblem
$("#notification").css("position", "fixed");
//Hide the bar
$notifyTimer = setTimeout(function () {
$("#notification").animate({top: -100}, 1000, function() {
//change back to absolute
$("#notification").css("position", "absolute");
});
}, 2000);
}
});
return false;
});
$(".nav").click(function(){
$("ul").toggle();
});
$(document).click(function() {
$("ul").hide();
});
$(".nav").click(function(e) {
e.stopPropagation();
return false;
});
});
</script>
</head>
<body>
<div id="navcontainer">
<div class="nav">Menu ⇓</div>
<ul class="navpanel top">
<a href='create.php'><li class="first">Create File</li></a>
<a href='createdir.php'><li>Create Folder</li></a>
<a href='upload.php'><li>Upload File</li></a>
<a href='uploadzip.php'><li>Upload ZIP</li></a>
<a href='Logout.php'><li class="last">Logout</li></a>
</ul>
</div>
<div id='notification'>Created</div>
<div id="container">
<h2>Create</h2>
<form class='edit' action='' method='post'>
<textarea id='content' name='content' cols='118' rows='20'>
<?php
$filetype = $_GET['filetype'];
if ($filetype=="HTML")
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>';
elseif ($filetype=="CSS")
echo '@charset "utf-8";
/* CSS Document */';
elseif ($filetype=="PHP")
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>';
elseif ($filetype=="Javascript")
echo '// JavaScript Document';
elseif ($filetype=="Other")
echo "";
?>
</textarea>
<input type='submit' class='notify' name='Submit' value='Create'>
</form>
<a class='return' href='../<?php echo $_GET['location'] ?>'>← Back to file list</a>
</div>
</body>
</html>