Fix for Fix for $_GET variable is empty nside of drupal

  1. [Mon Jan 25 23:14:00 2010] [error] [client ::1] Array\n(\n    [q] => user/1/info/place_of_living\n    [lng] => 11.25\n    [lat] => 50.28933925329177\n    [country] => Deutschland\n    [region] => Th\xc3\xbcringen\n    [city] => Neuhaus-Schierschnitz\n)\n, referer: http://localhost:8080/drupal/user/1/info/edit
  2. [Mon Jan 25 23:14:00 2010] [error] [client ::1] Array\n(\n    [q] => user/1/info/place_of_living\n)\n, referer: http://localhost:8080/drupal/user/1/info/edit
  3.  
  4. /**
  5.  * Implements hook_menu().
  6.  * @return
  7.  */
  8. function profileadds_menu() {
  9.         $items['user/%user_uid_optional/info/place_of_living'] = array(
  10.           'page callback' => 'storeGeoData',
  11.           'page arguments' => array(1),
  12.           'access callback' => TRUE,
  13.           'type' => MENU_CALLBACK,
  14.         );
  15.         return $items;
  16. }
  17.  
  18. function storeGeoData ($account) {
  19.        
  20.         $gcity = check_plain($_GET['city']);
  21.         $gcountry = $_GET['country'];
  22.         $gregion = $_GET['region'];
  23.         error_log(print_r($_GET, TRUE));
  24.        
  25.         $query = "SELECT birthdate_month, birthdate_day, birthdate_year, gender, languages, skype, msn, icq, mobile, telephone, address, zipcode, website, relationship, "
  26.                               ." interests, clubs, advicedwebsites"
  27.                         ."  FROM {profileadds} WHERE uid = %d";
  28.                         $result = db_query($query, $account->uid);
  29.         if(db_fetch_object($result)) {
  30.                 $query = "UPDATE {profileadds} SET country = '%s', region = '%s', city = '%s' WHERE uid = %d";
  31.                 db_query($query, $gcountry, $gregion, $gcity, $account -> uid);
  32.         }
  33.         else {
  34.                 $query = "INSERT INTO {profileadds} (uid, country, region, city) VALUES (%d, '%s', '%s', '%s')";
  35.                 db_query($query, $account -> uid, $gcountry, $gregion, $gcity);
  36.         }
  37.        
  38. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.