Проще не выйдет: Давай ка посмотрим поближе на скрипт. Code: --создаем промежуточную таблицу памяти --для того чтобы подсчитать кому в даный момент сколько поинтов добавить declare @TRef table (Referrer_Name varchar(10), points int) insert into @TRef (Referrer_Name, points) select r.Referrer_Name, sum(5) from TABLE_Referrer r inner join Character c on c.name=r.Referrer_AccountID and cLevel>=200 -- COLLATE Latin1_general_CI_AI inner JOIN MEMB_STAT m ON c.AccountID = m.memb___id and m.ConnectStat=0 -- COLLATE Latin1_general_CI_AI where r.Add_count=1 group by r.Referrer_Name Эта таблица была сделана для того, что бы если в определенный момент для Одного игрока одновременно 2 реферала достигнут указанного левела, то начислилось не 0,5 WMZ а 1. То есть другими словами group by r.Referrer_Name -- сгрупировать по тому кто привел sum(5) -- за каждого кто достиг по 5 поинтов and m.ConnectStat=0 --юзверь не в сети and cLevel>=200 --юзверь достиг 200 левела Второй оператор Update просто подставляет поинты в таблицу Character. Есни это будут не левелАПпоинты мы просто добавим поле типа BonusPoints. ммм.дальше уже под себя....
вот так в php ////////////////////////////////////////////////////////////////////////////////////////////// //////FUNCTION REGISTER////// //////////////////////////// function do_register() { if ((isset($_COOKIE['pass'])) && (isset($_COOKIE['user']))); { $account = stripslashes($_POST['account']); $password = stripslashes($_POST['password']); $repassword = stripslashes($_POST['repassword']); $email = $_POST['email']; $squestion = stripslashes($_POST['question']); $sanswer = stripslashes($_POST['answer']); $verifyinput = stripslashes($_POST['verifyinput']); $verifyinput2 = stripslashes($_POST['verifyinput2']); $account = clean_var($account); $password = clean_var($password); $repassword = clean_var($repassword); $email = clean_var($email); $squestion = clean_var($squestion); $sanswer = clean_var($sanswer); $verifyinput = clean_var($verifyinput); $verifyinput2 = clean_var($verifyinput2); require("config.php"); require_once "sql_inject.php"; include_once('sql_check.php'); check_inject(); $bDestroy_session = TRUE; $url_redirect = 'index.php'; $sqlinject = new sql_inject('./log_file_sql.log',$bDestroy_session,$url_redirect) ; $username_check = mssql_query("SELECT memb___id FROM MEMB_INFO WHERE memb___id='$account'"); $username_verify = mssql_num_rows($username_check); $email_check = mssql_query("SELECT mail_addr FROM MEMB_INFO WHERE mail_addr='$email'"); $email_verify = mssql_num_rows($email_check); if ( empty($account) || empty($password) || empty($repassword) || empty($email) || empty($squestion) || empty($sanswer) || empty($verifyinput2)){ echo "<img src=./images/warning.gif> Error: Some fields were left blank!"; } elseif ($username_verify > 0){ echo "<img src=./images/warning.gif> Error: Login is already used, please chose another one! "; } elseif ($email_verify > 0){ echo "<img src=./images/warning.gif> Error: E-mail is already used, please chose another one! "; } elseif (($password != $repassword) || ($repassword != $password)){ echo "<img src=./images/warning.gif> Error: Please go back and retype password corectly! "; } elseif ($verifyinput != $verifyinput2){ echo "<img src=./images/warning.gif> Error: Please go back and write code corectly!"; } else { $msquery1 = "SET IDENTITY_INSERT MEMB_INFO ON"; $msquery2 = "INSERT INTO MEMB_INFO (memb___id,memb__pwd,memb_name,sno__numb,mail_addr,appl_days,modi_days,out__days ,true_days,mail_chek,bloc_code,ctl1_code,memb__pwd2,fpas_ques,fpas_answ) VALUES ('$account',[dbo].[fn_md5]('$password','$account'),'MuWeb','1','$email','01/01/2006','01/01/2006','01/01/2006','01/01/2006','1','0','0','$password','$squestion','$sanswer')"; $msquery3 = "INSERT INTO VI_CURR_INFO (ends_days,chek_code,used_time,memb___id,memb_name,memb_guid,sno__numb,Bill_Sect ion,Bill_value,Bill_Hour,Surplus_Point,Surplus_Minute,Increase_Days ) VALUES ('2005','1',1234,'$account','zzz',1,'7','6','3','6','6','2003-11-23 10:36:00','0')"; $sqlinject->test($msquery1); $sqlinject->test($msquery2); $sqlinject->test($msquery3); //$msresults= mssql_query($msquery1); $msresults= mssql_query($msquery2); $msresults= mssql_query($msquery3); echo "<img src=./images/ok.gif> Account has been created succesfully!"; } }} а это тоже скрипт тока на Character: <?PHP if (eregi("modules/rankings/docharacter.php", $_SERVER['SCRIPT_NAME'])) { die ("Access Denied"); } ?> <style type="text/css"> <!-- ..style3 {color: #FFFFFF} ..ranking { font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 11px; color: #FFFFFF; } --> </style> <? include("./includes/paginator.php"); include('config.php'); require_once "sql_inject.php"; include_once('sql_check.php'); check_inject(); $bDestroy_session = TRUE; $url_redirect = 'index.php'; $sqlinject = new sql_inject('./log_file_sql.log',$bDestroy_session,$url_redirect) ; $sql = mssql_query("SELECT count(*) FROM Character"); $num_rows = mssql_result($sql, 0, 0); $a =& new Paginator($_GET['page'],$num_rows); $a->set_Limit($top); $a->set_Links(15); $limit1 = $a->getRange1(); $limit2 = $a->getRange2(); $query = 'SELECT TOP '; $query .= $limit1 + $limit2; $query .= ' Name,Class,cLevel,resets,strength,dexterity,vitality,energy from Character order by resets desc ,clevel desc'; $result = mssql_query($query); echo '<TABLE border=0 cellPadding=0 cellSpacing=0 > <TBODY> <TR> <TD align=left vAlign=top> </TR> <TR> <TD align=left vAlign=top> <TABLE border=0 cellPadding=0 cellSpacing=0 <TBODY> <TR> <TD align=middle vAlign=center><br><span class="ranking">Top Characters</span> <br></br> <table height=30 border="0" cellpadding="4" cellspacing="2" width="350" bgcolor="#520C00" > <tr> <td valign=top align=center><span class="ranking">#</td> <td valign=top align=center><span class="ranking">Name</strong></td> <td valign=top align=center><span class="ranking">Class</strong></td> <td valign=top align=center><span class="ranking">Lv</strong></td> <td valign=top align=center><span class="ranking">Resets</strong></td> <td valign=top align=center><span class="ranking">Str</strong></td> <td valign=top align=center><span class="ranking">Ag</strong></td> <td valign=top align=center><span class="ranking">Vit</strong></td> <td valign=top align=center><span class="ranking">En</strong></td> </tr>'; for ($i=0;$i < $limit1; ++$i) { $row = mssql_fetch_row($result); } for($j=0;$j < mssql_num_rows($result)-$limit1;++$j) { $row = mssql_fetch_row($result); $query2="Select ConnectStat from MEMB_STAT where memb___id='$row[9]'" ; $result2 = mssql_query($query2); $row2 = mssql_fetch_row($result2); $query3="Select memb___id from Character order where Name ='mssql_query($query)'"; $result3= mssql_query($query3); $rank = $j + $limit1 +1; if($row[1] == 0){ $row[1] ='DW'; } if($row[1] == 1){ $row[1] ='SM'; } if($row[1] == 16){ $row[1] ='DK'; } if($row[1] == 17){ $row[1] ='BK'; } if($row[1] == 32){ $row[1] ='ELF'; } if($row[1] == 33){ $row[1] ='ME'; } if($row[1] == 48){ $row[1] ='MG'; } if($row[1] == 64){ $row[1] ='DL'; } if($row[8] == 0){ $row[8] = 'Lorencia'; } if($row[8] == 1){ $row[8] = 'Dungeon'; } if($row[8] == 2){ $row[8] = 'Davias'; } if($row[8] == 3){ $row[8] = 'Noria'; } if($row[8] == 4){ $row[8] = 'Losttower'; } if($row[8] == 5){ $row[8] = 'Exile'; } if($row[8] == 8){ $row[8] = 'Tarkan'; } if($row[8] == 7){ $row[8] = 'Atlans'; } if($row[8] == 6){ $row[8] = 'Arena'; } if($row[8] == 9){ $row[8] = 'Devil Square'; } if($row[8] == 10){ $row[8] = 'Icarus'; } if($row[8] == 11){ $row[8] = 'Blood Caslte1'; } if($row[8] == 12){ $row[8] = 'Blood Caslte2'; } if($row[8] == 13){ $row[8] = 'Blood Caslte3'; } if($row[8] == 14){ $row[8] = 'Blood Caslte4'; } if($row[8] == 15){ $row[8] = 'Blood Caslte5'; } if($row[8] == 16){ $row[8] = 'Blood Caslte6'; if($row[8] == 18){ $row[8] = 'Chaos Castle 1';} if($row[8] == 19){ $row[8] = 'Chaos Castle 2';} if($row[8] == 20){ $row[8] = 'Chaos Castle 3';} if($row[8] == 21){ $row[8] = 'Chaos Castle 4';} if($row[8] == 22){ $row[8] = 'Chaos Castle 5';} if($row[8] == 23){ $row[8] = 'Chaos Castle 6';} if($row[8] == 24){ $row[8] = 'Kalima 1';} if($row[8] == 25){ $row[8] = 'Kalima 2';} if($row[8] == 26){ $row[8] = 'Kalima 3';} if($row[8] == 27){ $row[8] = 'Kalima 4';} if($row[8] == 28){ $row[8] = 'Kalima 5';} if($row[8] == 29){ $row[8] = 'Kalima 6';} if($row[8] == 30){ $row[8] = 'Valley Of Loren';} if($row[8] == 31){ $row[8] = 'Lands Of Trials';} if($row[8] == 32){ $row[8] = 'Devil Square';} if($row[8] == 33){ $row[8] = 'Aida';} if($info[8] == 34){ $row[8] = 'CryWolf';} } if($row2[0] == 0){ $row2[0] ='<img src=http://img.server.ru/offline.gif>'; } if($row2[0] == 1){ $row2[0] ='<img src=http://img.server.ru/online.gif>'; } echo "<tr><td valign=top align='center' style='background-color:#330000'><span class='ranking'>$rank.</td> <td valign=top align='center' style='background-color:#330000;'><span class='ranking'>$row[0]</span></td> <td valign=top align='center' style='background-color:#330000;'><span class='ranking'>$row[1]</strong></td> <td valign=top align='center' style='background-color:#330000;'><span class='ranking'>$row[2]</strong></td> <td valign=top align='center' style='background-color:#330000;'><span class='ranking'>$row[3]</strong></td> <td valign=top align='center' style='background-color:#330000;'><span class='ranking'>$row[4]</strong></td> <td valign=top align='center' style='background-color:#330000;'><span class='ranking'>$row[5]</span></td> <td valign=top align='center' style='background-color:#330000;'><span class='ranking'>$row[6]</span></td> <td valign=top align='center' style='background-color:#330000;'><span class='ranking'>$row[7]</span></td> <td valign=top align=center style='background-color:#330000;'><span class='style4'>$row2[0]</strong></td> </tr>"; } ?> </tbody> </table><br> <span class='ranking'> <? //=========================================================================== //This shows how to create your links using the output availiable from the //Paginator class. It is a good example to study since it shows most of //the information that Paginator can output. //=========================================================================== //check to see if current page is one. If so there will be no link. if($a->getCurrent()==1) { $first = "First | "; } else { $first="<a href=\"" . $a->getPageName() . "?op=rankings&page=" . $a->getFirst() . "\">First</a> |"; } //check to see that getPrevious() is returning a value. If not there will be no link. if($a->getPrevious()) { $prev = "<a href=\"" . $a->getPageName() . "?op=rankings&page=" . $a->getPrevious() . "\">Prev</a> | "; } else { $prev="Prev | "; } //check to see that getNext() is returning a value. If not there will be no link. if($a->getNext()) { $next = "<a href=\"" . $a->getPageName() . "?op=rankings&page=" . $a->getNext() . "\">Next</a> | "; } else { $next="Next | "; } //check to see that getLast() is returning a value. If not there will be no link. if($a->getLast()) { $last = "<a href=\"" . $a->getPageName() . "?op=rankings&page=" . $a->getLast() . "\">Last</a> | "; } else { $last="Last | "; } //since these will always exist just print out the values.. Result will be //something like 1 of 4 of 25 echo $a->getFirstOf() . " of " .$a->getSecondOf() . " of " .. $a->getTotalItems() . " "; //print the values determined by the if statements above. echo $first . " " . $prev . " " . $next . " " . $last; //============================================================================== //end of example ?> </span> </TD> </TR></TBODY></TABLE></TD></TR> <TR> </TD></TR></TBODY></TABLE>