<commit_before><?php
//error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);

session_start();

if (!isset($_SESSION["is_auth"])) {
	header("location:login.php");
	exit;
}
if(isset($_POST['submit'])){
    $isbn = $_POST['isbn'];
    $library_choice = $_POST['library_choice'];
    $add_delete = $_POST['add_delete'];
    $user_id = $_SESSION['user_id'];
}else{<commit_msg>Added function to strip/replace all but digits from ISBN and check for 10 or 13 digits or display message.<commit_after><?php
//error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);

session_start();

if (!isset($_SESSION["is_auth"])) {
	header("location:login.php");
	exit;
}

function strip_all($string) {
    $string = trim($string);
    $string = strtolower($string);
    $string = preg_replace("/[^0-9]+/", "", $string);
    $string = str_replace(" +", "", $string);
    return $string;
}

// get POST array data
if(isset($_POST['submit'])){
    $isbn = $_POST['isbn'];
    $isbn = strip_all($isbn);
    if (strlen($isbn) != 10 && strlen($isbn) != 13) {
        echo "Please enter 10 or 13 digit ISBN number.";
    }	
    $library_choice = $_POST['library_choice'];
    $add_delete = $_POST['add_delete'];
    $user_id = $_SESSION['user_id'];
}else{
{'fraction_non_alphanumeric': 0.19634340222575516, 'fraction_numerical': 0.012718600953895072, 'mean_word_length': 4.775229357798165, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2436914', 'n_tokens_mistral': 446, 'n_tokens_neox': 430, 'n_words': 93}