I made this website quite a while ago for the purpose of grabbing random puu.sh images and displaying them. Also a warning, the content this site shows is user generated, and I can not guarantee it is SFW.
https://dl.dropboxusercontent.com/s/dlb1uke5udz8kwy/index.html
I just started looking at it again, and it appears it has some serious bugs with the systems it uses to gather content. How can I change my javascript so that it doesn't spam out puu.sh, and make it refuse connections?
Here is the code:
var currentThumb = 0;
function getImgUrl()
{
    var text = (Math.round(Math.random() * 9)).toString();
    //var text = '3T';
    var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    for(var i=0; i < 4; i++ )
        text += possible.charAt(Math.floor(Math.random() * possible.length));
    return 'http://puu.sh/' + text;
}
function open_in_new_tab(url)
{
  var win=window.open(url, '_blank');
  win.focus();
}
function getImages()
{
    //var width = window.innerWidth;
    var images = 10;
    for(var i = 0;i < images;i++)
    {
        var url = getImgUrl();
        document.getElementById('thumbs').innerHTML += '<img class="thumb" id="thumb' + i + '" src=' + url + '>';
        if(i == 0)
        {
            document.getElementById('fullimage').innerHTML = '<img id="big" src=' + url + '>';
            $('#thumb' + currentThumb).css('border','2px solid white');
        }
    }
}
function refreshImages()
{
    var images = 10;
    for(var i = 0;i < images;i++)
    {
        var url = getImgUrl();
        $('#thumb' + i).attr('src',url);
    }
    $('img').css('border','');
    $('#thumb' + currentThumb).css('border','2px solid white');
}
function resize()
{
    var width = $(window).width();
    var height = $(window).height();
    $('#fullimage img').css('max-width',width);
    $('#fullimage img').css('max-height',height - 87);
}
function setBig()
{
    $('#big').attr('src',($('#thumb' + currentThumb).attr('src')));
    $('img').css('border','');
    $('#thumb' + currentThumb).css('border','2px solid white');
    resize();
}
getImages();
$('img').error(function() {
    $(this).attr('src',getImgUrl());
    setBig();
});
$('#thumbs img').click(function() {
    $('#fullimage').html('<img id="big" src=' + $(this).attr('src') + '>');
    currentThumb = parseInt($(this).attr("id").match(/\d+/));
    $('img').css('border','');
    $(this).css('border','2px solid white');
    resize();
});
$('#fullimage').click(function() {
    open_in_new_tab($('#fullimage img').attr('src'));
});
$(window).resize(function() {
    resize();
});
$(document).ready(function() {
    resize();
});
The problem most likely lies in
$('img').error(function() {
    $(this).attr('src',getImgUrl());
    setBig();
});