Maybe you should add a new column that holds either 0 or 1, for letting the script know if that member has already been shown once already?
Some pseudo code to help you along (the extra column that I suggest will be named
chosen here):
Code:
search for a random member in table tbl_name
if member has 1 in chosen column, then skip and choose another member
if member has 0 in chosen column, then continue on with that member
For the photo part, just simply check the proper table to see if the member has uploaded a photo or not, shouldn't be that difficult (P.S. I have never used the Member photo hack).