var counter = 0;
function increase() {
counter += 1;
document.getElementById('counter').value = counter;
var  fh = fopen("ad_counter.txt", 3); // Open the file for writing

if(fh!=-1) // If the file has been successfully opened
{
    var str = counter;
    fwrite(fh, str); // Write the string to a file
    fclose(fh); // Close the file
} 
}

