PHP API (home) (private) - JustDerb/Snack-Tack GitHub Wiki
Private PHP API
Instructions
Just include api/snacktack.php to use the API.
Connecting to the database: Put require_once('api/private/sql_functions.php');
with the includes in the file. See api/private/sql_functions.php for more info.
User Functions
Registering
See api/private/core_user.php for information on functions.
After using the Facebook API to login successfully:
<?php
//$facebook is the object from the Facebook API
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user_profile = null;
}
if ($user_profile) {
if (st_user_isRegistered($user_profile['id'])) {
//User already registered
}
else {
$userArray = st_user_register($user_profile);
//User registered
}
}
?>
Remove event
See Event Functions/Creating a new Event below.