TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 07-04-2009, 03:24 PM   #1 (permalink)
The Wanderer
 
Join Date: Jul 2009
Posts: 10
Thanks: 1
talonos is on a distinguished road
Default cant work this error out

ok i've been working on a world of warcraft armory parser for achievements and for some reason its showing an error even thou the other pages i have just like this one work fine

CODE:
PHP Code:
#!/usr/bin/php 
<?php 


// Include phpbb's config for db info 
//include("config.php"); 

echo 'Working...' '</br>'

/* 
roster_gen class posted by D1g1talS0ul on elitistjerks.com 
*/ 

class roster_gen 

 const 
BROWSER="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070319 Firefox/2.0.0.3"

 public 
$query
 public 
$server
 public 
$guild
 public 
$guildie
 public 
$page

public function 
__construct $query$server$guild$guildie$page ) { 
    
$this->query $query
    
$this->server $server
    
$this->guild $guild
    
$this->guildie $guildie
    
$this->page $page
 } 
// end of __construct() 

public function pull_xml() { 

    if( 
$this->query === 'roster' ) { 
        
$url 'http://eu.wowarmory.com/guild-info.xml?r=' $this->server '&n=' $this->guild'&p=' $this->page
         
    } elseif( 
$this->query === 'character' ) { 
        
$url 'http://eu.wowarmory.com/character-sheet.xml?r=' $this->server '&n=' $this->guildie
     
    } elseif( 
$this->query === 'achievements' ) { 
        
$url 'http://eu.wowarmory.com/character-achievements.xml?r=' $this->server '&cn=' $this->guildie '&gn=' .  
            
$this->guild '&c=168'
    } 

    
$ch curl_init(); 
    
curl_setopt ($chCURLOPT_URL$url); 
    
curl_setopt ($chCURLOPT_RETURNTRANSFER1); 
    
curl_setopt ($chCURLOPT_CONNECTTIMEOUT60); 
    
curl_setopt ($chCURLOPT_USERAGENT,  roster_gen::BROWSER); 
     
    
$url_string curl_exec($ch); 

    return 
simplexml_load_string($url_string); 
     
    
curl_close($ch); 
 } 
// end of pull_xml() 

// end class 

$roster = new roster_gen ('roster''stormrage''heroes+of+warcraft'NULL1); 
$xml_roster $roster->pull_xml(); 


// Change to querying achievements 
$roster->query=achievements

// Set up the member array 
$member_data = array(); 
$id 0


foreach (
$xml_roster->guildInfo->guild->members->character as $char

    if (
$char['level'] == 80 && $char['rank'] <= '2' ) { 

        
$roster->guildie $char['name']; 
         
        
$xml_char $roster->pull_xml(); 

        
$ach find_category($xml_char->category); 

        
$a = array(); 

        
$a[0] = check_achievement($ach0); 
        
$a[1] = check_achievement($ach1); 
        
$a[2] = check_achievement($ach2); 
        
$a[3] = check_achievement($ach3); 
        
$a[4] = check_achievement($ach4); 
        
$a[5] = check_achievement($ach5); 

         
        
$member_data[$id] = array( 
                                
'name' => $char['name'], 
                                
'0' => $a[0], 
                                
'1' => $a[1], 
                                
'2' => $a[2], 
                                
'3' => $a[3], 
                                
'4' => $a[4], 
                                
'5' => $a[5]
                                ); 
                                 
        
// Provide some output that it's doing stuff 
        
echo 'Updated: <b>' $char['name'] . '</b> ' $a[0] . '-' $a[1] . '-' $a[2] . '-' $a[3] . '-' $a[4] . '-' $a[5] . '</br>'
                                 
        
$id++;                         
    } 
     
}  
/*
echo '</br>Inserting values into DB...</br>'; 

// Connect to the DB 
$db = mysql_connect($dbhost, $dbuser, $dbpasswd); 
$db_selected = mysql_select_db($dbname, $db); 

foreach ($member_data as $member) 

    $name = $member['name']; 

    $sql = "insert into ach_data2(name, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)  
       VALUES ('$name', '$a[0]', '$a[1]', '$a[2]', '$a[3]', '$a[4]', '$a[5]', '$a[6]', '$a[7]', '$a[8]', '$a[9]', '$a[10]', '$a[11]', '$a[12]', '$a[13]', '$a[14]')"; 
    $result = mysql_query($sql); 
     
   if(!$result); 
       echo mysql_error() . "\n";     


echo 'Database update completed.'; 
*/

function find_category($xml

    foreach(
$xml->achievement as $ach) { 
        if(
$ach['id'] == 576
            return 
$ach
    } 



function 
check_achievement($achievement$num) { 
if(
$achievement ['dateCompleted'] != NULL)
        return 
1;
        else
    if(
$achievement->criteria[$num]['date'] != NULL
        return 
1
    else 
        return 
0


?>
mysql access is disabled until error is fixed,
the error i'm recieving is when i update the script it send me this
HTML Code:
#!/usr/bin/php 
Working...</br><br />
<b>Notice</b>:  Use of undefined constant achievements - assumed 'achievements' in <b>C:\wamp\www\ulduar.php</b> on line <b>65</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\wamp\www\ulduar.php</b> on line <b>144</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\wamp\www\ulduar.php</b> on line <b>144</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\wamp\www\ulduar.php</b> on line <b>144</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\wamp\www\ulduar.php</b> on line <b>144</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\wamp\www\ulduar.php</b> on line <b>144</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\wamp\www\ulduar.php</b> on line <b>144</b><br />
Updated: <b>Goll</b> 0-0-0-0-0-0</br><br />
and the same for ALL the other things its meant to list too

does anyone know how to rectify this error at all

any help is appreciated
thanks in advance

Talonos

Last edited by talonos : 07-04-2009 at 03:25 PM. Reason: typo
talonos is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Defining your World: All About Constants Wildhoney General 15 01-29-2013 12:32 PM
Duble the work on pages Face_Of_Boe Absolute Beginners 3 01-06-2009 04:16 PM
Functions dont work from included files. Orc Javascript, AJAX, E4X 2 07-25-2008 11:22 AM
File upload forms dont work for me anymore Orc General 6 05-09-2008 10:38 AM
Host Upgraded - File Upload won't work now gillweb General 7 02-25-2008 03:53 AM


All times are GMT. The time now is 04:56 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design