populate($_SESSION['dude']); $logged_user->update_timestamp($_SESSION['dude']); $logged_user->unread_mail($_SESSION['dude']); // echo "first: logged in as $logged_user->name"; if ($logged_user->country_code == "XX") { $block = "apple"; setcookie("orange", $block, time()+(84600*30), "/"); } if (session_name()=='') { session_start(); } $_SESSION['dude'] = $_COOKIE['username']; $_SESSION['person_object'] = $logged_user; $logged_user->populate($_SESSION['dude']); $_SESSION['location'] = $logged_user->location; $random_check = rand(0, 10); $_SESSION['unread_mail'] = $logged_user->unread_count; } ////////// // // If session is not set, check cookie. If cookie username and password are valid. Set user as logged in. // //////////////// if ($_SESSION['auth'] != 1) { if ( (isset($_COOKIE['username'])) && (isset($_COOKIE['pass'])) ) { $logged_user = new Person; $logged_user->populate($_COOKIE['username']); $his_id = $logged_user->id; $gclid = $logged_user->gclid; $actual_password = SHA1($logged_user->password); if (( $actual_password == $_COOKIE['pass'] ) || ($logged_user->password == $_COOKIE['pass'])) { //echo "second: logged in"; setcookie("username", $_COOKIE['username'], time()+(84600*30), "/"); setcookie("pass", $_COOKIE['pass'], time()+(84600*30), "/"); setcookie("cookie_data", $logged_user->password, time()+(84600*30), "/"); session_start(); $_SESSION['auth'] = 1; $_SESSION['location'] = $logged_user->location; $logged_user->unread_mail($logged_user->name); if ($logged_user->email_verified == NULL) { $_SESSION['auth'] = 2; } $dude = $_COOKIE['username']; $logged_user->unread_mail($_COOKIE['username']); $timestamp = time(); $session_id = session_id(); if (!isset($_SESSION['updated'])) { $_SESSION['updated'] = 1; $logged_user->update_timestamp($logged_user->name); } $_SESSION['dude'] = $_COOKIE['username']; $_SESSION['id'] = $his_id; if (!empty($gclid)) { $_SESSION['gclid'] = $gclid; $logged_user->get_keywords($gclid); $key = str_replace(" ","_" , $logged_user->adwordskey); $_SESSION['key'] = $key; $_SESSION['bkey'] = $key; } $logged_user->unread_mail($logged_user->name); $_SESSION['unread_mail'] = $logged_user->unread_count; //echo $logged_user->unread_count; } } } ///////////// // // no cookie is set. // ///////////////// if ( (!isset($_COOKIE['username'])) && (!isset($_COOKIE['pass'])) ) { $_SESSION['dude'] = ""; if (!isset($_SESSION['viewed'])) { $_SESSION['viewed'] = array("1" , "2"); } $visitor = new Visitor; $visitor->variableGrab(); $visitor->logVisitor(); if (empty($_SESSION['key'])) { $_SESSION['key'] = $visitor->codo; } else { $visitor->codo = $_SESSION['key']; // print_r($_SESSION); } $test = $_SESSION['gclid']; // echo $test; // echo "key: $visitor->codo"; } ?> "Dating > Discreet Encounters" , "140" => "Services" , "141" => "Domestic" , "142" => "Commercial" , ); $requesting_array = array( "m4w" => "80" , "w4m" => "81" , "m4m" => "82" , "w4w" => "83" , "f" => "84" ); $city_array = array( "Auckland" => "Auckland" , "Wellington" => "Wellington" , "Hamilton" => "Hamilton" , "Christchuch" => "Christchurch" , "Dunedin" => "Dunedin" , ); $ethnicity_array = array( "0" => "not indicated" , "1" => "Caucasian" , "3" => "Indian" , "2" => "Other South Asian" , "4" => "Chinese" , "5" => "Korean" , "6" => "African" , "7" => "Other" ); $weight_array = array( "0" => "Prefer not to say" , "1" => "Slim" , "2" => "Athletic" , "3" => "Average" , "4" => "Couple of extra lbs" , "5" => "Large" ); $seeking_array = array( "0" => "Not Specified" , "1" => "Short term" , "2" => "Chat / Email" , "3" => "Dating" , "4" => "Discreet Encounter" , "5" => "Other" ); $seeking_arrayde = array( "0" => "Freundschaft" , "1" => "Kurze Zeit" , "2" => "Chatten" , "3" => "Datink" , "4" => "Diwkrete Encounter" , "5" => "Andere" ); $height_array = array( "152" => "5' 0" (152 cm)" , "155" => "5' 1" (155 cm)" , "157" => "5' 2" (157 cm)" , "160" => "5' 3" (160 cm)" , "163" => "5' 4" (163 cm)" , "165" => "5' 5" (165 cm)" , "168" => "5' 6" (168 cm)" , "170" => "5' 7" (170 cm)" , "173" => "5' 8" (173 cm)" , "175" => "5' 9" (175 cm)" , "178" => "5' 10" (178 cm)" , "180" => "5' 11" (180 cm)" , "183" => "6' " (183 cm)" , "185" => "6' 1" (185 cm)" , "188" => "6' 2" (188 cm)" , "191" => "6' 3" (191 cm)" , "193" => "6' 4" (193 cm)" , "196" => "6' 5" (196 cm)" , "198" => "6' 6" (198 cm)" , "201" => "> 6' 6" (200 cm)" , ); $requesting_array = array( "w4m" => "Woman Seeking Men" , "m4w" => "Man Seeking Women" , "m4m" => "Man Seeking Men" , "w4w" => "Woman 4 Women" , "c4c" => "Couple 4 Couples" , "c4w" => "Couple 4 Women" , "c4m" => "Couple 4 Men" , "O" => "Other" ); $requesting_search_array = array( "w4m" => "women seeking men" , "m4w" => "men seeking women" , "m4m" => "men seeking men" , "w4w" => "women seeking women" , "c4c" => "couples seeking couples" , "c4w" => "Couple 4 Women" , "c4m" => "Couple 4 Men" , "O" => "Other" ); $title_requesting_array = array( "w4m" => "Women Seeking Men (w4m)" , "m4w" => "Men Seeking Women (m4w)" , "m4m" => "Men Seeking Men (m4w)" , "w4w" => "Women Seeking Women (w4w)" , "c4c" => "Couples Seeking Couples (c4c)" , "c4w" => "Couples Seeking Women (c4w)" , "c4m" => "Couples Seeking Men (c4m)" , "O" => "Other" ); $religion_array = array( "1" => "Prefer not to say" , "7" => "Non-Religious" , "8" => "Anglican" , "12" => "Baptist" , "10" => "Methodist" , "11" => "Christianity - other" , "13" => "Lutheran" , "14" => "Presbyterian" , "2" => "Islam" , "3" => "Judaism" , "5" => "Buddhism" , "6" => "Hinduism" , "8" => "Anglican" , "9" => "Sikh" , "15" => "Other" ); $marital_array = array( "1" => "Single" , "2" => "In a Relationship" , "3" => "Married" , "4" => "Separated" , "5" => "Divorced" , "6" => "Widowed" , "7" => "Prefer not to say" , "8" => "Other" ); $smoking_array = array( "1" => "Prefer not to say" , "2" => "No" , "3" => "Yes" , "4" => "Socially" ); $drinking_array = array( "1" => "Prefer not to say" , "2" => "No" , "3" => "Yes" , "4" => "Socially" ); ?> gclid)) { $gclid = $visitor->codo; } else { $gclid = "vx_return_zxv" . $name->gclid; } return $gclid; } function new_cityad($name, $visitor) { $use_city = $name->city_name; if (empty($name->gclid)) { $gclid = $visitor->codo; } else { $gclid = "vx_return_zxv" . $name->gclid; } if (empty($name->city_name)) { $use_city = apache_note("GEOIP_CITY"); } echo "

