Thread: RsPsCoding Auto Vote [474 - 562 - 600+]

Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1 RsPsCoding Auto Vote [474 - 562 - 600+] 
    Registered Member
    Join Date
    Dec 2010
    Posts
    98
    Thanks given
    0
    Thanks received
    21
    Rep Power
    5
    Hi,

    This is a auto voting tutorial without MySQL, every revision and calling back RsPsCoding to check if someone actuelly voted. I am not sad so this also works for the other communities.

    Server Sided

    474 Server Sided
    Spoiler for 474:

    Declare this code in src > server > model > players > client.java

    Code:
    public void checkVote(String playerName, String IP) {
    try {
    String urlString = "http://www.rspscoding.biz/check_vote/call_back.php?ip="+IP+"&id="+serverid+"";
    int serverid = 1;
    int vote_item = 995;
    int vote_item_amount = 20000000;
    urlString = urlString.replaceAll(" ", "_");
    URL url = new URL(urlString);
    BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
    String results = reader.readLine();
    if(results.length() > 0) {
    if(results.equals(serverid) && checkVote2(playerName) == true) {
    c.getItems().addItem(vote_item, vote_item_amount);
    } else {
    c.sendMessage"Our system couldn't find your vote, you might not have voted yet.");
    }
    }
    } catch (MalformedURLException e) {
    System.out.println("Error checking a vote on RsPsCodig.");
    } catch (IOException e) {
    System.out.println("Error checking a vote on RsPsCodig.");
    }
    }
    
    public boolean checkVote2(String playerName) {
    try {
    String urlString = "http://www.domain.com/check_vote.php?username="+playerName+"&auth=JFHDJ484F";
    urlString = urlString.replaceAll(" ", "_");
    BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
    String results = reader.readLine();
    if(results.length() > 0) {
    if(results.equals("true")) {
    return true;
    }
    }
    } catch (MalformedURLException e) {
    //System.out.println("Error in vote check.");
    } catch (IOException e) {
    //System.out.println("Error in vote check.");
    }
    return false;
    }
    In src > server > model > players > packets > Commands.java add the following command "::claim / ::redeem".

    Code:
    if(playerCommand.equalsIgnoreCase("::redeem") || playerCommand.equalsIgnoreCase("::claim")) {
    c.checkVote(c.playerName, Server.playerHandler.players[c.playerId].connectedFrom);
    }


    562 Server Sided
    Spoiler for 562:

    Declare this code in src > com > rs2hd > model > player.java.

    Code:
    public void checkVote(String playerName, String IP) {
    try {
    String urlString = "http://www.rspscoding.biz/check_vote/call_back.php?ip="+IP+"&id="+serverid+"";
    int serverid = 1;
    int vote_item = 995;
    int vote_item_amount = 20000000;
    urlString = urlString.replaceAll(" ", "_");
    URL url = new URL(urlString);
    BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
    String results = reader.readLine();
    if(results.length() > 0) {
    if(results.equals(serverid) && checkVote2(playerName) == true) {
    getInventory().addItem(vote_item, vote_item_amount);
    } else {
    sm("Our system couldn't find your vote, you might not have voted yet.");
    }
    }
    } catch (MalformedURLException e) {
    System.out.println("Error checking a vote on RsPsCodig.");
    } catch (IOException e) {
    System.out.println("Error checking a vote on RsPsCodig.");
    }
    }
    
    public boolean checkVote2(String playerName) {
    try {
    String urlString = "http://www.domain.com/check_vote.php?username="+playerName+"&auth=JFHDJ484F";
    urlString = urlString.replaceAll(" ", "_");
    BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
    String results = reader.readLine();
    if(results.length() > 0) {
    if(results.equals("true")) {
    return true;
    }
    }
    } catch (MalformedURLException e) {
    //System.out.println("Error in vote check.");
    } catch (IOException e) {
    //System.out.println("Error in vote check.");
    }
    return false;
    }
    In src > com > rs2hd > PacketHandler > CommandsPacketHandler.java, add the following command "::claim / ::redeem".

    Code:
    if(cmd[0].equals("::redeem") || cmd[0].equals("::claim")) {
    player.checkVote(player.getUsername(), player.getSession().getRemoteAddress().toString().substring(1).split(":")[0]);
    }


    If you do not have these imported server sided yet, declare these.

    Code:
    import java.net.*;
    import java.io.*;
    If you want to add this automaticly on logging in / relogging on welcome, you can use the code below.

    474

    Search in client.java > "public void initialize() {".

    Code:
    checkVote(c.playerName, Server.playerHandler.players[c.playerId].connectedFrom);
    562

    Search in ActionSender.java > "public void sendLogin() {".

    Code:
    player.checkVote(player.getUsername(), player.getSession().getRemoteAddress().toString().substring(1).split(":")[0]);
    Change the auth code to the auth code you add website sided and the server ID declared as "int serverid = 1;" to your own ID, for example is ID 1 "TkoScape".

    Change the domain name / path / url to yours, remember the action and username which are readed by the GET method in PHP need to be exactly correct.

    Wesite Sided

    Upload the files attached in the attachement of this message to your webhost, the files can be downloaded below.

    Download PsCoding.Vote.rar @ UppIT

    Change the auth code website sided but also server sided, add the map "database" with the maps "vote" and "ip" in the map of your "vote.php" is uploaded in.

    If you cannot download the files you can read them below. If you have downloaded the files and changed the details server and website expecially in "vote.html" the RsPsCoding, RuneLocus and Rune-Server vote URL.

    vote.html

    Code:
    <html>
    <head>
    <title>Vote 4 Server Name</title>
    <script language="JavaScript">
    var votes = 0;
    function vote1() {
    if(votes == 2) {
    document.getElementById('reward').value = 'Reward';
    document.getElementById('form').action = 'vote.php?action=vote';
    }
    votes++;
    document.getElementById('frame').src = 'http://www.rspscoding.org/toplist/vote.php?id=1';
    }
    function vote2() {
    if(votes == 2) {
    document.getElementById('reward').value = 'Reward';
    document.getElementById('form').action = 'vote.php?action=vote';
    }
    votes++;
    document.getElementById('frame').src = 'http://www.runelocus.com/toplist/index.php?action=vote&id=29978';
    }
    function vote3() {
    if(votes == 2) {
    document.getElementById('reward').value = 'Reward';
    document.getElementById('form').action = 'vote.php?action=vote';
    }
    votes++;
    document.getElementById('frame').src = 'http://www.rune-server.org/top.php?act=vote&sid=1602';
    }
    </script>
    <style type="text/css">
    body {
    font-family: calibri, tahoma, verdana, arial, sans-serif;
    background: #1b1b1b url(images/bg.gif);
    color: white;
    }
    </style>
    </head>
    <body>
    <br>
    <center><button style="height: 30px;" onclick="javascript:vote1();">RsPsCoding</button>
    <button style="height: 30px;" onclick="javascript:vote2();">RuneLocus</button>
    <button style="height: 30px;" onclick="javascript:vote3();">Rune-Server</button>
    <form method="post" action="disabled.html" id="form">
    <div style="margin-right: 55px;">
    <br>
    Username: <input style="height: 48px; width: 250px;" type="text" name="username" size="40">
    <input style="height: 50px;" type="submit" id="reward" value="You didn't vote at all sites yet!">
    </div>
    <br><br>
    <iframe id="frame" src="default.html" width="80%" height="75%"></center>
    </form>
    </body>
    </html>
    vote.php

    Code:
    <?php
    function vote($username, $today, $ip) {
    $username2 = str_replace(" ", "_", $username);
    $character = 'database/vote/'.$username2.'-'.$today.'.txt';
    $ip2 = 'database/ip/'.$ip.'-'.$today.'.txt';
    if (file_exists($ip2)) {
    die('<h2 style="color: #ff0000">You already voted or didn\'t claim your reward yet.');
    } else {
    $handle = fopen($ip2, 'w') or die();
    $ip3 = $username2;
    fwrite($handle, $ip3);
    }
    if (!file_exists($character)) {
    $handle = fopen($character, 'w') or die();
    $vote = "true";
    fwrite($handle, $vote);
    } else {
    echo '<h2 style="color: #ff0000">You already voted or didn\'t claim your reward yet.';
    }
    }
    
    $action = $_GET['action'];
    $today = date("m-d-y");
    $ip = $_SERVER['REMOTE_ADDR'];
    
    vote($_POST['username'], $today, $ip);
    ?>
    check_vote.php

    Code:
    <?php
    function vote($username, $today) {
    $character = "database/vote/$username-$today.txt";
    if (file_exists($character)) {
    $handle = fopen($character, 'r');
    echo fread($handle,filesize($character));
    unlink($character);
    } else {
    echo "false";
    }
    }
    
    $auth = "JFHDJ484F";
    
    if(empty($_GET['username'])) {
    echo 'Please insert a username.';
    } else if(empty($_GET['auth'])) {
    echo 'Please insert a ligitimate auth code';
    }
    
    if($_GET['auth'] == $auth) {
    $today = date("m-d-y");
    vote($_GET['username'], $today);
    } else {
    die("Incorrect auth code.");
    exit;
    }
    ?>
    Create the map "database" and add the file "index.php" in this, change the path / url to your website.

    index.php

    Code:
    <?php
    header("Location: http://www.domain.com");
    ?>
    default.html

    Code:
    <style>
    * {
    color: #ffffff;
    }
    </style>
    <br><br><br><br><br><br><br><br><center style="font-family: Arial;"><h1>Please click on the button RsPsCoding, RuneLocus or Rune-Server!</h1><br><h3>Copyright &amp;copy; RsPsCoding - Call Vote Back Project.</h3></center>
    disabled.html

    Code:
    <html>
    <head>
    <title>Disabled, go back and vote</title>
    <style>
    * {
    font-family: Arial;
    }
    </style>
    </head>
    <body>
    <br><br>
    <h1 align="center">You didn't vote on all sites yet, go back and vote.</h1>
    </body>
    If you have questions on doing this you can post it in my PM or in this topic. If any errors occur please report them to me I wrote this out of my head without testing on 2:00 night.

    This is especially made for RsPsCoding server purposes but also for RuneLocus and Rune-Server.

    Credits
    - Apache Ah64

    Kind regards,
    Apache Ah64

    - Founder of RsPsCoding
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Mar 2011
    Posts
    8
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Warning: fopen(database/vote/ip/92.29.114.39-12-08-11.txt) [function.fopen]: failed to open stream: No such file or directory in /home/rhokib11/public_html/vote/vote.php on line 9
    This is the only error im getting.
    Reply With Quote  
     

  3. #3  
    Extreme Donator

    woof woof bish's Avatar
    Join Date
    May 2011
    Age
    26
    Posts
    2,444
    Thanks given
    2,212
    Thanks received
    1,019
    Rep Power
    5000
    Does it work for 614s?
    Edit: the code is terrible tbh.
    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    Banned

    Join Date
    Oct 2011
    Posts
    2,689
    Thanks given
    1,235
    Thanks received
    673
    Rep Power
    0
    nice release apache. used this for my server.
    Reply With Quote  
     

  6. #5  
    Registered Member
    Join Date
    Dec 2010
    Posts
    98
    Thanks given
    0
    Thanks received
    21
    Rep Power
    5
    Quote Originally Posted by KillerR View Post
    This is the only error im getting.
    Fixed

    Replace vote.php with

    Code:
    <?php
    function vote($username, $today, $ip) {
    $username2 = str_replace(" ", "_", $username);
    $character = 'database/vote/'.$username2.'-'.$today.'.txt';
    $ip2 = 'database/ip/'.$ip.'-'.$today.'.txt';
    if (file_exists($ip2)) {
    die('<h2 style="color: #ff0000">You already voted or didn\'t claim your reward yet.');
    } else {
    $handle = fopen($ip2, 'w') or die();
    $ip3 = $username2;
    fwrite($handle, $ip3);
    }
    if (!file_exists($character)) {
    $handle = fopen($character, 'w') or die();
    $vote = "true";
    fwrite($handle, $vote);
    } else {
    echo '<h2 style="color: #ff0000">You already voted or didn\'t claim your reward yet.';
    }
    }
    
    $action = $_GET['action'];
    $today = date("m-d-y");
    $ip = $_SERVER['REMOTE_ADDR'];
    
    vote($_POST['username'], $today, $ip);
    ?>

    Quote Originally Posted by RuneDesign614 View Post
    Does it work for 614s?
    Edit: the code is terrible tbh.
    I will also convert it to 614, and I know the code is terrible because I got a headache of reading it myself LOL.
    Reply With Quote  
     

  7. Thankful user:


  8. #6  
    محمد

    Jamili's Avatar
    Join Date
    Jun 2010
    Posts
    405
    Thanks given
    93
    Thanks received
    249
    Rep Power
    307
    Credits to Stuart? (1776)

    Spoiler for Honorable mentions:

    Quote Originally Posted by JRFisher View Post
    Dude, learn yourself, it took me 17 months of continuous research to learn how to import a project.
    Quote Originally Posted by Pollution View Post
    When? And Idiot, I'm using a oldschool, it's not easy to get the command for an oldschool, retard c u.
    Quote Originally Posted by Waj_Assif View Post
    I sayin u dont contribute never aall u do is finna tryin attack ppl and always finna start fights .......
    Quote Originally Posted by Kris View Post
    You must be one of those slower breeds.
    Quote Originally Posted by Gandalf View Post
    Just piss off ploter hacker fella dumb fuck. Your a donor to a rsps community, I'm a Mainowner to a Private Server thats 7+ Years old. Lmfao kid, get a life. Don't let my name come out of your mouth again. Or it wont end nicely for you. Understand me big boy?
    Quote Originally Posted by Tojad View Post
    What do you know about Public Void and int without this [] is only 1 integer, why?
    Reply With Quote  
     

  9. Thankful user:


  10. #7  
    Registered Member
    Join Date
    Dec 2010
    Posts
    98
    Thanks given
    0
    Thanks received
    21
    Rep Power
    5
    Quote Originally Posted by Mercenary View Post
    Credits to Stuart? (1776)
    Who's Stuart?
    Reply With Quote  
     

  11. #8  
    Member

    Join Date
    Jul 2011
    Posts
    164
    Thanks given
    12
    Thanks received
    24
    Rep Power
    0
    getting a few annoying errors

    Code:
    src\server\model\players\Client.java:553: int cannot be dereferenced
    String results = reader.readLine();
                           ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 error
    Press any key to continue . . .
    Code:
    src\server\model\players\Client.java:552: int cannot be dereferenced
    BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(
    )));
                                                                        ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 error
    Press any key to continue . . .
    i've already tried fixing it but i couldnt quite manage doing that
    Reply With Quote  
     

  12. #9  
    Registered Member
    Join Date
    Dec 2010
    Posts
    98
    Thanks given
    0
    Thanks received
    21
    Rep Power
    5
    Quote Originally Posted by EnvyPvP View Post
    getting a few annoying errors

    Code:
    src\server\model\players\Client.java:553: int cannot be dereferenced
    String results = reader.readLine();
                           ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 error
    Press any key to continue . . .
    Code:
    src\server\model\players\Client.java:552: int cannot be dereferenced
    BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(
    )));
                                                                        ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 error
    Press any key to continue . . .
    i've already tried fixing it but i couldnt quite manage doing that
    You didn't add the imports.
    Reply With Quote  
     

  13. #10  
    Member

    Join Date
    Jul 2011
    Posts
    164
    Thanks given
    12
    Thanks received
    24
    Rep Power
    0
    yes i did
    heres my import list
    Code:
    import java.util.LinkedList;
    import java.util.ArrayList;
    import java.util.Queue;
    import java.util.concurrent.Future;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.InputStreamReader;
    import java.io.BufferedReader;
    import java.net.*;
    import java.io.*;
    
    import server.event.CycleEventHandler;
    
    import java.io.IOException;
    import org.apache.mina.common.IoSession;
    import server.Config;
    import server.Server;
    import java.net.URL;
    import server.model.npcs.*;
    import java.net.MalformedURLException;
    import java.io.InputStreamReader;
    import java.io.BufferedReader;
    import java.io.IOException;
    import server.model.items.ItemAssistant;
    import server.model.shops.ShopAssistant;
    import server.net.HostList;
    import server.net.Packet;
    import server.net.StaticPacketBuilder;
    import server.util.Misc;
    import server.model.players.skills.Summoning;
    import server.util.Stream;
    import server.util.MadTurnipConnection;
    import server.model.players.skills.*;
    import server.event.EventManager;
    import server.event.Event; 
    import server.model.players.PlayerSave;
    import server.model.players.PlayerHandler;
    import server.event.EventContainer;
    import server.model.minigames.WarriorsGuild;
    import server.model.minigames.Gambling;
    import server.model.minigames.*;
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [Help] Auto vote
    By Udang in forum Application Development
    Replies: 2
    Last Post: 03-13-2012, 12:29 PM
  2. RsPsCoding [Toplist / Commnity]
    By apache ah64 in forum Website Development
    Replies: 17
    Last Post: 07-30-2011, 09:55 PM
  3. I need help with my auto vote system
    By auto talker in forum Help
    Replies: 0
    Last Post: 07-27-2011, 03:33 PM
  4. Paying for Auto-Vote and Auto-Donate
    By football1smylife in forum Help
    Replies: 5
    Last Post: 01-22-2011, 08:44 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •