Note that there are some explanatory texts on larger screens.

plurals
  1. POphp-Facebook redirect after registration?
    primarykey
    data
    text
    <p>I am using the php sdk in order to login the users to the website. Also I am using the redirect_uri to redirect to login.php I am setting up a cookie with the user id. Then I am checking if the cookie exists I am using the header function in order to dircet the users back to main.php</p> <pre><code>&lt;?php if(isset($_COOKIE['id']) == false){ require_once('scripts/facebook.php'); $config = array('appId' =&gt; 'xxx','secret' =&gt; 'xxx'); $params = array('scope' =&gt; 'email,offline_access,user_birthday', 'redirect_uri' =&gt; 'http://www.xxx.com/login.php'); $facebook = new Facebook($config); $user = $facebook-&gt;getUser(); if($user) { try { $user_profile = $facebook-&gt;api('/me','GET'); $userid = $user_profile['username']; //insert cookie $expire = time() + 31556926; $cookie_id = $user_profile['username']; setcookie("id", $cookie_id, $expire); header('Location: main.php'); } catch(FacebookApiException $e) { $login_url = $facebook-&gt;getLoginUrl($params); echo '&lt;img src="assets/login.png"&gt;&lt;br&gt;'; echo '&lt;a href="' . $login_url . '"&gt;&lt;img src="assets/facebook_login.png"&gt;&lt;/a&gt;'; error_log($e-&gt;getType()); error_log($e-&gt;getMessage()); } } else { $login_url = $facebook-&gt;getLoginUrl($params); echo '&lt;img src="assets/login.png"&gt;&lt;br&gt;'; echo '&lt;a href="' . $login_url . '"&gt;&lt;img src="assets/facebook_login.png"&gt;&lt;/a&gt;'; }//end facebook }else{ //if cookie id is set header('Location: main.php'); } ?&gt; </code></pre> <p>now, the problem is when the user authenticated the app, it is redirecting to the login page. which means that the php page is not getting refreshed. How can I solve this problem ? UPDATE: if the user refresh the page or click login again he will be automatically redirected to main ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload