Thread: Players Online Via Website (No MYSQL)

Page 1 of 3 123 LastLast
Results 1 to 10 of 23
  1. #1 Players Online Via Website (No MYSQL) 
    I'm back

    Uavix's Avatar
    Join Date
    Apr 2011
    Posts
    356
    Thanks
    68
    Thanked 172 Times in 68 Posts
    Rep Power
    116
    Since keep selling this stuff, figured I would release my old server's one from months ago.



    First:
    Go into your Server class and under:
    Code:
    public class Server {
    add
    Code:
    	public static boolean forceWebUpdate = false;
    
    	public static Thread WebCommThread = new Thread (
    		new Runnable(){
    			long lastUpdate = 0;
    			@Override
    			public void run(){
    				while(true){
    					try{
    						if(System.currentTimeMillis() - lastUpdate > 1000 * 60 * 5 || Server.forceWebUpdate){
    							lastUpdate = System.currentTimeMillis();
    							new URL("http://website.com/vps/reset.php?pass=jilixpie").openStream().close();
    							for(Player p1: PlayerHandler.players){
    								if(p1 != null){
    									Client p = (Client)p1;
    									if(!p.properLogout)
    									new URL("http://website.com/vps/add.php?pass=jilixpie&u=" + p.playerName.replaceAll(" ","%20")).openStream().close();
    								}
    							}
    							if(Server.forceWebUpdate)
    								Server.forceWebUpdate = false;
    						System.gc();
    						}
    					}catch(Exception e){}
    				}
    			}
    		}
    	);
    then under main add:
    Code:
    WebCommThread.start();
    Then make sure to import:
    Code:
    import java.net.*;
    Second:
    In your Client class somewhere under logout add:
    Code:
    Server.forceWebUpdate = true;
    then declare this somewhere:
    Code:
    	public boolean runOnce = true;
    then under process add:
    Code:
    		if(runOnce){
    			Server.forceWebUpdate = true;
    			runOnce = false;
    		}
    Third:
    Download these files and add them to your webhost:
    Players Online Files
    You have to call it somehow to count players, like this:
    Code:
    <?php 
    $fileName = FOLDNAME/players.txt"; 
    $countOnline = count(file($fileName)); 
    	echo "$countOnline players online."; 
    ?>
    Credits:
    Matt123337
    Me

    Quote Originally Posted by Blood View Post
    im 9 lol I can't get a job
    Rune-Server Userbase ^


    Vault proving what we have all known all along: he is a 9faggot.
    Reply With Quote  
     


  2. #2  
    Registered Member

    Join Date
    Sep 2011
    Posts
    3,796
    Thanks
    1,337
    Thanked 1,057 Times in 603 Posts
    Rep Power
    1194
    Good job.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Nov 2011
    Posts
    73
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Rep Power
    14
    I'm more of an in-game person.
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    May 2011
    Posts
    2,066
    Thanks
    1,433
    Thanked 349 Times in 246 Posts
    Rep Power
    0
    Great job, thank you!
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    Sep 2011
    Posts
    3,796
    Thanks
    1,337
    Thanked 1,057 Times in 603 Posts
    Rep Power
    1194
    Quote Originally Posted by vial View Post
    I'm more of an in-game person.
    That has no relevance?
    Reply With Quote  
     

  6. #6  
    Registered Member Paulius,'s Avatar
    Join Date
    Aug 2011
    Posts
    73
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Rep Power
    31
    Nice
    Reply With Quote  
     

  7. #7  
    Registered Member Paulius,'s Avatar
    Join Date
    Aug 2011
    Posts
    73
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Rep Power
    31
    Fix:
    In server.java
    add this import
    import java.net.*;
    Reply With Quote  
     

  8. #8  
    I'm back

    Uavix's Avatar
    Join Date
    Apr 2011
    Posts
    356
    Thanks
    68
    Thanked 172 Times in 68 Posts
    Rep Power
    116
    Quote Originally Posted by Paulius, View Post
    Fix:
    In server.java
    add this import
    import java.net.*;
    Forgot that, thanks.
    Though if people are using an IDE (like they should), it wouldn't be a problem :P

    Quote Originally Posted by Blood View Post
    im 9 lol I can't get a job
    Rune-Server Userbase ^


    Vault proving what we have all known all along: he is a 9faggot.
    Reply With Quote  
     

  9. #9  
    Banned
    Join Date
    Dec 2011
    Posts
    49
    Thanks
    8
    Thanked 3 Times in 2 Posts
    Rep Power
    0
    Very Nice Chris May use bro
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Jun 2011
    Posts
    119
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Rep Power
    15
    Wait, I'm confused how do we call it to the website??
    Reply With Quote  
     


Page 1 of 3 123 LastLast
Thread Information
Users Browsing this Thread

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

Similar Threads

  1. [PI] Website Players Online [ NO MYSQL]
    By ItsGoml in forum Selling
    Replies: 26
    Last Post: 01-08-2012, 07:05 PM
  2. Players Online -MySQL-
    By Goth Wolf in forum Help
    Replies: 1
    Last Post: 07-04-2009, 01:09 PM
  3. Players online [No MYSQL]
    By PeeHPee in forum Tutorials
    Replies: 34
    Last Post: 09-15-2008, 01:27 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •