function Person($id) { if (preg_match('/@/', $id)) { $this->id = db_getOne('select id from person where lower(email) = ? for update', strtolower($email)); } elseif (preg_match('/^[1-9]\\d*$/', $id)) { $this->id = db_getOne('select id from person where id = ? for update', $id); } else { err('value passed to person constructor must be person ID or email address'); } if (is_null($this->id)) { err("No such person '{$id}'"); } list($this->email, $this->name, $this->password, $this->website, $this->numlogins) = db_getRow_list('select email, name, password, website, numlogins from person where id = ?', $id); }
function stash_check_for_post_redirect() { /* Are we doing a POST redirect? */ $key = get_http_var('stashpost'); if (!$key) { return; } global $stash_in_stashpost; $stash_in_stashpost = true; /* Extract the post data */ list($method, $url, $post_data) = db_getRow_list('select method, url, post_data from requeststash where key = ?', $key); if (is_null($method)) { err(_("If you got the email more than a year ago, then your request has probably expired. Please try doing what you were doing from the beginning."), E_USER_NOTICE); } /* Postgres/PEAR DB BYTEA madness -- see comment in auth.php. */ $post_data = pg_unescape_bytea($post_data); $pos = 0; $stashed_POST = rabx_wire_rd(&$post_data, &$pos); if (rabx_is_error($stashed_POST)) { err("Bad serialised POST data in stash_check_for_post_redirect('{$key}')"); } /* Fix $_POST to make this look like one */ $_POST = $stashed_POST; # print_r($stashed_POST); }