
far2slow
Members-
Posts
33 -
Joined
-
Last visited
Everything posted by far2slow
-
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 ?
-
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,
-
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 ?
-
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
-
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
-
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>'; } }
-
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'], ) ); }
-
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
-
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 />';
-
php sensei i cant cant get that to work either
-
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
-
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
-
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
-
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
-
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?
-
sorry i have sorted it
-
ok i want to put this $request = $smcFunc['db_query']('', ' SELECT gamer_xbgt FROM {db_prefix}members WHERE id_member = {int:user} LIMIT 1', array( 'user' => $user_info['id'], ) ); $row1 = $smcFunc['db_fetch_assoc']($request); into this so it calls the gamer_xbgt for each member $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'], ) ); } // Looping through the members. 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'], 'name' => '<span style="color: ' . $row['online_color'] . ';">' . $profile['real_name'] . '</span>', 'colorless_name' => $profile['real_name'], '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', ), );
-
any help with this? $gamertag = 'vbgtxyrr'; $url = "http://www.oldgamerz.co.uk/xboxapi/xboxapi.php?gamertag=".urlencode($gamertag); $output = file_get_contents($url); $json = json_decode(utf8_encode($output), true); if($json === null) die("Error parsing JSON response (error #".json_last_error().")."); $xboxonline = $json['response'][0]['user']['is_online']; $xboxonline_status = $json['response'][0]['user']['online_status']; is the the json // Looping through the members. 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'], 'name' => '<span style="color: ' . $row['online_color'] . ';">' . $profile['real_name'] . '</span>', 'colorless_name' => $profile['real_name'], 'vbgtxyrr'=> $profile['id_member'] . $row['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', ), ); } this loops through the mebers i have called from the database so how can i do it so i can loop each member through the json
-
do i need the json in the array for this to call each member or will it call it for each one ? if so how i dont think the line 'vbgtxyrr'=> $profile['id_member'] . $row['gamer_xbgt'], is right yet // Looping through the members. 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'], 'name' => '<span style="color: ' . $row['online_color'] . ';">' . $profile['real_name'] . '</span>', 'colorless_name' => $profile['real_name'], 'vbgtxyrr'=> $profile['id_member'] . $row['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); $gamertag = 'vbgtxyrr'; $url = "http://www.oldgamerz.co.uk/xboxapi/xboxapi.php?gamertag=".urlencode($gamertag); $output = file_get_contents($url); $json = json_decode(utf8_encode($output), true); if($json === null) die("Error parsing JSON response (error #".json_last_error().")."); $xboxonline = $json['response'][0]['user']['is_online']; $xboxonline_status = $json['response'][0]['user']['online_status'];
-
ok i can call my gamer like this but this just gets the one gamer thats logged in global $smcFunc, $scripturl, $user_info; $request = $smcFunc['db_query']('', ' SELECT gamer FROM {db_prefix}members WHERE id_member = {int:user} LIMIT 1', array( 'user' => $user_info['id'], ) ); $row = $smcFunc['db_fetch_assoc']($request); echo' <div class="centertext"><h1>', $row['gamer'], '</h1></div>'; but i want to be able to do it when i have called the members from a group, gamer is not in the database but can be called from the user details $query_members = $smcFunc['db_query']('', ' SELECT mem.id_member, mem.id_group, mem.real_name, mem.usertitle, mem.gamer, 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'], ) );
-
thanks did try that but didnt put the ; in solved thanks again
-
$gonline = $json['response'][0]['user']['is_online']; so $gonline can be 0 or 1 i know i can do it like if ($gonline=="0") echo "Off line"; else echo "Online"; but i want to echo the result later on in the script in the line <img src="', $member['online']['image_href'], '" alt="', $member['online']['link'], '" /> <span class="smalltext">', $member['link'], ' ', $gonline, '</span><br />';
-
i want to add gamer_xbgt to the array so i can do a json call for each gamer_xbgt name any help would be great // Grab all the team groups! $request = $smcFunc['db_query']('', ' SELECT mg.id_group, mg.group_name, mg.online_color, mg.stars, t.place, t.roworder FROM ({db_prefix}membergroups AS mg, {db_prefix}team AS t) WHERE mg.id_group = 18 ORDER BY t.roworder', array() ); while ($row = $smcFunc['db_fetch_assoc']($request)) { $row['stars'] = empty($row['stars']) ? array('', '') : explode('#', $row['stars']); $context['display_groups'][$row['place']][$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(), 'place' => $row['place'], ); { $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'] ) ); } // Looping through the members. 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'], 'name' => '<span style="color: ' . $row['online_color'] . ';">' . $profile['real_name'] . $profile['gamer_xbgt'] .'</span>', 'colorless_name' => $profile['real_name'], 'gamer_xbgt' => $profile['gamer_xbgt'] != '' && !isset($context['disabled_fields']['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);
-
thank you this works a spot on
-
I still havent sorted this this is as far as i have got and just cant get it to work <?php $gamertag = 'Oldg Slow'; $url = "http://www.oldgamerz.co.uk/xboxapi/xboxapi.php?gamertag=".urlencode($gamertag); $output = file_get_contents($url); $search = array('"OK"}}','{"user"'); // try to convert the response into a PHP object $obj = json_decode("[" . $output . "]"); //print_r($obj); if(!is_object($obj)) die("Error parsing JSON response\n"); //define variables $online = ($obj->user->is_online); $onlinestat = ($obj->user->online_status); print $avatar; print $onlinestat; ?>