Que es Chequear Votación?

Es un sistema para chequear si los jugadores votan o no por su sitio o servidor ingresando el código correcto de seguridad dado en la dirección de votación.

Postback PHP

Whitelist IP: monitor.topg.org in your Firewall Settings.

Para configurar la URL del postback vaya a su panel de control, clic en su sitio o servidor luego use la opción de Editar Configuración.

1. Configurar la URL del Postback (en TopG):

https://YOURDOMAIN/postback.php
Para configurar este link use la opción Editar Configuración desde la página de su servidor.
El nombre del archivo postback.php es solo un ejemplo y este no es obligatorio, puede nombrarlo como usted quiera.


2. Actualice el link de su votación y los parámetros para finalizar:

https://topg.org/CATEGORY/in-SITEID-PARAMETER
Su enlace votación en TopG debe tener un extra - y el parámetro en el final. Copie el LINK de su código de Votación y agregue -USUARIO o -123456 o algo que no pierda de su vista (El PARAMETRO puede ser solo números, letras y _ ). Por ejemplo si desea chequear el usuario `Razor` votar o no, puedo hacer el enlace https://topg.org/CATEGORY/in-SITEID-Razor.

3. Nuestra Respuesta:

TopG llamará a su sitio luego de la votación y la llamada devuelta se parecerá a este enlace :
https://YOURDOMAIN/postback.php?p_resp=PARAMETER&ip=USERIP
Nosotros le enviamos de vuelta el mismo PARAMETRO y la llamada se hace sólo si el usuario ha votado por usted. Su postback.php se puede ACTUALIZAR en este punto el PARAMETRO del usuario es Válido. En caso de que él no ha votado nosotros no le enviamos ninguna respuesta.


Ejemplo:

Como su link de votación puede verse como UserID (primero) o Usuario (segundo) :
https://topg.org/CATEGORY/in-SITEID-1234
https://topg.org/CATEGORY/in-SITEID-Razor

Nuestra respuesta, en caso de ser el primero o segundo, será :
https://YOURDOMAIN/postback.php?p_resp=1234&ip=123.123.123.123
https://YOURDOMAIN/postback.php?p_resp=Razor&ip=123.123.123.123
Conclusión: El jugador con id de cuenta 1234 o usuario Razor ha votado por usted, en este caso llamamos a su link postback con su parametro.
123.123.123.123 is the IP address used by the player to vote on Topg.
Por favor lea nuestro ejemplo PHP para que comprenda la captura a nuestra respuesta. Le enviamos la respuesta a la llamada http SOLO cuando el usuario ha votado por usted. Si necesita ayuda configurando esto contactenos.

How to fix voting callback on topg for Fusion CMS:
If you are using Fusion CMS go to /applications/modules/vote/plugins/topg.php and change line 21 to this:
return $this->CI->input->ip_address() == gethostbyname('monitor.topg.org');

postback.php example


define("DEBUG", 0); //set to 1 to enable debuger
define("LOG_FILE", "_postback.log"); //if debug is enabled will create this file for logs
define("TOPG_IP", gethostbyname("monitor.topg.org")); //This is TopG IP address

$ip_request = $_SERVER['REMOTE_ADDR']; //for Cloudflare $ip_request = $_SERVER["HTTP_CF_CONNECTING_IP"];
if($ip_request == TOPG_IP) //check if response is coming from TopG
{
	if(DEBUG == true) {	
	 error_log(date('[Y-m-d H:i] ')."[OK] Valid callback: $ip_request".PHP_EOL, 3, LOG_FILE);	 
	}
	
	//get the parameters response from us and clean them
	$p = preg_replace('/[^A-Za-z0-9\_\-]+/','',$_GET['p_resp']); //can be only numbers letters, minus and underscore
	$user_ip = preg_replace('/[^0-9\.]+/','',$_GET['ip']); //can be only numbers and dots
	
	//connect to database
	
	//if using MySQL uncomment the following lines (remove slashes)
	//$p = mysql_escape_string($p); 
	//$user_ip = mysql_escape_string($user_ip);
	
	//or if using MySQLi (change $DB name to correct one)
	//$p = $DB->real_escape_string($p);
	//$user_ip = $DB->real_escape_string($user_ip);
	
	if(DEBUG == true) {	
	 error_log(date('[Y-m-d H:i] ')."[GET] Parameters [p_resp]=$p [ip]=$user_ip".PHP_EOL, 3, LOG_FILE); 
	}
	
	//Note: we send the parameters $_GET['p_resp'] and $_GET['ip'] back ONLY! if user $p has voted
	//here run your code
	//first you should check if account $p is valid and exists in your database
	//also check if the user has voted in the last 12 hours
	//give points to user $p that voted with ip $user_ip
	//close database
}
else
{
	if(DEBUG == true) {	
	 error_log(date('[Y-m-d H:i] ')."[Invalid] Invalid request: $ip_request".PHP_EOL, 3, LOG_FILE); 
	}
	//handle invalid request when callback is NOT from TopG.
	//ignore or log the $ip_request as invalid request in your database
}

Minecraft Votifier

Minecraft Votifier

Whitelist IP: monitor.topg.org in your Firewall Settings.

Para Minecraft usamos un plugin especial llamado votifier. El flujo del proceso de votación es como este :
  1. Sus jugadores ingresan su usuario en nuestro enlace de Votación.
  2. Le enviamos una respuesta a su servidor si él ha votado por lo que le puede recompensar.
TOP: To auto-fill Minecraft username field change your voting link to this syntax:
https://topg.org/Minecraft/in-SITEID-username

Como habilitar Votifier

Usted puede habilitar y configurar este plugin en su Control Panel cuando agrega o edita su servidor.

Descargar e instalar el plugin

Puede obtener el plugin votifier de Bukkit o de Curse: Download Votifier . El segundo paso es encontrar foros de bukkit para que trabaje bien el listador votifier compatible con su version minecraft.

Obtenga su configuración votifier

PUBLIC KEY it's a long string file located: /plugins/Votifier/rsa/public.key. Copy-paste ALL of it.
VOTIFIER IP and VOTIFIER PORT settings can be found inside: /plugins/Votifier/config.yml
host: VOTIFIER IP //your external IP address, the one used to connect to play
port: VOTIFIER PORT //the default votifier port is 8192
debug: false //set to true to see connection details in console 
listener_folder: plugins/Votifier/listeners
Le sugerimos para habilitar la depuración (depurar: cierto) mientras hace pruebas a los nuevos topsites.