1 weopine Feb 05, 2010 17:32
3 weopine Feb 10, 2010 21:10
Thank you for your reply. I was successful in implementing the hack and resetting page views, however, I did get this error message once the hack went "live"
Warning: Cannot modify header information - headers already sent by (output started at /home/weopine/public_html/conf/hacks.php:9) in /home/weopine/public_html/inc/skins/_skin.funcs.php on line 379
I just renamed the hack when I was done in case I need it again but, Is it typical for hacks to elicit error messages like this? I"m basically new to doing anything outside the standard configuration so I was just wondering.
Thanks again for your help.
4 sam2kb Feb 10, 2010 21:46
Make sure there's no space or line breaks on line 9.
The file should end with ?>
5 managerblue Apr 21, 2010 14:25
Hi sam2kb i have a ploblem help me, please.
referable: www.blogtika.com
I would like reset page views automatic all blog "admin and users" every 24 hr. You have a code for referable.
6 sam2kb Apr 22, 2010 02:42
managerblue wrote:
Hi sam2kb i have a ploblem help me, please.
referable: www.blogtika.comI would like reset page views automatic all blog "admin and users" every 24 hr. You have a code for referable.
Are you talking about post views or blog stats? To reset blog stats go to Global settings > Features and configure "Hit & session logging" section
7 managerblue Apr 22, 2010 03:49
I'm meaning post views. How to reset post views all blog?
referable: http://members.blogtika.com
All post from all users show at Visit Popular Member "see pic". So i would like to reset post views everyday 24hr. for update new post. Please, suggestion.
8 sam2kb Apr 22, 2010 05:07
Create a file stats_reset.php in blog root directory. Then create a cron job and set it to run the above file every 24 hours.
This should work for you
0 0 * * * /usr/bin/php /real/path/stats_reset.php
stats_reset.php
require_once dirname(__FILE__).'/PATH TO/conf/_config.php';
require_once $inc_path .'_main.inc.php';
$DB->query('UPDATE T_items__item SET post_views = 0');
9 managerblue Apr 22, 2010 05:22
Where for paste stats_reset.php? Please, tell folder.
10 managerblue Apr 22, 2010 05:27
This code it's ok?
<?php
require_once dirname(__FILE__).'/PATH TO/conf/_config.php';
require_once $inc_path .'_main.inc.php';
$DB->query('UPDATE T_items__item SET post_views = 0');
?>
I don't know more about PHP :roll:
11 sam2kb Apr 22, 2010 16:53
managerblue wrote:
Where for paste stats_reset.php? Please, tell folder.
In blog root directory (where your blog index.php is), e.g. /home/username/www/blog/
Don't forget to edit "PATH TO" to the real path to config file. If you put stats_reset.php in blog root, the following should work.
require_once dirname(__FILE__).'/conf/_config.php';
12 managerblue Apr 22, 2010 17:45
Now, it's ok.
This code:
<?php
require_once dirname(__FILE__).'/conf/_config.php';
require_once $inc_path .'_main.inc.php';
$DB->query('UPDATE T_items__item SET post_views = 0');
?>
My question.
1.Automatic reset post views? i world like to reset everyday, how to?
2.How to use stats_reset.php or only type url?
13 sam2kb Apr 22, 2010 17:53
First try to run this file manually in browser, if it works you should configure a cron job to run the file daily.
Read about cron jobs [url=http://www.developertutorials.com/blog/php/running-php-cron-jobs-regular-scheduled-tasks-in-php-172/]here[/url]
14 managerblue Apr 22, 2010 18:32
Where? if i would like to paste or set cron jobs.
Create cron job with a php file? How to.
This my code:
<?php
0 0 * * * /usr/bin/php /home/blogtika/public_html/stats_reset.php
?>
15 sam2kb Apr 22, 2010 18:45
The path is correct, but you can't use it this way.
Please read about cron
http://webmaster.iu.edu/tool_guide_info/crontab.shtml
http://www.pantz.org/software/cron/croninfo.html
16 managerblue Apr 22, 2010 19:01
I save this code
<?php
0 0 * * * /usr/bin/php /home/blogtika/public_html/stats_reset.php
?>
to stats_reset_auto.php and paste to /plublic_html/... it wrong? if i paste stats_reset_auto.php outside .../plublic_html it correct?
17 sam2kb Apr 22, 2010 19:08
You don't need stats_reset_auto.php
Please read the info I linked to, you can create cron job in cPanel or directly linux shell.
18 managerblue Apr 22, 2010 19:49
After i find tools in cpanel. I use cron jobs for set your code.
Now, it work!
Good friend, Thank you.
19 sam2kb Apr 22, 2010 19:55
No problem :)
Welcome to the forums!
There's no option to reset the counter from control panel.
What you can do is create a file /conf/hacks.php with the following code
Then you can reset views for post 777 by adding index.php?reset_views=777 to your blog URL