Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2012-10-25 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog
Chat

War3:Source
October 24, 2012, 08:43:13 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://war3source.com/index.php?board=9.0
What is War3Source?: http://war3source.com/index.php?topic=200.0
Sample Stats: http://war3source.com/war3stats
Steam Community Group: http://steamcommunity.com/groups/war3source
War3Source SVN Checkout: http://ownageclan.com/svn/war3source/
War3Source servers: http://www.game-monitor.com/search.php?vars=war3_version=
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Website scripts  (Read 1018 times)
ibab
Newbie
*
Posts: 3


View Profile
« on: March 16, 2010, 07:06:42 AM »

In case of this is wrong place for such a thing as this, then either move it or delete it please.
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.
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 />';

?>


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>
« Last Edit: March 16, 2010, 07:17:18 AM by ibab » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!