andre 4 years ago
parent
commit
bbcaac5ba6
1 changed files with 4 additions and 4 deletions
  1. 4 4
      index.php

+ 4 - 4
index.php

@@ -9,11 +9,11 @@ if ($db->connect_errno){
 $db->set_charset('utf8');
 $db->set_charset('utf8');
 
 
 function checkToken($token,$db) {
 function checkToken($token,$db) {
-    $dbAction = $db->prepare("SELECT * FROM client WHERE token = '123456a'");
-//    $dbAction->bind_param('s',$token);
+    $dbAction = $db->prepare("SELECT description FROM clients WHERE token = '?'");
+    $dbAction->bind_param('s',$token);
     $dbAction->execute();
     $dbAction->execute();
     $dbAction->bind_result($token, $description);
     $dbAction->bind_result($token, $description);
-    echo "$description" . PHP_EOL;
+    echo "$description";
     if ($dbAction->num_rows == 1){
     if ($dbAction->num_rows == 1){
         return true;
         return true;
     }
     }
@@ -28,7 +28,7 @@ function set($ip,$db) {
 
 
 if (checkToken($token,$db)){
 if (checkToken($token,$db)){
     if(set(ip2long($ip),$db)){
     if(set(ip2long($ip),$db)){
-        echo "$token inserted $ip" . PHP_EOL;
+        echo " inserted $ip" . PHP_EOL;
     } else {
     } else {
         echo "fehler" . PHP_EOL;
         echo "fehler" . PHP_EOL;
     };
     };