Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 13:15

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] Vote counter (xtremetop100, PHP+JavaScript)

Discussion on [Release] Vote counter (xtremetop100, PHP+JavaScript) within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
[Release] Vote counter (xtremetop100, PHP+JavaScript)

First of all, make sure you have .

We will go through three easy steps.

1) Fetch content from xtremetop100
2) Load it into an HTML-element
3) Find the correct element for votecount and retrieve it


PHP:
Code:
$voteContents = file_get_contents('http://www.xtremetop100.com/conquer-online');
HTML:
Code:
<div id="voteContents" style="display: none;"><?=$voteContents?></div>
JavaScript (jQuery):
Code:
function GetVotes(serverid)
{
  return $("#voteContents").find('a[href="out.php?site=' + serverid + '"]').first().parent().next(".stats1").find("span").eq(1).html();
}
You can now, via JavaScript (jQuery if you ask me) populate any element with the count. To do so, simply do this.


Lets say we have an element with the class "voteCounts"
<span class="voteCounts"></span>

We can now do:
Code:
$(".voteCounts").text(GetVotes(1132343528))
The ID is your server ID.

I chose to go with PHP over JSONp for external fetching of data. Whoever uses this should also consider making an AJAX-call to populate the #voteContents once the document is ready, to avoid any possible delay.


Enjoy.
_Emme_ is offline  
Thanks
4 Users
Old 07/08/2013, 18:26   #2
 
turk55's Avatar
 
elite*gold: 130
Join Date: Oct 2007
Posts: 1,655
Received Thanks: 705
simple, yet effective =p
turk55 is offline  
Old 07/08/2013, 19:39   #3
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
The only "trick" with this is knowing your JavaScript. You could parse it all via PHP, but it won't be as clean. Here's an example in raw PHP(very unclean). It fetches amount of votes and the current rank.


PHP Code:
<?php
function getVotes($parts) { return ($parts[1][449 2] == "<" $parts[1][449].$parts[1][449 1] : $parts[1][449].$parts[1][449 1].$parts[1][449 2]); }
function 
getRank($parts$pos) { return ($parts[0][$pos 24] == "<" $parts[0][$pos 23] : $parts[0][$pos 23].$parts[0][$pos 24]); }
function 
rankPos($haystack){
    
$pos strpos(strrev($haystack), strrev('number'), 0);
    return (
$pos === false)?false:( strlen($haystack) - $pos strlen('number') );
}

$contents file_get_contents('http://www.xtremetop100.com/conquer-online'); 
$ar explode('COServer'$contents);

$votes getVotes($ar);
$totalVotes $votes;
$rank getRank($arrankPos($ar[0]));

echo 
'Rank: '.$rank.'<br/>Total votes: '.$votes;
?>
_Emme_ is offline  
Old 07/09/2013, 00:50   #4
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
Should I be honest. It's neat, but quite useless. 99% of the votes are fake on xtremetop100, for the matter on any voting websites.
Super Aids is offline  
Old 07/09/2013, 01:09   #5
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
Depends on how you see it though. Almost every private server uses xtremetop100, this is just a way for them to present amount of votes (and rank easily done) on their website.

Would be a nice addon don't you think?
_Emme_ is offline  
Old 07/09/2013, 09:41   #6
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
Yup, my point was that the votes are generated by bots, thus is kind of a fake rank most servers have, since it's not based on actual player votes.
Super Aids is offline  
Old 07/09/2013, 18:07   #7
 
elite*gold: 0
Join Date: Sep 2012
Posts: 775
Received Thanks: 329
definitely nice snippet but there is more useful items you can do, ex. earning points system (surveys and tasks like at super rewards)
as of what i remember the hardest part is to manage the connections between member login , db and website confirmation to reward members (i couldn't get it working so don't trust what i just said :P )
that would definitely be the greatest thing one can do to co community
go for it is offline  
Old 07/09/2013, 19:38   #8
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
@Aids
I know what you mean but doesn't remove the fact that people still use it.

@go_for_it
Do you mean for servers to put up and reward players, and the server making money out of it? Do you know any service that is real. I have stumbled across some but they all ended up being fake or having to register your phone etc - I don't like that kind of stuff.

Just give me the tools I need and I'll do the logic and functionality for it all, no worries.
_Emme_ is offline  
Thanks
1 User
Old 07/09/2013, 20:31   #9
 
elite*gold: 0
Join Date: Sep 2012
Posts: 775
Received Thanks: 329
Quote:
Originally Posted by 'Emil View Post
@Aids
I know what you mean but doesn't remove the fact that people still use it.

@go_for_it
Do you mean for servers to put up and reward players, and the server making money out of it? Do you know any service that is real. I have stumbled across some but they all ended up being fake or having to register your phone etc - I don't like that kind of stuff.

Just give me the tools I need and I'll do the logic and functionality for it all, no worries.
well i use a simple common sense to figure out who's real and who's fake by going to big games around and find what they use
imvu and crossfire/z8games are using so many of that rewarding systems for years, every website they use are real (as they been using it for years)
there is no worries about getting sued as the only one who will complain is tq, which should send you first a warning asking you to take the private server down
but the most important questions is, are they going to accept you ? (they have restrictions for your website also your services) but generally i've seen a crossfire private server using it

anyway it's not hard but it takes serious web programming skills
go for it is offline  
Old 07/09/2013, 21:06   #10
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
If it requires me to apply for it etc then screw it. Feel free to come up with other ideas for things to release.
_Emme_ is offline  
Old 07/09/2013, 21:26   #11
 
elite*gold: 0
Join Date: Sep 2012
Posts: 775
Received Thanks: 329
Quote:
Originally Posted by 'Emil View Post
If it requires me to apply for it etc then screw it. Feel free to come up with other ideas for things to release.
well it doesn't require alot (just general info) but no phone vitrification or even ssn or visa but still that's up to you ^^
go for it is offline  
Reply


Similar Threads Similar Threads
Vote xtremetop100.com
04/06/2013 - Conquer Online 2 Trading - 5 Replies
Hey Guys im sell a voting Prices : for 1000 voting 30 usd 2000 voting 60 usd 3000 voting 90 usd 4000 voting 120 usd 5000 voting 150 usd im accept only PayPal : pm me
[Release] Xtremetop100 Vote Comparer (W/ source)
08/29/2011 - Coding Releases - 2 Replies
http://i56.tinypic.com/5yamtx.png Download Binary & Source Code: VoteCompare.zip using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq;
Vote Bot für xtremetop100
05/13/2010 - RO Exploits, Hacks, Bots & Guides - 7 Replies
ich suche die ganze zeit eine votebot fürein pserver in xtremetop site,ich kann nirgendwo finden.kann jemand mir so ein program posten bitte



All times are GMT +1. The time now is 13:17.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.