overzicht.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. error_reporting(-1); ini_set('display_errors', 'On');
  3. error_reporting(E_ALL);
  4. ini_set("display_errors", 1);
  5. if($stmt = $mysqli -> prepare("SELECT username FROM Twitch WHERE uid = ?")){
  6. $stmt -> bind_param("i", $userid);
  7. $stmt -> execute();
  8. $stmt -> bind_result($TwitchUsername);
  9. $stmt -> fetch();
  10. $stmt -> close();
  11. }
  12. if(isset($TwitchUsername))
  13. {
  14. $ch = curl_init();
  15. curl_setopt($ch, CURLOPT_URL, "https://api.twitch.tv/kraken/users/".$TwitchUsername."/follows/channels");
  16. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  17. $jsonreturn = json_decode(curl_exec($ch), true);
  18. curl_setopt($ch, CURLOPT_URL, "https://api.twitch.tv/kraken/users/".$TwitchUsername);
  19. $userdata = json_decode(curl_exec($ch), true);
  20. }
  21. ?>
  22. <head>
  23. <style type="text/css">
  24. title {
  25. font-size: 200%;
  26. }
  27. </style>
  28. </head>
  29. <div class="col-lg-12">
  30. <div class="ibox float-e-margins">
  31. <div class="ibox-title">
  32. <h5>Twitch Integratie</h5>
  33. <div class="ibox-tools">
  34. <a class="collapse-link">
  35. <i class="fa fa-chevron-up"></i>
  36. </a>
  37. <a class="dropdown-toggle" data-toggle="dropdown" href="#">
  38. <i class="fa fa-wrench"></i>
  39. </a>
  40. <ul class="dropdown-menu dropdown-user">
  41. <li><a href="twitch.php?i=configuration">Configure Twitch Account</a></li>
  42. </ul>
  43. <a class="close-link">
  44. <i class="fa fa-times"></i>
  45. </a>
  46. </div>
  47. </div>
  48. <div class="ibox-content">
  49. <label><?php
  50. if(isset($TwitchUsername))
  51. {
  52. print("Ingelogd als: <br/> <br/> <br/> <img src=".$userdata["logo"]." width=\"100\" height=\"100\">".$userdata["display_name"]);
  53. }
  54. else
  55. {
  56. print("Nog geen twitchaccount toegevoegd");
  57. }
  58. ?> </label>
  59. <br />
  60. <br />
  61. <?php
  62. if(isset($TwitchUsername))
  63. {
  64. print("<label>Aan het volgen:</label>
  65. <br />
  66. <label>");
  67. for($x = 0; $x < count($jsonreturn["follows"]); $x++ )
  68. {
  69. echo "<img src=\"".$jsonreturn["follows"][$x]["channel"]["logo"]."\" width=\"50\" heigth=\"50\">";
  70. echo $jsonreturn["follows"][$x]["channel"]["display_name"]."<br />";
  71. }
  72. }
  73. else
  74. {
  75. print("<html> Voeg een account toe door op het <i class=\"fa fa-wrench\"></i> icoon rechtsboven te klikken. </html>");
  76. }
  77. ?></label>
  78. </div>
  79. </div>
  80. </div>