OSDN Git Service

b10ee3549cba67dd59ddb84e80e8816ecf180f03
[embrj/master.git] / ajax / getRelationship.php
1 <?php\r
2         if(!isset($_SESSION)){\r
3                 session_start();\r
4         }\r
5         include_once("../lib/twitese.php");\r
6         if(!isset($_GET['target'])){\r
7                 echo "error";\r
8                 exit;\r
9         }\r
10         $target = trim($_GET['target']);\r
11         $t = getTwitter();\r
12         $source = isset($_GET['source']) ? trim($_GET['source']) : $t->username;\r
13         if($target == '' || $source == ''){\r
14                 echo "error";\r
15                 exit;\r
16         }\r
17         $analysis = getRelationship($target, $source);\r
18         switch($analysis){\r
19                 case 1:\r
20                         $result = '<h3 style="color:#00805F;text-shadow:1px 1px #FFFFFF;">They\'re following each other. How sweet!</h3>';\r
21                         break;\r
22                 case 2:\r
23                         $result = '<h3 style="margin-top: 80px; text-shadow: 1px 1px rgb(255, 255, 255); color: rgb(0, 128, 95);">\r
24                                                 <a href="user.php?id='.$source.'">@'.$source.'</a> is following <a href="user.php?id='.$target.'">@'.$target.'</a>\r
25                                                 </h3>\r
26                                            <h3 style="margin-top: 5px; color: rgb(131, 22, 31); text-shadow: 1px 1px rgb(255, 255, 255);">\r
27                                            <a href="user.php?id='.$target.'">@'.$target.'</a> is NOT following <a href="user.php?id='.$source.'">@'.$source.'</a>\r
28                                                 </h3>';\r
29                         break;\r
30                 case 3:\r
31                         $result = '<h3 style="margin-top: 80px; text-shadow: 1px 1px rgb(255, 255, 255); color: rgb(0, 128, 95);">\r
32                                                 <a href="user.php?id='.$target.'">@'.$target.'</a> is following <a href="user.php?id='.$source.'">@'.$source.'</a>\r
33                                                 </h3>\r
34                                            <h3 style="margin-top: 5px; color: rgb(131, 22, 31); text-shadow: 1px 1px rgb(255, 255, 255);">\r
35                                            <a href="user.php?id='.$source.'">@'.$source.'</a> is NOT following <a href="user.php?id='.$target.'">@'.$target.'</a>\r
36                                                 </h3>';\r
37                         break;\r
38                 case 4:\r
39                         $result = '<h3 style="color: rgb(131, 22, 31); text-shadow: 1px 1px rgb(255, 255, 255);">\r
40                                                 <a href="user.php?id='.$source.'">@'.$source.'</a> is blocking <a href="user.php?id='.$target.'">@'.$target.'</a>\r
41                                                 </h3>';\r
42                         break;\r
43                 case 9:\r
44                         $result = '<h3 style="color:#666666;text-shadow: 1px 1px rgb(255, 255, 255);">It seems that they don\'t know each other!</h3>';\r
45                         break;\r
46         }\r
47         $html = $result;\r
48         echo $html;\r
49 ?>