';
echo'
';
echo'';
echo '';
//echo 'Picture ';
echo $currentphoto;
echo ' of ';
echo $counter;
echo ' in ';
echo '';
echo $picturecountry;
echo ' | ';
echo '';
echo $row[3];
echo ' | ';
echo '';
echo ' | ';
echo '';
if($prev>0)
{
echo '';
echo 'Previous ';
echo '';
}
if ($next>0)
{
echo '';
echo 'Next ';
echo '';
}
echo ' | ';
echo '
';
echo '';
echo '';
//display picture from query
if ($next>0)
{
echo '';
echo '';
}
else if ($next<=0)
{
echo '';
}
echo ' ';
echo ' | ';
echo '
';
echo '
';
$timestamp = $row[2];
$RFC_formatted = date('r', strtotime($timestamp));
$withouttime= substr_replace($RFC_formatted,"",-14);
$views=$row[9]+1;
//echo $views;
$sql40='UPDATE photos SET views=';
$sql41=' WHERE photo_id=';
$update_views_query=$sql40.$views.$sql41.$photo_id;
//echo $update_views_query;
mysqli_query($conn,$update_views_query);
echo '';
echo ' ';
echo ' ';
echo'
';
echo'';
echo '';
echo $withouttime;
echo ' | ';
echo '';
echo $row[8];
echo ' | ';
echo ' | ';
echo '';
//echo 'Views: ';
//echo $views;
echo ' |
';
displaycomments($photo_id,$conn);
if($next>0)
{
echo'
';
}
if ($prev>0)
{
echo'
';
}
//echo 'Photo id is: ';
//echo $photo_id;
$submitted=$_GET['submit'];
function submitform($submitvalue,$pictureid)
{
echo'
';
}
switch($submitted)
{
//perform this when the form hasn't been submitted yet
case 1:
submitform(2,$photo_id);
break;
case 2:
//echo'case 2 executed';
$username=$_POST["username"];
$comment=$_POST["comment"];
$skill=$_POST["skill"];
$photoid=$_GET['pid'];
//$pageid=1;
if($username=="")
{
echo 'Comment was not submitted: Please enter a name';
submitform(2,$photo_id);
break;
}
if($skill<>4)
{
echo 'Comment was not submitted: Please enter 4 for the 2+2 answer';
submitform(2,$photo_id);
break;
}
if($comment=="")
{
echo 'Comment was not submitted: Please enter a comment';
submitform(2,$photo_id);
break;
}
include 'php/databaseconnect.php';
$result400 = mysqli_query($conn, "SELECT MAX(comment_id) FROM comment");
$row400 = mysqli_fetch_array($result400);
//echo $row400[0];
//echo 'test end';
$commentid=$row400[0]+1;
//echo $commentid;
$current__date=date("Y-m-d");
$display=0;
$sql220="INSERT INTO comment VALUES "."('$photoid','$username','$comment','$current__date','$display',$commentid)";
//echo $sql220;
if (mysqli_query($conn, $sql220)) {
echo "";
} else {
echo "Error: " . $sql . "
" . mysqli_error($conn);
}
mysqli_close($conn);
echo 'Your comment has been submitted. Thank you!';
break;
}
echo '