![]() |
|
|
#1 |
|
Архивный участник
Join Date: Feb 2005
Posts: 159
|
can somebody help
im trying to make automatic bonus system for acc which have some amount of total hours played, or by account age for example. i catn make it set subscription_flag. im bad in sql ... on account creation set bonus status 0 (i use row subscription_flag) for diff ammount of played time i need to be set to 1 , 2, 3, depends on total playtime (also it creates additional row in user_account - create time, and set creation datetime for bonus by acc age). so, this script collect total acc playtime, and chech for banned accs, subscription_flag but update subscr_flag dont work ( ( i try it i 2 places but no effect.) [php:1:2c937c3ab5] <? <? include("config.php"); mssql_connect($mssql_server,$mssql_user,$mssql_pas s); mssql_select_db($mssql_db); $result=mssql_query("select TmpD.sumamount,time_data.account_id from (select account_id, SUM(use_time) AS sumamount FROM user_data GROUP BY account_id) TmpD INNER JOIN time_data ON TmpD.account_id = time_data.account_id ORDER BY time_data.account_id "); $online_users=array(); for($x=0;($online_users[$x]=mssql_fetch_assoc($result));$x++){$online_users[$x]['use_time_h']=round($online_users[$x]['sumamount']/3600,1); }; unset($online_users[count($online_users)-1]); mssql_connect($mssql_server,$mssql_user,$mssql_pas s); mssql_select_db(lin2db); $result2=mssql_query(" select uid, pay_stat,last_world,subscription_flag from user_account where last_world > 0 order by uid"); $online_users2=array(); for($x=0;$online_users2[$x]=mssql_fetch_assoc($result2);$x++){ $online_users2[$x]['use_time_h']=round($online_users2[$x]['use_time']/3600,1); }; $msserver="***"; //put your server alias here $usrname="***"; //put your MS SQL username here $passwrd="***"; //put your MS SQL password here $database1="lin2db"; $database2="lin2world"; $accdesc = $online_users2[$x]["uid"]; $bonus = $online_users2[$x]["subscription_flag"]; $active = $online_users2[$x]["pay_stat"]; $acctime = $online_users[$x]["use_time_h"]; $querylistaplayer="update user_account set subscription_flag=0, where account='$accdesc'"; if ($bonus == "0" and $active == "1" and $acctime >= "200") {$querylistaplayer="update user_account set subscription_flag=1 where account='$accdesc'";} else {$querylistaplayer="update user_account set subscription_flag=0 where account='$accdesc'";} $conn=mssql_connect($msserver,$usrname,$passwrd); mssql_select_db($database1, $conn); $resultlistaplayer = mssql_query($querylistaplayer); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <META HTTP-EQUIV="Expires" CONTENT="Fri, Jan 01 1900 00:00:00 GMT"> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> <META http-equiv="Content-Type" content="text/html; charset=windows-1251"> <META http-equiv="content-language" content="en"> <META name="author" content=""> <META HTTP-EQUIV="Reply-to" CONTENT="@.com"> <META name="generator" content="PHPEd 3.1"> <META NAME="description" CONTENT=""> <META name="keywords" content=""> <META NAME="Creation_Date" CONTENT="08/15/2000"> <META name="revisit-after" content="15 days"> <title>Online</title> </head> <body> <div align="center">Online <table width="503" border="1" align="center"> <tr> <td>acc</td> <td>time, h</td> <td>time, sec</td> <td>pay_stat</td> <td>subscription_flag</td> <td>uid</td> </tr> <?for($x=0;$x<count($online_users);$x++){?> <tr> <td><?=$online_users[$x]["account_id"]?></td> <td><?=$online_users[$x]["use_time_h"]?></td> <td><?=$online_users[$x]["sumamount"]?></td> <td><?=$online_users2[$x]["pay_stat"]?></td> <td><?=$online_users2[$x]["subscription_flag"]?></td> <td><?=$online_users2[$x]["uid"];$querylistaplayer="update user_account set subscription_flag=0, where account='$accdesc'"; if ($bonus == "0" and $active == "1" and $acctime >= "200") {$querylistaplayer="update user_account set subscription_flag=1 where account='$accdesc'";} else {$querylistaplayer="update user_account set subscription_flag=0 where account='$accdesc'";} $conn=mssql_connect($msserver,$usrname,$passwrd); mssql_select_db($database1, $conn); $resultlistaplayer = mssql_query($querylistaplayer); ?></td> </tr> <?}?> <tr> <td colspan="3">Всего:</td> <td><?=count($online_users)?></td> </tr> </table> </body> </html> [/php:1:2c937c3ab5] if somebody can make it work by account age it will aslo suit me. |
|
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|