0) { #@mysql_query("UPDATE ppl_online SET user_id='" . $_SESSION['ID'] . "', activity=now(), member='y' WHERE session_id='".session_id()."'"); @mysql_query("INSERT INTO ppl_online (session_id, activity, user_id, member, ip_address, refurl, user_agent) VALUES ('" . session_id() . "', now(), '" . $_SESSION['ID'] . "', 'y', '{$_SERVER['REMOTE_ADDR']}', '{$_SERVER['HTTP_REFERER']}', '{$_SERVER['HTTP_USER_AGENT']}')"); $memberaccessid = $_SESSION['ID']; } else { $memberaccessid = 0; } $limit_time = time() - 600; // 5 Minute time out. 60 * 5 = 300 @mysql_query("DELETE FROM ppl_online WHERE UNIX_TIMESTAMP(activity) < " . (time() - 3600)) or die (mysql_error()); #$sql = mysql_query("SELECT * FROM ppl_online WHERE UNIX_TIMESTAMP(activity) >= $limit_time AND member='n' GROUP BY ip_address") or die (mysql_error()); #$visits = mysql_num_rows($sql); $fakehour = date("G"); if ($fakehour == 4 OR $fakehour == 5 OR $fakehour == 6) { $visits = rand(3020, 3120); } elseif ($fakehour == 7 OR $fakehour == 8 or $fakehour == 9) { $visits = rand(3120, 3220); } elseif ($fakehour == 10 OR $fakehour == 11 or $fakehour == 12 OR $fakehour == 13) { $visits = rand(3220, 3340); } elseif ($fakehour == 14 OR $fakehour == 15 or $fakehour == 16 OR $fakehour == 17) { $visits = rand(3420, 3540); } elseif ($fakehour == 18 OR $fakehour == 19 or $fakehour == 20 OR $fakehour == 21) { $visits = rand(3320, 3540); } elseif ($fakehour == 22 OR $fakehour == 23 OR $fakehour == 24 OR $fakehour == 0) { $visits = rand(3520, 1740); } elseif ($fakehour == 1 OR $fakehour == 2 OR $fakehour == 3) { $visits = rand(1620, 1840); } $sql = mysql_query("SELECT user_id AS id FROM ppl_online UNION SELECT id FROM realchat WHERE ID > 0") or die (mysql_error()); $membervisits = mysql_num_rows($sql); #$membervisits = rand(25, 41); #$sql_member = mysql_query("SELECT * FROM realchat5 WHERE ID > 0") or die (mysql_error()); #$usercount = mysql_num_rows($sql_member); $usercount = file_get_contents($FILEPATH . "/posts/static/chatcount5.txt"); #$usercount = 17; #if ($REMOTE_ADDR == gethostbyaddr($REMOTE_ADDR)) { # $subject = $sitename . ': Unable to resolve (' . $REMOTE_ADDR . ')'; # $note = 'IP: ' . $REMOTE_ADDR . "\n\r"; # $note .= 'Warning, a visitor to the site is connecting with an IP address that cannot be resolved. Normally this is a spammer or someone trying to get by the system but not always.' . "\n\r"; # mail($sitemail,$subject,$note,"From: " . $sitemail . "\r\n" . "Reply-To: " . $sitemail . "\r\n" . "X-Mailer: PHP/" . phpversion()); #} // if (isbanned($REMOTE_ADDR) or isbanned(gethostbyaddr($REMOTE_ADDR))) { if ( isbanned($REMOTE_ADDR) ) { $subject = $sitename . ': Attempted Access from (' . gethostbyaddr($REMOTE_ADDR) . ')'; $body = 'IP Address: ' . $REMOTE_ADDR . "\r\n\r\n"; $body .= 'Which resolved as: ' . gethostbyaddr($REMOTE_ADDR) . "\r\n\r\n"; #mail($sitemail,$subject,$note,"From: " . $sitemail . "\r\n" . "Reply-To: " . $sitemail . "\r\n" . "X-Mailer: PHP/" . phpversion()); sock_mail($sitemail,$subject,$body,"",$sitemail); header("Location: http://www.nsa.gov"); } ispersistent(); #2010-08-19 Daniel Saint James #Add code to set latitude and longitude for geolocating if (!isset($_SESSION['latitude'])) { // $geoip = $_SERVER['REMOTE_ADDR']; // $location = new IPGeolocation($geoip); // $_SESSION['latitude'] = (string)$location->getLatitude(); // $_SESSION['longitude'] = (string)$location->getLongitude(); } function adminmsg($fid) { global $db; $fsql = "SELECT admin FROM User_Account WHERE ID = " . $fid; $fresult = mysql_query($fsql,$db); $frow = mysql_fetch_array($fresult); if ($frow[0] <> '') { return true; } else { return false; } } function ccbill_status($fid,$fresponse = null) { global $db; if ($fresponse == "bool") { $fsql = "SELECT * FROM subscriber_log WHERE user_account = " . $fid . " AND TO_DAYS(NOW()) - TO_DAYS(date_stamp) <= 7 ORDER BY date_stamp DESC LIMIT 1"; $fresult = mysql_query($fsql,$db); $frow = mysql_fetch_array($fresult); if ($frow[0] <> '') { return true; } else { return false; } } else { $fsql = "SELECT * FROM subscriber_log WHERE user_account = " . $fid . " AND TO_DAYS(NOW()) - TO_DAYS(date_stamp) <= 7 ORDER BY date_stamp DESC LIMIT 1"; $fresult = mysql_query($fsql,$db); $frow = mysql_fetch_array($fresult); if ($frow[0] <> '') { $fsql2 = 'SELECT User_Class FROM User_Account WHERE ID = ' . $fid; $fresult2 = mysql_query($fsql2,$db); $frow2 = mysql_fetch_array($fresult2); if ($frow2[0] > 2) { echo '' . $frow['ccbill_type'] . ' PLUS Member'; } else { echo '' . $frow['ccbill_type'] . ' Member'; } echo '
'; } else { # no entry was found in the database, we now set their member type based on their user class $fuserclass = getlabel($fid,'User_Account','User_Class'); if ($fuserclass < 3) { echo 'Bronze Member
'; } else { echo 'Silver Member
'; } } } } function getonlinemembers($fcount = '9') { global $db, $domain; $fsql = "SELECT user_id AS User_Account FROM ppl_online UNION SELECT id AS User_Account FROM realchat WHERE ID > 0 LIMIT " . $fcount; $fresult = mysql_query($fsql,$db); echo '
' . "\n"; echo ' ' . "\n"; echo '
'; } function getnearbymembers($fcount = '9') { global $db, $domain; $fsql = "SELECT ID FROM User_Account WHERE Display = 1 AND Visible = 1 AND Country <> '' AND City <> '' AND Groups <> '' AND First_Name <> '' ORDER BY ID DESC LIMIT " . $fcount; $fsql = "SELECT a.ID, SQRT(((" . $_SESSION['latitude'] . " - a.latitude) * (" . $_SESSION['latitude'] . " - a.latitude)) + ((" . $_SESSION['longitude'] . " - a.longitude) * (" . $_SESSION['longitude'] . " - a.longitude))) * 54 AS Distance FROM User_Account a WHERE a.Country <> '' AND a.City <> '' AND a.First_Name <> '' AND a.Groups <> '' AND a.Display = 'True' AND a.Visible = 'True' AND TO_DAYS(NOW()) - TO_DAYS(a.Last_Logon) <= 730 AND a.Birthdate > '1911-08-19' AND a.Birthdate < '1992-08-19' AND a.Groups LIKE '%1%' AND a.latitude BETWEEN " . $_SESSION['latitude'] . " - 15 AND " . $_SESSION['latitude'] . " + 15 AND a.longitude BETWEEN " . $_SESSION['longitude'] . " - 15 AND " . $_SESSION['longitude'] . " + 15 ORDER BY Distance LIMIT " . $fcount; $fresult = mysql_query($fsql,$db); echo '
' . "\n"; echo ' ' . "\n"; echo '
' . "\n"; } function getrecentmembers($fcount = '9') { global $db, $domain; $fsql = "SELECT ID FROM User_Account WHERE Display = 1 AND Visible = 1 AND Country <> '' AND City <> '' AND Groups <> '' AND First_Name <> '' ORDER BY ID DESC LIMIT " . $fcount; $fresult = mysql_query($fsql,$db); echo '
' . "\n"; echo ' ' . "\n"; echo '
' . "\n"; } function gethighestratedmembers($fcount = '9') { global $db, $domain; $fsql = "SELECT * FROM ratings_calculated WHERE votes > " . date("j")/2 . " ORDER BY rating DESC LIMIT " . $fcount; #$fsql = "SELECT * FROM ratings_calculated WHERE votes > 1 ORDER BY rating DESC LIMIT " . $fcount; #$fsql = "SELECT * FROM ratings_calculated WHERE votes > 28 ORDER BY rating DESC LIMIT " . $fcount; # DAS 2013-07-03 Bayesian calc based on view (sproc) $fsql = "SELECT user_account, ((avg_num_votes * avg_rating) + (this_num_votes * this_rating)) / (avg_num_votes + this_num_votes) as real_rating FROM `urnawm`.`ratings_bayesian` ORDER BY real_rating DESC LIMIT " . $fcount; $fresult = mysql_query($fsql,$db); while ($frs = mysql_fetch_row($fresult)) { $fformatname = formatname($frs[0], 10); echo '
' . "\n"; echo ' ' . "\n"; getdbimage($frs[0],'user_account','','_s',$fformatname); echo '
' . "\n"; echo '

' . $fformatname . '
' . "\n"; echo ' ' . round($frs[1],2) . '

' . "\n"; echo '
' . "\n"; echo '
' . "\n"; echo '
' . "\n"; } # now we iterate through the groups and select the highest rated member in each group } function getrecentupdates($fcount = '9') { global $db, $domain; $fsql = "SELECT ID FROM User_Account WHERE Display = 1 AND Visible = 1 AND Country <> '' AND City <> '' AND Groups <> '' AND First_Name <> '' ORDER BY Modified DESC LIMIT " . $fcount; $fresult = mysql_query($fsql,$db); echo '
' . "\n"; echo ' ' . "\n"; echo '
' . "\n"; } function getmostrecent($fgroupid,$fgroupname) { $fdb = mysql_connect("modelts-web01.cavecreek.net","profile","!?bate!?"); $fresult = mysql_query("SELECT ID FROM User_Account WHERE specialgroups LIKE '%$fgroupid%' AND Display = 1 AND Visible = 1 ORDER BY $fgroupname DESC LIMIT 1",$fdb); $frow = mysql_fetch_array($fresult); showprofile($frow[0]); } function getmostrecenttiny($fgroupid,$fgroupname,$fsize = '_s') { global $db; $fresult = mysql_query("SELECT ID,First_Name,Middle_Name,Last_Name,Description FROM User_Account WHERE specialgroups LIKE '%$fgroupid%' AND Display = 1 AND Visible = 1 ORDER BY $fgroupname DESC LIMIT 1",$db); $frow = mysql_fetch_array($fresult); echo '' . "\n"; echo '

' . getlabel($fgroupid,'specialgroups','title') . '

' . "\n"; echo '' . $frow['First_Name'] . ' ' . $frow['Middle_Name'] . ' ' . $frow['Last_Name'] . '
' . "\n"; echo '

' . substr($frow['Description'],0,200); echo '... [more]

' . "\n"; } function showprofile($fid) { global $db, $path, $domain; $fshowprofileresult = mysql_query("SELECT *,Month(Birthdate) as BMonth, DayOfMonth(Birthdate) as BDay FROM User_Account WHERE ID = " . $fid,$db); $fshowprofilerow = mysql_fetch_array($fshowprofileresult); # format the users dB name for use in the profile $ffullname = formatname($fshowprofilerow['ID']); if ($_SESSION['User_Class'] > 2 OR $_SESSION['Adult'] == 'Member' OR $_SESSION['Enhanced'] == 'Member') { # if a user isn't a registered member, they see a little less info, smaller images, etc. echo '
' . "\n"; /* Image cell goes here */ echo '
' . "\n"; echo ' '; if (getdbimage($fshowprofilerow['ID'],'user_account','','_thumb','Full profile for ' . $ffullname)) { } else { if (getdbimage($fshowprofilerow["ID"],'user_account/provisional','','_thumb','Full profile for ' . $ffullname)) { } } echo '' . "\n"; echo '
' . "\n"; echo '
' . "\n"; echo ' ' . "\n"; echo '
' . "\n"; echo '
' . "\n"; } else { # if a user isn't a registered member, they see a little less info, smaller images, etc. echo '
' . "\n"; /* Image cell goes here */ echo '
' . "\n"; echo ' ' . "\n"; echo ' '; if (getdbimage($fshowprofilerow["ID"],'user_account','','_s','Full profile for ' . $ffullname)) { } else { # check to see if they have a provisional photo if (getdbimage($fshowprofilerow["ID"],'user_account/provisional','','_s','Full profile for ' . $ffullname)) { # show image } } echo "\n"; echo '
' . "\n"; echo '
' . "\n"; echo ' ' . "\n"; echo '
' . "\n"; echo '
' . "\n"; } } function showplace($fid,$Country = null, $State = null, $City = null) { global $domain; $path = "/var/www/virtual/urnotalone"; $fshowplacedb = mysql_connect("modelts-db01.cavecreek.net","profile","!?bate!?"); $fshowplaceresult = mysql_query("SELECT * FROM Location WHERE ID = " . $fid,$fshowplacedb); $fshowplacerow = mysql_fetch_array($fshowplaceresult); echo '

' . $fshowplacerow["Location"] . ''; if ($_SESSION['User_Class'] == '20') { echo '  [edit]'; } echo '

' . "\n"; if ($fshowplacerow["eMail"]==='True') { echo '
' . "\n"; } if (strlen(trim($fshowplacerow['Headline'])) > 1) { echo '' . $fshowplacerow['Headline'] . '
' . "\n"; } #mapquestlink(getlabel($fshowplacerow["Country"],'Country','Abbr'),$fshowplacerow["State"],$fshowplacerow["City"],$fshowplacerow["Address1"],$fshowplacerow["Zip"]); mapquestlink($fshowplacerow['Country'],$fshowplacerow['State'],$fshowplacerow['City'],$fshowplacerow['Address1'],$fshowplacerow['Zip']); echo '
' . "\n"; if (trim($fshowplacerow["WebURL"])<>"") { $pos = strpos($fshowplacerow["WebURL"],"http://"); echo 'Website' . "\n"; } echo '
' . "\n"; if ($fshowplacerow['Address1'] <> '') { echo $fshowplacerow['Address1'] . '
' . "\n"; } if ($fshowplacerow["Address2"]<>'') { echo $fshowplacerow["Address2"] . '
' . "\n"; } listlocation($fshowplacerow['City'],$fshowplacerow['State'],$fshowplacerow['Country']); if ($fshowplacerow["Phone"]<>'') { echo '
' . $fshowplacerow["Phone"] . '
' . "\n"; } } ?>