$use_city Girls

" ."

$use_city Guys

"; } function new_searchcityad($city, $name, $visitor) { if (empty($name->gclid)) { $gclid = $visitor->codo; } else { $gclid = "vx_return_zxv" . $name->gclid; } echo "

$city Girls

" ."

$city Guys

"; } function new_flirtclaim($name) { echo "\n

You sent a flirt to $name

"; } function new_registration_lc_top($referer) { $string = reg_pics($referer); $city_name = apache_note("GEOIP_CITY"); echo \"" ."\n
" ."\n" ."\n
" ."\n
\"\"
" ."\n
" ."\n

465,254 members!

" ."\n

1,365 Online NOW!**

" ."\n

2,332 New Photos this Week!

" ."\n" ."\n
" ."\n
\"\"
" ."\n" ."\n
" ."\n" ."\n
" ."\n
\"\"
" ."\n
" ."\n

Members
near $city_name

" ."\n
    " ."\n $string" ."\n
" ."\n" ."\n
" ."\n
\"\"
" ."\n" ."\n
" ."\n
"; } function new_joinaffclaim($name) { echo "\n
"; echo "Yes!, I would like to accept a free registration to name\" target=\"_blank\">Get It On to maximize my chance of meeting someone as soon as possible! name\" target=\"_blank\">Click here"; echo "\n
"; } function new_reportingclaim() { echo "\n
" ."\nThis form is for reporting users who are acting inappropriately" ."\n
"; } function new_modifyclaim() { echo "\n
" ."\n

