Jump to content

far2slow

Members
  • Posts

    33
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

far2slow's Achievements

Member

Member (2/5)

0

Reputation

  1. I will only be running this twice a day and yes i will be caching the data i can not use set_time_limit due to the system policy of our host so is there another way this can be done maybe do it in chunks at a time ?
  2. I am calling members gamer tags out of the database and then passing them to xbox live to get there online status. the problem i have is I cant pull more than about 10 at a time or it times out i dont have the option of increasing the time out limit, $result = mysql_query ("SELECT id_member, gamer_xbgt FROM smf_members"); while($row = mysql_fetch_array($result)) { $gamertag = $row['gamer_xbgt']; if (!empty($gamertag)) { $html = file_get_html ('https://live.xbox.com/en-US/Profile?Gamertag=' . urlencode ($gamertag)); foreach ($html->find('div[class=presence] ') as $e) echo $row['id_member'] . " " . $gamertag . " " . $e->innertext; echo "<br />"; } } what would be the best solution to solve timeout problems,
  3. we have a small fourm will only ever be 100 members each member has a xbox gamer id in there profile what i want to do is call each gamer id and pass it to xbox live and fetch there online status but as this will take some time to do is it best i run a script that will do the scraping in the background let it run every hour and send the the result into the database so it can be called or am i going about this all the wrong way ?
  4. I am trying to find out where to put my code in joomla I have a component installed and a search module I have made a type of store locater ( find the stores with in a set distace of the members zip/postcode) i would like to add this to the search module that is already there, but having problems understanding where this code should go i have put the form new form in modules/MODNAME/tmpl/default.php - under the existing form for now just for testing I would like to use the same view that the search form already uses but were do add the code that runs the sql query get the results and display them in the existing search view sorry if this is a stupid question new to coding and strugling to understand how this works
  5. hope i have posted this in the right forum I am getting a error/ message is_dir() [function.is-dir]: open_basedir restriction in effect. File(././..) is not within the allowed path(s): (/var/www/vhosts/oursite.co.uk/httpdocs/:/tmp/) not sure how i can fix this i belive i need to lift the restriction but not sure what file i need to do this in and how to do it, can anyone point me in the right direction the only file i have found on the server with anything to do with this is in /ect/php.ini ;open_basedir = but not sure if this is the file that I need we use 1&1 vps dont know if that information is any help or not
  6. I am new to coding so please understand before you slate me to much This is the code i am working on what i am trying to do is grab the members from group 18 and list them At the moment i cant get it to work so any help would be great thank you { global $context, $scripturl, $txt, $settings, $user_info, $modSettings, $smcFunc, $options ; // Get members $query_members = $smcFunc['db_query']('', ' SELECT mem.id_member, mem.id_group, mem.real_name, mem.usertitle, IFNULL(lo.log_time, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type FROM {db_prefix}members AS mem LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member) LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member) WHERE mem.id_group = 18 ' . (!empty($modSettings['team_additional_groups']) ? 'OR FIND_IN_SET({int:id_group}, mem.additional_groups)' : '') . ' ORDER BY mem.real_name ASC', array( 'id_group' => $row['id_group'], ) ); } // Looping through the members. while ($profile = $smcFunc['db_fetch_assoc']($query_members)) { $context [$row['id_group']]['members'][$type] = array( 'id' => $profile['id_member'], 'group_id' => $profile['id_group'], 'name' => '<span style="color: ' . $row['online_color'] . ';">' . $profile['real_name'] . '</span>', 'colorless_name' => $profile['real_name'], 'gamername' => $profile['gamer_xbgt'], 'href' => $scripturl . '?action=profile;u=' . $profile['id_member'], 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '"><span style="color: ' . $row['online_color'] . ';">' . $profile[ 'real_name'] . '</span></a>', 'title' => $profile['usertitle'], 'online' => array( 'label' => $txt[$profile['is_online'] ? 'online' : 'offline'], $txt[$profile['is_online'] ? 'online' : 'offline'] . '</a>', 'image_href' => $settings['images_url'] . '/' . ($profile['is_online'] ? 'useron' : 'useroff') . '.gif', ), ); $smcFunc['db_free_result']($query_members); $smcFunc['db_free_result']($request); } { echo ' <table width="100%" border="0"> <tr>'; foreach ($data as $member) { echo ' <td> <div align="left" style="padding-left: 20px;"> <img src="', $member['online']['image_href'], '" alt="', $member['online']['link'], '" /> <span class="smalltext">', $member['link']; echo ' </div> } </td> </tr>'; echo ' <tr> <td> </td> </tr> </table>'; } }
  7. i dont know if anyone can help with this, what i am trying to do is get a mebergroup and list the mebers in that group and make sure if the user is in a additional group is included in the list eg admin mods i may be way off with this at the moment { global $context, $scripturl, $txt, $settings, $user_info, $modSettings, $smcFunc ; // Grab the team group $request = $smcFunc['db_query']('', ' SELECT mg.id_group, mg.group_name, mg.online_color, mg.stars FROM ({db_prefix}membergroups AS mg WHERE mg.id_group = 19 ORDER BY mg_online_color', array() ); while ($row = $smcFunc['db_fetch_assoc']($request)) { $row['stars'] = empty($row['stars']) ? array('', '') : explode('#', $row['stars']); $context['display_groups'][$row['id_group']] = array( 'name' => $row['group_name'], 'color' => $row['online_color'], 'image' => str_repeat('<img src="' . str_replace('$language', $context['user']['language'], isset($row['stars'][1]) ? $settings['images_url'] . '/' . $row['stars'][1] : '') . '" alt="*" border="0" />', empty($row['stars'][0]) || empty($row['stars'][1]) ? 0 : $row['stars'][0]), 'members' => array(), ); { $query_members = $smcFunc['db_query']('', ' SELECT mem.id_member, mem.id_group, mem.real_name, mem.usertitle, IFNULL(lo.log_time, 0) AS is_online, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type FROM {db_prefix}members AS mem LEFT JOIN {db_prefix}log_online AS lo ON (lo.id_member = mem.id_member) LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member) WHERE mem.id_group = {int:id_group} ' . (!empty($modSettings['team_additional_groups']) ? 'OR FIND_IN_SET({int:id_group}, mem.additional_groups)' : '') . ' ORDER BY mem.real_name ASC', array( 'id_group' => $row['id_group'], ) ); }
  8. that makes sence but once i have done the include ("$sourcedir/xboxapi.php"); how do i get it to run ?gamertag=".urlencode($gamertag); for each user
  9. this works but it takes way to long to get the screen scrap data from xboxapi for each user is there a better way of doing this? foreach ($group['members'] as $pos => $data) { foreach ($data as $member) { $gamertag = $member['gamername']; $url = "http://www.oldgamerz.co.uk/xboxapi/xboxapi.php?gamertag=".urlencode($gamertag); $output = file_get_contents($url); $json = json_decode(utf8_encode($output), true); $xboxonline = $json['response'][0]['user']['is_online']; $xboxonline_status = $json['response'][0]['user']['online_status']; echo ' <tr class="windowbg2"> <td align="center">'; echo ' </td> <td align="left" style="padding: 0mm"> <div align="left" style="padding-left: 20px;"> <img src="', $member['online']['image_href'], '" alt="', $member['online']['link'], '" /> <span class="smalltext">', $member['link'], ' ' ; if ($xboxonline == "0") echo '<span style="color: red">Off line</span>'; else echo '<span style="color: green">Online</span>'; echo ' ', $xboxonline_status; echo'</span><br />';
  10. php sensei i cant cant get that to work either
  11. not sure if i change the line $gamertag = $member['gamername']; to $gamertag = 'real gamer tag'; i do get a output but its the same for whole list, i have checked that $member['gamername'] is showing the right gamer tag for the user, but if i use it i get nothing been on this for to many hours just cant work it out
  12. i am going to have one last go trying to explain what i am trying to do first part of the code the gamername is the users xbox gamer id while ($profile = $smcFunc['db_fetch_assoc']($query_members)) { $context['display_groups'][$row['place']][$row['id_group']]['members'][$type][] = array( 'id' => $profile['id_member'], 'group_id' => $profile['id_group'] . $gamertag, 'name' => '<span style="color: ' . $row['online_color'] . ';">' . $profile['real_name'] . '</span>', 'colorless_name' => $profile['real_name'], 'gamername' => $profile['gamer_xbgt'], 'href' => $scripturl . '?action=profile;u=' . $profile['id_member'], 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '"><span style="color: ' . $row['online_color'] . ';">' . $profile['real_name'] . '</span></a>', 'title' => $profile['usertitle'], 'online' => array( 'label' => $txt[$profile['is_online'] ? 'online' : 'offline'], $txt[$profile['is_online'] ? 'online' : 'offline'] . '</a>', 'image_href' => $settings['images_url'] . '/' . ($profile['is_online'] ? 'useron' : 'useroff') . '.gif', ), ); } next bit of the code is the json that that calls the file that scraps the data from xbox.com $gamertag = $member['gamername']; $url = "http://www.oldg.co.uk/xboxapi/xboxapi.php?gamertag=".urlencode($gamertag); $output = file_get_contents($url); $json = json_decode(utf8_encode($output), true); next bit shows prints the data <td align="left" style="padding: 0mm"> <div align="left" style="padding-left: 20px;"> <img src="', $member['online']['image_href'], '" alt="', $member['online']['link'], '" /> <span class="smalltext">', $member['link'], $xboxonline = $json['response'][0]['user']['is_online'], $xboxonline_status = $json['response'][0]['user']['online_status'], '</span><br />'; but i cant get json part to show the data for all the users
  13. am very sorry i over complicated things in my head what i wanted to do, rather just sitting back and having a think I have about sorted it now
  14. i tryed to make the json script a function then try and call it like 'gamr_x' => $profile['gam_x']. call_user_func('xgamrinfo'), but that wont work any one have any ideas how i can do this the scrip i am running gets members out of a group, lists so this json call is for about 15 users
  15. This is the json $gtag = $member['gam_x']; $url = "http://www.oldg.co.uk/xboxapi/xboxapi.php?gtag=".urlencode($gtag); $output = file_get_contents($url); $json = json_decode(utf8_encode($output), true); if($json === null) die("Error parsing JSON response (error #".json_last_error().")."); $online = $json['response'][0]['user']['is_online']; $online_status = $json['response'][0]['user']['online_status']; and i want to call it to 'gamr_x' => $profile['gam_x'], do i just set the json as a function then call it?
×
×
  • 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.