vote cast reset time?

Basti

Administrator
Staff member
That takes 2 steps

1) make yourself a cron job which clears the VL_ip_log table unq in data daily at 12 ( midday ). The file the cron job points to, has to have this in it
Place it where settings_sql.php is

PHP:
<?php
//===========================================================================\\
// VisioList is a proud derivative work of:                                  \\
// Aardvark Topsites PHP                                                    \\
// Copyright (c) 2000-2009 Jeremy Scheff.  All rights reserved.              \\
//---------------------------------------------------------------------------\\
// http://www.aardvarktopsitesphp.com/                http://www.avatic.com/ \\
//---------------------------------------------------------------------------\\
// This program is free software; you can redistribute it and/or modify it  \\
// under the terms of the GNU General Public License as published by the    \\
// Free Software Foundation; either version 2 of the License, or (at your    \\
// option) any later version.                                                \\
//                                                                          \\
// This program is distributed in the hope that it will be useful, but      \\
// WITHOUT ANY WARRANTY; without even the implied warranty of                \\
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General \\
// Public License for more details.                                          \\
//===========================================================================\\
// Help prevent register_globals injection
define('ATSPHP', 1); //REMOVE ONCE ALL PLUGINS ARE UPDATED
define('VISIOLIST', 1);
$CONF = array();
$FORM = array();
$TMPL = array();

// Set encoding for multi-byte string functions
mb_internal_encoding("UTF-8");

// Change the path to your full path if necessary
$CONF['path'] = '.';

// Connect to the database
// Set the last argument of $DB->connect to 1 to enable debug mode
require_once ("{$CONF['path']}/settings_sql.php");
require_once ("{$CONF['path']}/sources/sql/{$CONF['sql']}.php");
$DB = "sql_{$CONF['sql']}";
$DB = new $DB;
$DB->connect($CONF['sql_host'], $CONF['sql_username'], $CONF['sql_password'], $CONF['sql_database'], 0);

// Clear vote logs
$DB->query("UPDATE {$CONF['sql_prefix']}_ip_log SET unq_in = 0 WHERE unq_in = 1", __FILE__, __LINE__);

// Close connection
$DB->close();
2) you need a modified version of your plugin. Delete the old one and use the attached plugin instead
 

Attachments

gamespro

New Member
That takes 2 steps

1) make yourself a cron job which clears the VL_ip_log table unq in data daily at 12 ( midday ). The file the cron job points to, has to have this in it
Place it where settings_sql.php is

PHP:
<?php
//===========================================================================\\
// VisioList is a proud derivative work of:                                  \\
// Aardvark Topsites PHP                                                    \\
// Copyright (c) 2000-2009 Jeremy Scheff.  All rights reserved.              \\
//---------------------------------------------------------------------------\\
// http://www.aardvarktopsitesphp.com/                http://www.avatic.com/ \\
//---------------------------------------------------------------------------\\
// This program is free software; you can redistribute it and/or modify it  \\
// under the terms of the GNU General Public License as published by the    \\
// Free Software Foundation; either version 2 of the License, or (at your    \\
// option) any later version.                                                \\
//                                                                          \\
// This program is distributed in the hope that it will be useful, but      \\
// WITHOUT ANY WARRANTY; without even the implied warranty of                \\
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General \\
// Public License for more details.                                          \\
//===========================================================================\\
// Help prevent register_globals injection
define('ATSPHP', 1); //REMOVE ONCE ALL PLUGINS ARE UPDATED
define('VISIOLIST', 1);
$CONF = array();
$FORM = array();
$TMPL = array();

// Set encoding for multi-byte string functions
mb_internal_encoding("UTF-8");

// Change the path to your full path if necessary
$CONF['path'] = '.';

// Connect to the database
// Set the last argument of $DB->connect to 1 to enable debug mode
require_once ("{$CONF['path']}/settings_sql.php");
require_once ("{$CONF['path']}/sources/sql/{$CONF['sql']}.php");
$DB = "sql_{$CONF['sql']}";
$DB = new $DB;
$DB->connect($CONF['sql_host'], $CONF['sql_username'], $CONF['sql_password'], $CONF['sql_database'], 0);

// Clear vote logs
$DB->query("UPDATE {$CONF['sql_prefix']}_ip_log SET unq_in = 0 WHERE unq_in = 1", __FILE__, __LINE__);

// Close connection
$DB->close();
2) you need a modified version of your plugin. Delete the old one and use the attached plugin instead

by cron job you mean modifying the cron.php file?
because i can't find anything related to cron in admincp


edit: after i modified my cron.php and replaced the new plugin

its still showing

Next Vote valid in 3 hours and 16 minutes.
still not 12 hours i need 12 hours interval per ip vote.
 
