Gtop100 VotePingBack not working.

11/02/2017 13:06 FlyffDeveloper#1
Hello everyone,

I have a problem with my gtop100 voting. And I am not sure where it is going wrong at the moment.

What I have:

The url the player clicks is defined like this:
Code:
<a href="http://www.gtop100.com/topsites/Flyff/sitedetails/mysitehere?vote=1&pingUsername=<?= $_SESSION['user'] ?>" title="Flyff Private Server" target="_blank"><img src="http://www.gtop100.com/images/votebutton.jpg" border="0" alt="Vote Now"></a>
I have tested this and the url properly adds the username in it when click on it.
On gtop100 I have defined this as my pingback url:
[Only registered and activated users can see links. Click Here To Register...]


This leads to my votepingback url. Which has the following code:
Code:
<?php

 require_once($_SERVER['DOCUMENT_ROOT'].'/Source/Includes/Config.php');

	$voterIP = isset($_POST["VoterIP"]) ? $_POST['VoterIP'] : ''; // voter ip address
	$success = isset($_POST["Successful"]) ? abs($_POST["Successful"]) : 1; // 1 for error, 0 for successful
	$reason = isset($_POST['Reason']) ? $_POST["Reason"] : '';
	$pingUsername = isset($_POST["pingUsername"]) ? $_POST["pingUsername"] : '';
	$postback = isset($_GET['custom']) ? $_GET['custom'] : '';
	
	// GTop 100
	if (!empty($_POST['pingUsername']))
	{
        $controller = new Donate();
        $object = $controller->SetVoteCoins($pingUsername);
	}
	else
	{
        Alert("Not from Gtop100");
	}
?>
Then in the donate controller I have this:
Code:
	public function SetVoteCoins($pingUsername)
	{
		global $cfg;
		$vote = self::Select(array('vcoins', 'lastvote'), 'Website', 'WebAccount', array('username' => $pingUsername));
		$last = $vote['Result'][1]['lastvote'];
		$coins = (int)$vote['Result'][1]['vcoins'];
		
		
	    $nextvote = time()+1*20*60*60;
		$newcoins = $coins + 10;
		
		self::Update(array('vcoins' => $newcoins), array('username' => $pingUsername), 'Website', 'WebAccount');
		self::Update(array('lastvote' => $nextvote), array('username' => $pingUsername), 'Website', 'WebAccount');
		
		//if($last == NULL || $last <= time()){
		//	$nextvote = time()+1*20*60*60;
		//	$newcoins = $coins + 10;
		//	self::Update(array('vcoins' => $newcoins), array('username' => $_SESSION['user']), 'Website', 'WebAccount');
		//	self::Update(array('lastvote' => $nextvote), array('username' => $_SESSION['user']), 'Website', 'WebAccount');
		//	return 'Vote success. Please refresh your panel to see your vote coins.';
		//}else {
		//	return 'Can not vote now. New vote at: ' . date('d.m.Y h:i:s a');
		//}
	}
(The timer check is disabled for testing purposes at the moment).

However when I vote I do not get anything, I can see on my Gtop100 dashboard I have 4x IN but 0x OUT. So its not going out? I don't know exactly what this means or where the error is within the page.
I know that browsing to the url triggers the PHP code.

Any ideas?
11/02/2017 16:18 Dr. Peacock#2
What Website do you use ? ;)
11/02/2017 17:48 FlyffDeveloper#3
I'm using [Only registered and activated users can see links. Click Here To Register...] as my template and building on that or making some small changes where needed.
11/06/2017 07:07 FlyffDeveloper#4
Bumps, any suggestions?
11/06/2017 07:28 FlyffServices#5
What is not working? You dont get pingback data? Select query dont work? Update votepoints?

Add on "votepingback url" at the start var_dump($_REQUEST) and look what gtop is sending.

- Verify if its good (probably they do a GET request and u check POST?)

Log your querys for Select and Update and check in MSSQL Studio Managment Client if the Query Syntax are valid.
11/06/2017 08:18 FlyffDeveloper#6
Quote:
Originally Posted by FlyffServices View Post
What is not working? You dont get pingback data? Select query dont work? Update votepoints?

Add on "votepingback url" at the start var_dump($_REQUEST) and look what gtop is sending.

- Verify if its good (probably they do a GET request and u check POST?)

Log your querys for Select and Update and check in MSSQL Studio Managment Client if the Query Syntax are valid.

I know the sql queries work since I tested those. From what I can notice atm is either gtop isn't sending a pingback or the pingback isn't received by my website correctly and im not sure how to check that.


Quote:
- Verify if its good (probably they do a GET request and u check POST?)
This could be plausible, will check.
11/06/2017 08:27 xTwiLightx#7
You should also check your webserver's access logs to verify that the pingbacks are at least being sent to you.
11/06/2017 08:42 FlyffDeveloper#8
Quote:
Originally Posted by xTwiLightx View Post
You should also check your webserver's access logs to verify that the pingbacks are at least being sent to you.
It looks like they aren't being sent. I added some code to log $_REQUEST to a file when the pingback page loads/is hit and voted afterwards. The log file wasn't updated.

That and on my Gtop100 Dashboard i have 0 under "OUT". But I have no clue why it wouldn't be sending things.
11/06/2017 08:59 FlyffServices#9
Quote:
Originally Posted by FlyffDeveloper View Post
It looks like they aren't being sent. I added some code to log $_REQUEST to a file when the pingback page loads/is hit and voted afterwards. The log file wasn't updated.

That and on my Gtop100 Dashboard i have 0 under "OUT". But I have no clue why it wouldn't be sending things.
You can send me your Teamviewer ID / PIN with a PN and i will take a look into your settings.