<?php
require_once '../../library/config.php';
require_once '../library/functions.php';
require_once '../library/logged.php';
require_once '../../library/validation.php';



if($_POST['photo_id']){
	
	$photo_id = isNumber(trim($_POST['photo_id']));
	
	$sql = mysql_query("select * from photo WHERE photo_id =$photo_id");
	$row =  mysql_fetch_assoc($sql);
	if ($row){
		do {
			echo '<textarea style="width:200px; float:left" rows="15" id="'.$photo_id.'" class="input_desc">'.$row['desc'].'</textarea>';
		} while ($row =  mysql_fetch_assoc($sql));
	} else {
		echo '<textarea style="width:200px; float:left" rows="15" id="'.$photo_id.'" class="input_desc"></textarea>';
	}

}

if($_POST['value']){
	$value = htmlPurify($_POST['value']);
	$photo_id = isNumber(trim($_POST['photo_id']));
	mysql_query("UPDATE `photo` SET `desc` = '$value' WHERE `photo_id` = '$photo_id'", $connePaper);
?>
<b style="color:red;" id="this_info">更新成功!!</b>
<?php 
}

mysql_close($connePaper);
?>
