Status
Not open for further replies.

DEViANCE

Active Member
1,399
2009
64
0
Hi,

I'm trying to setup an auto site rating for WCDDL. I have used the code from a mod here: http://warezcoders.com/forum/viewtopic.php?f=15&t=1095

PHP:
if(isset($rsites)) {
     mysql_query("UPDATE wcddl_sites SET rating=1");
     $get300 = mysql_query("SELECT COUNT(title) AS 'number' , sid FROM wcddl_downloads GROUP BY sid ORDER BY number DESC LIMIT 0,300");
while ($row = mysql_fetch_array($get300)) {
mysql_query("UPDATE wcddl_sites SET rating= rating+1 where id = '".$row['sid']."'"); }

     $get200 = mysql_query("SELECT COUNT(title) AS 'number' , sid FROM wcddl_downloads GROUP BY sid ORDER BY number DESC LIMIT 0,200");
while ($row = mysql_fetch_array($get200)) {
mysql_query("UPDATE wcddl_sites SET rating= rating+1 where id = '".$row['sid']."'"); }

$get100 = mysql_query("SELECT COUNT(title) AS 'number' , sid FROM wcddl_downloads GROUP BY sid ORDER BY number DESC LIMIT 0,100");
while ($row = mysql_fetch_array($get100)) {
mysql_query("UPDATE wcddl_sites SET rating= rating+1 where id = '".$row['sid']."'"); }

$getwhite = mysql_query("SELECT url FROM wcddl_whitelist");
while ($row = mysql_fetch_array($getwhite)) {
mysql_query("UPDATE wcddl_sites SET rating= rating+1 where url = '".$row['url']."'"); }
echo '<div align="center" style="color:green;">Sites Rated</div>';
}
Which is meant to set all sites as rating 1*, then if they have 100 downloads 2*, 200 downloads 3*, 300 downloads 4*, and 300 downloads and in whitelist 5*.

But it is just setting all the sites as *4 but none of the sites have even 100 downloads (and none in whitelist hence its not setting then as 5*. As it stands all of the sites should be set as 1*. can anybody tell me whats wrong with the code??
 
15 comments
I think i have a solution so give me a few hours oto solve it asw ive re-written my limit mod, so debugging that btw this ratng thing is easy as pissing and so i was gonna do this modifiction anyway.
 
okays ive done it, told ya easy as.

just go to ur DB and run this SQL statement:

Code:
ALTER  TABLE  `wcddl_sites`  CHANGE  `rate`  `rate` VARCHAR( 4  )  CHARACTER  SET latin1 COLLATE latin1_swedish_ci NOT  NULL

now all sites will be 1* on first submission :)
 
Hi, chris.

I already have it set so sites are rated one on first submission. The code above is for a button in the admin panel that auto rates the sites based on number of downloads but its not working as intended, specifically the code that is not working is:
PHP:
     $get300 = mysql_query("SELECT COUNT(title) AS 'number' , sid FROM wcddl_downloads GROUP BY sid ORDER BY number DESC LIMIT 0,300");
while ($row = mysql_fetch_array($get300)) {
mysql_query("UPDATE wcddl_sites SET rating= rating+1 where id = '".$row['sid']."'"); }

     $get200 = mysql_query("SELECT COUNT(title) AS 'number' , sid FROM wcddl_downloads GROUP BY sid ORDER BY number DESC LIMIT 0,200");
while ($row = mysql_fetch_array($get200)) {
mysql_query("UPDATE wcddl_sites SET rating= rating+1 where id = '".$row['sid']."'"); }

$get100 = mysql_query("SELECT COUNT(title) AS 'number' , sid FROM wcddl_downloads GROUP BY sid ORDER BY number DESC LIMIT 0,100");
while ($row = mysql_fetch_array($get100)) {
mysql_query("UPDATE wcddl_sites SET rating= rating+1 where id = '".$row['sid']."'"); }
 
Its odd, I'm sure I used the same code on a site a couple of years back and it worked ok but this time its acting like all sites have over 300 downloads even when they don't.

I really want to get this working as there is no way I am manually rating sites with the "email me for rerate" method etc.. Once I get this working I'm just gonna change it to something like this:

New Sites = 1*
200+ Downloads = 2*
600+ Downloads = 3*
1200+ Downloads = 3*
3000+ Downloads = 5*
 
explaining
the above code who was made by moi.

get 100 sites whit higher number of downloads...200...300...400
get sites from whitelist +1

mean if you have 1 site and that are in whitelist will be rank 5 cuz are the in the top 100,200.... and whitelisted.

i did others versions of this but... isn't perfect too who is similar but whit an precentage of sites for each rank based on downloads number too.


