Thread: SMF Server Intergration

Results 1 to 7 of 7
  1. #1 SMF Server Intergration 
    Registered Member

    Join Date
    Sep 2007
    Age
    32
    Posts
    2,396
    Thanks given
    5
    Thanks received
    436
    Rep Power
    902
    Credits to james on this tut im just releaseing fixed and on this site

    Difficulty: 4 - its mysql no one at all gets it

    Classes Modified: Server, Client

    Description: SMF Server - Site intergration

    Assumed Knowledge: not being a noob, setting up a database,

    Step 1: Open up Server.java add this method

    Code:
    public static String MySQLURL = "jdbc:mysql://WEBSITE/DATABASENAME"; //The MySQL URL. Change the DATABASE to your database
    	public static String MySQLUser = "DATABSEUSERNAME"; //The MySQL login name
    	public static String MySQLPassword = "PASSWORD"; //The MySQL login pass
    	public static Connection conn; //Class Connection (in java libary) is now declared
    public static void createConnection(){
    	try {
    			Class.forName("com.mysql.jdbc.Driver").newInstance();
    			conn = DriverManager.getConnection(MySQLURL, MySQLUser, MySQLPassword);
    			misc.println("mysql connected");
    		} catch(Exception e) {	
    			e.printStackTrace();
    		}
    	}
    Ok now if you havent already got a webhoster or xampp
    visit this site and register an account

    http://www.000webhost.com/order.php

    its free and it has php and phpmyadmin

    once youve set that up go mysql and set up a database username pass word etc im not gona explain ti all

    Step 2: replace all the info in the above code with your details heres an example

    public static String MySQLURL = "jdbc:mysql://rune-server.org/runeserver_forums";
    public static String MySQLUser = "kevin"; //The MySQL login name
    public static String MySQLPassword = "ihackedtheseforums"; //The MySQL login pass

    that is jsut an example and will NOT work

    Step 3: connecting your server to it while still in server.java add this
    Code:
    createConnection();
    under

    Code:
    public static void main(java.lang.String args[])
    			throws NullPointerException {
    Step 4: Open up client.java and add these methods

    Code:
    public String SMF_MD5(String in) {
     byte[] theTextToDigestAsBytes =
                    in.getBytes( "8859_1"/* encoding */ );
            MessageDigest md = MessageDigest.getInstance( "SHA" );
            md.update( theTextToDigestAsBytes );
            byte[] digest = md.digest();
    
            // will print SHA
    
            // should be 20 bytes, 160 bits long
    
            // dump out the hash
            for ( byte b : digest )
                {
                return Integer.toHexString( b & 0xff );
                }
    			return "";
            }
    
    public boolean Load(String Password) {
    	try{
    	Statement statement = server.conn.createStatement();
    	ResultSet group = statement.executeQuery("SELECT * FROM smf_ WHERE username = '"+playerName+"'");
    	while(group.next()) {
    	String RealPass = group.getString("password");
    String tempName = playerName.toLowerCase();
    String toEncode = tempName+Password;
    String EnteredPass_Hash = SMF_MD5(toEncode);
    if(RealPass.equals(EnteredPass_Hash)) {
    return true;
    	} else { 
    	statement.close();
    	return false; 
    	}
    	}
    
    	} catch (Exception sqlEx){
    	
    	try{
    	server.conn.close();
    	server.createConnection();
    	} catch (Exception sqlEx2){}
    	
          //System.err.println(sqlEx);
    	  return false;
        }
    	return false;
    	}

    Step 5: this will probally be one of the hardest parts as you will probally messs it up if your a noob

    search
    Code:
    int loadgame
    and put this below it

    Code:
    if(Load(playerPass) == true) {
    then search

    Code:
    } catch (java.lang.Exception __ex) {
    And Put this ABOVE it

    Code:
    } else {
    		returnCode = 3;
    		disconnected = true;		
    		
    			}
    this requires some basic knowledge to actally do that part right



    Step 6: Download these files and put them in your source folder make sure there extracted

    http://www.megaupload.com/?d=KE47I3CV
    http://rapidshare.com/files/126872804/Files.zip.html

    -thanks harvey for links

    Step 7:
    make sure u have these imports in server.java
    Code:
    import java.sql.*;
    and these imports in client.java

    Code:
    import java.sql.*;
    import java.security.*;
    Ill do IBP later
    I didnt test this so if some one would it would be great
    It should work in theory lol
    Hyperion V2 Martin's Updates.

    Scar says:
    i hate it when it hits your face
     

  2. #2  
    Community Veteran

    ^_^'s Avatar
    Join Date
    Jul 2007
    Age
    34
    Posts
    859
    Thanks given
    195
    Thanks received
    32
    Rep Power
    205
    Nice, you have done vb and smf now nice.

    Unlock Your Phone To All Carriers | WORLDWIDE | ANY PHONE
    http://www.rune-server.org/black-mar...hin-24hrs.html

     

  3. #3  
    Registered Member

    Join Date
    Sep 2007
    Age
    32
    Posts
    2,396
    Thanks given
    5
    Thanks received
    436
    Rep Power
    902
    thanks ill ahve to look into IBP a bit i never used that before and dodian source is **** for it since its all messed up by winten lol
    Hyperion V2 Martin's Updates.

    Scar says:
    i hate it when it hits your face
     

  4. #4  
    Registered Member
    Pride's Avatar
    Join Date
    Mar 2008
    Posts
    727
    Thanks given
    0
    Thanks received
    1
    Rep Power
    121
    Please Do phpBB! I'd love ya! In a non-*** Way..
     

  5. #5  
    Registered Member
    Join Date
    Dec 2007
    Posts
    123
    Thanks given
    0
    Thanks received
    1
    Rep Power
    12
    nice man! cant with for IBP
    hi
     

  6. #6  
    Registered Member ninja's Avatar
    Join Date
    Aug 2006
    Age
    83
    Posts
    400
    Thanks given
    0
    Thanks received
    1
    Rep Power
    44
    do it for phpbb.
     

  7. #7  
    Professional Upsetter


    Join Date
    Jul 2006
    Posts
    5,392
    Thanks given
    163
    Thanks received
    447
    Rep Power
    2040
    This isn't his work, he can't improve.

    James already has posted, please get permission from him, until further...

    [Closed]
    Ex-super moderator of Rune-Server.org and RSBot.org
     


Thread Information
Users Browsing this Thread

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


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •