Fair Compensation and Website Security

Just throwing a question out there. What would you deem fair compensation if somebody found a security exploit in your website?

This particular exploit that I discovered offered access to half of a members credit card number, as well as personal information [i.e. - full name, address, etc] for every order on their [e-commerce] website.

Since first finding the exploit, I have also been able to exploit the download section of the website. I can gain access to every file on the site, without having to purchase them. I am still waiting on a return phone call on this particular issue.

What do you think [a] I was offered and [b] what I should have been offered?

Nick

Using JQuery to clear a div [or an element]

JQuery continues to make things easy on us. The following code will remove all of the children elements from the parent.

$('#idOfElement').empty();

Now, that was easy, eh?

Nick

Using ORDER BY with UPDATE

Yep, you read the title correctly. This problem presented itself when I needed a quick and dirty way to update an auto_increment [a_i] field in a database. I wanted to move the a_i field up by n, where a_i > x. The query looked like this:

UPDATE table_name SET id = (id + n) WHERE id > x ORDER BY id DESC

To see why one must do it this way, try to do the query without the ORDER BY.

Nick

mysqli_num_rows() functionality

Warning: mysqli_num_rows() [function.mysqli-num-rows]: Function cannot be used with MYSQL_USE_RESULT

Does this error look familiar? Yeah, weird that even though you are using mysqli_, it says MYSQL_; trust me, I know. Instead of using mysqli_use_result(), try mysqli_store_result(). Problem sloved.

Nick

JavaScript and Image Galleries

For one of my recent freelance projects, I was tasked with creating an image gallery. I wanted the gallery to cycle continuously [i.e. - end to beginning when next is clicked, beginning to end when prev is clicked]; however, when the image was loading [i.e. - it is uncached], I wanted a ‘Loading …’ bar to display. I started to overthink the solution at first; however, the solution turned out to be rather easy. Please note, this solution has only been tested in FF3 and IE6.

function updateImage() {
document.location.hash = currentImage;

var image = document.getElementById('galleryImage');

image.src = documentRoot + galleryName + currentImage + imageSuffix;

// If the image has fully loaded, we are ready to display
// the image, and take away the loading bar.
image.onload = hideLoading;
}

/*********************************************************/

function showLoading() {
document.getElementById('loadingBar').style.display = 'block';
document.getElementById('galleryImage').style.display = 'none';
}

/*********************************************************/

function hideLoading() {
document.getElementById('loadingBar').style.display = 'none';
document.getElementById('galleryImage').style.display = 'block';
}