<commit_before><?php
require 'util.php';

function display_request_info_gbp($uid, $reqid)
{
    $query = "
        SELECT name, bank, acc_num, sort_code
        FROM uk_requests
        WHERE reqid='$reqid'
    ";
    $result = do_query($query);
    $row = mysql_fetch_assoc($result);
    if (!$row)
        return;
    echo "<p>Name: {$row['name']}</p>\n";
    echo "<p>Bank: {$row['bank']}</p>\n";
    echo "<p>Account number: {$row['acc_num']}</p>\n";
    echo "<p>Sort code: {$row['sort_code']}</p>\n";
}
function display_request_info_btc($uid, $reqid)
{
    $query = "
        SELECT addy
        FROM bitcoin_requests
        WHERE reqid='$reqid'
    ";
    $result = do_query($query);
    $row = mysql_fetch_assoc($result);
    if (!$row)
        return;
    echo "<p>Bitcoin address: {$row['addy']}</p>\n";
}
function display_request_info_intnl($uid, $reqid)
{
    $query = "
        SELECT iban, swift
        FROM international_requests
        WHERE reqid='$reqid'
    ";
    $result = do_query($query);
    $row = mysql_fetch_assoc($result);
    if (!$row)
        return;
    echo "<p>IBAN: {$row['iban']}</p>\n";
    echo "<p>BIC/SWIFT: {$row['swift']}</p>\n";
}

$reqid = get('reqid');
$uid = user_id();

if (isset($_POST['cancel_request'])) {
    # cancel an order
    $query = "
        UPDATE
            requests,
            purses
        SET
            requests.status='CANCEL',
            purses.amount=purses.amount+requests.amount
        WHERE
            reqid='$reqid'
            AND requests.uid='$uid'
            AND requests.uid=purses.uid
            AND purses.type=requests.curr_type
            AND status='VERIFY'
    ";
    do_query($query);
    ?><div class='content_box'>
        <h3>Cancelled!</h3>
        <p>Request <?php echo $reqid; ?> is no more.</p>
    </div><?php
}
else {
    $query = "
        SELECT
            req_type,
            amount,
            curr_type,<commit_msg>query uses ANSI form instead.<commit_after><?php
require 'util.php';

function display_request_info_gbp($uid, $reqid)
{
    $query = "
        SELECT name, bank, acc_num, sort_code
        FROM uk_requests
        WHERE reqid='$reqid'
    ";
    $result = do_query($query);
    $row = mysql_fetch_assoc($result);
    if (!$row)
        return;
    echo "<p>Name: {$row['name']}</p>\n";
    echo "<p>Bank: {$row['bank']}</p>\n";
    echo "<p>Account number: {$row['acc_num']}</p>\n";
    echo "<p>Sort code: {$row['sort_code']}</p>\n";
}
function display_request_info_btc($uid, $reqid)
{
    $query = "
        SELECT addy
        FROM bitcoin_requests
        WHERE reqid='$reqid'
    ";
    $result = do_query($query);
    $row = mysql_fetch_assoc($result);
    if (!$row)
        return;
    echo "<p>Bitcoin address: {$row['addy']}</p>\n";
}
function display_request_info_intnl($uid, $reqid)
{
    $query = "
        SELECT iban, swift
        FROM international_requests
        WHERE reqid='$reqid'
    ";
    $result = do_query($query);
    $row = mysql_fetch_assoc($result);
    if (!$row)
        return;
    echo "<p>IBAN: {$row['iban']}</p>\n";
    echo "<p>BIC/SWIFT: {$row['swift']}</p>\n";
}

$reqid = get('reqid');
$uid = user_id();

if (isset($_POST['cancel_request'])) {
    # cancel an order
    $query = "
        UPDATE
            requests
        JOIN
            purses
        ON
            purses.uid=requests.uid
            AND purses.type=requests.curr_type
        SET
            requests.status='CANCEL',
            purses.amount=purses.amount+requests.amount
        WHERE
            reqid='$reqid'
            AND requests.uid='$uid'
            AND status='VERIFY'
    ";
    do_query($query);
    ?><div class='content_box'>
        <h3>Cancelled!</h3>
        <p>Request <?php echo $reqid; ?> is no more.</p>
    </div><?php
}
else {
    $query = "
        SELECT
            req_type,
            amount,
            curr_type,
{'fraction_non_alphanumeric': 0.16987426225301513, 'fraction_numerical': 0.0010264305876315114, 'mean_word_length': 2.218827415359207, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 47, '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': '5239998', 'n_tokens_mistral': 1340, 'n_tokens_neox': 1336, 'n_words': 256}