Last edited:

Basti

Administrator
Staff member
No, not editing cron.php, that is VL core cron file if someone want to use it for a cronjob, undo your changes there


Make yourself a new file, name it whatever you want ( cron_12_hour.php for example ) and place what i wrote into it.
A cron job is added via cpanel for example. There you define how often it should run ( daily at midday ) and the path to the file you just created
 

gamespro

New Member
sorry iam using windows dedicated server with php and apache and task scheduler is not performing still
votes are resetting in 1 week instead of 1 month and vote cast time is still resetting in 3 hours and 6 hours instead of 12 hours :/
 

Basti

Administrator
Staff member
if you cannot add a cron job or sheduled task in your case, you can not enable twice a day voting and have to keep 24 hour voting until scheduler is setup.
( how you need to setup or configure the task later i do not know, no experience on windows )
 

Mark

Administrator
Staff member
I think its a bit more complicated than the cron Basti posted above.

You would need to query the time of the last vote based on IP and username the vote was cast for. Then calculate 12 hours from the last vote by that IP on that username and update the DB according to that.
 

Basti

Administrator
Staff member
Nope, its that simple, using it on several lists.

- between 00:00 - 11:59 allows to vote
custom cron sets unq back to 0 at 12:00 for that ip / user combination
between 12:00 and 00:59 allows to vote cos unq is 0 again for that ip / user combination


Anything else ( real 12 hours ) is not possible, since VL only stores vote log one day, so it has to be done in this way
 

gamespro

New Member
Nope, its that simple, using it on several lists.

- between 00:00 - 11:59 allows to vote
custom cron sets unq back to 0 at 12:00 for that ip / user combination
between 12:00 and 00:59 allows to vote cos unq is 0 again for that ip / user combination


Anything else ( real 12 hours ) is not possible, since VL only stores vote log one day, so it has to be done in this way
so if i am unable to figure it out on windows dedicated server about the cron/task schedular? if i switch to your webhosting service(http://osempire.com/clients/) will it b easy for me to setup the cronjob?
 

Basti

Administrator
Staff member
As far as im aware, Marks hosting comes with cpanel, but not sure if its a extra on dedicated or vps, so dont take me 100% for it. Best to wait for his reply
 

Mark

Administrator
Staff member
Cron job is no problem and is included with all plans.

But to avoid confusion, there is a slight misunderstanding I think as I read through this thread.

gamespro is asking for a 12 hour reset per username and per IP.

Basti's code provides 12 hour reset for the entire list.

Moving to my host will not change this plugins behavior, it will still reset every 12 hours, basically splitting the 24 hour day into 2-12 hour days for the entire list. Which means a user could vote at say 11:45 AM, then the reset happens via scheduled task at 12:00PM noon, that user would be able to vote again at 12:01PM (16 minutes later). But gamespro wants that user to only be able to vote again at 11:45PM which as Basti mentioned is not really possible (well it is, but custom development would be required to do so).

Hopefully I am clarifying more than confusing :)
 

gamespro

New Member
Cron job is no problem and is included with all plans.

But to avoid confusion, there is a slight misunderstanding I think as I read through this thread.

gamespro is asking for a 12 hour reset per username and per IP.

Basti's code provides 12 hour reset for the entire list.

Moving to my host will not change this plugins behavior, it will still reset every 12 hours, basically splitting the 24 hour day into 2-12 hour days for the entire list. Which means a user could vote at say 11:45 AM, then the reset happens via scheduled task at 12:00PM noon, that user would be able to vote again at 12:01PM (16 minutes later). But gamespro wants that user to only be able to vote again at 11:45PM which as Basti mentioned is not really possible (well it is, but custom development would be required to do so).

Hopefully I am clarifying more than confusing :)
ok thanks
btw votes of all websites are also resetting weekly instead of monthly the top list reset timer is showing days for month but its resetting in weeks

Also in the ip log table its showing value of timestamp null for all rows.
 

Mark

Administrator
Staff member
the weekly reset would be caused by your cron setting running weekly. Also ensure your admin settings is set to reset monthly.

Thanks for the ip_log report, I confirmed on my list the timestamp is also NULL. Will post an update for this.
 

gamespro

New Member
the weekly reset would be caused by your cron setting running weekly. Also ensure your admin settings is set to reset monthly.

Thanks for the ip_log report, I confirmed on my list the timestamp is also NULL. Will post an update for this.
okay thanks, also if i switch from my hosting to your osempire hosting
will the medium package of
$8.95/ Month
will work ? for gamespro100.com ?
 

kalle801

Member
i installed your plugin. Do i have to set a cronjob still or does it work out of the box?

Edit: It works! Thank you very much.
 
Last edited:
Top