Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   Уязвимости (https://forum.antichat.xyz/forumdisplay.php?f=74)
-   -   Помогите проанализировать скрипт (https://forum.antichat.xyz/showthread.php?t=167585)

ronald 01.01.2010 21:40

Помогите проанализировать скрипт
 
Здравствуйте, уважаемые форумчане!
Пришла ко мне одна хулиганская идея:
Вы наверняка знакомы с системой интернет-бронирования билетов в кинотеатрах, но не всегда есть хорошие места, и к тому же пустые. Подскажите пожалуйста, можно ли каким-либо образом подготовить запрос, не обладая значением одной переменной (а именно codeword)в функциях cancel_booking и edit_booking, который приведёт к "хорошему" результату ? Вот собственно скрипты:
Код:

$(document).ready(init);

function init() {

        $("#hall_seats_div img").click( function(event) {
                $("#dont_click").show();
                event.stopPropagation();
        });

        var current_timestamp_tz = $("#current_timestamp_tz").text();
        var repertoir_timestamp_tz = $("#repertoir_timestamp_tz").text();
        var repertoir_status = $("#repertoir_status").text();

        if( repertoir_timestamp_tz > current_timestamp_tz ) {
                var multiplex_timezone = $("#multiplex_timezone").text();
                if ( ( multiplex_timezone.length > 0 ) && ( is_compatible ) && ( repertoir_status == '1' ) ) {
                        var repertoir_timestamp = ( repertoir_timestamp_tz - multiplex_timezone *60*60 );
                        var repertoir_time = new Date();
                        repertoir_time.setTime( repertoir_timestamp * 1000 );
                        $("#countdown").countdown({until: repertoir_time, compact: true, onExpiry: countdown_expired });
                        $("#countdown_holder").show();
                };
                var order_state = $("#order_state").text();
                if ( order_state == "1" ) {
                        $("#button_edit").attr("disabled",false);
                        $("#button_cancel").attr("disabled",false);
                        $("#info_actions").show();
                };
        };

        if ( repertoir_timestamp_tz < current_timestamp_tz ) {
                $("#seat_summary").addClass("seat_summary_error");
                $("#seat_summary").html("Всё, сеанс прошёл - соответственно, брони уже нет. Можете посмотреть, как сидели люди в зале :)");
        };

};

function countdown_expired() {
        $("#countdown").addClass("countdown_expired");
        $("#field_name,#button_cancel").attr("disabled","disabled");
};

function cancel_booking() {
        var field_name = $("#field_name");
        var name_value = field_name.attr("value");
        if ( name_value.length == 0 ) {
                field_name.focus();
        } else
        {
                var filmname = $("#filmname").text();
                if ( pageTracker ) { pageTracker._trackEvent("Сессия бронирования","Снятие",filmname); };
                prepare_for_the_end();
                var multiplex_id = $("#field_multiplex_id").text();
                var order_id = $("#field_order_id").text();
                $.ajax({
                        type:                "GET",
                        url:                "/booking/api/cancel_booking/",
                        data:        {
                                        multiplex_id:        multiplex_id,
                                        order_id:        order_id,
                                        codeword:        name_value
                                },
                        success:        cancel_booking_response,
                        error:                cancel_booking_failure
                });


        };
};

function prepare_for_the_end() {
        $("#button_cancel").attr("disabled","disabled");
        $("#button_edit").attr("disabled","disabled");
        $("#booking_action_loader").show();
};

function cancel_booking_response(data, textStatus) {
        var data_status = $("status",data).text();
        if ( data_status == 1 ) {
                show_cancel_results("cancel_success");
        }
        else {
                var statustext = $("result statustext",data).text();
                if ( statustext == "" ) {
                        statustext = "неизвестно, что именно произошло";
                };
                $("#cancel_failure_textstatus").append(statustext);
                show_cancel_results("cancel_failure");
        };
};

function cancel_booking_failure() {
        $("#cancel_failure_textstatus").append("произошла ошибка связи");
        show_cancel_results("cancel_failure");
};


function show_cancel_results( section ) {
        $("#booking_action_loader").hide();
        $("#cancel_results,#"+section).show();
        window.scrollBy(0,200);
};

function edit_booking() {
        var field_name = $("#field_name");
        var name_value = field_name.attr("value");
        if ( name_value.length == 0 ) {
                field_name.focus();
        } else
        {
                var filmname = $("#filmname").text();
                if ( pageTracker ) { pageTracker._trackEvent("Сессия бронирования","Изменение",filmname); };
                prepare_for_the_end();
                var multiplex_id = $("#field_multiplex_id").text();
                var order_id = $("#field_order_id").text();
                $.ajax({
                        type:                "GET",
                        url:                "/booking/api/edit_booking/",
                        data:        {
                                        multiplex_id:        multiplex_id,
                                        order_id:        order_id,
                                        codeword:        name_value
                                },
                        success:        edit_booking_response,
                        error:                edit_booking_failure
                });


        };
};

function edit_booking_response(data, textStatus) {
        var data_status = $("status",data).text();
        if ( data_status == 1 ) {
                var multiplex_id = $("#field_multiplex_id").text();
                var repertoir_id = $("#field_repertoir_id").text();
                var b_session_id = $("b_session_id",data).text();
                location.href = "/booking/selection/" + multiplex_id + "/" + repertoir_id + "/" + b_session_id + "/";
        }
        else {
                var statustext = $("result statustext",data).text();
                if ( statustext == "" ) {
                        statustext = "неизвестно, что именно произошло";
                };
                $("#edit_failure_textstatus").append(statustext);
                show_edit_results("edit_failure");
        };
};

function edit_booking_failure() {
        $("#edit_failure_textstatus").append("произошла ошибка связи");
        show_edit_results("edit_failure");
};

function show_edit_results( section ) {
        $("#booking_action_loader").hide();
        $("#edit_results,#"+section).show();
        window.scrollBy(0,200);
};



Время: 04:00