All credits for the script goes to me.
I've had this script for a while, but I decided to release it here because theres no use for it to me because I can not host my own server.
I've been lately doing some stuff on HTML, CSS, PHP and MySQL and I decided to do some scripts with War3Source, and so far I've done a script for Top10 list, which can of course be used just as Ranking list. It shows the players total_level. This is a simple code which maybe anyone can do, but in case of theres some people who can't do this by them selves, I'd be glad to be able to help those.
Theres just few things you got to do, and those are...
Ranking/Top 10
1. Create a config.php in your website folder (I've got this at stats folder).
2. Copy and paste this to config.php
Code:
<?php
// Make a MySQL Connection
mysql_connect("localhost", "root", "password") or die(mysql_error());
mysql_select_db("tf2") or die(mysql_error());
?>
3. What you got to do, is change the localhost, root, password to the ones you've got. By default localhost is localhost, root is root, and password is blank, unless you've changed the password.// Make a MySQL Connection
mysql_connect("localhost", "root", "password") or die(mysql_error());
mysql_select_db("tf2") or die(mysql_error());
?>
Also the db "tf2" should be changed to whatever you then have there.
That was just the config part of it, so the script can connect to the database.
4. Create a new file named top10.php or ranking.php or whatever you wish to name it. This is the file which you will be adding to your website later. You can also add this to the page where you wish to include the ranking.
5. Copy and paste this to the file.
Code:
<?php
require("config.php");
// Get comments from database
$query = mysql_query('SELECT * FROM war3source ORDER BY total_level DESC LIMIT 10');
while($row = mysql_fetch_assoc($query))
// Show comments
echo ''.$row['name'].'<br />';
?>
require("config.php");
// Get comments from database
$query = mysql_query('SELECT * FROM war3source ORDER BY total_level DESC LIMIT 10');
while($row = mysql_fetch_assoc($query))
// Show comments
echo ''.$row['name'].'<br />';
?>
Its done!
You'll probably see the LIMIT 10 there, its the one which chooses how many from there it shows. If you remove the whole LIMIT 10 it will show all it finds from there.
I'll add to it also a search button to find from the right player hes stats.
Currently it just shows the total_level of the player.
Hope you like it.
Race Info
This does pretty much the same thing as the in-game raceinfo.
It shows up the information about the race, this thing does it in the website though.
It gets the race information from the MySQL database.
It tells the Skill 1, Skill 2, Skill 3, Ultimate and their description for the race.
It might be useless.
Just get the config.php which is in the first code tag of this post.
Then do a raceinfo.php and copy & paste this into it or just add it to the page you wish to include this.
Code:
<table border="1">
<tr>
<td><b>Name</b></td>
<td><b>Skill 1</b></td>
<td><b>Skill 2</b></td>
<td><b>Skill 3</b></td>
<td><b>Ultimate</b></td>
<td><b>Skill 1 Description</b></td>
<td><b>Skill 2 Description</b></td>
<td><b>Skill 3 Description</b></td>
<td><b>Ultimate Description</b></td>
</tr>
<?php
require("config.php");
// Get comments from database
$query = mysql_query('SELECT * FROM war3sourceraces');
while($row = mysql_fetch_assoc($query))
// Show comments
echo '<tr><td>'.$row['full_name'].'</td><td>'.$row['skill1'].'</td><td>'.$row['skill2'].'</td><td>'.$row['skill3'].'</td><td>'.$row['ult'].'</td><td>'.$row['skill1_desc'].'</td><td>'.$row['skill2_desc'].'</td><td>'.$row['skill3_desc'].'</td><td>'.$row['ult_desc'].'</td></rt>';
?>
</table>
<tr>
<td><b>Name</b></td>
<td><b>Skill 1</b></td>
<td><b>Skill 2</b></td>
<td><b>Skill 3</b></td>
<td><b>Ultimate</b></td>
<td><b>Skill 1 Description</b></td>
<td><b>Skill 2 Description</b></td>
<td><b>Skill 3 Description</b></td>
<td><b>Ultimate Description</b></td>
</tr>
<?php
require("config.php");
// Get comments from database
$query = mysql_query('SELECT * FROM war3sourceraces');
while($row = mysql_fetch_assoc($query))
// Show comments
echo '<tr><td>'.$row['full_name'].'</td><td>'.$row['skill1'].'</td><td>'.$row['skill2'].'</td><td>'.$row['skill3'].'</td><td>'.$row['ult'].'</td><td>'.$row['skill1_desc'].'</td><td>'.$row['skill2_desc'].'</td><td>'.$row['skill3_desc'].'</td><td>'.$row['ult_desc'].'</td></rt>';
?>
</table>




Logged