sandy4 Posted August 21, 2009 Share Posted August 21, 2009 Help! I have a problem with my php and mysql database in that it won't insert into the members database the ip_long and ip_lat information, however it has inserted the ip address and the other user details correctly. Here is what happens, user creates a new account, fill in all his/her details and click submit. In my members database table it shows everything recorded except the ip_long, ip_lat, ip_country, and ip_code. If I fill in manually a latitude and longitude country and code in my members table the google maps marker appears correctly placed. So again my question would be whats stopping it inserting those values? My code below: ////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// function AddMember($data, $extra){ /* THIS FUNCTION WILL GENERATE A NEW MEMBER ACCOUNT */ global $DB; $user = str_replace(" ", "", strip_tags($data['username'])); $email = str_replace(" ", "", strip_tags($data['email'])); $pass = str_replace(" ", "", strip_tags($data['password'])); $default_CC ="United States"; $MSGSTATUS= D_STATUSMSG; $ip = $_SERVER['REMOTE_ADDR']; $session = session_id(); $member_Package_id = DEFAULT_PACKAGE; // DETERMINE ACCOUNT STATUS if(APPROVE_ACCOUNTS == "yes"){ $status = "unapproved"; }else{ $status = "active"; } //////////////////////////////// ## FIRST LETS GET THE DATA FROM THE PACKAGES $packageData = $DB->Row("SELECT * FROM package WHERE pid='".$member_Package_id."' LIMIT 1"); //////////////////////////////////////////// // GEOIP SYSTEM DETECTION // $reg_long=""; $reg_lat=""; $reg_country=""; $reg_code=""; if(!isset($_SESSION['clever_ip_country']) && MAPS_ID !="" && GOOGLE_MAPS_KEY !=""){ $exe_data = explode(",",ValidateExternalCountry($_SERVER['REMOTE_ADDR'])); if(is_array($exe_data) && $exe_data != 0){ $reg_long=$exe_data[4]; $reg_lat=$exe_data[3]; $reg_country=$exe_data[2]; $reg_code=$exe_data[0]; } }elseif( isset($_SESSION['clever_ip_long']) ){ $reg_long = $_SESSION['clever_ip_long']; $reg_lat = $_SESSION['clever_ip_lat']; $reg_country = $_SESSION['clever_ip_country']; $reg_code = $_SESSION['clever_ip_code']; $default_CC = $_SESSION['clever_ip_country_name']; }elseif(isset($data['country'])){ $reg_country = $data['country']; $default_CC =$data['country']; } if(D_MD5 ==1){ $passcode = md5($pass); }else{ $passcode = $pass; } ///////////////////////////////////////////// $DB->Insert("INSERT INTO `members` ( `id` , `username` , `password` , `email` , `session` , `ip` , `lastlogin` , `visible` , active, `created`, packageid, hits, profile_complete, templateid, updated, moderator, activate_code, highlight, ip_long, ip_lat, ip_country, ip_code,member_rating, msgStatus, video_duration, video_live ) VALUES (NULL , '".$user."', '".$passcode."', '".$email."', '".$session."', '".$ip."', '".DATE_TIME."', 'yes', '".$status."', '".DATE_TIME."', '".$member_Package_id."','0','0','1','".DATE_TIME."', 'no', 'OK','off','".$reg_long."','".$reg_lat."','".$reg_country."','".$reg_code."', '0','".goodInput($MSGSTATUS)."','0','no')"); $userid = $DB->InsertID(); Quote Link to comment Share on other sites More sharing options...
sandy4 Posted August 21, 2009 Author Share Posted August 21, 2009 Err no one here? Quote Link to comment Share on other sites More sharing options...
sandy4 Posted August 21, 2009 Author Share Posted August 21, 2009 I have a feeling it is something simple after all why would the ip address get recorded into the database but not the co-ords? Quote Link to comment Share on other sites More sharing options...
mapleleaf Posted August 21, 2009 Share Posted August 21, 2009 echo out these to see if they are set: $reg_long = $_SESSION['clever_ip_long']; $reg_lat = $_SESSION['clever_ip_lat']; $reg_country = $_SESSION['clever_ip_country']; $reg_code = $_SESSION['clever_ip_code']; $default_CC = $_SESSION['clever_ip_country_name']; Quote Link to comment Share on other sites More sharing options...
sandy4 Posted August 23, 2009 Author Share Posted August 23, 2009 Hi, No its not being set. The only output I get is from echo $ip; echo $reg_long; echo $reg_lat; echo $ip; What now? :'( Quote Link to comment Share on other sites More sharing options...
sandy4 Posted August 26, 2009 Author Share Posted August 26, 2009 bump Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted August 26, 2009 Share Posted August 26, 2009 check to make sure you sessions variables are correct. should it be $_SESSION['Clever_IP_country'] or any other combination of uppercase, or lowercase letters. also make sure you put session_start() at the beginning of your php page Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.