Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/old_sites/appo/galerie_view.php

(Deskargatu)
<html>
<head>
<title>View of file</title>
<style type="text/css">
input,textarea { border:1px solid black;  background-color:#eee;}
input.button { border:1px outset black; }



body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
color: #333333;
}

div.gris { background-color:#f5f5f5; padding:10px;}
div.noir { background-color:#d5d5d5; padding:10px;}

body {
	margin-left: 15px;
	margin-top: 15px;
        margin-right: 15px;
	margin-bottom: 15px;
}
	a:link {
	color: #000000;
	text-decoration: none;
}
	a:visited {
	text-decoration: none;
	color: #999999;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}													}
													-->

</style>

</head>


<body>
<center>
<table width="500" cellspadding="0" cellspacing="0">
<?
if (empty($_GET['cat']) or empty($_GET['file'])) { die; }
$cat = preg_replace("[^a-zA-Z]","",$_GET['cat']);
$file = preg_replace("[^a-zA-Z]","",$_GET['file']);
if (! file_exists("galerie/maxi/$cat/$file")) { die("Fichier inexistant"); }

include("connect.php");
include("admin/func.php");
echo "<h4>Image $file</h4>
<div class=\"com\">
\n";
$nom = preg_replace("/\..{3}/",".txt",$file);
echo "<img style=\"border:1px solid black; padding:1px\" width=\"500\" src=\"galerie/maxi/$cat/$file\" alt=\"image en grand\"></div>";


echo "<h4 align\"left\">Commentaires</h4>";

if (! empty($_POST['pseudo']) and ! empty($_POST['contenu'])) {
    $pseudo = htmlentities($_POST['pseudo']);
    $site = htmlentities($_POST['site']);    
    $contenu = text2html($_POST['contenu']);    
    
    $query  = "INSERT INTO galerie (section,fichier,pseudo,site,contenu) VALUES
	('".$cat."','".$file."','".$pseudo."','".$site."','".$contenu."')";
    echo $query;
    mysql_query($query) or die(mysql_error());
}	




$query = "SELECT * FROM galerie WHERE section='$cat' and fichier='$file' ORDER BY id DESC";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) == 0) { echo "<tr><td align=\"left\">Aucun commentaire &agrave; ce jour</td></tr>"; }
else {
    $i=1;
    while($row = mysql_fetch_assoc($result))
    {
	$i++;
	if ($i % 2 == 0) { $class = "gris"; } else { $class = "noir"; }
	ereg("([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})",$row{'date'},$regs);
	echo "
	<tr><td align=\"left\">
	<div class=\"$class\">
	Par <strong><a href=\"".$row{'site'}."\">".$row{'pseudo'}."</a></strong>, le ".$regs[3]."/".$regs[2]."/".$regs[1]." &agrave; ".$regs[4].":".$regs[5].":".$regs[6]."<br>";
        $contenu = explode("\n",$row{'contenu'});
        foreach($contenu as $key) { print "$key<br>\n"; }
        echo "</div></td></tr>";

    }  
    }
echo "</div>";    
if (empty($_POST['pseudo']) or empty($_POST['contenu']))
{
    echo "
    <tr>
    <td align=\"left\">
    <form action=\"galerie_view.php?cat=$cat&amp;file=$file\" method=\"post\">
    <dl>
    <dt>Pseudo</dt><dd><input type=\"text\" name=\"pseudo\" value=\"".$_POST['pseudo']."\"></dd>
    <dt>Site</dt><dd><input type=\"text\" name=\"site\" value=\"".$_POST['site']."\"></dd>    
    <dt>Contenu</dt><dd><textarea rows=\"5\" cols=\"25\" name=\"contenu\"></textarea></dd>
    <dt></dt><dd><input class=\"button\" type=\"submit\" value=\"Envoyer\"></dd>
    </dl>
    </form>
    </td></tr>

    ";
}



?>
</table>
</center>
</body>
</html>