0) { // existing user return mysql_fetch_assoc($checknew_result); } else { return false; } } function trackuser($user) { global $facebook, $_SERVER, $_REQUEST, $loggedin, $user_obj; if ($loggedin) { $getInfofields = "about_me, activities, affiliations, birthday, books, "; $getInfofields .= "first_name, last_name, interests, locale, "; $getInfofields .= "movies, music, pic_big, profile_blurb, sex, timezone, tv"; $about_me = mysql_real_escape_string(addslashes($user_obj["about_me"])); $activities = mysql_real_escape_string(addslashes($user_obj["activities"])); if (is_array($usr["affiliations"])) { $affiliations = mysql_real_escape_string(addslashes(implode(" ", $user_obj["affiliations"]))); } else { $affiliations = mysql_real_escape_string(addslashes($user_obj["affiliations"])); } $birthday = mysql_real_escape_string(addslashes($user_obj["birthday"])); $books = mysql_real_escape_string(addslashes($user_obj["books"])); $first_name = mysql_real_escape_string(addslashes($user_obj["first_name"])); $last_name = mysql_real_escape_string(addslashes($user_obj["last_name"])); $interests = mysql_real_escape_string(addslashes($user_obj["interests"])); $locale = mysql_real_escape_string(addslashes($user_obj["locale"])); $movies = mysql_real_escape_string(addslashes($user_obj["movies"])); $music = mysql_real_escape_string(addslashes($user_obj["music"])); $pic_big = mysql_real_escape_string(addslashes($user_obj["pic_big"])); $profile_blurb = mysql_real_escape_string(addslashes($user_obj["profile_blurb"])); $sex = mysql_real_escape_string(addslashes($user_obj["sex"])); $timezone = mysql_real_escape_string(addslashes($user_obj["timezone"])); $tv = mysql_real_escape_string(addslashes($user_obj["tv"])); $last_ip_address = mysql_real_escape_string($_SERVER["REMOTE_ADDR"]); $db = openWorkingSetWrite(); if (is_array($usr = existing_user($user, $db))) { // existing user if (isset($facebook)) { $query = "update tracking set about_me='$about_me', activities='$activities', affiliations='$affiliations', birthday='$birthday', books='$books', first_name='$first_name', last_name='$last_name', interests='$interests', locale='$locale', movies='$movies', music='$music', pic_big='$pic_big', profile_blurb='$profile_blurb', gender='$sex', timezone='$timezone', tv='$tv', most_recent_visit=NOW(), last_ip_address='$last_ip_address', fb_pageviews=(fb_pageviews+1) where uid='$user'"; $result = mysql_query($query, $db); } else { $result = true; // to pass test below } } else { // new user if (isset($facebook)) { $query = "insert into tracking ( uid, first_visit, about_me, activities, affiliations, birthday, books, first_name, last_name, interests, locale, movies, music, pic_big, profile_blurb, gender, timezone, tv, most_recent_visit, fb_pageviews, last_ip_address ) values ( '$user', NOW(), '$about_me', '$activities', '$affiliations', '$birthday', '$books', '$first_name', '$last_name', '$interests', '$locale', '$movies', '$music', '$pic_big', '$profile_blurb', '$sex', '$timezone', '$tv', NOW(), 1, '$last_ip_address' )"; } else { $query = "insert into tracking (uid, first_visit) values ('$user', NOW())"; } $result = mysql_query($query, $db); } if ($result === false) { $msg = addslashes("Got MySQL error: " . mysql_error($db) . "(" . mysql_errno($db) . ") on query: $query"); dbg($msg, $user, "data.php(trackuser)", 3); } return $usr; } else { return null; } } function increment_highest_step($user, $sv, $pf, $os, $pv, $br, $dv, $st) { $db = openWorkingSetWrite(); $user = mysql_real_escape_string($user); $sv = mysql_real_escape_string($sv); $pf = mysql_real_escape_string($pf); $os = mysql_real_escape_string($os); $pv = mysql_real_escape_string($pv); $br = mysql_real_escape_string($br); $dv = mysql_real_escape_string($dv); $st = mysql_real_escape_string($st); // 4 is currently the highest step $query = "update tracking set highest_step_reached=LEAST(4, $st), dig_version='$dv', productVersion='$sv', platform='$pf', osVersion='$os', browser='$br', productBuildVersion='$pv' where uid='$user'"; $result = mysql_query($query, $db); if ($result === false) { $msg = addslashes("Got MySQL error: " . mysql_error($db) . "(" . mysql_errno($db) . ") on query: $query"); dbg($msg, $user, "data.php(increment_highest_step)", 3); } } function increment_parties($user) { $user = mysql_real_escape_string($user); $db = openWorkingSetWrite(); if (existing_user($user, $db) === false) { // new user trackuser($user); } // 4 is currently the highest step $query = "update tracking set num_parties=(num_parties+1), last_party=NOW() where uid='$user'"; $result = mysql_query($query, $db); if ($result === false) { $msg = addslashes("Got MySQL error: " . mysql_error($db) . "(" . mysql_errno($db) . ") on query: $query"); dbg($msg, $user, "data.php(increment_highest_step)", 3); } } function increment_fb_pageviews($user) { $user = mysql_real_escape_string($user); $db = openWorkingSetWrite(); if (existing_user($user, $db) === false) { // new user trackuser($user); } // 4 is currently the highest step $query = "update tracking set fb_pageviews=(fb_pageviews+1) where uid='$user'"; $result = mysql_query($query, $db); if ($result === false) { $msg = addslashes("Got MySQL error: " . mysql_error($db) . "(" . mysql_errno($db) . ") on query: $query"); dbg($msg, $user, "data.php(increment_fb_pageviews)", 3); } } function set_shockwave_ever_missing($user) { $user = mysql_real_escape_string($user); $db = openWorkingSetWrite(); if (existing_user($user, $db) === false) { // new user trackuser($user); } $query = "update tracking set shockwave_ever_missing=1 where uid='$user'"; $result = mysql_query($query, $db); if ($result === false) { $msg = addslashes("Got MySQL error: " . mysql_error($db) . "(" . mysql_errno($db) . ") on query: $query"); dbg($msg, $user, "data.php(set_shockwave_ever_missing)", 3); } } ?> Talk about Simisi
digplanet beta 1: Athena
Powered by Disqus digplanet comments powered by Disqus