¿Ustedes que opinan?

Estado
No está abierto para más respuestas.
Mensajes
16
Puntuación de reacción
0
Hola que tal , aver si me pueden ayudar he instalado este mod en mi tracker que funciona con xbtit 2.3.0

El mod es para dar puntos funciona bien lo unico que se puede puntuar todas las veces que quieras cuando solo se deberia poder puntuar una vez por usuario el mismo torrent.....

Os dejo aqui el codigo del mod a ver si alguien sabe algo , yo ya he probado varias cosas y nada , a ver si ustedes me dan esa ayudita que me falta , gracias

Habria que hacer que la base de datos mysql cuente los votos no? por que parece que no los cuenta y por eso deja puntuar los torrents todas las veces que quieras , ustedes que opinan?

<?php
require_once("include/functions.php");
global $CURUSER ;
dbconn();

///== Mod by dokty - Tbdev.net

$id = 0 + $_GET["id"];
$points = 0 + $_GET["points"];
$poi = 0 + $_GET["ix"];
$infohash=mysql_real_escape_string($_GET["id"]);

$pointscangive = array("10", "20", "50", "100", "200", "500", "1000");
if (!in_array($points, $pointscangive))
stderr("Error", "No puedes dar esa cantidad de puntos!!!");

$sdsa = mysql_query("SELECT 1 FROM xbtit2_coins WHERE info_hash='$infohash' AND userid ='$CURUSER[id]'") or sqlerr(__FILE__, __LINE__);
$asdd = mysql_fetch_array($sdsa);
if ($asdd)
stderr("Error", "Ya diste puntos a este torrent.");

$res = mysql_query("SELECT * FROM xbtit2_files WHERE info_hash =" . sqlesc($infohash) . " ")or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_assoc($res) or stderr("Error", "El Torrent no se encontró");
$userid = $row["uploader"];


if ($row["uploader"] == $CURUSER["id"])
stderr("Error", "¡No puedes darte a ti mismo puntos!");

if ($CURUSER["seedbonus"] < $points)
stderr("Error", "No tiene suficientes puntos");

mysql_query("INSERT INTO xbtit2_coins (userid,info_hash,points) VALUES ($poi, " . sqlesc($infohash) . "," . sqlesc($points) . ")") or sqlerr(__FILE__, __LINE__);
mysql_query("UPDATE xbtit2_users SET seedbonus=seedbonus+" . $points . " WHERE id=$userid") or sqlerr(__FILE__, __LINE__);
mysql_query("UPDATE xbtit2_users SET seedbonus=seedbonus-" . $points . " WHERE id=$poi") or sqlerr(__FILE__, __LINE__);
mysql_query("UPDATE xbtit2_files SET points=points+" . $points . " WHERE info_hash=" . sqlesc($infohash) . "") or sqlerr(__FILE__, __LINE__);
$msg = sqlesc("Le has dado " . $points . " Seedbonus a ".$CURUSER["username"]." por el torrent ".$row["filename"].".");
mysql_query("INSERT INTO xbtit2_messages (sender, receiver, added, subject, msg) VALUES(0, $userid, " . sqlesc(time()) . ", 'Se le ha dado un regalo', $msg)") or sqlerr(__FILE__, __LINE__);
success_msg("Bien", "Se dieron correctamente los Seedbonus al torrent.");

?>

ALTER TABLE `{$db_prefix}files` ADD `points` INT( 10 ) NOT NULL default '0';]]>


CREATE TABLE `{$db_prefix}coins` (
`id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`userid` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',
`info_hash` VARCHAR( 40 ) NOT NULL DEFAULT '',
`torrentid` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',
`points` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY ( `id` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci;]]>
 
Estado
No está abierto para más respuestas.
Arriba