forked from xmakina/TweetToList
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.php
More file actions
59 lines (48 loc) · 1.7 KB
/
Copy pathauth.php
File metadata and controls
59 lines (48 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
include "twitter-async/EpiCurl.php";
include "twitter-async/EpiOAuth.php";
include "twitter-async/EpiTwitter.php";
include "db.class.php";
include "config.php";
include "secret.php";
function SetUpAuthorisation($oauth_token) {
$twitterObj = new EpiTwitter(CONSUMER_KEY, CONSUMER_SECRET);
$twitterObj->setToken($oauth_token);
$token = $twitterObj->getAccessToken();
$twitterObj->setToken($token->oauth_token, $token->oauth_token_secret);
try {
$twitterInfo = $twitterObj->get("/account/verify_credentials.json");
} catch (Exception $e) {
header("Location: sendtweet.php");
die("ERROR" . $e);
}
$twitterID = $twitterInfo->id;
setcookie("twitterid", $twitterID);
setcookie("oauth_token", $token->oauth_token);
setcookie("oauth_token_secret", $token->oauth_token_secret);
}
try {
// Being pased back from Twitter, time to authenticate and get access
SetUpAuthorisation($_GET["oauth_token"]);
} catch (EpiTwitterException $e) {
echo "We caught an EpiOAuthException";
echo $e->getMessage();
header("Location: sendtweet.php");
die("Something went wrong. Please email bugs@omnisoft.co.uk");
} catch (Exception $e) {
echo "We caught an unexpected " . $e->__toString();
echo $e->getMessage();
header("Location: sendtweet.php");
die("Something went wrong. Please email bugs@omnisoft.co.uk");
}
if ($_COOKIE["broadcast"] == true) {
header("Location: broadcast.php");
die();
}
if (isset($_COOKIE["listid"]) && isset($_COOKIE["message"])) {
$listid = $_COOKIE["listid"];
$message = $_COOKIE["message"];
header("Location: sendtweet.php?listid=$listid&message=$message");
}
header("Location: sendtweet.php");
?>