Advertisement
Guest User

Untitled

a guest
Feb 26th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. <?php
  2. $valid = 'false';
  3. require_once("passClass.php");
  4. $sql = array();
  5. $sql['host'] = "xxxxxxxxxxxx";
  6. $sql['user'] = "xxxxxxxxxxxxxxxxxx";
  7. $sql['pwd'] = "xxxxxxxxxx";
  8. $sql['db'] = "xxxxxxxxxxxx";
  9.  
  10. $sql['mysql_error'] = "Verbindung zur Datenbank konnte hergestellt werden SQL Array Pr&uuml;fen.";
  11. $sql['db_error'] = "Datenbank konnte gew&auml;hlt werden.";
  12.  
  13. $db = @mysqli_connect($sql['host'], $sql['user'], $sql['pwd']) or die($sql['mysql_error']);
  14. @mysqli_select_db($db,$sql['db']) or die($sql['db_error']);
  15.  
  16. $username = @$_POST['username'];
  17. $password = @$_POST['password'];
  18. $sql = "SELECT password, userID FROM wcf1_user WHERE username = '" . $username . "'";
  19.  
  20. ?>
  21.  
  22. <?php
  23. $result = mysqli_query($db,$sql);
  24. $suche = mysqli_num_rows($result);
  25. $id = 0;
  26.  
  27. if ($suche == '0') {
  28. $valid = 'false0';
  29. //echo "Diesen Benutzer Gibt es nicht";
  30. } else {
  31. while ($row = mysqli_fetch_assoc($result)) {
  32. $test = PasswordUtil::getDoubleSaltedHash($password,$row['password']);
  33. if($test == $row['password']){
  34. $valid = 'true'; // Passwort Stimmt
  35. $id = $row['userID'];
  36. }else{
  37. $valid = 'false'; // Passwort Falsch
  38. }
  39. }
  40. }
  41. if($valid == 'false'){
  42. //echo "Iwas Stimmt nicht!";
  43. echo "Passwort Falsch";
  44. }else if($valid == "false0"){
  45. //echo "Irgentwas ist falsch";
  46. }else{
  47. $sqlA = "SELECT userOption33 FROM wcf1_user_option_value WHERE userID = '".$id."'";
  48. $socialClub = mysqli_query($db,$sqlA);
  49. while ($d = mysqli_fetch_assoc($socialClub)){
  50. $club = $d['userOption33'];
  51. $json = "{\"erlich\":\"" . $valid . "\",\"SocialClub\":\"" . $club . "\"}";
  52. echo toGM("http://54.36.126.228:8888/Login", $json);
  53. }
  54.  
  55. }
  56.  
  57. function toGM($urli,$data){
  58. $url = $urli;
  59. $content = json_encode($data);
  60.  
  61. $curl = curl_init($url);
  62. curl_setopt($curl, CURLOPT_HEADER, false);
  63. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  64. curl_setopt($curl, CURLOPT_HTTPHEADER,
  65. array("Content-type: application/json"));
  66. curl_setopt($curl, CURLOPT_POST, true);
  67. curl_setopt($curl, CURLOPT_TIMEOUT, 10);
  68. curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
  69. $json_response = curl_exec($curl);
  70. $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
  71.  
  72.  
  73. if ( $status != 200 ) {
  74. die("Error: call to URL $url failed with status $status, response $json_response, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl));
  75. }
  76. curl_close($curl);
  77. $response = json_decode($json_response, true);
  78. return $response;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement