Open URL/Ad after closing session(yeahhh)

Page 1 of 2 12 LastLast
Results 1 to 15 of 28
  1. #1
    Account Upgraded | Title Enabled! Carrino is offline
    MemberRank
    Mar 2010 Join Date
    1,114Posts

    Open URL/Ad after closing session(yeahhh)

    BEFORE THAT
    ANY SIGN OF CREDITING YOURSELF USING MY WORK AND JAVAWORLD WILL BE REMOVED STRAIGHT AWAY.

    hehe.


    BrowserControl.java
    PHP Code:
    package sycho;

    import java.io.IOException;

    /**
     *
     * @author javaworld
     */
    public class BrowserControl
    {
        
    /**
         * Display a file in the system browser.  If you want to display a
         * file, you must include the absolute path name.
         *
         * @param url the file's url (the url must start with either "http://"
    or
         * "file://").
         */
        
    public static void displayURL(String url)
        {
            
    boolean windows isWindowsPlatform();
            
    String cmd null;
            try
            {
                if (
    windows)
                {
                    
    // cmd = 'rundll32 url.dll,FileProtocolHandler http://...'
                    
    cmd WIN_PATH " " WIN_FLAG " " url;
                    
    Process p Runtime.getRuntime().exec(cmd);
                }
                else
                {
                    
    // Under Unix, Netscape has to be running for the "-remote"
                    // command to work.  So, we try sending the command and
                    // check for an exit value.  If the exit command is 0,
                    // it worked, otherwise we need to start the browser.
                    // cmd = 'netscape -remote openURL(http://www.google.com)'
                    
    cmd UNIX_PATH " " UNIX_FLAG "(" url ")";
                    
    Process p Runtime.getRuntime().exec(cmd);
                    try
                    {
                        
    // wait for exit code -- if it's 0, command worked,
                        // otherwise we need to start the browser up.
                        
    int exitCode p.waitFor();
                        if (
    exitCode != 0)
                        {
                            
    // Command failed, start up the browser
                            // cmd = 'netscape http://www.google.com'
                            
    cmd UNIX_PATH " "  url;
                            
    Runtime.getRuntime().exec(cmd);
                        }
                    }
                    catch(
    InterruptedException x)
                    {
                        
    System.err.println("Error bringing up browser, cmd='" +
                                           
    cmd "'");
                        
    System.err.println("Caught: " x);
                    }
                }
            }
            catch(
    IOException x)
            {
                
    // couldn't exec browser
                
    System.err.println("Could not invoke browser, command=" cmd);
                
    System.err.println("Caught: " x);
            }
        }
        
    /**
         * Try to determine whether this application is running under Windows
         * or some other platform by examing the "os.name" property.
         *
         * @return true if this application is running under a Windows OS
         */
        
    public static boolean isWindowsPlatform()
        {
            
    String os System.getProperty("os.name");
            if ( 
    os != null && os.startsWith(WIN_ID))
                return 
    true;
            else
                return 
    false;
        }

        public static 
    void main(String[] args)
        {
            
    displayURL("http://www.google.com");
        }
        
    // Used to identify the windows platform.
        
    private static final String WIN_ID "Windows";
        
    // The default system browser under windows.
        
    private static final String WIN_PATH "rundll32";
        
    // The flag to display a url.
        
    private static final String WIN_FLAG "url.dll,FileProtocolHandler";
        
    // The default browser under unix.
        
    private static final String UNIX_PATH "netscape";
        
    // The flag to display a url.
        
    private static final String UNIX_FLAG "-remote openURL";

    Open MapleServerHandler.java
    Find
    PHP Code:
     public void sessionClosed(IoSession sessionthrows Exception {
            
    synchronized (session) {
                
    MapleClient client = (MapleClientsession.getAttribute(MapleClient.CLIENT_KEY);
                if (
    client != null) {
                    
    client.disconnect();
                    
    session.removeAttribute(MapleClient.CLIENT_KEY);
                }
            }
            
    super.sessionClosed(session);
        } 
    Under
    PHP Code:
    session.removeAttribute(MapleClient.CLIENT_KEY); 
    Add
    PHP Code:
    BrowserControl.displayURL("http://www.google.com"); 
    :) Did not modify the WZ

    PHP Code:
    Instructions
    1.Find displayURL
    ("http://www.google.com"); in browsercontrol.java
    and replace [url]http://www.google.com[/url] to your own url
    2.Find BrowserControl.displayURL("http://www.google.com");
    Replace [url]http://www.google.com[/url] to your own url 
    Simple and easy isn't it?
    Enjoy opening urls now.
    Last edited by Carrino; 21-03-10 at 03:05 PM.


  2. #2
    Godslayer iHero is offline
    MemberRank
    Oct 2009 Join Date
    RivaLocation
    250Posts

    Re: Open URL/Ad after closing session(yeahhh)

    First Post Nice Job

  3. #3
    Member Masoud is offline
    MemberRank
    Jan 2010 Join Date
    69Posts

    Re: Open URL/Ad after closing session(yeahhh)

    I don't think BrowserControl.java is yours. It's not your comments either. You just wrote your name there.

  4. #4
    Account Upgraded | Title Enabled! Sactual is offline
    MemberRank
    Jan 2010 Join Date
    Hong KongLocation
    212Posts

    Re: Open URL/Ad after closing session(yeahhh)

    http://www.javaworld.com/javaworld/j...javatip66.html

    Oh come on, leaking is bad at one hand, but a public java site? That's just sad.

    A BETTER way of doing this is sending SEND_LINK or whatever its called with the site you want it to navigate to. Your basically calling a new java class in replacement of a simple packet to send.

  5. #5
    Member Masoud is offline
    MemberRank
    Jan 2010 Join Date
    69Posts

    Re: Open URL/Ad after closing session(yeahhh)

    Quote Originally Posted by Carrino View Post
    BEFORE THAT
    ANY SIGN OF CREDITING YOURSELF USING MY WORK WILL BE REMOVED STRAIGHT AWAY.
    I'm laughing.

  6. #6
    Account Upgraded | Title Enabled! AxedMS is offline
    MemberRank
    Dec 2008 Join Date
    358Posts

    Re: Open URL/Ad after closing session(yeahhh)

    http://www.javaworld.com/javaworld/j...javatip66.html
    Why would they have to leave your credits when you leeched it yourself?

    EDIT:
    Dammit, haiku beat me.
    Last edited by AxedMS; 21-03-10 at 02:57 PM.

  7. #7
    Account Upgraded | Title Enabled! Carrino is offline
    MemberRank
    Mar 2010 Join Date
    1,114Posts

    Re: Open URL/Ad after closing session(yeahhh)

    Quote Originally Posted by AxedMS View Post
    http://www.javaworld.com/javaworld/j...javatip66.html
    Why would they have to leave your credits when you leeched it yourself?

    EDIT:
    Dammit, haiku beat me.
    Sorry, i lol-ed too.
    lol, i was caught red-handed, i did that because i cant find a method to open url.Java is complicated.
    But anyway, this method is fun and i think used by nexon.
    Last edited by Carrino; 21-03-10 at 03:07 PM.

  8. #8
    Member Masoud is offline
    MemberRank
    Jan 2010 Join Date
    69Posts

    Re: Open URL/Ad after closing session(yeahhh)

    Quote Originally Posted by Carrino View Post
    Sorry, i lol-ed too.
    lol, i was caught red-handed, i did that because i cant find a method to open url.Java is complicated.
    But anyway, this method is fun and i think used by nexon.
    Funny thing you wrote your name on the java file and yet you telling people not to remove credit.


    Hope you die.

  9. #9
    Account Upgraded | Title Enabled! Carrino is offline
    MemberRank
    Mar 2010 Join Date
    1,114Posts

    Re: Open URL/Ad after closing session(yeahhh)

    Quote Originally Posted by Masoud View Post
    Funny thing you wrote your name on the java file and yet you telling people not to remove credit.


    Hope you die.
    D: sorry

  10. #10
    Account Upgraded | Title Enabled! Sactual is offline
    MemberRank
    Jan 2010 Join Date
    Hong KongLocation
    212Posts

    Re: Open URL/Ad after closing session(yeahhh)

    Quote Originally Posted by Carrino View Post
    D: sorry
    Next time, just do the sendLink packet.

    Code:
    public static MaplePacket sendGuestTOS() {
            MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
            mplew.writeShort(SendPacketOpcode.SEND_LINK.getValue());
            mplew.writeShort(0x100);
            mplew.writeInt(Randomizer.getInstance().nextInt(999999));
            mplew.writeLong(0);
            mplew.write(HexTool.getByteArrayFromHexString("40 E0 FD 3B 37 4F 01"));
            mplew.writeLong(getKoreanTimestamp(System.currentTimeMillis()));
            mplew.writeInt(0);
            mplew.writeMapleAsciiString("http://nexon.net");
            return mplew.getPacket();
        }
    Easy as that.
    Btw, correct me if I am wrong, but aren't you opening a new browser to the server, not the client? If so, thats just plain stupid.

  11. #11
    Wut? Csharp? Kerelmans is offline
    MemberRank
    Apr 2008 Join Date
    Olalalala CityLocation
    417Posts

    Re: Open URL/Ad after closing session(yeahhh)

    Uhm, above packet is better I guess, since the 1st method would open the site at the server machine... not very usefull if you ask me (;

  12. #12
    Account Upgraded | Title Enabled! DaichiKokujo is offline
    MemberRank
    Jul 2008 Join Date
    I live nowhereLocation
    504Posts

    Re: Open URL/Ad after closing session(yeahhh)

    Quote Originally Posted by Carrino View Post
    Sorry, i lol-ed too.
    lol, i was caught red-handed, i did that because i cant find a method to open url.Java is complicated.
    But anyway, this method is fun and i think used by nexon.
    You're kidding me right?
    You should just get off the forums
    Remove the part where you claim credits before I report your faggot ass.

  13. #13
    Banned lolxd is offline
    BannedRank
    Feb 2010 Join Date
    85Posts

    Re: Open URL/Ad after closing session(yeahhh)

    Quote Originally Posted by DaichiKokujo View Post
    You're kidding me right?
    You should just get off the forums
    Remove the part where you claim credits before I report your faggot ass.
    Oh look, an internet tough guy.

  14. #14
    may web.very maple.pls. iAkira is offline
    MemberRank
    Aug 2009 Join Date
    somewhere..Location
    2,378Posts

    Re: Open URL/Ad after closing session(yeahhh)

    Quote Originally Posted by DaichiKokujo View Post
    You're kidding me right?
    You should just get off the forums
    Remove the part where you claim credits before I report your faggot ass.
    Lawl i looled my ___ off
    from a person with higher post of 500 with no thanks
    i was wondering why shouldn't u leave?
    kthxbaiibaii hobo <3

  15. #15
    Member Masoud is offline
    MemberRank
    Jan 2010 Join Date
    69Posts

    Re: Open URL/Ad after closing session(yeahhh)

    Quote Originally Posted by iAkira View Post
    Lawl i looled my ___ off
    from a person with higher post of 500 with no thanks
    i was wondering why shouldn't u leave?
    kthxbaiibaii hobo <3
    Why should the amount of thanks matter?



Page 1 of 2 12 LastLast

Advertisement