Skip to content

Instantly share code, notes, and snippets.

@ennjoy
Created June 29, 2019 15:56
Show Gist options
  • Save ennjoy/fd43c063b596109db80f85e6b6cdd3ed to your computer and use it in GitHub Desktop.
Save ennjoy/fd43c063b596109db80f85e6b6cdd3ed to your computer and use it in GitHub Desktop.
screen_name.php
<?php
$screen_name = isset($_REQUEST['screen_name']) ? secure($_REQUEST['screen_name']) : false;
$access_token = check_token();
$result = array();
if (!$screen_name) {
error(2, 'not found screen_name');
}
$result = mysqli_fetch_assoc(mysqli_query($sqlConnect, "SELECT `user_id` as `object_id`, 'user' as `type` FROM ". T_USERS ." WHERE `username` = '$screen_name' UNION SELECT `page_id` as `object_id`, 'page' as `type` FROM ". T_PAGES ." WHERE `pagename` = '$screen_name' UNION SELECT `id` as `object_id`, 'group' as `type` FROM ". T_GROUPS ." WHERE `group_name` = '$screen_name'"));
if (!$result) {
error(3, 'screen_name - '.$screen_name.' is incorrect');
}
$response = array(
'response' => $result
);
json_encode_cyr($response);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment