/* * Get the http.php file from http://www.phpclasses.org/httpclient */ require 'http.php'; require 'oauth_client.php'; require 'database_oauth_client.php'; require 'mysqli_oauth_client.php'; /* * Create an object of the sub-class of the OAuth client class that is * specialized in storing and retrieving access tokens from MySQL * databases using the mysqli extension * * If you use a different database, replace this class by another * specialized in accessing that type of database */ $client = new mysqli_oauth_client_class(); /* * Define options specific to your database connection */ $client->database = array('host' => '', 'user' => 'oauth', 'password' => 'oauth', 'name' => 'oauth', 'port' => 0, 'socket' => '/var/lib/mysql/mysql.sock'); $client->server = 'Google'; /* * Set the offline access only if you need to call an API * when the user is not present and the token may expire */ $client->offline = true; $client->debug = false; $client->debug_http = true; $client->redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . dirname(strtok($_SERVER['REQUEST_URI'], '?')) . '/mysqli_login_with_google.php'; $client->client_id = ''; $application_line = __LINE__;
$hostParts['host'] = isset($hostParts['host']) ? $hostParts['host'] : ""; if ($hostParts['host'] != CLEAN_HOST) { $_SESSION['continue'] = Open::URL("home"); } else { $_SESSION['continue'] = urldecode($_GET['c']); } } } /* We make an array of Database Details */ $databaseDetails = unserialize(DATABASE); /** * The PHP OAuth Library requires some special items in array, so we add that */ $databaseDetails["password"] = $databaseDetails["pass"]; $databaseDetails["socket"] = "/var/run/mysqld/mysqld.sock"; $client = new mysqli_oauth_client_class(); $client->database = $databaseDetails; $client->server = 'Facebook'; $client->offline = true; $client->debug = true; $client->debug_http = true; $client->redirect_uri = Open::URL('/oauth/login_with_facebook'); $client->client_id = 'fbAppID'; $client->client_secret = 'fbAppSecret'; $client->scope = 'user_about_me,email,user_birthday,user_location,publish_actions'; if ($success = $client->Initialize()) { if ($success = $client->Process()) { if (strlen($client->authorization_error)) { $client->error = $client->authorization_error; $success = false; } elseif (strlen($client->access_token)) {
/* * Get the http.php file from http://www.phpclasses.org/httpclient */ require 'http.php'; require 'oauth_client.php'; require 'database_oauth_client.php'; require 'mysqli_oauth_client.php'; /* * Create an object of the sub-class of the OAuth client class that is * specialized in storing and retrieving access tokens from MySQL * databases using the mysqli extension * * If you use a different database, replace this class by another * specialized in accessing that type of database */ $client = new mysqli_oauth_client_class(); /* * Define options specific to your database connection */ $client->database = array('host' => '', 'user' => 'oauth', 'password' => 'oauth', 'name' => 'oauth', 'port' => 0, 'socket' => '/var/lib/mysql/mysql.sock'); $client->server = 'Twitter'; /* * Set the offline access only if you need to call an API * when the user is not present and the token may expire */ $client->offline = true; $client->debug = true; $client->debug_http = true; $client->redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . dirname(strtok($_SERVER['REQUEST_URI'], '?')) . '/mysqli_login_with_twitter.php'; $client->client_id = ''; $application_line = __LINE__;