View file include/ielades/ieladet.php

File size: 3.18Kb
<?php

$title = $tlapa.': ielādes';
$sakt = microtime(1);
$id = idsid($sid);
$info1 = infoid($id);

////////////////////////////iegūstam vajadzīgo informāciju

$mape = trim($_GET['kur']);
$mape = str_replace('.', '', $mape);
$mape = str_replace('\\', '', $mape);
$mape = str_replace('/', '', $mape);
$mape = str_replace('$', '', $mape);
$mape = htmlspecialchars($mape, ENT_QUOTES);

$fails = trim($_GET['nos']);
$fails = str_replace('\\', '', $fails);
$fails = str_replace('/', '', $fails);
$fails = str_replace('$', '', $fails);
$fails = htmlspecialchars($fails, ENT_QUOTES);

if (file_exists('ielades/'.$mape.'/'.$fails)!=false)
{
	$finfo = faila_info($mape, $fails);
	$url = pathinfo(getenv('SCRIPT_NAME'));
	$parbaude = pathinfo($fails);
}

///////////////////////////////////////////ielādējam failu

if (isset($_GET['ieladet']) && isset($finfo))
{
	mysql_query("UPDATE ielades_faili SET ieladets = ieladets + 1 , pedeja_ielade = '".time()."' WHERE fails = '".$fails."'");
	
	if (mysql_affected_rows()==0)
	{
		mysql_query("INSERT INTO ielades_faili SET fails='".$fails."' , mape='".$mape."' , ieladets = '1' , pedeja_ielade = '".time()."'");
	}
	
	header('Location: ielades/'.$mape.'/'.$fails);
	
	exit();
}

//////////////////////////////////////////////////////////

require_once('include/augsa.php');
		
echo '<div class="sani" style="text-align: center">';
echo '<font class="ramis">-Ielādes-</font>';
echo '</div>';
echo '<div class="vidus" style="text-align: left">';

if (isset($finfo))
{
	if (strtolower($parbaude['extension'])=='jpeg' || strtolower($parbaude['extension'])=='jpg' 
	|| strtolower($parbaude['extension'])=='gif' || strtolower($parbaude['extension'])=='png')
	{
		
		$izmeri = @getimagesize('ielades/'.$mape.'/'.$fails);
	
		echo '<img src="./?kas=samazinat&amp;kur='.$mape.'&amp;nos='.$fails.'&amp;sid='.$sid.'" alt="paraugs"/>';
		echo '<hr></hr>';
		echo 'Izmēri: <b>'.$izmeri[0].'</b>x<b>'.$izmeri[1].'</b><br/>';
	}
	
	echo 'Nosaukums: <b>'.$finfo['nosaukums'].'</b><br/>';
	echo 'Formāts: <b>'.$finfo['formats'].'</b><br/>';
	echo 'Svars: '.$finfo['svars'].'<br/>';
	
	if (!empty($finfo['apraksts']))
	{
		echo 'Apraksts: <small><b>'.skatit($finfo['apraksts'], $info1['smaidi']).'</b></small><br/>';
	}
	
	echo 'Ielādēts: <b>'.$finfo['ieladets'].'</b><br/>';
	
	if ($finfo['pedeja_ielade']>0)
	{
		echo '<small>Pēdējā ielāde: <b>'.date("H:i d-m-y", $finfo['pedeja_ielade']).'</b></small><br/>';
	}
	
	echo '&#8226; <a href="./?kas=fails&amp;kur='.$mape.'&amp;nos='.$fails.'&amp;sid='.$sid.'&amp;ieladet">Lejuplādēt</a><br/>';
	echo '<br/><input type="text" name="ieladet" value="http://'.getenv('HTTP_HOST').$url['dirname'].'/ielades/'.$mape.'/'.$fails.'" size="12"/>';
}
else
{
	echo '<b>Šāds fails neeksistē!</b>';
	echo '<hr></hr>';
}

echo '</div>';
echo '<div class="vidus" style="text-align: left">';

if (isset($url))
{
	echo '&#8226; <a href="./?kas=faili&amp;kur='.$mape.'&amp;sid='.$sid.'">'.mapes_nosaukums($mape).'</a> ';
}

echo '&#8226; <a href="./?kas=ielades&amp;sid='.$sid.'">Ielādes</a><br/>';
echo '&#8226; <a href="./?kas=&amp;sid='.$sid.'">Galvenā</a>';
echo '</div>';

?>