0){ if( $_SESSION['pref'] == 1){ // straight if( $_SESSION['sex'] == 1){ // male $defsex = 2; $defpref = 1; }elseif($_SESSION['sex'] == 2){ // female $defsex = 1; $defpref = 1; }else{ } } if( $_SESSION['pref'] == 2){ // gay if( $_SESSION['sex'] == 1){ // male $defsex = 1; $defpref = 2; }elseif($_SESSION['sex'] == 2){ // female $defsex = 2; $defpref = 2; }else{ } } if( $_SESSION['pref'] == 3){ // bi } if( $_SESSION['pref'] == 4){ // bi-curious } } // make it work for get also if( isset($_GET['sex'])){ $_POST['sex'] = $_GET['sex']; }else{ } if( isset($_GET['pref'])){ $_POST['pref'] = $_GET['pref']; }else{ } if( isset($_GET['status'])){ $_POST['status'] = $_GET['status']; }else{ } if( isset($_GET['minage'])){ $_POST['minage'] = $_GET['minage']; }else{ } if( isset($_GET['maxage'])){ $_POST['maxage'] = $_GET['maxage']; }else{ } if( isset($_GET['withphotos'])){ $_POST['withphotos'] = $_GET['withphotos']; }else{ } if( isset($_GET['sortby'])){ $_POST['sortby'] = $_GET['sortby']; }else{ } // set our vars if( isset($_POST['sex'])){ $_POST['sex']=intval($_POST['sex']);}else{ $_POST['sex'] = $defsex; } if( isset($_POST['pref'])){$_POST['pref']=intval($_POST['pref']); }else{ $_POST['pref'] = $defpref; } if( isset($_POST['status'])){$_POST['status']=intval($_POST['status']); }else{ $_POST['status'] = 0; } if( isset($_POST['minage'])){$_POST['minage']=intval($_POST['minage']); }else{ $_POST['minage'] = 18; } if( isset($_POST['maxage'])){$_POST['maxage']=intval($_POST['maxage']); }else{ $_POST['maxage'] = 99; } if( isset($_POST['withphotos'])){$_POST['withphotos']=intval($_POST['withphotos']); }else{ $_POST['withphotos'] = 0; } if( (string) $_POST['withphotos'] == "on" || $_POST['withphotos'] == 1){ $_POST['withphotos'] = 1; }else{ $_POST['withphotos'] = 0; } if( isset($_POST['sortby'])){$_POST['sortby']=intval($_POST['sortby']); }else{ $_POST['sortby'] = 0; } if( $_POST['sex'] <> 0){ $sexquery = " sex=".intval($_POST['sex'])." "; }else{ $sexquery = " 1=1 "; } if( $_POST['pref'] <> 0){ $prefquery = " pref=".intval($_POST['pref'])." "; }else{ $prefquery = " 1=1 "; } if( $_POST['status'] <> 0){ $statusquery = " status=".intval($_POST['status'])." "; }else{ $statusquery = " 1=1 "; } if( $_POST['withphotos'] == 1){ $photoquery = " defphoto <> 0 "; }else{ $photoquery = " 1=1 "; } $minagedate = date('Y-m-d H:i:s', strtotime('-'.$_POST['minage'].' years')); $maxagedate = date('Y-m-d H:i:s', strtotime('-'.($_POST['maxage'] + 1).' years')); $agequery = " dob < \"$minagedate\" and dob > \"$maxagedate\" "; // print $agequery; $sortcol = "accountid"; if( $_POST['sortby'] == 1){ $sortcol = "lastlogin"; } if( $_POST['sortby'] == 2){ $sortcol = "reputation"; } if( isset($_GET['page'])){ $page = $_GET['page']; }else{ $page = 1; }; $start = 1 + (($page - 1) * 50); $end = $start + 49; $skip = ($page - 1)* 50; $query = "select count(*) from (select 1 from photos p, accounts a where p.accountid=a.accountid and $sexquery and $prefquery and $statusquery and $photoquery and $agequery and accountstatus = 1 limit 1001) t;"; if( $_SESSION['accountlevel'] > 80){ // print $query; } $bcresults = mysqli_query($link, $query); $getcount = mysqli_fetch_row($bcresults); $numresults = $getcount[0]; if( $numresults > 1000){ $numresults = 1000; } // $query = "select a.*, p.* from accounts a, photos p where p.accountid=a.accountid and $sexquery and $prefquery and $statusquery and $photoquery and $agequery and accountstatus = 1 order by p.photoid desc limit $skip, 30;"; // use query that allows for album privacy $query = "select a.*, p.* from photos p left join accounts a on p.accountid=a.accountid left join albums l on p.albumid=l.albumid where $sexquery and $prefquery and $statusquery and $photoquery and $agequery and accountstatus = 1 and (l.isprivate=0 or p.albumid=0) order by p.photoid desc limit $skip, 30;"; if( $_SESSION['accountlevel'] > 80){ // print $query; } $photoresults = mysqli_query($link, $query); // $query = "select * from accounts where $sexquery and $prefquery and $statusquery and $photoquery and $agequery and accountstatus = 1 order by $sortcol desc limit $skip, 30;"; // print $query; if( $numresults < $end){ $end = $numresults; } // build pagination $pagelink = "search_photos.html?sex=" . $_POST['sex'] . "&pref=" . $_POST['pref'] . "&status=" . $_POST['status'] . "&minage=" . $_POST['minage'] . "&maxage=" . $_POST['maxage'] . "&withphotos=" . $_POST['withphotos'] . "&sortby=" . $_POST['sortby']; $pagination = nw_buildPagination($numresults, $start, $end, 50, $page, $pagelink, "Photos "); ?> - Photo Browse
Basic Search

to













Your Search Results


0){ if( mysqli_num_rows($photoresults) > 0){ while($browseinfo = mysqli_fetch_assoc($photoresults)){ $count++; $thisphotodir = getphotodir($browseinfo['username']); $thissex = $browseinfo['sex']; $thisage = getuserage($browseinfo['dob']); print "
\n"; print ""; print ""; // print "
"; // print ""; // print $browseinfo['username'] . "\n"; // print "
" . $thisage . " / " . $shortsex[$thissex]; print "
\n"; /* print "
"; print "
".$browseinfo['username']."
"; print "
" . $thisage . " / " . $shortsex[$thissex]; print "
"; */ } }else{ print "
No results match your search. Please broaden your search criteria.
"; } }else{ print "

Sorry, in order to see more than the first 50 results you must be logged in.
"; } ?>
"; echo "overall_time = $overall_time seconds
\n"; echo ""; } ?>