Complete form to modify profile.

" ."\n
"; } function new_scamwarning() { echo "\n
" ."\n

Users requesting money are ALWAYS scammers. Please flag them.

" ."\n
"; } function new_claim() { include("config.php"); echo "\n
" ."\n

$sitename is a totally free dating website.

" ."\n

Register now and join over 435,432 others. " ."\n

"; } function new_toppagination() { echo "
" ."\n" ."\n
" ."\nPrev 1 2 3 4 5 6 7 ... 100 Next" ."\n
" ."\n
\n"; } function new_bottompagination() { echo "\n" ."\n
" ."\nPrev 1 2 3 4 5 6 7 ... 100 Next" ."\n
" ."\n"; } function new_logo($sitecss) { echo "" ."\n" ."\n" ."
" ."\n
" ."\n\"Casual" ."\n
"; } function new_breadcrumb($person) { echo "

home\"\" " ."\nlocation_lc.html\">$person->location_lc\"\" " ."\nrequesting_c/$person->location_lc.html\">$person->requesting_lc\"\" " ."\n$person->name

"; } function new_topad() { echo "

Click Here for Wellington Girls

"; } function new_loggedin($name) { if (!empty($name->name)) { if ($name->unread_count == 1) { $message = "(1) Message"; } if ($name->unread_count == 0) { $message = "Messages"; } if ($name->unread_count > 1) { $message = "($name->unread_count) Messages"; } echo "\n
" ."\n" ."\n" ."\n
" ."\n

Logged in as: $name->name

" ."\n
" ."\n" ."\n
"; } else { echo "
" ."\n" ."\n
" ."\n
" ."\n
Member Login" ."\n
" ."\n
" ."\n
" ."\n
"; } } function new_contactuser($sender, $recipient) { //if (!empty($recipient->name)) //{ //$string = "Reply to $recipient->name:"; //} //else //{ $string = "Message $recipient->name"; //} if (!empty($sender->name)) { echo "
" ."\n

$string

" ."\n
" ."\n
" ."\nname\">name\">" ."\n" ."\n" ."\n
" ."\n" ."\n
" ."\n" ."\n
" ."\n" ."\n

name.html\">Flag this Profile\"flag

"; } } function new_morephotos() { echo "\n
" ."\n

More Photos of Harvey

" ."\n
" ."\n
    " ."\n
  • \"\"
  • " ."\n
  • \"\"
  • " ."\n
  • \"\"
  • " ."\n
  • \"\"
  • " ."\n
  • \"\"
  • " ."\n
" ."\n
" ."\n
"; } function new_closebox() { echo \"
" ."\n\"close\"" ."\n

Things to do:

" ."\n

1. Meet more people on Get It On.

" ."\n" ."\n
"; } function new_profile($profile, $filename, $user) { $last_visit = timeDiff($profile->last_timestamp); $height = $profile->height; if (empty($height)) { $height = "not indicated"; } $bodyshape = $profile->bodyshape; if (empty($bodyshape)) { $bodyshape = "not indicated"; } $heading = substr($profile->classified_heading, 0, 60); echo "

$profile->name, \"$heading\"

