Evony Guides and Help
Trik Forum - RuneScape Forum  
Register Forum Homepage Members Mark Forums Read


Trik Members: 34,283 | Total Posts: 132,912 | Total Threads: 25,583
Welcome to our newest member, boblin.
Go Back   Trik Forum - RuneScape Forum > Runescape 2 Cheating > Runescape Private Servers
Reload this Page Players Online TuT mysql
Runescape Private Servers Advertise your Runescape private server(s) here. Discuss about servers, post tutorials, get help, read people's developments, etc.


Reply
 
Thread Tools Display Modes
Players Online TuT mysql
Old
  (#1)
Jake is Offline
Corporal
Junior Member
Jake is an unknown quantity at this point
 
Posts: 115
Thanks: 2
Thanked 6 Times in 4 Posts
Join Date: Nov 2009
Location: United Kingdom
Activity: 0%
Longevity: 47%
Today: 0/5
   
Post Players Online TuT mysql - 11-15-2009, 05:39 AM

Purpose: Players online with a remote connection and no mysql!
Difficulty: 6/10
Tested On: Devolution
Requirements: An FTP client, I suggest Filezilla or SmartFTP. You can get your FTP details from your website's host.

Add this method and imports to the client class (took it from Devolution v7 ):


Code:
import java.net.URL;
import java.net.URLConnection;
import java.io.DataInputStream;

public void savePlayers() {
try {
// NOTE: Change password to your own password.
URL page = new URL("http://filthscape.net76.net/players_online.php?password=ap2572hfbh5fd&players= "+PlayerHandler.getPlayerCount());
URLConnection conn = page.openConnection();
DataInputStream in = new DataInputStream(conn.getInputStream());
String source, pageSource = "";
while ((source = in.readLine()) != null) {
pageSource += source;
}
} catch (Exception e) {
e.printStackTrace();
}
}
Basically it just opens a page. The URL should be in this format:


Code:
http://yourwebsite.com/players_onlin...layers=PLAYERS
Call this method whenever someone logs in, or is disconnected.

Now upload these two files to your website:

players.txt:


Code:
0
The next part is important!!!!!!! In your FTP client, connect to your website and right click on players.txt. You should see something like 'permissions'. Click it. There should be checkboxes or something like that.

CHECK THE BOXES UNDER 'write', 'writable', or w/e it's called EXCEPT for public! This makes it so that players.txt can be written to by everyone except the public (like from another website).

So you should check owner and owner's group.

Add players_online.php:


Code:
<?php

$password = ap2572hfbh5fd; // change this to your password
$rsc = fopen("players.txt", 'r') or die("Failed to open file!");
$players = fread($rsc, filesize("players.txt"));

if ($password == $_GET['password']) {
$wsc = fopen("players.txt", 'w') or die("Failed to open file!");
fwrite($wsc, $_GET['players']);
header('Location: http://filthscape.net76.net/players.php');
}

?>
Don't forget to change the password to your own! Basically, $rsc loads the file 'players.txt' in a reading format, hence the 'r', then $players reads the file. Then it checks if the passwords match (so other people can't edit this). If they match, it opens the file in a writable format, hence the 'w'. Then it writes to the file the players. Then, finally it redirects you to your home page (you should change that redirect to your homepage.)

This is how you retrieve the players:


Code:
<?php

include "players_online.php";

echo "There are currently $players players online!";

?>
Include does what it says. It includes the php file so you can take variables from it. In this case, we want the $players variable. echo prints out the statement after it. If you use these quotes: 'text' it will print out the actual variable name. I.E


Code:
echo 'There are currently $players players online!';

WOULD APPEAR AS:

There are currently $players players online!
But if you use these quotes: "text"


Code:
echo "There are currently $players players online!";

WOULD APPEAR AS:

There are currently 100 players online!
You are done!

DON'T FORGET TO CHANGE PASSWORDS!!!!

Or you can do :: players


Jake Please Rep++


Proud to Be A Trik's Forum Member!
Yay 100 rank Party!
  
Reply With Quote Share with Facebook
Reply

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump




======================================================================================== ---------------------------------------------------------------------------------------- ========================================================================================

Your Ad Here

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Copyright © Trik.com