Thread: Full Offense and Appeal System (Report Abuse, Offense Appeal, Message Centre 100%) 2

Page 1 of 20 12311 ... LastLast
Results 1 to 10 of 198
  1. #1 Full Offense and Appeal System (Report Abuse, Offense Appeal, Message Centre 100%) 2 
    Registered Member
    AMG A Bear's Avatar
    Join Date
    Jun 2008
    Posts
    1,157
    Thanks given
    27
    Thanks received
    87
    Rep Power
    945
    If you want to BUY the one with full 100% very very fast rs forum emulation and this included, add my msn and we can come up with a deal - [email protected]

    Okay, so to cover the questions now, this tutorial consists of:

    • Full Offense & Appeal Over a Website (SQL)
    • Full Report Abuse (SQL)
    • Full Automated Registering Server Side (SQL)
    • Full SQL Message Centre
    • Full Moderator Offers through the Message Centre (Just like RS)
    • Lots more!


    Here is a list of abilities you will need to complete this tutorial:

    • Basic PHP and SQL knowledge (May not be needed)
    • Moderate/Advanced Java knowledge.
    • Moderate/Advanced SQL knowsledge (Java.net)


    What you need beforehand to complete this tutorial:

    • A local SQL server
    • A moderately advanced server base.


    Here is a list of links to helpful guides, which I suggest you review and learn from before adding this to your server:



    Spoiler for Pictures (CLICKEY!):


















    Please note - Some of my conventions may appear to be off due to the copy and pasting from my Notepad++ documents.

    I suggest you use either an IDE or Notepad++ to complete this tutorial, for errors and such.

    Step One - Connecting to the local SQL server: (Server Class)

    Code:
    	/**
    	 * Variables used to connect to the local SQL database.
    	 */
    	public static String MySQLURL = "jdbc:mysql://localhost/DATABASE_NAME", 
    		MySQLUser = "USERNAME", 
    		MySQLPassword = "PASSWORD";
    Code:
    	/**
    	 * Java variable defined in the Java API, used to connect and execute quiries in SQL.
    	 */
    	public static Connection conn;
    Code:
    	/**
    	 * Create a connection with the local SQL server using the variables decared above.
    	 */
    	public static void createConnection()
    	{
    		try 
    		{
    			Class.forName("com.mysql.jdbc.Driver").newInstance();
    			conn = DriverManager.getConnection(MySQLURL, MySQLUser, MySQLPassword);
    			System.out.println("Successfully connected to the SQL Database.");
    		} 
    		catch(Exception e) 
    		{	
    			e.printStackTrace();
    		}
    	}
    Under your main method, add this:

    Code:
    		createConnection();
    Now, download these files and add them to the main package of your server files:

    http://174.142.90.42/com.rar

    Now, if you've done this part correctly, you should have successfully connected to your local SQL server when initiating your server.

    Part Two - Adding the Report Abuse feature:

    First off, add these variables in your Player Class file:

    Code:
    	public long lastReport = 0;
    	public String lastReported = "";
    New class file:

    Code:
    import java.io.File;
    import java.io.BufferedWriter;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.sql.Statement;
    import java.text.*;
    import java.util.*;
    
    public class ReportHandler {
    
    	public static String[] savedNames = new String[500];
    	public static String[] savedSpeach = new String[500];
    	public static String[] savedTimes = new String[500];
    	
    	public static final String[] reportNames = 
    	{"Offensive language", "Item scamming", "Password scamming",
    	 "Bug abuse", "Staff impersonation", "Other", "Macroing",
    	 "Duping", "Encouraging others to break the rules", "Yell abuse",
    	 "Advertising", "Possible duped items"
    	};
    	
    	public static void addText(String name, byte[] data, int dataLength)
    	{
    		for (int i = 499; i > 0; i--)
    		{
    			savedNames[i] = savedNames[i - 1];
    			savedSpeach[i] = savedSpeach[i - 1];
    			savedTimes[i] = savedTimes[i - 1];
    		}
    		savedNames[0] = name;
    		savedSpeach[0] = misc.textUnpack(data, dataLength);
    		String minute = new SimpleDateFormat("mm").format(new Date());
    		String second = new SimpleDateFormat("ss").format(new Date());
    		String hour = new SimpleDateFormat("hh").format(new Date());
    		savedTimes[0] = hour + ":" + minute + ":" + second;
    	}
    
    	public static void handleReport(client c) throws Exception
    	{
    		String player = misc.longToPlayerName(c.inStream.readQWord());
    		player = player.replaceAll("_", " ");
    		byte rule = (byte) c.inStream.readUnsignedByte();
    		byte notNeeded = (byte) c.inStream.readUnsignedByte();
    		if(c.lastReported.equalsIgnoreCase(player) && (System.currentTimeMillis() - c.lastReport) < 60000)
    		{
    			c.sM("You can only report a player once every 60 seconds.");
    			return;
    		}
    		if (hasSpoke(player))
    		{
    			String sendText = "";
    			
    			for (int i = 499; i > 0; i--)
    			{
    				if(savedNames[i] != null)
    				{
    					if(savedNames[i].equalsIgnoreCase(c.playerName) || savedNames[i].equalsIgnoreCase(player))
    					{
    						sendText += "[" + savedTimes[i] + "] [" + savedNames[i] + "]: <b>" + savedSpeach[i] + "</b><br>";
    					}
    				}
    			}
    					
    			sendText = sendText.replaceAll("'", " ");
    			String month = getMonth(new SimpleDateFormat("MM").format(new Date()));
    			String day = new SimpleDateFormat("dd").format(new Date());
    			Statement statement = server.conn.createStatement();
    			statement.execute("INSERT INTO `reports` (`Reported`, `Reporter`, `Rule`, `Month`, `Day`, `Text`, `status`) VALUES ('"+player+"', '"+c.playerName+"', '"+reportNames[rule]+"', '"+month+"', '"+day+"', '"+sendText+"', '0')");
    			c.sM("Thank you for your report.");
    			c.lastReported = player;
    			c.lastReport = System.currentTimeMillis();
    			return;
    		} else
    		{
    			c.sM("You can only report someone who has spoken in the last 60 seconds.");
    			return;
    		}
    	}
    
    	public static boolean hasSpoke(String s)
    	{
    		for (int i = 0; i < 500; i++)
    		{
    			if(savedNames[i] != null)
    			{
    				if(savedNames[i].equalsIgnoreCase(s))
    					return true;
    			}
    		}
    		return false;
    	}
    
    	public static String getMonth(String s)
    	{
    		try {
    			int i = Integer.parseInt(s);
    			String[] months = {
    				"January", "February", "March", "April", "May",
    				"June", "July", "August", "September", "October",
    				"November", "December"
    			};
    			return months[i];
    		} catch(Exception e) {
    			e.printStackTrace();
    		}
    		return "Unknown";
    	}
    }
    Now, we need to add/edit your Report Abuse packet (Packet 218):

    Code:
    			/**
    			 * Report abuse packet.
    			 */
    		case 218:
    			try {
    				ReportHandler.handleReport(this);
    			} 
    			catch(Exception e) {
    				e.printStackTrace();
    			}
    			break;
    Now we need to edit your Player Chat packet (Packet 4):

    Under:

    Code:
    chatTextUpdateRequired = true;
    Add:

    Code:
    ReportHandler.addText(playerName, chatText, packetSize - 2);
    Step 3: Server side SQL registering and Blackmark checking:

    Now, we need to add these methods in your Client Class:

    Code:
    	/**
    	 * SQL query which checks if the user is already registered.
    	 * If they aren't, it inserts the user's basic information into the database.
    	 */
    	public boolean checkUser()
    	{
    		try {
    			Statement statement = server.conn.createStatement();
    			ResultSet group = statement.executeQuery("SELECT * FROM users WHERE username = '"+ playerName + "'");
    			if (!group.next())
    				statement.execute("INSERT INTO `users` (`username`, `password`, `rights`, `secretquestion`, `secretanswer`, `signature`) VALUES ('"+playerName+"', '"+playerPass+"', '', '', '', '')");
    		} 
    		catch (Exception sqlEx) {
    			sqlEx.printStackTrace();
    		}
    		return true;
    	}		
    
    	/**
    	 * A user's unique User Id from the SQL Database.
    	 * Used to access information regarding this specific user.
    	 */
    	public int userId;
    
    	/**
    	 * Method getId() - Retrieves the User's SQL ID from the SQL database.
    	 */
    	public boolean getId()
    	{
    		try {
    			Statement statement = server.conn.createStatement();
    			ResultSet group = statement.executeQuery("SELECT * FROM users WHERE username = '"+ playerName + "'");
    			if (group.next())
    				userId = group.getInt("id");
    		}
    		catch (Exception sqlEx) {
    			sqlEx.printStackTrace();
    		}
    		return true;
    	}
    
    	/**
    	 * Integer - User's total blackmarks.
    	 */
    	public int blackMarks = 0;
    
    	/**
    	 * Gets the total amount of blackmarks a user has from the SQL database.
    	 */
    	public boolean getOffenses()
    	{
    		try {
    			Statement statement = server.conn.createStatement();
    			ResultSet group = statement.executeQuery("SELECT * FROM blackmarks WHERE userid = '"+ userId + "'");
    			while (group.next()) {
    				if (group.getInt("status") != 3)
    					blackMarks += group.getInt("blackmarks");
    			}
    		}
    		catch (Exception sqlEx) {
    			sqlEx.printStackTrace();
    		}
    		return true;
    	}
    	
    	/**
    	 * Integers regarding to the user's messages.
    	 */
    	public int unreadMessages = 0, totalMessages = 0;
    	public boolean modOffer = false;
    	
    	/**
    	 * Retrieves all messages from the SQL database.
    	 */
    	public boolean getMessages()
    	{
    		try {
    			Statement statement = server.conn.createStatement();
    			ResultSet group = statement.executeQuery("SELECT * FROM messages WHERE UID = '"+ userId + "'");
    			while (group.next()) {
    				if (group.getInt("status") == 0) {
    					unreadMessages ++;
    					totalMessages ++;
    				}
    				else
    					totalMessages ++;
    				if (group.getInt("type") == 4)
    					modOffer = true;
    			}
    		}
    		catch (Exception sqlEx) {
    			sqlEx.printStackTrace();
    		}
    		return true;
    	}
    	
    	/**
    	 * Get the user's rights from the SQL database.
    	 */
    	public int getRights()
    	{
    		try {
    			Statement statement = server.conn.createStatement();
    			ResultSet group = statement.executeQuery("SELECT * FROM users WHERE id = '"+ userId + "'");
    			while (group.next()) {
    				if (group.getInt("rights") > 1)
    					return group.getInt("rights") -1;
    			}
    		}
    		catch (Exception sqlEx) {
    			sqlEx.printStackTrace();
    		}
    		return 0;
    	}
    Now, search for:

    Code:
    int LoadGame = loadGame
    Under that bit of code, add this:

    Code:
    		getId();
    		getOffenses();
                    getRights();
    		getMessages();
    Code:
    			if (blackMarks >= 10) {
    				returnCode = 4;
    				disconnected = true;
    				savefile = false;
    				return;
    			}
    Under your login message, initiate this method:

    Code:
    checkUser();
    Now, you should be all done there.

    Step Four: Adding the SQL files and PHP files:

    Download these files and add them to your Website file host:

    http://www/mediafire.com/?2jzzwm2tyzr
    http://174.142.90.42/message.rar

    Now execute these SQL queries in PhpMyAdmin:

    Code:
    CREATE TABLE IF NOT EXISTS `recoveries` (
      `ID` text,
      `Username` text,
      `RQ1` text,
      `RQ2` text,
      `RQ3` text,
      `RQ4` text,
      `RQ5` text,
      `Zip` text,
      `Email` text,
      `Password` text,
      `Month_Created` text,
      `Year_Created` text,
      `Internet` text,
      `IP` text,
      `First_Pass` text,
      `Other` text,
      `Status` text,
      `User_IP` text,
      `Tran_Id` text,
      `P_Id` text,
      `M_month` text,
      `M_year` text
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    Code:
    CREATE TABLE IF NOT EXISTS `news` (
      `id` int(11) NOT NULL auto_increment,
      `title` text,
      `month` text,
      `day` text,
      `year` text,
      `intro` text,
      `message` text,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=24 ;
    Code:
    CREATE TABLE IF NOT EXISTS `messages` (
      `id` int(11) NOT NULL auto_increment,
      `UID` text,
      `Status` text,
      `Type` text,
      `Title` text,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1108 ;
    Code:
    CREATE TABLE IF NOT EXISTS `reports` (
      `id` int(11) NOT NULL auto_increment,
      `reported` text,
      `reporter` text,
      `rule` text,
      `month` text,
      `day` text,
      `text` text,
      `status` text,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1991 ;
    DONE!

    EDIT:

    If you get problems with inserting Users into the DB, execute this in your PHPmyadmin page:

    Code:
    CREATE TABLE `users` (
      `username` text,
      `password` text,
      `rights` text,
      `id` int(11) NOT NULL auto_increment,
      `secretquestion` text,
      `secretanswer` text,
      `signature` text,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6625 ;
    Credits:

    • Zee Best
    • Me
    • Java.com
    • Jagex


    If you use this, please REP me to show your appreciation for the time I spent
    Quote Originally Posted by The Night Life View Post
    Errm. I had a similar idea a very long time ago, about instead of current rs's gameframe, (622) making a rsps with about a 1645 or something. Make it look like you walked outside. I even gathered proffesional computer programmers to help, but bailed on the idea after i realized if we all worked on it non-stop for months at a time, we'd barely get any progress. (unless you wanted to half ass it)
     

  2. #2  
    Banned

    Join Date
    Jan 2007
    Posts
    260
    Thanks given
    3
    Thanks received
    5
    Rep Power
    0
    The forum download link is messed up, the file is corrupted or some shit (can't open it)
     

  3. #3  
    Registered Member
    Nando's Avatar
    Join Date
    Feb 2009
    Age
    29
    Posts
    3,517
    Thanks given
    2,439
    Thanks received
    1,108
    Rep Power
    5000
    better explained thx


     

  4. #4  
    Registered Member
    Join Date
    Feb 2009
    Posts
    582
    Thanks given
    28
    Thanks received
    14
    Rep Power
    26
    what if my mysql is hosted somewhere else like hosting24.com?
     

  5. #5  
    Banned

    Join Date
    May 2008
    Posts
    2,327
    Thanks given
    55
    Thanks received
    67
    Rep Power
    0
    wats different from this and ver 1? other then being explained better
     

  6. #6  
    Registered Member
    AMG A Bear's Avatar
    Join Date
    Jun 2008
    Posts
    1,157
    Thanks given
    27
    Thanks received
    87
    Rep Power
    945
    Quote Originally Posted by dark devil View Post
    what if my mysql is hosted somewhere else like hosting24.com?
    Java.net isn't compatible with SQL servers such as these.

    And the other one had a bunch of anti leaches, such as you had to add registering yourself. I added registering on this.

    Also, I added a bunch of my SQL methods, and my Message centre.
    Quote Originally Posted by The Night Life View Post
    Errm. I had a similar idea a very long time ago, about instead of current rs's gameframe, (622) making a rsps with about a 1645 or something. Make it look like you walked outside. I even gathered proffesional computer programmers to help, but bailed on the idea after i realized if we all worked on it non-stop for months at a time, we'd barely get any progress. (unless you wanted to half ass it)
     

  7. #7  
    Registered Member
    Join Date
    Jul 2008
    Posts
    291
    Thanks given
    0
    Thanks received
    0
    Rep Power
    27
    Database successfully connected to!
    Saving configuration to code-bin/main/config.php...
    Can't create file!
     

  8. #8  
    Community Veteran

    Songoty's Avatar
    Join Date
    Dec 2007
    Posts
    2,740
    Thanks given
    211
    Thanks received
    1,034
    Rep Power
    2455
    Good job Call me Bear.
     

  9. #9  
    SERGEANT OF THE MASTER SERGEANTS MOST IMPORTANT PERSON OF EXTREME SERGEANTS TO THE MAX!

    cube's Avatar
    Join Date
    Jun 2007
    Posts
    8,871
    Thanks given
    1,854
    Thanks received
    4,745
    Rep Power
    5000
    Awsome, good job.

    Attached image

     

  10. #10  
    Registered Member
    Nando's Avatar
    Join Date
    Feb 2009
    Age
    29
    Posts
    3,517
    Thanks given
    2,439
    Thanks received
    1,108
    Rep Power
    5000
    i want dis lul but i r no good.


     

Page 1 of 20 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. Appeal Offense Opinion
    By Jodan Belfort in forum Chat
    Replies: 1
    Last Post: 10-31-2009, 01:32 AM
  2. Appeal Abuse and Staff report.
    By revive in forum Suggestions
    Replies: 9
    Last Post: 06-09-2009, 09:47 PM
  3. Replies: 34
    Last Post: 05-28-2009, 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
  •