PHP:
$found = mysql_num_rows(mysql_query("SELECT distinct sid FROM wcddl_downloads"));
        mysql_query("UPDATE wcddl_sites SET rating = 0");

   $get75percent = mysql_query("SELECT COUNT(title) AS number , sid FROM wcddl_downloads GROUP BY sid 
ORDER BY number DESC LIMIT 0,".round($found / 100 * 75)."");
echo "<center><b>RANK 1 *</b></center>";
while ($got = mysql_fetch_array($get75percent)) {
mysql_query("UPDATE wcddl_sites SET rating= rating+1 where id = '".$got['sid']."'");
}

     $get50percent = mysql_query("SELECT COUNT(title) AS number , sid FROM wcddl_downloads GROUP BY sid 
ORDER BY number DESC LIMIT 0,".round($found / 100 * 50)."");
echo "<center><b>RANK 2 **</b></center>";
while ($got = mysql_fetch_array($get50percent)) {
mysql_query("UPDATE wcddl_sites SET rating= rating+1 where id = '".$got['sid']."'");
}

btw to by default the rank be 1 in sqlmyadmin edit the rank row "default 1"
 
TEST IN AN SAFE PLACE

The query to update table are incomplete

PHP:
$found = mysql_query("SELECT distinct sid FROM wcddl_downloads");
//$srank="";
while($updaterank = mysql_fetch_assoc($found)) {
   $getnumdownloads = mysql_query("SELECT title FROM wcddl_downloads WHERE sid= ".$updaterank['sid']);
   $result = mysql_num_rows($getnumdownloads);
   if(strlen($result) >= 4 || $result >= 500) {
  $srank ="5"; }
   if(strlen($result) === 3 && $result >= 200 && $result <= 499) {
   $srank = substr($result, 0, 1);
 }
 if(isset($srank)) {
 //mysql_query("UPDATE BLABLABLA"); //continue whit the query and uncomment after the test if everyhing are ok
echo "Site id ".$updaterank['sid']." - white ".$result." downloads will be rank ".$srank."<br />";
unset($srank);
}
}
2ex0m7m.png
 
Last edited:
Ok thanks for your help. I'm just going to use a modified version of the first code. My problem was that I missunderstood how it worked in the first place :)
 
in fact i didn't see your ratings values

but are easy to change the code above to be whit that values.

wat i posted do

200->299 Rank2
300->399 R3
400->499 R4
500+ R5


if($result >= 200 && $result <= 599) {
$srank ="2"; }
if($result >= 600 && $result <= 2999) {
$srank ="3"; }
//theres no rank4?
if($result >= 5000) {
$srank ="5"; }
 
i am trying to add this to my auto queue accept mod, which is run 4 - 5x day via cron.

here my code:

PHP:
	$get100 = mysql_query("SELECT COUNT(title) AS 'number' , sid FROM wcddl_downloads GROUP BY sid ORDER BY number DESC LIMIT 120");
	while ($row = mysql_fetch_array($get100)) {
	mysql_query("UPDATE wcddl_sites SET rating=2 where id = '".$row['sid']."'"); }

	$get600 = mysql_query("SELECT COUNT(title) AS 'number' , sid FROM wcddl_downloads GROUP BY sid ORDER BY number DESC LIMIT 600");
	while ($row = mysql_fetch_array($get600)) {
	mysql_query("UPDATE wcddl_sites SET rating=3 where id = '".$row['sid']."'"); }

	$get2800 = mysql_query("SELECT COUNT(title) AS 'number' , sid FROM wcddl_downloads GROUP BY sid ORDER BY number DESC LIMIT 2800");
	while ($row = mysql_fetch_array($get2800)) {
	mysql_query("UPDATE wcddl_sites SET rating=4 where id = '".$row['sid']."'"); }

	echo '<div align="center" style="color:green;">Sites Rated</div>';


it sees to not be rating si tes.

any heelp
 
Last edited:
here's my working modified code:

PHP:
		mysql_query("UPDATE wcddl_sites SET rate=1");

		$get1600 = mysql_query("SELECT COUNT(title) AS 'number' , sid FROM wcddl_downloads GROUP BY sid ORDER BY number DESC LIMIT 1600");
	    while ($row = mysql_fetch_array($get1600)) {
    	mysql_query("UPDATE wcddl_sites SET rate=4 where id = '".$row['sid']."'"); }
		
		$get420 = mysql_query("SELECT COUNT(title) AS 'number' , sid FROM wcddl_downloads GROUP BY sid ORDER BY number DESC LIMIT 420");
	    while ($row = mysql_fetch_array($get420)) {
    	mysql_query("UPDATE wcddl_sites SET rate=3 where id = '".$row['sid']."'"); }
	    
		$get120 = mysql_query("SELECT COUNT(title) AS 'number' , sid FROM wcddl_downloads GROUP BY sid ORDER BY number DESC LIMIT 120");
    	while ($row = mysql_fetch_array($get120)) {
    	mysql_query("UPDATE wcddl_sites SET rate=2 where id = '".$row['sid']."'"); }

    echo '<div align="center" style="color:green;">All eligible sites rated</div>';

problem is, its rating all sites 2* as if they have 420 downloads. and they dont.
 
Status
Not open for further replies.
Back
Top