Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

website vote reward

Junior Spellweaver
Joined
Apr 24, 2014
Messages
117
Reaction score
7
Hello everyone, I'm trying to adapt the old Vote Reward system to php 5.6 and above, I'm stuck somewhere.:grr:

After voting, the cash is loaded into the account without any problems, but when the time comes for the second vote, it votes forever without specifying the time.

The problem is that after the second vote, it doesn't report time again, and the reward is added by voting constantly.

Exemplary Vote System=https://forum.ragezone.com/f458/vote-reward-system-v0-3-a-798843/




Code:
[COLOR=#666666]USE [CabalCash][/COLOR]GO
/****** Object:  Table [dbo].[votes]    Script Date: 09/15/2011 01:03:54 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[votes](
    [accName] [varchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,
    [lastVoteDate] [datetime] NOT NULL,
    [voteLink] [int] NULL,
    [ip] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
 [COLOR=#666666]alter table CashAccount add votes int not null default 0[/COLOR]
 

Attachments

You must be registered for see attachments list
RaGEZONE VIP
[VIP] Member
Joined
Oct 10, 2019
Messages
198
Reaction score
458
Show the contents of the votes table after the first vote and after the second vote.

upd

I'm not sure which of the two principles of use was implied in this script, so I will write problems in 2 versions.

1. If you want to store only one record for each user in the votes table, you need to make changes on line 72 (check if a record exists for this user. If yes - use UPDATE. If not - INSERT).

2. If you want to record each vote on a separate line, you need to add sorting to the query on line 36 (ORDER BY [lastVoteDate] DESC).
 
Last edited:
Upvote 0
Junior Spellweaver
Joined
Apr 24, 2014
Messages
117
Reaction score
7
Code:
// update cash account        $db->query("UPDATE CabalCash.dbo.CashAccount SET         Cash = '".($cashAccount->Cash + $data['cash'])."',        Votes = '".($cashAccount->Votes + 1)."'        WHERE ID= '".$data['accountName']."'        ");

I tried what you said but nothing changed, so I found this localhost error.
 

Attachments

You must be registered for see attachments list
Upvote 0
Junior Spellweaver
Joined
Apr 24, 2014
Messages
117
Reaction score
7
Code:
Votes = '".($cashAccount->Votes + 1)."'

I tried what you said but nothing changed, so I found this localhost error.
 

Attachments

You must be registered for see attachments list
Last edited:
Upvote 0
Junior Spellweaver
Joined
Apr 24, 2014
Messages
117
Reaction score
7
Maybe it has a trigger to rollback voting time or voting countdown to older date when the level column or value is updated.

Or try to add value intervals.



PHP:
foreach($VoteList as $key => $value){
                    if(!empty($value['time'])){
                        $hours = floor(((3600 * $value['hours'] - (time() - $value['time'])) / 3600));
                        $minutes = floor((((3600 * $value['hours'] - (time() - $value['time'])) % 3600) / 60));
                        $time_left = ($hours >= 1) ? $hours.' h :' : '';
                        $time_left .= ($minutes >= 1) ? ' '.$minutes.' m' : '';
                    }
            ?>
            <tr>
                <td><?php echo $key+1;?></td>
                <td><?php echo htmlspecialchars($value['title']);?></td>
                <td><?php echo (int)$value['points'];?></td>
                <td>
                    <?php if(empty($value['time'])){ ?>
                        <a href="#" id="vote-<?php echo (int)$value['id'];?>" data-status="can_vote" data-link="<?php echo htmlspecialchars($value['url']);?>" >Vote Now!</a>
                    <?php } else { echo 'After '.$time_left; }?>
            </tr>
        <?php
                unset($Vote, $VoteList);
            }
        ?>

        </tbody>
    </table>

Code:
$check['updateVoteTime'] = $db->query("delete from CashShop.dbo.votes where lastVoteDate <= '".date('Y-m-d H:i:s')."'");

Thanks for your help, I forgot to update the vote time.:rolleyes:
 
Upvote 0
Junior Spellweaver
Joined
Apr 24, 2014
Messages
117
Reaction score
7
PHP:
USE [CashShop]GO/****** Object:  Table [dbo].[votes]    Script Date: 12/06/2011 21:20:49 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGOCREATE TABLE [dbo].[votes](    [accName] [varchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,    [lastVoteDate] [datetime] NOT NULL,    [voteLink] [int] NULL,    [ip] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL) ON [PRIMARY]GOSET ANSI_PADDING OFFalter table CashAccount add votes int not null default 0
 

Attachments

You must be registered for see attachments list
Upvote 0
Joined
Oct 10, 2007
Messages
1,772
Reaction score
187
PHP:
USE [CashShop]GO/****** Object:  Table [dbo].[votes]    Script Date: 12/06/2011 21:20:49 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGOCREATE TABLE [dbo].[votes](    [accName] [varchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,    [lastVoteDate] [datetime] NOT NULL,    [voteLink] [int] NULL,    [ip] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL) ON [PRIMARY]GOSET ANSI_PADDING OFFalter table CashAccount add votes int not null default 0

this query gives me an error in the database
 
Upvote 0
Junior Spellweaver
Joined
Apr 24, 2014
Messages
117
Reaction score
7
check CashShop >>vote If this table exists, you don't need to rewrite it. and CabalCash >>CashAccount >>Votes
 
Upvote 0
Junior Spellweaver
Joined
Jul 15, 2020
Messages
100
Reaction score
15
just some idea how i would do this...

1. use UCVS. u can google the source code.
2. if vote success (the vote site ping your ip with $GET/$POST), update table containing voters username with time.
3. everytime player want to vote, make the php to check for ($lastvote+12hour).
4. if $lastvote+12hour > 1, allow player to vote.and repeat step 2.

it is much easier than using the old vote reward system. i have tried it before
 
Upvote 0
Joined
Oct 10, 2007
Messages
1,772
Reaction score
187
just some idea how i would do this...

1. use UCVS. u can google the source code.
2. if vote success (the vote site ping your ip with $GET/$POST), update table containing voters username with time.
3. everytime player want to vote, make the php to check for ($lastvote+12hour).
4. if $lastvote+12hour > 1, allow player to vote.and repeat step 2.

it is much easier than using the old vote reward system. i have tried it before

can you post your change?
 
Upvote 0
Initiate Mage
Joined
Jul 20, 2020
Messages
3
Reaction score
0
Maybe it has a trigger to rollback voting time or voting countdown to older date when the level column or value is updated.

Or try to add value intervals.



PHP:
foreach($VoteList as $key => $value){
                    if(!empty($value['time'])){
                        $hours = floor(((3600 * $value['hours'] - (time() - $value['time'])) / 3600));
                        $minutes = floor((((3600 * $value['hours'] - (time() - $value['time'])) % 3600) / 60));
                        $time_left = ($hours >= 1) ? $hours.' h :' : '';
                        $time_left .= ($minutes >= 1) ? ' '.$minutes.' m' : '';
                    }
            ?>
            <tr>
                <td><?php echo $key+1;?></td>
                <td><?php echo htmlspecialchars($value['title']);?></td>
                <td><?php echo (int)$value['points'];?></td>
                <td>
                    <?php if(empty($value['time'])){ ?>
                        <a href="#" id="vote-<?php echo (int)$value['id'];?>" data-status="can_vote" data-link="<?php echo htmlspecialchars($value['url']);?>" >Vote Now!</a>
                    <?php } else { echo 'After '.$time_left; }?>
            </tr>
        <?php
                unset($Vote, $VoteList);
            }
        ?>

        </tbody>
    </table>

I wouldn't trust him with anything. He's Darkcodex#3286 on Discord, and he's an absolute scammer. He will consistently mislead you, pressure you, harass you, and continue to push you to pay him without any work being done.He's an absolute failure of a coder, having coded nothing, with nothing to prove, and he can't genuinely work on anything. All his payment methods are scams, and nothing is a real name.His PayPal name is Samsudin Mama, while his friends call him Mark, and some banks called him by Chrisphor. Nothing he says is ever reliable, so I wouldn't even consider purchasing anything from him or his friends. They are a developer group at Devest Forums, and they are the absolute worst in anything.I won't publicly show the messages here, but message me and I'll provide them.Also, his actual name is Christoper zen aguio Alegre, so if you see this name anywhere, you should avoid interacting with him and being part of him. He and his friends aren't actual coders, but run a scamming business.
 
Upvote 0
Back
Top