<commit_before><?php

include __DIR__ . '/../cms-config.php';

include __DIR__ . '/../include/pdo_db_functions.inc.php';
include __DIR__ . '/../include/general_functions.inc.php';
include __DIR__ . '/../include/login.inc.php';

if (is_logged_in()) {

    $id        = filter_input(INPUT_POST, 'id');
    $firstname = filter_input(INPUT_POST, 'firstname');
    $lastname  = filter_input(INPUT_POST, 'lastname');
    $username  = filter_input(INPUT_POST, 'username');
    $email     = filter_input(INPUT_POST, 'email');
    $publicAs  = filter_input(INPUT_POST, 'public_as');
    $active    = filter_input(INPUT_POST, 'active');

    $pdo = getPdoDB();

    $sql = 'UPDATE `users` SET `id`= :id
        ,`firstname`= :firstname
        ,`lastname`= :lastname
        ,`email`= :email
        ,`username`= :username
        ,`public_as`= :public_as
        ,`active`= :active';
    
    $input_parameters = [
        ':id'        => $id,
        ':firstname' => $firstname,
        ':lastname'  => $lastname,
        ':email'     => $email,
        ':username'  => $username,
        ':public_as' => $publicAs,
        ':active'    => $active
    ];
        
        try {

            $stmt = $pdo->prepare($sql);
            $stmt->execute($input_parameters);
            
        } catch (PDOException $ex) {
            
            echo $ex->getMessage();
            exit();
            
        }
        
        header ( 'Location: index.php?uri=user' );
}<commit_msg>update, clean code<commit_after><?php

session_start();

include __DIR__ . '/../cms-config.php';

include __DIR__ . '/../include/pdo_db_functions.inc.php';
include __DIR__ . '/../include/general_functions.inc.php';

if (is_logged_in()) {

    $id        = filter_input(INPUT_POST, 'id');
    $firstname = filter_input(INPUT_POST, 'firstname');
    $lastname  = filter_input(INPUT_POST, 'lastname');
    $username  = filter_input(INPUT_POST, 'username');
    $email     = filter_input(INPUT_POST, 'email');
    $publicAs  = filter_input(INPUT_POST, 'public_as');
    $active    = filter_input(INPUT_POST, 'active');

    $pdo = getPdoConnection();

    $sql = 'UPDATE `users` SET `firstname`= :firstname
        ,`lastname`= :lastname
        ,`email`= :email
        ,`username`= :username
        ,`active`= :active';

    try {
        $stmt = $pdo->prepare($sql);

        $stmt->bindParam(':firstname', $firstname);
        $stmt->bindParam(':lastname', $lastname);
        $stmt->bindParam(':email', $email);
        $stmt->bindParam(':username', $username);
        $stmt->bindParam(':active', $active);

        $stmt->execute();
    } catch (PDOException $ex) {
        echo $ex->getMessage();
        exit();
    }

    header ( 'Location: index.php?uri=user' );
}
{'fraction_non_alphanumeric': 0.17619220968329086, 'fraction_numerical': 0.0, 'mean_word_length': 2.4696969696969697, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '6155648', 'n_tokens_mistral': 921, 'n_tokens_neox': 903, 'n_words': 159}