Jump to content

Minecraft Voting for Diamonds Script Help Required


LegacyP7

Recommended Posts

Hello everyone.

I recently coded a Minecraft Voting for Diamonds script. Basically, you enter your username, you vote on the sites, then click "Get Reward". The reward then goes through a RCON script, and rewards the user with their diamonds in-game. the full script works fine, and I am happy with it, but there is one small problem; and that is users being able to abuse the system. If they wanted to, they could just refresh the page, and click Get Rewarded again, and again. I want to make something like this:

 

20aubnr.png

 

It has a countdown on the link, which is started upon click, and then the link re-activates when the timer is done. My script already has "disabled=..." tags, so you have to click all links, this way would make sure a user cannot click the link until the timer is done. I'm pretty new to PHP, and please forgive me if it is not 100% PHP, but this place seemed extremely helpful. I am also pretty new to PHP, so make it for dummies xD

 

Thanks everyone!

Link to comment
Share on other sites

Hi and welcome.

 

You havent had any responses as your question is a little vague.  Perhaps if you explain what you have accomplished, what you have tried and what is failing...maybe by posting some of your code, any errors you get, etc you may get more help. 

 

Will

Link to comment
Share on other sites

I could be misunderstanding your problem, but it sounds like sessions would solve your problem.  For example, when the user claims the diamonds create a session that signifies that they've gotten their diamonds. 

 

Here's an example:

 

<?php
session_start();

if(isset($_SESSION['gotDiamonds'])) {
  echo'You've already gotten diamonds!';
} else {
  //proceed with giving them diamonds
  $_SESSION['gotDiamonds'] = true;
}
?>

Link to comment
Share on other sites

I could be misunderstanding your problem, but it sounds like sessions would solve your problem.  For example, when the user claims the diamonds create a session that signifies that they've gotten their diamonds. 

 

Here's an example:

 

<?php
session_start();

if(isset($_SESSION['gotDiamonds'])) {
  echo'You've already gotten diamonds!';
} else {
  //proceed with giving them diamonds
  $_SESSION['gotDiamonds'] = true;
}
?>

 

Hello. Can sessions be deleted after 24 hours? And created when the user clicks a button to get their reward? If so, that would work well.

However, I like the idea of the countdown on the button. When the button is clicked, it becomes disabled, and the countdown starts. When the countdown becomes 0, the button re-activates.

How can I make this?

 

Thanks

Link to comment
Share on other sites

If you store it in sessions, the user would only need to close their browser and open it up again to "cheat". You will probably need to store some info like their IP address, in your database.

How can I do this? I don't want anyone cheating :P

Link to comment
Share on other sites

EDIT: Now using "setrawcookie" to prevent cheating, and URL encoding.

 

 

Start Page:

<center>


Vote here for free <font color='#3F92D1'><b>DIAMONDS!</b></font>
<br/>
<br/>
Enter your EXACT username!
<form method='POST' action='1new.php'>
<br/>
<input type="text" name='username' id='user' class='text'>
<br/>
<input type="submit" class='submit'> 
</form>

</center>

 

Second Page:

<?php



$username = $_POST['username'];


echo ("<font color='blue'>$username is logged in! </font><img src='http://cdn1.iconfinder.com/data/icons/drf/PNG/lock.png'>");

?>

//Buttons here

<?php

if(isset($_COOKIE["reward"])) {
  echo "You've already voted from this IP today!";
} else {
  echo ("<input type='submit' value='Get Reward' id='submit'/>");
}
?>

 

Set Cookies Page:

<?php

$username = $_POST['username'];

setrawcookie("reward", time()+60);

?>

 

Last Page:

<?php

$username = $_POST['username'];



print ("<font face='Arial' color='cyan'>$username");
echo ( " thank you for voting today! Come back in 24 hours to vote again!</font>" );
?>

 

Obviously, there is lots of HTML and CSS in there, but it would use up pages :P

 

Is there any way I can improve the code, and make it more secure?

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.