hier mal eine Frage an die Ilch Profis.
Zum Beispiel habe ich mal eine Testdatei, die neben dem PHP Code auch Formulare enthält und nach der Ausführung mir einen kombinierten wehrt ausgeben soll. als anzeige.
Ich versteh noch nicht ganz wie das mit dem getview funktioniert.
Das Problem ist vieles wird davon nicht ind ie Datenbank geschrieben. ist erstmal nur ein Test wie es funktioniert.
Hoffe ich kann auf eure Hilfe setzten.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | <link href= "wb.css" type= "text/css" rel= "stylesheet" > <div id= 'box2' class = 'boxgroesse2' > <p style= 'text-align: center;' > Account Name <input type= "text" size= "17" name= "account" > <input type= "submit" name= "sent" > </form> </div></div> <br> <br> <?php // Benötigt die Dateien require_once 'api_2.php' ; require_once 'wn8.php' ; //Bitte eigen AppID erstellen und diese hier eintragen! siehe hierzu https://developers.wargaming.net $appId = "APPID" ; $api = new \Wargaming\API( $appId , \Wargaming\LANGUAGE_DEUTSCH, \Wargaming\SERVER_EU); echo "<div id='box1' class='boxgroesse1'>" ; //echo "<p style='text-align: center;'>"; if (isset( $_POST [ 'sent' ])){ $search = $_POST [ "account" ]; //Prüft die Abfrage //echo $search; //Abfrage Players (Nickname & WGID) //Mit Limit beinflusst Du die Anzahl an angezeigter ähnlicher Nicknamen, bitte vorerst auf 1 lassen!!! $limit = '1' ; $sprache = 'de' ; $tier = '10' ; $queryAccountId = file_get_contents ( 'https://api.worldoftanks.eu/wot/account/list/?application_id=' . $appId . '&language=' . $sprache . '&search=' . $search . '&limit=' . $limit . '' ); $resultAccountId = json_decode( $queryAccountId , true); $accountId = $resultAccountId [ 'data' ][ '0' ][account_id]; $accountName = $resultAccountId [ 'data' ][ '0' ][nickname]; //Prüft die Abfrage Players //echo "<pre>"; //print_r($resultAccountId); //Abfrage Player Details (Account Erstellung, Anzahl Gefechte....) $queryPlayersStats = file_get_contents ( 'https://api.worldoftanks.eu/wot/account/info/?application_id=' . $appId . '&language=de&account_id=' . $accountId . '' ); $resultPlayersStats = json_decode( $queryPlayersStats , true); $created_at = $resultPlayersStats [ 'data' ][ $accountId ][created_at]; $client_language = $resultPlayersStats [ 'data' ][ $accountId ][client_language]; $last_battle_time = $resultPlayersStats [ 'data' ][ $accountId ][last_battle_time]; $battles = $resultPlayersStats [ 'data' ][ $accountId ][statistics][all][battles]; $battlesWins = $resultPlayersStats [ 'data' ][ $accountId ][statistics][all][wins]; $winRate = round ( $battlesWins / $battles * 100,2); //$WR = number_format(($memberInfo->data->{$member->account_id}->statistics->all->wins / $memberInfo->data->{$member->account_id}->statistics->all->battles) * 100, 2, ',', ' '); //Prüft die Abfrage Players Stats //echo "<pre>"; //print_r($resultPlayersStats); //Resultate echo "<span style='font-size:25px;'>Deine WGID: <span style=\"color:#4a92b7\">" . $accountId . "</span></span><br>" ; echo "<span style='font-size:25px;'>Deine NICK: <span style=\"color:#4a92b7\">" . $accountName . "</span></span><br>" ; echo "<span style='font-size:25px;'>Account erstellt: <span style=\"color:#4a92b7\">" . gmdate ( "Y-m-d" , $created_at ) . "</span></span><br>" ; echo "<span style='font-size:25px;'>Client Sprache: <span style=\"color:#4a92b7\">" . $client_language . "</span></span><br>" ; echo "<span style='font-size:25px;'>Letztes Gefecht: <span style=\"color:#4a92b7\">" . gmdate ( "Y-m-d" , $last_battle_time ) . "</span></span><br>" ; echo "<span style='font-size:25px;'>Anzahl Gefechte: <span style=\"color:#4a92b7\">" . $battles . "</span></span><br>" ; echo "<span style='font-size:25px;'>WINRATE: <span style=\"color:#4a92b7\">" . $winRate . "</span></span><br>" ; //Abfrage Player Tanks $queryPlayersTanks = file_get_contents ( 'https://api.worldoftanks.eu/wot/account/tanks/?application_id=' . $appId . '&language=de&account_id=' . $accountId . '' ); $resultPlayersTanks = json_decode( $queryPlayersTanks , true); // Berechnung der WN8 try { $colorRatingWN8 = colorByWN8 ((string)( new \Wot\WN8 ( $api , ( $accountName )))); echo "<span style='font-size:25px;'>Deine WN8: <span style=\"color:" . $colorRatingWN8 . "\">" . ((string)( new \Wot\WN8( $api , $accountName ))) . "</span></span>" .PHP_EOL; // Ups error } catch (Exception $e ) { die ( $e ->getMessage()); echo "</div>" ; }} function colorByWN8( $ratingWN8 ) { if ( $ratingWN8 > 2900.00) { return "#5a3175" ; } else if ( $ratingWN8 > 2350) { return "#83579d" ; } else if ( $ratingWN8 > 1900) { return "#4a92b7" ; } else if ( $ratingWN8 > 1600) { return "#4c762e" ; } else if ( $ratingWN8 > 1250) { return "#6d9521" ; } else if ( $ratingWN8 > 900) { return "#d7b600" ; } else if ( $ratingWN8 > 600.00) { return "#d77900" ; } else if ( $ratingWN8 > 300.00) { return "#cd3333" ; } else { return "#000000" ; } } //Prüft die Abfrage Players Tanks //echo "<pre>"; //print_r($resultPlayersTanks); echo "<table>" ; echo "<tr>" ; echo "<th>Tank ID</th>" ; echo "<th>Name</th>" ; echo "<th>Tier</th>" ; echo "<th>Bild</th>" ; echo "<th>Gefechte</th>" ; echo "<th>Avg XP</th>" ; echo "<th>Avg Schaden</th>" ; echo "</tr>" ; foreach ( $resultPlayersTanks [ 'data' ][ $accountId ] as & $tanks ) { $tankId = $tanks [tank_id]; //echo "<pre>"; //print_r($tanks); $queryTankDetails = file_get_contents ( 'https://api.worldoftanks.eu/wot/encyclopedia/vehicles/?application_id=' . $appId . '&language=' . $sprache . '&tank_id=' . $tankId . '' ); $resultTankDetails = json_decode( $queryTankDetails , true); if ( $resultTankDetails [ 'data' ][ $tankId ][ 'tier' ] == $tier ) { $queryTankStatistic = file_get_contents ( 'https://api.worldoftanks.eu/wot/tanks/stats/?application_id=' . $appId . '&account_id=' . $accountId . '&language=' . $sprache . '&tank_id=' . $tankId . '' ); $resultTankStatistc = json_decode( $queryTankStatistic , true); $damage = $resultTankStatistc [ 'data' ][ $accountId ][ '0' ][ 'all' ][ 'damage_dealt' ]; $avgDamage = round ( $damage / $resultTankStatistc [ 'data' ][ $accountId ][ '0' ][ 'all' ][ 'battles' ] * 1,0); //echo "<pre>"; //print_r($resultTankStatistc); echo "<tr>" .PHP_EOL; echo "<td>" . $tankId . "</td>" .PHP_EOL; echo "<td>" . $resultTankDetails [ 'data' ][ $tankId ][ 'short_name' ] . "</td>" .PHP_EOL; echo "<td>" . $resultTankDetails [ 'data' ][ $tankId ][ 'tier' ] . "</td>" .PHP_EOL; echo "<td><span title=\"" . $resultTankDetails [ 'data' ][ $tankId ][ 'short_name' ]. "\"><img src= " . $resultTankDetails [ 'data' ][ $tankId ][ 'images' ][ 'small_icon' ]. " alt=\"" . $resultTankDetails [ 'data' ][ $tankId ][ 'short_name' ]. "\"/></span></td>" .PHP_EOL; echo "<td>" . $resultTankStatistc [ 'data' ][ $accountId ][ '0' ][ 'all' ][ 'battles' ] . "</td>" .PHP_EOL; echo "<td>" . $resultTankStatistc [ 'data' ][ $accountId ][ '0' ][ 'all' ][ 'battle_avg_xp' ] . "</td>" .PHP_EOL; echo "<td>" . $avgDamage . "</td>" .PHP_EOL; echo "<tr>" .PHP_EOL; } } echo "<br>" ; echo "</table>" ; ?> <br> <br> RISE ANFORDERUNGEN #27 powered by aged_osprey |
verwendete ilch Version: 2.1.x
betroffene Homepage: www.r1sing.de
Zuletzt modifiziert von magicmarkus am 04.12.2018 - 19:22:30