8791 sujets

Développement web côté serveur, CMS

Bonjour,

Je me retrouve dans une impasse j'aurais voulu quand on clic 10 fois sur un lien sa ajoute 1 point.

Hors avec ma fonction 1 clic = 1 point

Je vous montre ma fonction créer


	function do_vote($site) {
		global $logon, $cms;
		
		if($logon->online) {
			
			$q = mysql_query("SELECT COUNT(*) AS `x` FROM ".$this->db.".votes WHERE user='".$logon	->username."' AND (`time` + ".(60*60*2).") > ".time()." AND `site` = ".$site."", $this->c);
			$r = mysql_fetch_assoc($q);
			
			if($r['x'] == 0) {
			
				$q2 = mysql_query("SELECT COUNT(*) AS `y` FROM ".$this->db.".topsites WHERE id = ".$site, $this->c);
				$r2 = mysql_fetch_assoc($q2);
				
				if($r2['y'] == 1) {
				
					$ip = $_SERVER['REMOTE_ADDR'];
					$time = time();
					$date = date("Y-m-d");
					$user = mysql_real_escape_string($logon->username);
					$month = date("F-Y");
					
					mysql_query("INSERT INTO ".$this->db.".votes(`site`, `ip`, `time`, `date`, `user`, `month`) VALUES('".mysql_real_escape_string($site)."', '".$ip."', '".$time."', '".$date."', '".$user."', '".$month."')", $this->c) or die(mysql_error());
					
					mysql_query("UPDATE ".$this->db.".topsites SET `total` = `total` + 1 WHERE `id` = '".$site."'", $this->c) or die(mysql_error());

                                        mysql_query("UPDATE ".$this->db.".monthlyvotes SET `votes` = `votes` + 1 WHERE `site` = '".$site."'", $this->c) or die(mysql_error());
					
					mysql_query("UPDATE ".$this->db.".account_info SET totalvp = totalvp + 1, vp = vp + 1 WHERE `user` = '".$user."'", $this->c) or die(mysql_error());
					
					$cms->do_log("vote", $_SERVER['REMOTE_ADDR'], $logon->username, time(), date("Y-m-d H:i:s"));
				}
			}
		}
	}


Merci pour votre aide
Modifié par subzeros (04 Feb 2011 - 13:03)