<?php
session_start();
include("header.php");
if (!isset($_SESSION['logueado_usuario'])) {
include ("login.php");
}
else {
$nombre =$_SESSION['logueado_nombre'];
$id_usuario=$_SESSION['logueado_id'];
$obejeto=$_REQUEST['objeto'];
}
if(!empty($_SESSION['logueado_nombre']))
{
include("privados/config.php");
$id=$_GET['id'];
if($_POST)
{
set_time_limit(0);
/*header("Edge-control: no-store");*/
sleep(0);
include('config.php');
$notificaciones=mysql_query("select * from comentario where id_foto='$id'",$conexion);
while($rs=mysql_fetch_assoc($notificaciones))
{?><div id="cacao"><?php $coment_foto=utf8_decode($rs['comentario']);
echo $coment_foto."<br>";
?></div><?php }
//echo $rs['id_logueado']."<br>";
mysql_close($conexion);
exit();
}
$resultados=mysql_query("select * from imagenes where id='$id' and id_logueado='1'",$conexion) or
die("Problemas en el select:".mysql_error());
$a = mysql_query("select max(id) from imagenes where id <".$id. " and id_logueado='1'");
$ida = mysql_result($a,0);
mysql_free_result($a);
$b = mysql_query("select min(id) from imagenes where id >".$id. " and id_logueado='1'");
$idb = mysql_result($b,0);
mysql_free_result($b);
$a1 = mysql_query("select max(id) from imagenes where id_logueado='1'");
$ida1 = mysql_result($a1,0);
mysql_free_result($a1);
$b1 = mysql_query("select min(id) from imagenes where id_logueado='1'");
$idb1 = mysql_result($b1,0);
mysql_free_result($b1);
?><div align="center"><div align="right" id="pasar"><a href="galeria.php?id=<?php echo $id; ?>" >Volver</a></div>
<?php
/*$fotos=mysql_query("select * from imagenes where id='$id'",$conexion);
while($fot=mysql_fetch_array($fotos))
{
echo '<img src="'.$fot['nombre'].'"';
}*/
?>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js'></script>
<script src='js/jquery.autosize.js'></script>
<script>
$(function(){
$('textarea').autosize();
});
</script>
<script language="JavaScript" type="text/javascript" src="ajax.js"></script>
<script language="JavaScript">
function nuevoAjax(){
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
function presionado(e)
{
if (window.event) //es ie?
{
divResultado = document.getElementById('resultado');
var foto = "<?php echo $id; ?>" ;
ajax=nuevoAjax();
ajax.open("GET","etiquetar.php?x="+window.event.clientX+"&y="+window.event.clientY+"&id="+foto,true);
ajax.onreadystatechange=function(){
if(ajax.readyState==4){
alert("Se ha etiquetado con exito.");
}
}
ajax.setRequestHeader("Conten-Type","application/x-www-form-urlencoded");
ajax.send("x="+window.event.clientX+"&y="+window.event.clientY)
}
else
{
var x1=e.clientX;
var y1=e.clientY;
divResultado = document.getElementById('resultado');
ajax=nuevoAjax();
ajax.open("GET","etiquetar.php?x="+e.clientX+"&y="+e.clientY,true);
ajax.onreadystatechange=function(){
if(ajax.readyState==4){
divResultado.innerHTML = ajax.responseText
}
}
ajax.setRequestHeader("Conten-Type","application/x-www-form-urlencoded");
ajax.send("x="+e.clientX+"&y="+e.clientY)
}
}
</script>
<html>
<head>
</head>
<body>
<script type="text/javascript" src="js/comet.js"></script>
<style type="text/css">
#cacao{background-color: #EEEFF0;
padding: 5px;
width: 500px;
margin: auto;
border-top:2px double #91969B ;
border-left:2px double #91969B ;
border-right:2px double #91969B ;
border-bottom:2px double #91969B ;
}
div.mapa_imagen {
position:static;
}
ul.notas li {
list-style: none;
display: none;
position: absolute;
/* border: medium solid white;*/
background: url("esta_imagen_no_existe");
}
div.mapa_imagen:hover ul.notas li {
display: block;
}
ul.notas li p {
margin: 10px 0 0 0;
padding: .3em;
display: none;
background: #FFF;
/*opacity: 0.65;*/
position: absolute;
top: 100%;
}
ul.notas li:hover p {
display: block;
}
</style> <?php
$con=mysql_query("select * from etiqueta where id_foto='$id'",$conexion);
$i=1;
echo '<div class="mapa_imagen">';
while($ima=mysql_fetch_array($con))
{
?><style>ul.notas li#nota<?php echo $i; ?> {
width: 100px; height: 100px; top: <?php echo $ima['y']."px"?>; left: <?php echo $ima['x']."px"?>;
}</style><?php
$consulta=mysql_query("select * from usuarios where id='$ima[id_logueado]'",$conexion);
while($cons=mysql_fetch_array($consulta))
{
echo '<ul class="notas">';
echo '<li id="nota'.$i.'"><p>'.$cons['nombre'].'</p></li>';
echo '</ul>';
}$i++;
}
$comentarios=mysql_query("select * from comentario where id_foto='$id'",$conexion);
while($comen=mysql_fetch_array($comentarios))
{
$comentario=utf8_decode($comen['comentario']);
}
while($fot=mysql_fetch_assoc($resultados))
{
$foto_nombre=$fot['nombre'];
$titulo=$fot['titulo'];
$fecha=$fot['fecha'];
if(isset($idb) && !empty($idb))
{
echo '<img src="'.$foto_nombre.'" onclick="presionado(event);" "usemap="#Map" style="z-index:0">';
echo '<br>';
/*echo $comentario;*/
}
else
{
echo '<img src="'.$foto_nombre.'" onclick="presionado(event);" usemap="#Map" style="z-index:0">';
echo '<br>';
/*echo $comentario;*/
}
}
echo "<br>";
?><div align="right" id="pasar" style="margin-top:-48%; position:relative"><?php echo $titulo."<br>"; echo $fecha; ?></div><?php
?>
<script type="text/javascript">
function sapeartextarea(){
var nav=(document.all)?"%0D":"%0A"
var ref=document.getElementById("textarea")
textoarea=escape(ref.value)
lineas=textoarea.split(nav)
lin=lineas.length
if(lin>4){
ref.rows=lin
document.getElementById("clin").innerHTML=lin
}
}
document.onkeyup = function(){sapeartextarea()}
</script>
<div id="respuesta"></div><?php }?>
</body>
</html>
<br /></div>
</body>
</html>