function deals_bh_visits() {
$fichero = "visits_deals.txt";
$fptr = fopen($fichero,"r");
$num = fread($fptr,filesize($fichero));
$num++;
$fptr = fopen($fichero,"w+");
fwrite($fptr,$num);
fclose($fptr);
return ("<span id='days_since'>$num</span>");
}
add_shortcode('deals_bh_visits', 'deals_bh_visits');
I have a problem, but before I will formulate what the following code does, this code creates a text file, with a number that increases each time you reload the web, that number is shown where the shortcode is placed.
I have only one problem, and that is that the file is not created in the same folder where the plugin is, it is created in the root of the web. How can I change the path of the text and believe in the same place?