Credits for voting?

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
How can I make it so that after someone votes, they get credits?
 
@Sledmore
When they vote , they get redirected to a secret page, which redirects them back to client. On the secret page just few lines of code:
PHP:
<?php
$amount = 5000;
$lastTime = mysql_fetch_assoc(mysql_query("SELECT lastGiven FROM user_rewards WHERE username='".$_SESSION['user']['username']."'"));
if(mysql_num_rows($lastTime) < 1){
mysql_query("INSERT INTO user_rewards (lastGiven, username) VALUES ('".time()."', '".$_SESSION['user']['username']."')");
mysql_query("UPDATE users SET `credits` = (`credits` + '".$amount."') WHERE username='".$_SESSION['user']['username']."'");
mysql_query("UPDATE user_rewards SET lastGiven = '".time()."' WHERE username='".$_SESSION['user']['username']."'");
}
if((date(H, $lastTime) - time()) > 23){
mysql_query("UPDATE users SET `credits` = (`credits` + '".$amount."') WHERE username='".$_SESSION['user']['username']."'");
mysql_query("UPDATE user_rewards SET lastGiven = '".time()."' WHERE username='".$_SESSION['user']['username']."'");
}
header(Location: "/client");
?>
And Create This Table:
user_rewards
lastGiven -> Timestamp (Length 0 , Decimal 0)
username -> Varchar (Length 50, Decimal 0)

Okay. Rest is up to you ! This is just something I coded real fast.
 

Sab

I love milfs.
Jun 25, 2011
1,212
136
When they vote , they get redirected to a secret page, which redirects them back to client. On the secret page just few lines of code:
PHP:
<?php
$amount = 5000;
$lastTime = mysql_fetch_assoc(mysql_query("SELECT lastGiven FROM user_rewards WHERE username='".$_SESSION['user']['username']."'"));
if(mysql_num_rows($lastTime) < 1){
mysql_query("INSERT INTO user_rewards (lastGiven, username) VALUES ('".time()."', '".$_SESSION['user']['username']."')");
mysql_query("UPDATE users SET `credits` = (`credits` + '".$amount."') WHERE username='".$_SESSION['user']['username']."'");
mysql_query("UPDATE user_rewards SET lastGiven = '".time()."' WHERE username='".$_SESSION['user']['username']."'");
}
if((date(H, $lastTime) - time()) > 23){
mysql_query("UPDATE users SET `credits` = (`credits` + '".$amount."') WHERE username='".$_SESSION['user']['username']."'");
mysql_query("UPDATE user_rewards SET lastGiven = '".time()."' WHERE username='".$_SESSION['user']['username']."'");
}
header(Location: "/client");
?>
And Create This Table:
user_rewards
lastGiven -> Timestamp (Length 0 , Decimal 0)
username -> Varchar (Length 50, Decimal 0)

Okay. Rest is up to you ! This is just something I coded real fast.

White screen.
 

Sab

I love milfs.
Jun 25, 2011
1,212
136
Are you able to put the sql in for me I think I did it wrong causing the page not to work.
 
Last edited:

Users who are viewing this thread

Top