real quick...off the top of my head. I would create a database with URL columns, a submit date, and auto-incrementing ids.
On the page load I would check for $_GET['id'].
if I didn't get one I'd just shoot this at the database:
$sql = "SELECT id, url FROM photos ORDER BY submitdate DESC LIMIT 1";
to get the next link, I would send a query something like:
$sql = "SELECT id FROM photos WHERE id < $theidwegotabove
ORDER BY submitdate DESC LIMIT 1";
That id would be set as my GET id value.
The following might get the previous link GET id:
$sql = "SELECT id FROM photos WHERE id > $theidwegotabove
ORDER BY submitdate LIMIT 1";
Hope this helps you to conceptualize. It's not tested.