Postează răspuns 
 
Evaluarea subiectului:
  • 0 voturi - 0 în medie
  • 1
  • 2
  • 3
  • 4
  • 5
Fix My Advertisements
Autor Mesaj
Mihu Deconectat
Simply the best!
Dezvoltatori

Mesaje: 1,582
Alăturat: Sep 2010
Reputaţie: 23
Mesaj: #1
My Advertisements

Azi am descoperit o nouă problemă legată de una dintre modificările de top pentru MyBB. Ea apare la toate versiunile de My Advertisements care au fost publicate până pe saitul oficial mybb.com. În ce constă problema...
Păi în momentul în care adăugați o zonă publicitară pe forumul dvs. cu această modificare și dați click pe acel spațiu, în baza de date se contabilizează numărul de click-uri date pe zona respectivă. Problema e că se pot efectua și click-uri false (fake), adică se pot adăuga click-uri fără să se dea click pe reclamă. De unde apare problema? În corpul funcției myadvertisements_click este buba.

Cod PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function myadvertisements_click()
{
	global $mybb, $db;
	
	if ($mybb->settings['myadvertisements_disabled'])
		return;
	
	// in case we switch page (we clicked a lin, right?) the script is not stopped
	ignore_user_abort(true);
	
	// this query could be avoided if we logged all advertisement ID's in cache or something
	// TODO: store active advertisements ID's and expiration time in cache and check if the aid exists in the line below instead of running the query
	$query = $db->simple_select('myadvertisements_advertisements', '*', 'aid='.intval($mybb->input['aid']));
	$ad = $db->fetch_array($query);
	if (!$ad)
		return; // do not log clicks as the ad doesn't exist
			
	// increase clicks
	$db->update_query('myadvertisements_advertisements', array('clicks' => 'clicks+1'), 'aid='.$ad['aid'], 1, true);
}

Autorul modificării a uitat să adauge un test de verificare a autenticității cererii "post" efectuată de scriptul myadvertisements.js. După corectarea acestei probleme, funcția ar trebui să arate așa :

Cod PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function myadvertisements_click()
{
	global $mybb, $db;
	
	if ($mybb->settings['myadvertisements_disabled'])
		return;
	
	// in case we switch page (we clicked a lin, right?) the script is not stopped
	ignore_user_abort(true);
	
    if (isset($mybb->input['action']) && $mybb->input['action'] == "do_click" && isset($mybb->input['my_post_key']) && verify_post_key($mybb->input['my_post_key'], true)) 
    {
        // this query could be avoided if we logged all advertisement ID's in cache or something
	    // TODO: store active advertisements ID's and expiration time in cache and check if the aid exists in the line below instead of running the query
	    $query = $db->simple_select('myadvertisements_advertisements', '*', 'aid='.intval($mybb->input['aid']));
	    $ad = $db->fetch_array($query);
	    if (!$ad)
            return; // do not log clicks as the ad doesn't exist
			
	    // increase clicks
	    $db->update_query('myadvertisements_advertisements', array('clicks' => 'clicks+1'), 'aid='.$ad['aid'], 1, true);
    }
}

Acum ar trebui ca la accesarea unui URL de genul următor DOMENIU/xmlhttp.php?aid=ZONA_PUBLICITARA să nu mai crească numărul de click-uri!
Problema o voi raporta și autorului acestei modificări... Să sperăm că face un update cât mai repede posibil!


Users : collective term for those who use computers. Users are divided into three types : novice, intermediate and expert.
Novice users : people who are afraid that simply pressing a key might break their computer.
Intermediate users : people who don`t know how to fix their computer after they`ve just pressed a key that broke it.
Expert users : people who break other people`s computers.
(Acest mesaj a fost modificat ultima dată: 09-27-2011 03:10 PM de Mihu.)
09-27-2011 03:10 PM
Vizitează site-ul acestui utilizator Găseşte toate mesajele acestui utilizator Citaţi acest mesaj într-un răspuns
raoul Deconectat
Membru
Membri

Mesaje: 41
Alăturat: Mar 2011
Reputaţie: 1
Mesaj: #2
RE: My Advertisements

Bun !
Citat:Problema o voi raporta și autorului acestei modificări... Să sperăm că face un update cât mai repede posibil!

Ti-a raspuns ? In legatura cu update-ul ?
10-28-2011 12:59 PM
Vizitează site-ul acestui utilizator Găseşte toate mesajele acestui utilizator Citaţi acest mesaj într-un răspuns
Mihu Deconectat
Simply the best!
Dezvoltatori

Mesaje: 1,582
Alăturat: Sep 2010
Reputaţie: 23
Mesaj: #3
RE: My Advertisements

Dap a si facut update! Versiunea de fata nu mai are aceasta problema!

Users : collective term for those who use computers. Users are divided into three types : novice, intermediate and expert.
Novice users : people who are afraid that simply pressing a key might break their computer.
Intermediate users : people who don`t know how to fix their computer after they`ve just pressed a key that broke it.
Expert users : people who break other people`s computers.
10-29-2011 10:03 PM
Vizitează site-ul acestui utilizator Găseşte toate mesajele acestui utilizator Citaţi acest mesaj într-un răspuns
Postează răspuns 


Săritura forum:


Utilizator(i) care navighează în acest subiect: 1 Musafir(i)