Jump to content

Ivaked

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Ivaked's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello there! I'm hoping someone will be able to help me get the jEditable functionality working properly on my site. My website is running the latest version of Drupal and has the PHP module enabled to allow Drupal to process PHP code on my pages. I currently have a page which is a Tracker. It allows the user who visits the page to update their Tracker statistics however I want them to be able to do it on the same page without reloading or going to a different page. This is the code I currently have on the page: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8"></script> <script src="http://www.warhawkinfo.com/scripts/jquery.jeditable.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> $(function() { $(".click").editable("http://www.warhawkinfo.com/save-tracker.php", { indicator : "<img src='http://www.warhawkinfo.com/images/ajax-indicator.gif'>", tooltip : "Click to edit this item...", style : "inherit" } ); } ); </script> <? #DRUPAL API TO CHECK USER IS LOGGED IN if (user_is_logged_in()) { #CALL GLOBAL VARIABLE THEN GET PSN FROM DATA global $user; $me = user_load(array('uid' => $user->uid)); $psn = $me->profile_psn; #CONNECT TO TRACKER DATABASE $sql_un = "username"; $sql_pw = "password"; $sql_db = "the-immortality_com_tracker-codwaw"; mysql_connect("127.0.0.1", $sql_un, $sql_pw); mysql_select_db($sql_db) or die("Unable to connect to CoD-WaW Tracker database."); #IF USER IS NEW TO TRACKER (FIRST VISIT), ADD DEFAULT DATA if(!mysql_num_rows(mysql_query("SELECT psn FROM missions WHERE uid = '$user->uid'")) > 0) { mysql_query("INSERT INTO multiplayer (uid,psn,prestige,rank,time_played_days,time_played_hours,world_ranking,kills,deaths,wins,losses,kill_streak,death_streak,win_streak,fav_weapon,lfav_weapon,fav_pistol,lfav_pistol,dog_kills,artillery_kills) VALUES ('$user->uid','$psn','0','1','0','0','Unknown','0','0','0','0','0','0','0','Unknown','Unknown','Unknown','Unknown','0','0')"); } ?> Welcome to your personal CoD:WaW Tracker <? echo $psn; ?>. This tool allows you to record and maintain various statistics of your CoD:WaW gaming such as what missions you have completed and what trophies you have attained. Your statistics can be edited at any time and all the data you provide will be used in your TB$ profile. To better use this facility, we highly recommend you register to <a href="http://www.callofduty.com">www.callofduty.com</a> and link your stats so that your stats are as accurate as possible. <br> <br> <hr> <br> <div align="center" style="font-family: Arial Black; font-size: 24px; color: black"> <b>Multiplayer Statistics</b> </div> <? #GET USERS MULTPLAYER STATISTICS $result = mysql_query("SELECT * FROM multiplayer WHERE uid = '$user->uid'"); $mpstat = mysql_fetch_row($result); ?> <br> <table> <tr> <th>Prestige</th> <? echo ($mpstat[2] > 0) ? '<td><img title="Prestige ' . $mpstat[2] . '" src="/images/prestige_icons/prestige' . $mpstat[2] . '.png"> (Prestige ' . $mpstat[2] . ')</td>' : '<td>Not Prestiged</td>'; ?> </tr><tr> <th>Rank</th> <td><? echo $mpstat[3]; ?></td> </tr><tr> <th>Time played</th> <td><? echo $mpstat[4]; ?> days, <? echo $mpstat[5]; ?> hours</td> </tr><tr> <th>World ranking (score)</th> <td><div id="world_ranking" class="click" style="display: inline"><? echo $mpstat[6]; ?></div></></td> </tr><tr> <th>Kills</th> <td><? echo $mpstat[7]; ?></td> </tr><tr> <th>Kills from Dogs</th> <td><? echo $mpstat[18]; ?></td> </tr><tr> <th>Kills from Artillery</th> <td><? echo $mpstat[19]; ?></td> </tr><tr> <th>Deaths</th> <td><? echo $mpstat[8]; ?></td> </tr><tr> <th>Kill to Death Ratio</th> <td><? echo round($mpstat[7] / $mpstat[8], 2); ?></td> </tr><tr> <th>Kill Streak</th> <td><? echo $mpstat[11]; ?></td> </tr><tr> <th>Death Streak</th> <td><? echo $mpstat[12]; ?></td> </tr><tr> <th>Wins</th> <td><? echo $mpstat[9]; ?></td> </tr><tr> <th>Losses</th> <td><? echo $mpstat[10]; ?></td> </tr><tr> <th>Win to Loss Ratio</th> <td><? echo round($mpstat[9] / $mpstat[10], 2); ?></td> </tr><tr> <th>Win Streak</th> <td><? echo $mpstat[13]; ?></td> </tr><tr> <th>Favourite Weapon</th> <td><? echo $mpstat[14]; ?></td> </tr><tr> <th>Least favourite Weapon</th> <td><? echo $mpstat[15]; ?></td> </tr><tr> <th>Favourite Pistol</th> <td><? echo $mpstat[16]; ?></td> </tr><tr> <th>Least favourite Pistol</th> <td><? echo $mpstat[17]; ?></td> </tr> </table> <? } else { ?> <p>You are not logged in. You need to login or register to access this page.</p> <br> <br> <? } ?> As you can see, the "World Ranking" statistic is the one I'm using for testing purposes and to get the thing working before I start making the other ones editable-in-place. jEditable is POST'ing the updated value which I'm trying to use to update my database however for some reason it seems to skip updating the database. It updates to the new value on the page, but doesn't update the database. The "save-tracker.php" file has the following code: <? global $user; $sql_un = "username"; $sql_pw = "password"; $sql_db = "the-immortality_com_tracker-codwaw"; mysql_connect("127.0.0.1", $sql_un, $sql_pw); mysql_select_db($sql_db) or die("Unable to connect to CoD-WaW Tracker database."); $world_ranking = $_POST["value"] ; mysql_query("UPDATE multiplayer SET world_ranking= '$world_ranking' WHERE uid = '$user->uid'") or die(mysql_error()); echo $world_ranking; ?> Does anyone have any idea why it seems to skip the mysql_query to update the statistic? Kind regards, ~Ivaked
  2. Thank-you for your help - along with the help of others I have got it working using this code: <?php if (!isset($_GET['psnId'])) { echo '<form action="http://www.warhawkinfo.com/statchecker/" method="get"><p>Enter PSN ID: <input type="text" name="psnId" value="PSN" /></p><p><input type="submit" value="Search..." /></p></form>'; } else { $feedUrl = 'http://myhawk.org/action/action.html?handle=' . $_GET['psnId'] . '&key=yallobzff7'; $response = simplexml_load_file($feedUrl); if ($response !== FALSE) { echo '<a href="http://www.warhawkinfo.com/statchecker">New search...</a>'; echo '<br />'; echo '<br/>'; echo '<p>'; echo '<table>'; echo '<tr>'; echo "<th align=\"center\">Rank Image</th>"; echo "<th align=\"center\">Rank</th>"; echo '</tr>'; echo '<tr>'; echo "<td align=\"center\"><img src=\"" . $response->rankImage . "\"></td>"; echo '<td align ="center" style="vertical-align: middle"><b>' . $_GET['psnId'] . ' is currently a ' . $response->rank . '</b></td>'; echo '</tr>'; echo '</tr>'; echo '</table>'; echo '<br />'; echo 'globalGamePoints = ' . $response->globalGamePoints . '<br />'; echo 'globalTeamScore = ' . $response->globalTeamScore . '<br />'; echo 'globalCombatScore = ' . $response->globalCombatScore . '<br />'; echo 'globalBonusScore = ' . $response->globalBonusScore . '<br />'; echo 'globalTime = ' . $response->globalTime . '<br />'; echo 'globalKills = ' . $response->globalKills . '<br />'; echo 'globalDeaths = ' . $response->globalDeaths . '<br />'; echo 'globalKdr = ' . $response->globalKdr . '<br />'; echo 'globalAccuracy = ' . $response->globalAccuracy . '<br />'; echo 'globalWins = ' . $response->globalWins . '<br />'; echo 'globalLosses = ' . $response->globalLosses . '<br />'; echo 'globalWinLossRatio = ' . $response->globalWinLossRatio . '<br />'; echo 'globalScorePerMinute = ' . $response->globalScorePerMinute . '<br />'; echo 'globalDmScore = ' . $response->globalDmScore . '<br />'; echo 'globalTdmScore = ' . $response->globalTdmScore . '<br />'; echo 'globalHeroScore = ' . $response->globalHeroScore . '<br />'; echo 'globalColScore = ' . $response->globalColScore . '<br />'; echo 'globalMilesWalked = ' . $response->globalMilesWalked . '<br />'; echo 'globalMilesDriven = ' . $response->globalMilesDriven . '<br />'; echo 'globalMilesFlown = ' . $response->globalMilesFlown . '<br />'; echo 'globalGamePointsRank = ' . $response->globalGamePointsRank . '<br />'; echo 'globalTeamScoreRank = ' . $response->globalTeamScoreRank . '<br />'; echo 'globalCombatScoreRank = ' . $response->globalCombatScoreRank . '<br />'; echo 'globalBonusScoreRank = ' . $response->globalBonusScoreRank . '<br />'; echo 'globalTimeRank = ' . $response->globalTimeRank . '<br />'; echo 'globalKillsRank = ' . $response->globalKillsRank . '<br />'; echo 'globalDeathsRank = ' . $response->globalDeathsRank . '<br />'; echo 'globalKdrRank = ' . $response->globalKdrRank . '<br />'; echo 'globalAccuracyRank = ' . $response->globalAccuracyRank . '<br />'; echo 'globalWinsRank = ' . $response->globalWinsRank . '<br />'; echo 'globalLossesRank = ' . $response->globalLossesRank . '<br />'; echo 'globalWinLossRatioRank = ' . $response->globalWinLossRatioRank . '<br />'; echo 'globalScorePerMinuteRank = ' . $response->globalScorePerMinuteRank . '<br />'; echo 'globalDmScoreRank = ' . $response->globalDmScoreRank . '<br />'; echo 'globalTdmScoreRank = ' . $response->globalTdmScoreRank . '<br />'; echo 'globalHeroScoreRank = ' . $response->globalHeroScoreRank . '<br />'; echo 'globalColScoreRank = ' . $response->globalColScoreRank . '<br />'; echo 'globalMilesWalkedRank = ' . $response->globalMilesWalkedRank . '<br />'; echo 'globalMilesDrivenRank = ' . $response->globalMilesDrivenRank . '<br />'; echo 'globalMilesFlownRank = ' . $response->globalMilesFlownRank . '<br />'; echo 'dailyGamePoints = ' . $response->dailyGamePoints . '<br />'; echo 'dailyTeamScore = ' . $response->dailyTeamScore . '<br />'; echo 'dailyCombatScore = ' . $response->dailyCombatScore . '<br />'; echo 'dailyBonusScore = ' . $response->dailyBonusScore . '<br />'; echo 'dailyTime = ' . $response->dailyTime . '<br />'; echo 'dailyKills = ' . $response->dailyKills . '<br />'; echo 'dailyDeaths = ' . $response->dailyDeaths . '<br />'; echo 'dailyKdr = ' . $response->dailyKdr . '<br />'; echo 'dailyAccuracy = ' . $response->dailyAccuracy . '<br />'; echo 'dailyWins = ' . $response->dailyWins . '<br />'; echo 'dailyLosses = ' . $response->dailyLosses . '<br />'; echo 'dailyWinLossRatio = ' . $response->dailyWinLossRatio . '<br />'; echo 'dailyScorePerMinute = ' . $response->dailyScorePerMinute . '<br />'; echo 'dailyDmScore = ' . $response->dailyDmScore . '<br />'; echo 'dailyTdmScore = ' . $response->dailyTdmScore . '<br />'; echo 'dailyHeroScore = ' . $response->dailyHeroScore . '<br />'; echo 'dailyColScore = ' . $response->dailyColScore . '<br />'; echo 'dailyMilesWalked = ' . $response->dailyMilesWalked . '<br />'; echo 'dailyMilesDriven = ' . $response->dailyMilesDriven . '<br />'; echo 'dailyMilesFlown = ' . $response->dailyMilesFlown . '<br />'; echo 'dailyGamePointsRank = ' . $response->dailyGamePointsRank . '<br />'; echo 'dailyTeamScoreRank = ' . $response->dailyTeamScoreRank . '<br />'; echo 'dailyCombatScoreRank = ' . $response->dailyCombatScoreRank . '<br />'; echo 'dailyBonusScoreRank = ' . $response->dailyBonusScoreRank . '<br />'; echo 'dailyTimeRank = ' . $response->dailyTimeRank . '<br />'; echo 'dailyKillsRank = ' . $response->dailyKillsRank . '<br />'; echo 'dailyDeathsRank = ' . $response->dailyDeathsRank . '<br />'; echo 'dailyKdrRank = ' . $response->dailyKdrRank . '<br />'; echo 'dailyAccuracyRank = ' . $response->dailyAccuracyRank . '<br />'; echo 'dailyWinsRank = ' . $response->dailyWinsRank . '<br />'; echo 'dailyLossesRank = ' . $response->dailyLossesRank . '<br />'; echo 'dailyWinLossRatioRank = ' . $response->dailyWinLossRatioRank . '<br />'; echo 'dailyScorePerMinuteRank = ' . $response->dailyScorePerMinuteRank . '<br />'; echo 'dailyDmScoreRank = ' . $response->dailyDmScoreRank . '<br />'; echo 'dailyTdmScoreRank = ' . $response->dailyTdmScoreRank . '<br />'; echo 'dailyHeroScoreRank = ' . $response->dailyHeroScoreRank . '<br />'; echo 'dailyColScoreRank = ' . $response->dailyColScoreRank . '<br />'; echo 'dailyMilesWalkedRank = ' . $response->dailyMilesWalkedRank . '<br />'; echo 'dailyMilesDrivenRank = ' . $response->dailyMilesDrivenRank . '<br />'; echo 'dailyMilesFlownRank = ' . $response->dailyMilesFlownRank . '<br />'; echo '</p>'; } else { echo '<p>Failed to open the feed - Myhawk may be down.</p>'; } } ?> EDIT - Scratch that - I got the error checking working lol. ~Pot-Nut
  3. My apologies, I should have mentioned this in my first post. Myhawk.org is not my website - that is just the site that provides the varying XML feed. My website is warhawkinfo.com which is the Drupal site I want the parsed xml to appear on when a user searches using a form on my own site. ~Liam
  4. http://myhawk.org/action/action.html?handle=*****&key=yallobzff7 The above link is my vital part when I seem to be struggling. Basically, I'm using the Drupal CMS for my website (www.warhawkinfo.com) and have recently acquired an XML feed for which I can parse the XML data and display the results on my site but I'm dumbfounded with PHP - it's something I've never tried to use before, and I've been stuck since the beginning. In the link you will see "*****". This variable can be any username which is associated with the game this XML feed is for. The value of which is to be defined using a form on my site e.g. if I put "Pot-Nut" into the form and click search the link would be "http://myhawk.org/action/action.html?handle=Pot-Nut&key=yallobzff7" which would then be parsed and the data returned to the user. The question is, how do I do this? I've tried a couple of methods with help from some friends on other forums but I have still not managed to get this working on my site. I'll be honest... I'm BEGGING for help with this as it's one of the most vital parts of my website which I need and any help anyone can give would not be thanked enough. Also, it will be my starting point for learning PHP! Very many thanks to any help in advance, it will be greatly appreciated. ~Liam
  5. Ivaked

    [SOLVED] -

    I tried to reply to a thread and it posted a new message. Ignore this please.
  6. Admin > Site Building > Modules Enable the 'Path' Module. When creating, editing or whatever to a page/story/comment etc, scroll to URL Path Settings and adjust accordingly to whatever you want. I'm not sure if this is what you are looking for though, so I apologise if it is not. Either way I hope that helps. ~Liam
  7. Ivaked

    [SOLVED] -

    Admin > Site Building > Modules Enable the 'Path' Module. When creating, editing or whatever to a page/story/comment etc, scroll to URL Path Settings and adjust accordingly to whatever you want. I hope that helps. ~Liam
  8. Oh I forgot to mention - I've put this in the Drupal forum as I think it may need a slightly different workaround that a standard web-site due to the way Drupal works with 'nodes' and 'pages' - sorry if it is in the incorrect section. ~Liam
  9. http://myhawk.org/action/action.html?handle=*****&key=yallobzff7 The above link is my vital part when I seem to be struggling. Basically, I'm using the Drupal CMS for my website (www.warhawkinfo.com) and have recently acquired an XML feed for which I can parse the XML data and display the results on my site but I'm dumbfounded with PHP - it's something I've never tried to use before, and I've been stuck since the beginning. In the link you will see "*****". This variable can be any username which is associated with the game this XML feed is for. The value of which is to be defined using a form on my site e.g. if I put "Pot-Nut" into the form and click search the link would be "http://myhawk.org/action/action.html?handle=Pot-Nut&key=yallobzff7" which would then be parsed and the data returned to the user. The question is, how do I do this? I've tried a couple of methods with help from some friends on other forums but I have still not managed to get this working on my site. I'll be honest... I'm BEGGING for help with this as it's one of the most vital parts of my website which I need and any help anyone can give would not be thanked enough. Also, it will be my starting point for learning PHP! Very many thanks to any help in advance, it will be greatly appreciated. ~Liam
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.