daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Mar 8th, 2018 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $pageownerID = $cookie['uid'];
  2.  
  3. $xsl_file = 'editprofile.xsl';
  4. $pageargs = array("metanocache" => TRUE, "postargs" => TRUE);
  5. $with_post = false;
  6. $xml_str = null;
  7. $err_xml = null;
  8. $pageOwner = getPageOwner($pageownerID, null, array('lastname', 'email'));
  9.  
  10. if ((isset($_POST['Submit']) && stristr($_POST['Submit'], 'save') !== FALSE) ||
  11.      count($_POST) >= 20) {
  12.  
  13.     $authcode = (isset($_POST['authcode'])) ? $_POST['authcode'] : null;
  14.     if (!verifySaltedUserAuthCode($pageownerID, $authcode))
  15.       dispatchRedirect('/');
  16.  
  17.     $with_post = true;
  18.     $postalcode = "";
  19.     if ($_POST['country'] == "CA") {
  20.         $postalcode = str_replace(" ", "", strtoupper($_POST['zipcode']));
  21.     }
  22.     if ($_POST['gender'] != 'm' && $_POST['gender'] != 'f') {
  23.         $err_xml = getErrorXml("gender");
  24.     } elseif (!$_POST['birthmonth'] || !$_POST['birthday'] || !$_POST['birthyear']) {
  25.         $err_xml = getErrorXml("dob");
  26.     } elseif ($_POST['birthyear'] < 1900 || $_POST['birthyear'] > 2000) {
  27.         $err_xml = getErrorXml("birthyearinvalid");
  28.     } elseif (!checkdate($_POST['birthmonth'], $_POST['birthday'], $_POST['birthyear'])) {
  29.         $err_xml = getErrorXml("dobinvalid");
  30.     } elseif (floor((time() - strtotime("{$_POST['birthyear']}-{$_POST['birthmonth']}-{$_POST['birthday']}")) / 31536000) < 16) {
  31.         // 31536000 = 60 sec * 60 min * 24 hr * 365 days = 1 year, 18 = min age
  32.         $err_xml = getErrorXml("mustbe18");
  33.     } elseif (!$_POST['country']) {
  34.         $err_xml = getErrorXml("country");
  35.     } elseif ($_POST['country'] == "US" &&
  36.               !zipCodeFormatIsValid($_POST['zipcode'])) {
  37.         $err_xml = getErrorXml("zipcodeinvalidformat");
  38.     } elseif ($_POST['country'] == "US" &&
  39.               getLocationByZipCode($_POST['zipcode']) === FALSE) {
  40.         $err_xml = getErrorXml("zipcodeinvalid");
  41.     } elseif ($_POST['country'] == "CA" &&
  42.               !postalCodeFormatIsValid($postalcode)) {
  43.         $err_xml = getErrorXml("postalcodeinvalidformat");
  44.     } elseif ($_POST['country'] == "CA" &&
  45.               getLocationByPostalCode($postalcode) === FALSE) {
  46.         $err_xml = getErrorXml("postalcodeinvalid");
  47.         $_POST['postalcode'] = $_POST['zipcode'];
  48.         unset($_POST['zipcode']);
  49.     } elseif (!isset($_POST['dating_m']) && !isset($_POST['dating_w']) &&
  50.                      !isset($_POST['relationship_m']) && !isset($_POST['relationship_w']) &&
  51.                      !isset($_POST['friends']) && !isset($_POST['activity']) && !isset($_POST['heretohelp'])) {
  52.         $err_xml = getErrorXml("whomeet");
  53.     } elseif (!is_numeric($_POST['status']) ||
  54.               $_POST['status'] < 2 || $_POST['status'] > 9) {
  55.         $err_xml = getErrorXml("status");
  56.     } elseif (isset($_POST['rss']) && strlen($_POST['rss']) && !rssURLIsValid($_POST['rss'])) {
  57.         $err_xml = getErrorXml("rss");
  58.     }
  59.  
  60.     $ndefaults = array("relationship_m", "relationship_w", "dating_m", "dating_w", "friends", "activity");
  61.     foreach ($ndefaults as $col) {
  62.         if (!isset($_POST[$col])) $_POST[$col] = "n";
  63.     }
  64.  
  65.     if (is_null($err_xml)) {
  66.         if ($_POST['country'] == "CA") {
  67.             $_POST['zipcode'] = $postalcode;
  68.             $_POST['postalcode'] = $postalcode;
  69.         } elseif ($_POST['country'] != "US") {
  70.             unset($_POST['zipcode']);
  71.         }
  72.  
  73.  
  74.         if ((isset($_POST['Submit_Shoutout']) && stristr($_POST['Submit_Shoutout'], 'yes') !== FALSE)) {
  75.           saveShoutout($pageownerID, $_POST['shoutout']);
  76.         } else {
  77.           $results = editProfile($pageownerID, $_POST);
  78.           $xml_str .= printStatus($results['status'], $results['message']);
  79.         }
  80.  
  81.         $xml_str .= printStatus(SUCCESS, '');
  82.     } else {
  83.         $xml_str = $err_xml;
  84.     }
  85.  
  86.     $xml_str .= getEditProfile($pageownerID );
  87. } else {
  88.     $xml_str .=  getEditProfile($pageownerID);
  89. }
  90.  
  91. // $xml_str .= getAccountSettings_XML($pageownerID);
  92. $xml_str .= getPageViewer_XML($pageownerID);
  93. $loc_info = array(
  94.                 'uid' => $pageownerID,
  95.                 'country_code' => getFromPost('country'),
  96.                 'region_code' => getFromPost('region'),
  97.                 'userinfo' => $pageOwner
  98.             );
  99. $loc_xml = _getLocationXML($loc_info, $with_post);
  100. $xml_str .= $loc_xml;
  101.  
  102. $xml_str .= formatPageOwner_XML($pageOwner, array('lastname', 'email'));
  103. $xml_str .= generateFormID_XML($pageownerID);
  104.  
  105. echo dispatchRender("xsl/$xsl_file", $xml_str, NULL, $pageargs);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top