Jump to content
bubbles

PHP + facebook login website

Recommended Posts

Posted

Am urmatorul cod :

<?php
session_start();

require 'src/facebook.php';
require 'functions.php';
date_default_timezone_set("Europe/Bucharest");
$facebook = new Facebook(array(
'appId' => '111',
'secret' => '222',
'cookie' => true,
));
$user = $facebook->getUser();
$mail_facebook = trim($femail);



if ($user) {

try {
$user_profile = $facebook->api('/me');
$fbid = $user_profile['id'];
$fbfullname = $user_profile['name'];
$femail = $user_profile['email'];
checkuser($fuid,$funame,$fbfullname,$femail,$fbid);

} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}

}

if ($user) {
$logoutUrl = $facebook->getLogoutUrl(array('next' => 'https://website.ro/logout.php', ));
} else {
$loginUrl = $facebook->getLoginUrl(array('scope'=> 'email', ));
}
?>

Iar pentru a apela link-ul pentru logarea pe site prin facebook folosesc

<?php echo $loginUrl; ?>

Insa nu pot sa-mi explic de ce nu se intampla absolut nimic cand dau click pe acel link de pe o pagina rescrisa cu RewriteRule care are si o variabila de tip GET in url.

Exemple :

RewriteRule test/$ /test.php
RewriteRule ^teste-([^/]*)$ /teste.php?lot=$1 [L]

test.php ->merge
test/ -> merge
teste.php?lot=exam ->merge
teste-examen -> NU MERGE

Posted (edited)

foloseste asta:


RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

Edited by sclipici
  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...