Viewing file: zoom.php (1.79 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<style type="text/css">
html,
body {
background-color: transparent;
}
</style>
<?php
@session_start();
print('<center><img src='.$_GET[image].'><br>');
if(empty($_SESSION[admin])){
if(file_exists($_GET['image'] . '.txt')){
print('<b>');
include($_GET[image].'.txt');}
}else{
print('<form action="" method=post>
<textarea name=comment cols=80 rows=10>');
if(file_exists($_GET['image'] . '.txt')){
include($_GET[image].'.txt');}
print('</textarea><br><input type=submit value=Ment>
<input type=button onclick=hax() value=Törlés>
</form>
<script>
function hax(){
var answer = confirm("Biztosan letörlöd?")
if (answer){
window.location = "zoom.php?del='.$_GET['image'].'";
}}
</script>
');
}
if(isset($_POST[comment]) && !empty($_SESSION[admin])){
$fp = fopen($_GET[image].'.txt', 'w');
fwrite($fp, $_POST[comment]);
fclose($fp);
}
if(isset($_GET[del]) && !empty($_SESSION[admin])){
unlink($_GET[del]);
if(file_exists($_GET['del'] . '.txt')){unlink($_GET[del].'.txt');}
$today = date("Y. m. d. G:i:s");
$ip = gethostbyaddr($_SERVER[REMOTE_ADDR]);
$somecontent = "[FILEDEL: ".$_GET[del]."][ MIKOR: ".$today." ][ IP: ".$ip." ] \n";
$filename = 'log.txt';
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
fclose($handle);
}
}
?>
|