Advertisement
Guest User

Untitled

a guest
Mar 19th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. http://kltools.net/?s=&post_type%5B%5D=portfolio&post_type%5B%5D=post&post_type%5B%5D=page
  2.  
  3. function submitchans(){
  4. for (var i=0;i<chans.length;i++)
  5. { var newHidInp = document.createElement('input');
  6. newHidInp.type = 'hidden';
  7. newHidInp.name = 'chans[]';
  8. newHidInp.value = chans[i];
  9. form.appendChild(newHidInp);
  10. }
  11. }
  12. function livearray(input){
  13. if (input != null) {
  14. chans.push(input);
  15. }
  16. if (Y === cSize){
  17. submitchans();
  18. document.forms[0].submit();
  19. }
  20.  
  21. }
  22.  
  23. <?php
  24. $page_to_load = $_POST[view];
  25. switch($page_to_load) {
  26. case '':
  27. echo "<script src="../scripts/jquery-3.2.0.min.js"></script>";
  28. echo "<script type="application/javascript" src="../scripts/raid.js"></script>";
  29. echo "<font size="+3" color="#FFFFFF">Who should I host?<br>Please wait while channel is selected<br></font>";
  30. echo "<font size="+2">";
  31. echo "<br><br>";
  32. echo "<img src="../_images/ajax_loader_blue_350.gif">";
  33. $servername = "localhost";
  34. $username = "username";
  35. $password = "password";
  36. $dbname = "database";
  37. $chanarray[] = null;
  38. $offline = 0;
  39.  
  40. // Create connection
  41. $conn = new mysqli($servername, $username, $password, $dbname);
  42. // Check connection
  43. if ($conn->connect_error) {
  44. die("Connection failed: " . $conn->connect_error);
  45. }
  46.  
  47. $sql = "SELECT `TwitchNames` FROM TK_Members WHERE Validated='1' AND RaidMe='1'";
  48. $result = $conn->query($sql);
  49.  
  50. if ($result->num_rows > 0) {
  51. // output data of each row
  52. while($row = $result->fetch_assoc()) {
  53. array_push($chanarray, $row['TwitchNames']);
  54. }
  55. } else {
  56. echo "0 results";
  57. }
  58. array_splice($chanarray, 0, 1);
  59. $conn->close();
  60. echo "<script type="application/javascript">";
  61. echo "var channels = ". json_encode($chanarray);
  62. echo "</script>";
  63. echo "</font>";
  64. echo "<form id="form" method="post">";
  65. echo "<input type="hidden" name="view" value="page2">";
  66. echo "</form>";
  67. break;
  68.  
  69. case 'page2':
  70. echo "<font size="+3" color="#FFFFFF">Who should I host?<br>";
  71. echo "Your channel to host is:<br></font>";
  72. echo "<font size="+2">";
  73. echo "<br><br>";
  74. $chans[] = null;
  75. $test = $_POST['outArray'];
  76. foreach ($test as $chan) {
  77. $temparray = array(rand(),$chan);
  78. array_push($chans, $temparray);
  79. }
  80. array_splice($chans,0,1);
  81. sort($chans);
  82. echo "<a href="https://twitch.tv/".$chans[0][1]."" target="_blank">".$chans[0][1]."</a>";
  83. echo "<br><br><br>";
  84. echo "<a href="whoslive.htm" target="_parent">See All Live Channels</a>";
  85. echo "</font>";
  86. break;
  87. }
  88. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement