<commit_before>//prototype code
//Added security check for sql injection
//Updated with proper sql commands
//needs to be tested

<?php
   define('DB_SERVER', 'localhost');
   define('DB_USERNAME', 'kompir');
   define('DB_PASSWORD', '<PASSWORD>');
   define('DB_NAME', 'home_automation');
   $db = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
  
   if (mysqli_connect_errno()) {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }

   $small_lamp = mysqli_real_escape_string($db, $_GET['small_lamp_p']);
   $pechka = mysqli_real_escape_string($db, $_GET['pechka']);
   $big_lamp = mysqli_real_escape_string($db, $_GET['big_lamp']);
   $_password = mysqli_real_escape_string($db, $_GET['password']);

   if ($small_lamp) {
       $db->query("UPDATE `".DB_NAME."` SET `small_lamp` = ".$small_lamp.";");
   }
   if ($pechka) {
       $db->query("UPDATE `".DB_NAME."` SET `pechka` = ".$pechka.";");
   }
   if ($big_lamp) {
       $db->query("UPDATE `".DB_NAME."` SET `big_lamp` = ".$big_lamp.";");
   }
   if ($_password) {
       $db->query("UPDATE `".DB_NAME."` SET `password` = ".$_password.";");
   }

   mysql_close($db);
 ?><commit_msg>Update modifyingDBbyGet.php<commit_after>//prototype code
//Added security check for sql injection
//Updated with proper sql commands
//needs to be tested

<?php
   define('DB_SERVER', 'localhost');
   define('DB_USERNAME', 'kompir');
   define('DB_PASSWORD', '<PASSWORD>');
   define('DB_NAME', 'home_automation');
   define('PASSWORD', '<PASSWORD>');
   $db = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);

   if (mysqli_connect_errno()) {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }

   $small_lamp = mysqli_real_escape_string($db, $_GET['small_lamp_p']);
   $pechka = mysqli_real_escape_string($db, $_GET['pechka']);
   $big_lamp = mysqli_real_escape_string($db, $_GET['big_lamp']);
   $_password = mysqli_real_escape_string($db, $_GET['password']);

   if ($_password == PASSWORD) {
       if ($small_lamp) {
           $db->query("UPDATE `small_lamp` SET `on` = ".$small_lamp.";");
       }
       if ($pechka) {
           $db->query("UPDATE `pechka` SET `power` = ".$pechka.";");
       }
       if ($big_lamp) {
           $db->query("UPDATE `big_lamp` SET `big_lamp` = ".$big_lamp.";");
       }
   }

   mysql_close($db);
 ?>
{'fraction_non_alphanumeric': 0.1890631623569309, 'fraction_numerical': 0.0, 'mean_word_length': 3.8559670781893005, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '740239', 'n_tokens_mistral': 874, 'n_tokens_neox': 846, 'n_words': 161}