website vote reward

Results 1 to 15 of 15
  1. #1
    Valued Member mafya077 is online now
    MemberRank
    Apr 2014 Join Date
    CabalOnlineLocation
    116Posts

    talk website vote reward

    Hello everyone, I'm trying to adapt the old Vote Reward system to php 5.6 and above, I'm stuck somewhere.

    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:
    USE [CabalCash]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
     alter table CashAccount add votes int not null default 0
    Attached Files Attached Files


  2. #2
    Proficient Member HariSeldon is offline
    MemberRank
    Oct 2019 Join Date
    189Posts

    Re: website vote reward

    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 by HariSeldon; 20-11-21 at 02:30 PM.

  3. #3
    Valued Member mafya077 is online now
    MemberRank
    Apr 2014 Join Date
    CabalOnlineLocation
    116Posts

    note Re: website vote reward

    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.
    Attached Thumbnails Attached Thumbnails _localhost.png  

  4. #4
    Valued Member mafya077 is online now
    MemberRank
    Apr 2014 Join Date
    CabalOnlineLocation
    116Posts

    config Re: website vote reward

    Code:
    Votes = '".($cashAccount->Votes + 1)."'
    I tried what you said but nothing changed, so I found this localhost error.
    Attached Thumbnails Attached Thumbnails _localhost.png  
    Last edited by mafya077; 20-11-21 at 10:54 PM.

  5. #5
    Valued Member mafya077 is online now
    MemberRank
    Apr 2014 Join Date
    CabalOnlineLocation
    116Posts

    Re: website vote reward

    up...

  6. #6
    Valued Member mafya077 is online now
    MemberRank
    Apr 2014 Join Date
    CabalOnlineLocation
    116Posts

    Re: website vote reward

    anyone ?=?

  7. #7
    Valued Member mafya077 is online now
    MemberRank
    Apr 2014 Join Date
    CabalOnlineLocation
    116Posts

    thumbs up Re: website vote reward

    Quote Originally Posted by Qhuongli View Post
    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.

    - - - Updated - - -

    PHP Code:
    foreach($VoteList as $key =&gt$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' '';
                        }
                ?&
    gt;
                &
    lt;tr>
                    &
    lt;td><?php echo $key+1;?></td>
                    &
    lt;td><?php echo htmlspecialchars($value['title']);?></td>
                    &
    lt;td><?php echo (int)$value['points'];?></td>
                    &
    lt;td>
                        &
    lt;?php if(empty($value['time'])){ ?>
                            &
    lt;a href="#" id="vote-<?php echo (int)$value['id'];?>" data-status="can_vote" data-link="<?php echo htmlspecialchars($value['url']);?>" >Vote Now!</a>
                        &
    lt;?php } else { echo 'After '.$time_left; }?>
                &
    lt;/tr>
            &
    lt;?php
                    
    unset($Vote$VoteList);
                }
            ?&
    gt;

            &
    lt;/tbody>
        &
    lt;/table&gt
    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.

  8. #8
    Alpha Member sasuke is offline
    MemberRank
    Oct 2007 Join Date
    In your houseLocation
    1,664Posts

    Re: website vote reward

    Quote Originally Posted by mafya077 View Post
    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.
    can you post the whole full page of the Vote?

  9. #9
    Valued Member mafya077 is online now
    MemberRank
    Apr 2014 Join Date
    CabalOnlineLocation
    116Posts

    thumbs up Re: website vote reward

    PHP Code:
    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](50COLLATE Chinese_PRC_CI_AS NOT NULL,    [lastVoteDate] [datetimeNOT NULL,    [voteLink] [intNULL,    [ip] [nvarchar](50COLLATE Chinese_PRC_CI_AS NULLON [PRIMARY]GOSET ANSI_PADDING OFFalter table CashAccount add votes int not null default 
    Attached Files Attached Files

  10. #10
    Alpha Member sasuke is offline
    MemberRank
    Oct 2007 Join Date
    In your houseLocation
    1,664Posts

    Re: website vote reward

    Quote Originally Posted by mafya077 View Post
    PHP Code:
    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](50COLLATE Chinese_PRC_CI_AS NOT NULL,    [lastVoteDate] [datetimeNOT NULL,    [voteLink] [intNULL,    [ip] [nvarchar](50COLLATE Chinese_PRC_CI_AS NULLON [PRIMARY]GOSET ANSI_PADDING OFFalter table CashAccount add votes int not null default 
    this query gives me an error in the database

  11. #11
    Valued Member mafya077 is online now
    MemberRank
    Apr 2014 Join Date
    CabalOnlineLocation
    116Posts

    Re: website vote reward

    check CashShop >>vote If this table exists, you don't need to rewrite it. and CabalCash >>CashAccount >>Votes

  12. #12
    Alpha Member sasuke is offline
    MemberRank
    Oct 2007 Join Date
    In your houseLocation
    1,664Posts

    Re: website vote reward

    Quote Originally Posted by mafya077 View Post
    check CashShop >>vote If this table exists, you don't need to rewrite it. and CabalCash >>CashAccount >>Votes

    Can you post your CashShop and CabalCash?

  13. #13
    Valued Member monstrebel is offline
    MemberRank
    Jul 2020 Join Date
    100Posts

    Re: website vote reward

    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

  14. #14
    Alpha Member sasuke is offline
    MemberRank
    Oct 2007 Join Date
    In your houseLocation
    1,664Posts

    Re: website vote reward

    Quote Originally Posted by monstrebel View Post
    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?

  15. #15
    Novice baetilt is offline
    MemberRank
    Jul 2020 Join Date
    3Posts

    Re: website vote reward

    Quote Originally Posted by Qhuongli View Post
    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.

    - - - Updated - - -

    PHP Code:
    foreach($VoteList as $key =&gt$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 &gt;= 1) ? $hours.' h :' '';
                            
    $time_left .= ($minutes &gt;= 1) ? ' '.$minutes.' m' '';
                        }
                ?&
    gt;
                &
    lt;tr&gt;
                    &
    lt;td&gt;&lt;?php echo $key+1;?&gt;&lt;/td&gt;
                    &
    lt;td&gt;&lt;?php echo htmlspecialchars($value['title']);?&gt;&lt;/td&gt;
                    &
    lt;td&gt;&lt;?php echo (int)$value['points'];?&gt;&lt;/td&gt;
                    &
    lt;td&gt;
                        &
    lt;?php if(empty($value['time'])){ ?&gt;
                            &
    lt;a href="#" id="vote-&lt;?php echo (int)$value['id'];?&gt;" data-status="can_vote" data-link="&lt;?php echo htmlspecialchars($value['url']);?&gt;" &gt;Vote Now!&lt;/a&gt;
                        &
    lt;?php } else { echo 'After '.$time_left; }?&gt;
                &
    lt;/tr&gt;
            &
    lt;?php
                    
    unset($Vote$VoteList);
                }
            ?&
    gt;

            &
    lt;/tbody&gt;
        &
    lt;/table&gt
    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.



Advertisement