Thread: Martin's Auto Donation System

Page 1 of 32 12311 ... LastLast
Results 1 to 10 of 313
  1. #1 Martin's Auto Donation System 
    Registered Member

    Join Date
    Sep 2007
    Age
    32
    Posts
    2,396
    Thanks given
    5
    Thanks received
    436
    Rep Power
    902
    IF YOU DID BEFORE POST 140 AND HAVE A PROBLEM LOOK AT THE FIX AT THE BOTTOM OR IN POST 140
    IF YOU DID THIS BEFORE POST 86, SEE THIS FIX: http://www.rune-server.org/runescape...ml#post2712349

    Well i've had this too long, and its being sold left right and centre which is a bit unfair considering pretty much everyone has it. SO lets get going! (PS this has the dupe fixes)

    If you wish to send me some money feel free to at [email protected], all money I receive usually goes towards beer so its a great investment from your point of view, once you do that I usally come on drunk and send me my shit code, so its usually well worth it.

    Credits:
    Me
    Graham (For the default paypal ipn file)(Could never find the download)
    Sabsabionline (For leeching / selling it to yall without the dupe fixes )

    Few things to keep in mind, I wrote this a long time ago it was one of my first html / php scripts so its kinda shit , If you want my new and improved one visit this thread:

    Few things before you start, IF YOU USE A FREE WEBHOST THEY USUALLY DO NOT SUPPORT REMOTE MYSQL SO OPEN A SUPPORT TICKET BEFORE YOU COMPLAIN HERE.

    Website Side:

    OK there's a few php files to upload but lets start first. In this tutorial I'm going to use CPanel, its the biggest in web management so it should work for all of you.

    OK so login to your cpanel on your webhost, and go into "MySQL databases"
    In here we will create a new database.

    Look for the heading "Create New Database", below here type in your database name, usually something to do with donate, so type in donate and click "Create Database", Once done, click the "go back" button, and you should be back on the previous screen.

    Now scroll down to "MySQL Users", in here we will add a new mysql user (NOTE SOME PHP VERSIONS DON'T SUPPORT RANDOMLY GENERATED PASSWORDS, (i.e some symbols), So i recommend you set it yourself.

    Then click create user. And write down the username and password (preferably in real life in some kind of notepad as that cant usually be stolen + your friends are prob tards, so they wont have a clue what its for).The scroll down to "Add User To Database" here select your username, and add it to the database you created earlier. The next screen will ask about permissions, just tick all the boxes and click "OK".

    Ok now, we will go back to CPanel's main page. Here click into "PhpMyAdmin". Once youve logged into phpMyAdmin, On the left there is a list of all your databases. Click the database you created in the first step. Once in here click the "SQL" tab. This will bring up a dialog box, copy and paste the below code and click the "Go" button.

    Code:
    CREATE TABLE IF NOT EXISTS `donation` (
      `username` varchar(32) NOT NULL,
      `time` varchar(100) NOT NULL,
      `productid` varchar(100) NOT NULL,
      `price` decimal(10,0) NOT NULL,
      `tickets` int(11) NOT NULL,
      `index` int(11) NOT NULL AUTO_INCREMENT,
      PRIMARY KEY (`index`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
    Ok nearly done!!!! (With mysql)
    Now here is a zip file: http://rs2-server.com/downloads/rune...r_release2.zip

    What you must do with this zip file, is upload it to your webhost. And extract it. (ITS BEST TO UPLOAD TO A DIRECTORY CALLED DONATE and extract in there)

    Once these files have been extracted we want to edit "db.php", In here we set our database setting from the first few steps. So replace
    USERNAME with your USERNAME
    PASSWORD with your PASSWORD
    DATABASE with your DATABASE

    simple enough. Now go back to your CPanel's main page, and click into "Remote MySQL". In here you MUST add your dedicated servers IP, or the hosters IP Address. If you don't do this, nothing will work.....

    Server Side
    Ok its simple enough. First we create a new class called MadTurnipConnection.java
    (IF YOUR USING PI, IT MUST NOT BE PUT IN "package server", so put it in "package server.util")

    Below is the following code for Project Insanity, If people want delta just request and ill post it.

    Code:
    package server.util;
    
    import java.sql.*;
    import server.model.players.Client;
    
    public class MadTurnipConnection extends Thread {
    
    	public static Connection con = null;
    	public static Statement stm;
    
    	public static void createConnection() {
    		try {
    			Class.forName("com.mysql.jdbc.Driver").newInstance();
    			con = DriverManager.getConnection("jdbc:mysql://website/database", "username", "password");
    			stm = con.createStatement();
    		} catch (Exception e) {
    			e.printStackTrace();
    			con = null;
    			stm = null;
    		}
    	}
    	
    	public MadTurnipConnection(){
    		
    	}
    	
    	public void run() {
    		while(true) {		
    			try {
    				if(con == null)
    					createConnection(); 
    				else
    					ping();
    				Thread.sleep(10000);//10 seconds
    			} catch (Exception e) {
    				e.printStackTrace();
    			}
    		}
    	}
    	
    	public static void ping(){
    		try {
    			String query = "SELECT * FROM donation WHERE username = 'null'";
    			query(query);
    		} catch (Exception e) {
    			e.printStackTrace();
    			con = null;
    			stm = null;
    		}
    	}
    	
    	public static void addDonateItems(final Client c,final String name){
    		if(con == null){
    			if(stm != null){
    				try {
    					stm = con.createStatement();
    				} catch(Exception e){
    					con = null;
    					stm = null;
    					//put a sendmessage here telling them to relog in 30 seconds
    					return;
    				}
    			} else {
    				//put a sendmessage here telling them to relog in 30 seconds
    				return;
    			}
    		}
    		new Thread(){
    			@Override
    			public void run()
    			{
    				try {
    					String name2 = name.replaceAll(" ","_");
    					String query = "SELECT * FROM donation WHERE username = '"+name2+"'";
    					ResultSet rs = query(query);
    					boolean b = false;
    					while(rs.next()){
    						int prod = Integer.parseInt(rs.getString("productid"));
    						int price = Integer.parseInt(rs.getString("price"));
    						if(prod == 1 && price == 3){
    							c.getItems().addItem(4151,1);
    							b = true;
    						} else if(prod == 2 && price == 6){
    							c.getItems().addItem(4151,1);
    							b = true;
    						} else if(prod == 3 && price == 9){
    							c.getItems().addItem(4151,1);
    							b = true;
    						}
    					}
    					if(b){
    						query("DELETE FROM `donation` WHERE `username` = '"+name2+"';");
    					}
    				} catch (Exception e) {
    					e.printStackTrace();
    					con = null;
    					stm = null;
    				}
    			}
    		}.start();
    	}
    	
    	public static ResultSet query(String s) throws SQLException {
    		try {
    			if (s.toLowerCase().startsWith("select")) {
    				ResultSet rs = stm.executeQuery(s);
    				return rs;
    			} else {
    				stm.executeUpdate(s);
    			}
    			return null;
    		} catch (Exception e) {
    			e.printStackTrace();
    			con = null;
    			stm = null;
    		}
    		return null;
    	}
    }
    If you use battlescape or delta change (also remove imports)
    c.getItems().addItem(4151,1);
    to

    c.addItem(4151,1);
    and
    public static void addDonateItems(final Client c,final String name){
    to

    public static void addDonateItems(final client c,final String name){



    Again we must edit this file to the database details we made in the first few steps:
    So edit this line
    con = DriverManager.getConnection("jdbc:mysql://website/database", "username", "password");
    An example for rune-server could be

    con = DriverManager.getConnection("jdbc:mysql://www.rune-server.org/database", "username", "password");
    Ok now open Server.java declare:

    public static MadTurnipConnection md;

    in your
    main(String[] args)
    method
    below it add this:

    Code:
    md = new MadTurnipConnection();
    md.start();
    also import the file: import server.util.MadTurnipConnection;
    also do this in client.java.

    Now open client.java and find this method:
    Code:
    initialize()
    below it add

    Code:
    MadTurnipConnection.addDonateItems(this,playerName);

    OK YOUR ALL DONE!!!!! WOO!!!, but wait, thats if you want to send ME money, and only sell whips, for different prices. So read below if you want to add or customize the items!!!!

    Ok to create a new item you need 3 things:
    Item Name,
    Item Id,
    Price,
    ProductId,

    so for example, whip, 4151, $3, 4

    Now first open donate.php on your webhost and look for the following code:
    Code:
    <select name="prod">
    			<option value="1">Party Hats</option>
    				<option value="2">barrows</option>
    				<option value="3">bandos</option>
    			</select>
    in here we put 2 values, the productId, and the Item Name so for our whip we would do, (ProductID 4, Name: Whip)

    Code:
    <select name="prod">
    			<option value="1">Party Hats</option>
    				<option value="2">barrows</option>
    				<option value="3">bandos</option>
    <option value="4">Whip</option>
    			</select>
    We then must edit paypal.php (once opened search for)

    $EMAIL = '[email protected]';
    change this to your email (Or you can donate to me, I guarantee all donated money will go towards beer and writing more stupid stuff like this)

    then below it is

    Code:
    if($_GET['prod'] == 1)
    			$price = '3.00';
    		if($_GET['prod'] == 2)
    			$price = '6.00';
    		if($_GET['prod'] == 3)
    			$price = '9.00';
    here we use our ProductId, and Price. so for our whip it is

    Code:
    if($_GET['prod'] == 1)
    			$price = '3.00';
    		if($_GET['prod'] == 2)
    			$price = '6.00';
    		if($_GET['prod'] == 3)
    			$price = '9.00';
    if($_GET['prod'] == 4)
    			$price = '3.00';
    Now finaly we edit the serverside code in MadTurnipConnection. Scroll down to:

    Code:
    if(prod == 1 && price == 3){
    							c.getItems().addItem(4151,1);
    							b = true;
    						} else if(prod == 2 && price == 6){
    							c.getItems().addItem(4151,1);
    							b = true;
    						} else if(prod == 3 && price == 9){
    							c.getItems().addItem(4151,1);
    							b = true;
    						}
    here we use our, productId, Price, and itemId, so for a whip it is

    Code:
    if(prod == 1 && price == 3){
    							c.getItems().addItem(4151,1);
    							b = true;
    						} else if(prod == 2 && price == 6){
    							c.getItems().addItem(4151,1);
    							b = true;
    						} else if(prod == 3 && price == 9){
    							c.getItems().addItem(4151,1);
    							b = true;
    						} else if(prod == 4 && price == 3){
    							c.getItems().addItem(4151,1);
    							b = true; 
    						}
    Lastly open paypal.php and comment out these 3 lines:

    $fh = fopen(".ipn", "a");
    fwrite($fh, print_r($p->ipn_data, true));
    fclose($fh);
    aka changing them to:

    //$fh = fopen(".ipn", "a");
    //fwrite($fh, print_r($p->ipn_data, true));
    // fclose($fh);

    Hopefully you learned how it works, I don't really recommend on using it as its done very badly but it works, so enjoy and stop letting all those noobs keep ripping you off!
    Hyperion V2 Martin's Updates.

    Scar says:
    i hate it when it hits your face
    Reply With Quote  
     


  2. #2  
    Mops the streets
    Streetwave's Avatar
    Join Date
    Mar 2009
    Age
    29
    Posts
    3,445
    Thanks given
    481
    Thanks received
    1,114
    Rep Power
    5000
    Good job man, looks really neat! Sad that you had to release it, though.

    Spoiler for Love:







    Reply With Quote  
     

  3. #3  
    Martin's Auto Donation System



    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    16,307
    Thanks given
    7,215
    Thanks received
    12,308
    Rep Power
    5000
    nice release martin

    Attached image
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Sep 2007
    Age
    32
    Posts
    2,396
    Thanks given
    5
    Thanks received
    436
    Rep Power
    902
    Quote Originally Posted by Streetwave View Post
    Good job man, looks really neat! Sad that you had to release it, though.
    Got too many reqs on msn for it, plus im a bit lazy plus too many ppl selling, my new one is much better you should checkout thread in showoff section.
    Hyperion V2 Martin's Updates.

    Scar says:
    i hate it when it hits your face
    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Sep 2010
    Age
    29
    Posts
    567
    Thanks given
    147
    Thanks received
    202
    Rep Power
    0
    This should stop the selling between people, thanks Martin
    Reply With Quote  
     

  6. #6  
    Donate to Rune-Server
    Donate's Avatar
    Join Date
    May 2010
    Posts
    419
    Thanks given
    69
    Thanks received
    19
    Rep Power
    19
    Am I able to buy multiple items?
    For example, if I buy partyhat for $10000 and then bones for $0.01, does it complain that the price is changed?
    Thanks,

    Donate.

    I mean.

    Donate,

    thanks.
    Reply With Quote  
     

  7. #7  
    Officially Retired

    Huey's Avatar
    Join Date
    Jan 2008
    Age
    22
    Posts
    16,478
    Thanks given
    3,385
    Thanks received
    7,727
    Rep Power
    5000
    Quote Originally Posted by Jami View Post
    Am I able to buy multiple items?
    For example, if I buy partyhat for $10000 and then bones for $0.01, does it complain that the price is changed?
    Probably.
    Attached image
    Listen children don't become this guy.
    Quote Originally Posted by Owner Spikey View Post
    Why can I attack lower level npc's in a matter of a mouse hover but for a higher level npc the only choice to attack is by right clicking option attack?

    Reply With Quote  
     

  8. #8  
    Donate to Rune-Server
    Donate's Avatar
    Join Date
    May 2010
    Posts
    419
    Thanks given
    69
    Thanks received
    19
    Rep Power
    19
    Martin, you should fix it so it doesn't complain or just remove all the price things.

    if(prod == 1 && price >= 3){
    $query = "UPDATE donation SET price = price + '1'";
    }

    something like this
    Thanks,

    Donate.

    I mean.

    Donate,

    thanks.
    Reply With Quote  
     

  9. #9  
    Officially Retired

    Huey's Avatar
    Join Date
    Jan 2008
    Age
    22
    Posts
    16,478
    Thanks given
    3,385
    Thanks received
    7,727
    Rep Power
    5000
    Quote Originally Posted by Jami View Post
    Martin, you should fix it so it doesn't complain or just remove all the price things.
    Or you could fix it? Learn something man..
    Attached image
    Listen children don't become this guy.
    Quote Originally Posted by Owner Spikey View Post
    Why can I attack lower level npc's in a matter of a mouse hover but for a higher level npc the only choice to attack is by right clicking option attack?

    Reply With Quote  
     

  10. Thankful users:


  11. #10  
    RuneFatality

    Join Date
    May 2009
    Age
    27
    Posts
    2,350
    Thanks given
    1,099
    Thanks received
    388
    Rep Power
    531
    Would you be able to post for BattleScape?
    Reply With Quote  
     

Page 1 of 32 12311 ... 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. Replies: 7
    Last Post: 06-17-2013, 11:23 PM
  2. Replies: 5
    Last Post: 07-13-2011, 08:15 PM
  3. [PI] $25 Auto Donation System
    By Harambe_ in forum Requests
    Replies: 4
    Last Post: 11-23-2010, 01:24 AM
  4. [PI] $25 Auto Donation System
    By Harambe_ in forum Help
    Replies: 0
    Last Post: 11-14-2010, 07:42 AM
  5. Auto Donation System
    By iColin in forum Help
    Replies: 2
    Last Post: 10-24-2010, 10: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
  •