php - How to set url parameters in an array? -


O people, I am using OpenID authentication on my website and after certifying, I am getting the URL from open providers, Yahoo and Google.

http://www.mysite.com/openid-login.php? Openid.identity = https: //me.yahoo.com/a/1234567& Openid.ax.value.nickname = John & amp; Openid.ax.value.email=john@yahoo.co.in& Http://www.mysite.com/openid-login.php? Openid.identity = https: //www.google.com/accounts/o8/1234567& Openid.ext1.value.email=kevin@gmail.com& OpenID.ext1.value.country = IN

I have sorted the URL a bit for clarity. I would like to create a single function for both, which can set up the email (if it exists) ), The nickname (if exits), returns an identity in the array (openID INA) and return the value. for example.

function userdetails (array_get) {...... ...... back $ userdetails; } $ Userdetails = userdetails ($ _ GET);

$ userdetails ['Nickname'] will give me a nickname if it exists and similarly for email and identity. Thank you

I did not make this function nor took credit for it. It was drawn and modified from the simple OpenID library. If someone has a link, please post it in the comment because I do not have access to the original source.

  / ** * How to filter through requested $ _GET array for requested user information. * An array of layoffs will return to userinfo * / public function filterUserInfo ($ arr_get) {$ valid_ax_types = array ('nickname' => 1, 'email' = & gt; 1, 'fullname' => 1, 'Dob' = & gt; 1, 'gender' = & gt;, 'postcode' => 1, 'country' => 1, 'language' => 1, 'timezone' = & Gt; 1, 'First Name' = & gt; 1, 'Last Name' => 1); $ Userinfo = array (); Forex Currency ($ arr_get $ key = & gt; $ value) {// trim $ trimmed_key = substr ($ key, strrpos ($ key, "_") + 1); // Check for valid openid_ext1 values ​​if (stristr ($ key, 'openid_ext1_value')) & amp; Isset ($ value [1])) $ $ userinfo [$ trimmed_key] = $ value; } // Check valid openid_ax values ​​if (stristr ($ key, 'openid_ax_value')) & amp; Isset ($ value [1])) $ $ userinfo [$ trimmed_key] = $ value; } // Check for valid sreg_ values ​​if the stristr ($ key, 'sreg_') & amp; amp; and & quot; array_key_exists ($ trimmed_key, $ arr_ax_types)) {$ userinfo [$ trimmed_key] = $ value; }} Return $ Userinfo; }  

Comments

Popular posts from this blog

MVP, design question -

excel - Populate list via a bi-Condition -

iphone - How do I make a UIPickerView in a UIActionSheet -