" ."\n" ."\n
" ."\n
\"\""; if ($profile->name == $user->name) { } else if (empty($user->name)) { echo "\n

\"flirt!\"

"; } else { echo "\n

name&height=125&width=350\" class=\"thickbox\" title=\"Flirt with $profile->name ?\">\"flirt!\"

"; } if ($profile->country == "US") { $postal = "Zip Code"; } else { $postal = "Postal Code"; } echo "\n
" ."\n

I am:

" ."\n

Seeking:

" ."\n

$postal:

" ."\n

Ethnicity:

" ."\n

Age:

" ."\n

Height:

" ."\n

Weight:

" ."\n

Profile Views:

" ."\n

Last Visit:

" ."\n
" ."\n
" ."\n

$profile->requesting

" ."\n

$profile->seeking

" ."\n

$profile->suburb1

" ."\n

$profile->ethnicity

" ."\n

$profile->age

" ."\n

$height

" ."\n

$bodyshape

" ."\n

$profile->views

" ."\n

$last_visit

" ."\n
" ."\n
" ."\n" ."\n
" ."\n"; if (!empty($profile->classified_posting)) { echo "\n
" ."\n

About Me

" ."\n

$profile->classified_posting

" ."\n
"; } } function new_header($name) { include("config.php"); $string = $name->classified_heading; if (empty($string)) { $string = $meta_description; } echo "" ."\n" ."\n" ."\n" ."\n" ."\n$sitename - $string" ."\n" ."\n" ."\n"; } function call_css($sitecss) { $browser = $_SERVER['HTTP_USER_AGENT']; if (preg_match("/MSIE 6./", $browser)) { $using_microsoft = 1; $css = ""; } else { $using_microsoft = 0; $css = ""; } echo $css; } function new_footer() { echo "
" ."" ."
" ."
" ."" ."
" ."" ."

Casual Encounters Blog | Safety and Privacy | Contact Us | Webmasters | Help

" ."" ."
" ."" ."" ."" ."" ."" ."" ."" ."" ."" .""; include("js/analytics.js"); echo "" .""; } function left_column($name) { if ($name->country == "US") { $postal = "Zip Code"; } else { $postal = "Postal Code"; } $sort_type = requesting_land($name->requesting_c); echo "" ."
" ."" ."" ."
" ."
\"\"
" ."
" ."

Search

" ."
" ."" ."

I am

" ."

" ." " ."

$postal

" ."
" ." " ."
" ."" ."
" ."
\"\"
" ."" ."
" ."" .""; } function check_username($username) { global $taken_usernames; $resp = array(); $username = trim($username); if (!$username) { $resp = array('ok' => false, 'msg' => "Please specify a username"); } else if (!preg_match('/^[a-z0-9\.\-_]+$/', $username)) { $resp = array('ok' => false, "msg" => "Your username can only contain alphanumerics and period, dash and underscore (.-_)"); } else { include("db.php"); mysql_select_db('localsex', $link); $query = "SELECT * FROM ads WHERE name = '$username'"; $result = mysql_query($query); $fail = 2; if (mysql_num_rows($result) == 1) { $fail = 1; } unset($query); unset($result); if ($fail == 1) { $resp = array("ok" => false, "msg" => "username already in use."); } else { $resp = array("ok" => true, "msg" => "username is available."); } } return $resp; } function check_email($username) { global $taken_usernames; $resp = array(); $username = trim($username); if (!$username) { $resp = array('ok' => false, 'msg' => "Please specify a username"); } else if (!preg_match('/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/', $username)) { $resp = array('ok' => false, "msg" => ""); } else { $fp = fsockopen("www.adultfriendfinder.com", 80, $errno, $errstr, 30); if (!$fp) echo "$errstr ($errno)\n"; else { fwrite($fp, "GET /p/flash_reg_fields_check.cgi?email=$username®_handle=$name HTTP/1.0\r\nHost: www.adultfriendfinder.com\r\n\r\n"); while (!feof($fp)) $body .= fgets($fp, 4096); fclose($fp); } $fail = 0; if (preg_match("/email=0/", $body)) { $fail = 1; } if ($fail == 1) { $resp = array("ok" => false, "msg" => "Dating Gold:"); } else { $resp = array("ok" => true, "msg" => ""); } } return $resp; } function reg_pics($referer) { $string = "
  • " ."
  • " ."
  • "; $regexp = '/(gay|m4m|male escort|male cock|bi guys|men seeking men|bisexual men)/i'; if (preg_match("$regexp", $referer)) { $string = "
  • " ."
  • " ."
  • "; } $regexp = '/(lesbian|bi women)/i'; if (preg_match("$regexp", $referer)) { $string = "
  • " ."
  • " ."
  • "; } $regexp = '/(swing/couple)/i'; if (preg_match("$regexp", $referer)) { $string = "
  • " ."
  • " ."
  • "; } return $string; } function verifyemail($site) { $string = "

    Please Check Your Email to Confirm Your Subscription

    " ."

    We sent you an email with a link to confirm your subscription." ." If you do not receive it within a reasonable amount of time, please check your spam filters to ensure you are allowing emails from webmaster@$site.

    " ."

    To ensure that our email reaches your Inbox, and is not deleted or moved to your Junk Mail folder, add our email address webmaster@$site to your safe sender list.

    "; echo $string; } function youviewed($name, $sitecss, $gclid) { include("config.php"); include("db.php"); if (!empty($name)) { $sql = "SELECT distinct(viewed), created from viewhistory where name='$name' order by id desc limit 14;"; $users = array(); mysql_select_db($db) or die ("Unable to select database!"); $qry = mysql_query($sql) or die ("Error in query: $sql. ".mysql_error()); $needtoclose = 0; if (mysql_num_rows($qry) > 0) { $needtoclose = 3; echo "
    " ."
    \"\"
    " ."
    " ."" ." \"you"; $printed_users = array(); $result = array(); while ($row = mysql_fetch_object($qry)) { if (!in_array($row->viewed, $users)) { echo "

    viewed/1/\">"; echo $row->viewed; $time_ago = timeDiff(strtotime($row->created)); echo " $time_ago

    "; array_push($users, $row->viewed); } } echo "
    "; } mysql_close($link); include("config.php"); include("db.php"); $sql = "SELECT distinct(name), created from viewhistory where viewed='$name' order by id desc limit 15;"; $users = array(); mysql_select_db($db) or die ("Unable to select database!"); $qry2 = mysql_query($sql) or die ("Error in query: $sql. ".mysql_error()); //echo "\"viewed"; if (mysql_num_rows($qry2) > 0) { if ($needtoclose == 0) { echo "
    " ."
    \"\"
    " ."
    "; echo "\"you"; } else { echo "\"you"; } $needtoclose = 3; $printed_users = array(); $result = array(); while ($row = mysql_fetch_object($qry2)) { if (!in_array($row->name, $users)) { echo "

    name/1/\">"; echo $row->name; $time_ago = timeDiff(strtotime($row->created)); echo " $time_ago

    "; array_push($users, $row->name); } } } if ($needtoclose == 3) { echo "
    \n" ."
    \"\"
    " ."" ."
    "; } else { echo "
    "; // echo "
    \n"; } //."
    "; mysql_close($link); } // else { // echo ""; // } } function receiverSitename($site) { if ($site == "localtryst.com") { $receiver_sitename = "LocalTryst.com"; } else if ($site == "casualencounters.com") { $receiver_sitename = "CasualEncounters.com"; } else if ($site == "australiansex.com") { $receiver_sitename = "AustralianSex.com"; } else { $receiver_sitename = "LocalSex.com"; } return $receiver_sitename; } function mailSigs($requesting, $site) { if ($site == "localtryst.com") { $sponsor = "passion.com"; $sponsor_name = "Passion.com"; } else { $sponsor = "adultfriendfinder.com"; $sponsor_name = "Adult FriendFinder"; } if ($requesting == "w4m") { $sig_string = "

    --------------------" ."
    $sponsor_name" ."
    Find Local Partners for Hot Sexual Encounters!"; } else if ($requesting == "m4w") { $sig_string = "

    --------------------" ."
    $sponsor_name" ."
    Get Laid Tonight. Join For FREE!"; } else if ($requesting == "m4m") { $sig_string = "

    --------------------" ."
    $sponsor_name" . "
    Meet Local Men For Hot Sex! Join FREE Now!"; } else if ($requesting == "w4w") { $sig_string = "

    --------------------" . "
    $sponsor_name" . "
    Local Lesbian Partners For Sexual Encounters. Join FREE!"; } else if ($requesting == "c4m") { $sig_string = "

    --------------------" ."
    $sponsor_name" . "
    Find Local Bi Men For Hot Couple Sex! Join FREE Now!"; } else if ($requesting == "c4w") { $sig_string = "

    --------------------" ."
    $sponsor_name" . "
    Meet the Hottest Singles and Wildest Couples in Your Area! "; } else if ($requesting == "c4c") { $sig_string = "

    --------------------" ."
    $sponsor_name" ."
    World's largest swinger personals - over 20,000,000 members! "; } else { echo "

    --------------------" ."
    $sponsor_name" ."
    World's largest swinger personals - over 20,000,000 members! "; } $sig_string = "

    --------------------"; //."
    Adult FriendFinder" //."
    World's largest swinger personals - over 20,000,000 members! "; return $sig_string; } function ThingsToDo($cookie_exist, $verified, $pic_exists, $posting, $member, $bv, $flirt) { $todo = array(); $referer = $_SERVER['HTTP_REFERER']; if (preg_match("/image.php/", $referer)) { echo "
    Success: Your photo is being processed.
    "; } if (isset($cookie_exist)) { // if (empty($verified)) { $string = "Check your email, and click the 'activate account' link (check spam folders)"; array_push($todo, $string); } if (empty($posting)) { $string = "Describe yourself, finish profile."; array_push($todo, $string); } if ($pic_exists == 0 ) { $string = "Be seen, upload photo."; array_push($todo, $string); } if (empty($bv)) { $string = "Visit our Casual Encounters Blog"; array_push($todo, $string); } if (empty($flirt)) { $string = "Flirt. Search, find someone you like and flirt!"; array_push($todo, $string); } // echo "

  • 5. Flirt. Search, find someone you like and flirt!
  • "; if ( (!empty($verified)) && ($pic_exists == 1) && (!empty($posting)) && ($member == 0) ) { $string = "Meet more people on Adult Friend Finder"; array_push($todo, $string); } $element_number = count($todo); if ($element_number > 0) { echo "
    "; echo "

    Things to do:

    "; for ($i = 0; $i != $element_number; ++$i) { $j = $i + 1; if ($j == 1) { echo "

    $j. "; echo $todo[$i]; echo "

    "; } else { echo "

    $j. "; echo $todo[$i]; echo "

    "; } } echo "
    "; } } } function RefererString($referer, $sitename) { $string = "Join $sitename for free and meet some of the 450,000 others looking to hookup."; if (preg_match('/booty/', $referer)) { $string = "Looking for someone to spend your life with, or perhaps just a booty call ?"; } if (preg_match('/buddy/', $referer)) { $string = "Looking for someone to spend your life with, or perhaps just a fuck buddy ?"; } if (preg_match('/stand/', $referer)) { $string = "Looking for someone to spend your life with, or perhaps a one night stand ?"; } if (preg_match('/fling/', $referer)) { $string = "Looking for someone to spend your life with, or perhaps a fling ?"; } if (preg_match('/tonight/', $referer)) { $string = "Looking for someone to spend your life with, or perhaps just sex tonight ?"; } if (preg_match('/casual/', $referer)) { $string = "Looking for someone to spend your life with, or perhaps just casual sex ?"; } if (preg_match('/hookup/', $referer)) { $string = "Looking for someone to spend your life with, or perhaps a casual hookup ?"; } if (preg_match('/looking/', $referer)) { $string = "Looking for someone to spend your life with, or perhaps you're looking for sex ?"; } if (preg_match('/search/', $referer)) { $string = "Looking for someone to spend your life with, or perhaps you search sex ?"; } if (preg_match('/find/', $referer)) { $string = "Looking for someone to spend your life with, or perhaps you want to find sex ?"; } return $string; } function picexist($name, $memcacheflag) { // include("memcaches.php"); include("config.php"); include("db.php"); $db = "localsex"; $sql = "SELECT id, filename, primary_media, flv_filename FROM media WHERE primary_media!=2 AND username=\"$name\" group by filename order by primary_media asc;"; // $key = md5('query'.$sql); // $result = $memcache->get($key); if ($memcacheflag == 1) { //memcache->delete($key, 10); $result = null; } if($result == null) { //echo "not cached"; mysql_select_db($db) or die ("Unable to select database!"); $qry = mysql_query($sql) or die ("Error in query: $sql. ".mysql_error()); $result = array(); while ($row = mysql_fetch_object($qry)) { $result[] = $row; } if (empty($result)) { $result[0]->id = 9876; $exists = 0; } else { $exists = 1; } //$memcache->set($key,$result,0,3600); mysql_close($link); } else { } return $exists; } function censor($text) { $mask = "*"; $badwords = array("bitch", "bastard", "fuck" , "cock" , "cunt" , "FUCK" , "COCK" , "Fuck" , "Cock" , "cum" , "shit" , "anal" ,"piss"); for ($i = 0; $i < sizeof($badwords); $i++) { $censored = substr($badwords[$i], 0, 1); $last = substr($badwords[$i], - 1); for ($x = 1; $x < (strlen($badwords[$i]) - 1); $x++) $censored .= $mask; $censored .= $last; $text = str_replace( $badwords[$i], $censored, $text); } return $text; } function calcAge($bMonth,$bDay,$bYear) { $cMonth = date('n'); $cDay = date('j'); $cYear = date('Y'); if(($cMonth >= $bMonth && $cDay >= $bDay) || ($cMonth > $bMonth)) { return ($cYear - $bYear); } else { return ($cYear - $bYear - 1); } } function distance($lat1, $lng1, $lat2, $lng2, $miles = true) { $pi80 = M_PI / 180; $lat1 *= $pi80; $lng1 *= $pi80; $lat2 *= $pi80; $lng2 *= $pi80; $r = 6372.797; // mean radius of Earth in km $dlat = $lat2 - $lat1; $dlng = $lng2 - $lng1; $a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2); $c = 2 * atan2(sqrt($a), sqrt(1 - $a)); $km = $r * $c; return ($miles ? ($km * 0.621371192) : $km); } function compatibility($logged, $ad) { $compatible = 1; if ( ($logged == "m4w") && ($ad == "w4m") ) { $compatible = 1; } if ( ($logged == "w4m") && ($ad == "m4w") ) { $compatible = 1; } if ( ($logged == "m4w") && ($ad == "w4w") ) { $compatible = 0; } if ( ($logged == "m4w") && ($ad == "c4w") ) { $compatible = 0; } if ( ($logged == "m4w") && ($ad == "m4w") ) { $compatible = 0; } if ( ($logged == "m4m") && ($ad == "m4w") ) { $compatible = 0; } return $compatible; } $code = $_GET['code']; function right_ads($dude) { if (empty($dude)) { //echo "
    "; } } function querypics($name, $reviewed) { include("config.php"); include("db.php"); $db = "localsex"; if ($reviewed == 1) { $reviewsql = ""; } else { $reviewsql = "AND reviewed > 1 "; } $sql = "SELECT id, filename, primary_media, flv_filename FROM media WHERE primary_media!=2 AND username=\"$name\" AND width is not null $reviewsql group by filename order by primary_media asc;"; if($result == null) { //echo "not cached"; mysql_select_db($db) or die ("Unable to select database!"); $qry = mysql_query($sql) or die ("Error in query: $sql. ".mysql_error()); $result = array(); while ($row = mysql_fetch_object($qry)) { $result[] = $row; } if (empty($result)) { $result[0]->id = 9876; } // $memcache->set($key,$result,0,3600); mysql_close($link); } else { } // echo $result[0]->filename; return $result; } function printprofilepic($result) { $media_length = count($result); if ($result[0]->id == 9876) { $media_length = 0; } if ($media_length == 0) { $string= "/images/profile.png"; } else { $filename = preg_replace('/\.jpg$/i' , '.thumb.jpg' , $result[0]->filename); $string = "http://http.cdnlayer.com/lsmedia/thumbs/$filename"; } return $string; } function printownprofilepic($result) { $media_length = count($result); if ($result[0]->id == 9876) { $media_length = 0; } // print_r($result); if ($media_length == 0) { echo "/img/upload3.gif"; } else { $jpeg_file = $result[0]->filename; $filename = preg_replace('/\.jpg$/i' , '.thumb.jpg' , $result[0]->filename); echo "/show_image.php?filename=thumbs/$filename&width=120"; } } function printotherpics($result, $profile) { include("config.php"); $photo_length = count($result); if ($result[0]->id == 9876) { $photo_length = 0; } if ($photo_length > 0) { echo "\n
    " ."\n

    Photos of $profile->name

    " ."\n
    " ."\n\n
    \n
    "; } } function getPaginationString($page = 1, $totalitems, $limit = 15, $adjacents = 1, $targetpage = "/", $pagestring = "?page=") { //defaults if(!$adjacents) $adjacents = 1; if(!$limit) $limit = 15; if(!$page) $page = 1; if(!$targetpage) $targetpage = "/"; //other vars $prev = $page - 1; //previous page is page - 1 $next = $page + 1; //next page is page + 1 $lastpage = ceil($totalitems / $limit); //lastpage is = total items / items per page, rounded up. $lpm1 = $lastpage - 1; //last page minus 1 /* Now we apply our rules and draw the pagination object. We're actually saving the code to a variable in case we want to draw it more than once. */ $pagination = ""; if($lastpage > 1) { $pagination .= "
    1) $pagination .= "< prev"; else $pagination .= "< prev"; //pages if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } } elseif($lastpage >= 7 + ($adjacents * 2)) //enough pages to hide some { //close to beginning; only hide later pages if($page < 1 + ($adjacents * 3)) { for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } $pagination .= "..."; $pagination .= "$lpm1"; $pagination .= "$lastpage"; } //in middle; hide some front and some back elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) { $pagination .= "1"; $pagination .= "2"; $pagination .= "..."; for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } $pagination .= "..."; $pagination .= "$lpm1"; $pagination .= "$lastpage"; } //close to end; only hide early pages else { $pagination .= "1"; $pagination .= "2"; $pagination .= "..."; for ($counter = $lastpage - (1 + ($adjacents * 3)); $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination .= "$counter"; else $pagination .= "$counter"; } } } //next button if ($page < $counter - 1) $pagination .= "next >"; else $pagination .= "next >"; $pagination .= "
    \n"; } return $pagination; } function queryresults($city_name, $state, $sort_request) { include("config.php"); //include("db.php"); $db = "localsex"; $link = mysql_connect('localhost', 'sacx', 'frusemide40mg'); unset($result1); $function_country_code = apache_note("GEOIP_COUNTRY_CODE"); $city_name_plain = preg_replace('/_/' , ' ' , $city_name); if (!empty($postcode)) { $lng = get_zip_coordinates($postcode, $function_country_code); //print_r($lng); } else { //print_r($lng); $lng = get_coordinates($city_name_plain, $state); } $geo_query = get_geoquery($lng[0], $lng[1], 150); $function_country_code = apache_note("GEOIP_COUNTRY_CODE"); if ( ($function_country_code != "US") && ($function_country_code != "GB") && ($function_country_code != "CA") && ($function_country_code != "AU") && ($function_country_code != "NZ") && ($function_country_code != "FR") ) { $geo_query = " AND category_name=\"$city_name,$state\" "; } if (!empty($sort_request)) { $request_string = " and requesting='$sort_request' "; } else { $request_string = ""; } $current_timestamp = time(); $last60 = $current_timestamp - 49184000; $regexp = "/localtryst/"; $site_host = $_SERVER["HTTP_HOST"]; if (!preg_match($regexp, $site_host)){ $tryst = " and ads.site!='localtryst.com' "; } $sql = "SELECT date_posted, ads.id, last_timestamp, classified_heading, classified_posting, requesting, name, age, suburb1, filename, primary_media, reviewed, country_code, category_name FROM ads LEFT JOIN media ON (ads.name = media.username) WHERE approved !='N' and approved !='E' $tryst $geo_query $request_string AND (private is null || private='10' || private='0' ) AND last_timestamp > $last60 GROUP by name order by email_verified desc, last_timestamp desc limit 700;"; //echo $sql; if($result == null) { mysql_select_db($db) or die ("Unable to select database!"); $qry = mysql_query($sql) or die ("Error in query: $sql. ".mysql_error()); $printed_users = array(); $result = array(); while ($row = mysql_fetch_object($qry)) { $result[] = $row; } } mysql_close($link); return $result; } function printresults($result, $page, $front, $city_name, $onlyphotos) { $number_of_results = 20; $element_number = count($result); if ($page == 1) { $j = 0; } else { $j = ($page - 1) * $number_of_results; } $length = ($page * $number_of_results); if ($element_number < $length) { $length = $element_number; } if ($j > $length) { $j = $length - 50; } if ($j < 1 ) { $j = 0; } //echo "$j $length"; $printed_users = array(); echo "
    "; for ($i = $j; $i != $length; ++$i) { if ( ( $result[$i]->filename != NULL) && ($result[$i]->reviewed > 1) && ($result[$i]->primary_media != 2) ) {$pic = ""; $photo = 1; } else { $pic = ""; $photo = 0; } /**$location = "sitedomain/city/".$result[$i]->category_name.".html\">$result[$i]->sitetype"; **/ if (!in_array($result[$i]->name, $printed_users)) { $current_time = time(); $last_time = $result[$i]->last_timestamp; $time_elapsed = $current_time - $last_time; if ($time_elapsed < 1800) { $green = "\"online\" "; } else { $green = ""; } $request0r = $result[$i]->requesting; include("category.array.php"); $span_title = $requesting_array[$request0r]; $new_string = trim(strtolower(ereg_replace("[^A-Za-z0-9 ]", "", $result[$i]->classified_heading ))); $new_string = preg_replace('/ /', "-", $new_string ); $heading = censor($result[$i]->classified_heading); $posting = censor($result[$i]->classified_posting); $posting = substr($posting, 0, 60); $time_ago = timeDiff($last_time); $regexp = '/months/'; if (preg_match($regexp, $time_ago)){ $time_ago = ""; } $filename = preg_replace('/\.jpg$/i' , '.thumb.jpg' , $result[$i]->filename); $filename_url = "http://http.cdnlayer.com/lsmedia/thumbs/" . $filename; if ($result[$i]->reviewed < 1) { $filename_url = "/images/no-photo.png"; } if (empty($filename)) { $filename_url = "/images/no-photo.png"; } if ( ($onlyphotos == 1) && ($photo == 1 )) { echo "\n
    " ."" ."
    " ."

    $heading

    " ."

    name."/$new_string/\">".$result[$i]->name." ".$result[$i]->age." $span_title

    " ."

    ".$result[$i]->category_name."

    " ."

    $time_ago

    " ."
    " ."" ."
    " ."
    "; } if ( ($onlyphotos == 0) && ($photo == 0 )) { echo "\n
    " ."" ."
    " ."

    $heading

    " ."

    name."/$new_string/\">".$result[$i]->name." ".$result[$i]->age." $span_title

    " ."

    ".$result[$i]->category_name."

    " ."

    $time_ago

    " ."
    " ."" ."
    " ."
    "; } $photo = 0; array_push($printed_users, $result[$i]->name); } } $results = $number_of_results - $length; $height = $results * 10; if ($onlyphotos == 0) { } } function geoprintpics($result, $page, $front) { include("language.array.php"); include("config.php"); $length = count($result); //echo "$header2_latest_array[$language]