[PHP] xml scipt not working :/

2002-08-20 Thread Pafo

anyone know why this scritp dont read all the posts..?
xml file: http://www.camelotherald.com/xml/servers.xml
script in action: http://www.ant.nu/test.php

if u look at the script in action, it prints out the xml file, except 1
line..
the output looks like this:

Relicname Relictype Relicowner
 Midgard
Merlin's Staff Magic Hibernia

it should look like this according to the xmlfile:

Relicname Relictype Relicowner
Scabbard of Excalibur Melee Midgard
Merlin's Staff Magic Hibernia

this is the script:
?php

//  **  Settings  
$ServerToPrint = Guinevere;

// ***
//
// START OF THE CODE
$printedserver = false;
$printedrelic = false;
$printedkeep = false;
$depth = array();
$insideitem = false;
$insidekeep = false;
$tag = ;
$server = false;
$crelic = new RelicInfo;
$cserver = new ServerInfo;
$ckeep = new KeepInfo;

class KeepInfo {
  var $KeepName = Array();
  var $KeepOwner = Array();
  var $KeepRealm = Array();
  var $KeepClaimant = Array();

   function PrintHeader() {
   print TRTDbr/TDTD/TDTD/TD/TR;
   print
TRTDbKeepname/b/TDTDbKeepowner/b/TDTDbKeepclaimant/b
/TD/TR;
 }

 function PrintInfo() {
   for ($i = 0; $i  count($this-KeepName); $i++) {
 if ($this-KeepRealm[$i] == Albion) { print TRTDbfont
color=#ff{$this-KeepName[$i]}/font/b; }
 if ($this-KeepRealm[$i] == Midgard) { print TRTDbfont
color=#ff{$this-KeepName[$i]}/font/b; }
 if ($this-KeepRealm[$i] == Hibernia) { print TRTDbfont
color=#00ff00{$this-KeepName[$i]}/font/b; }
 if ($this-KeepRealm[$i] == Neutral) { print TRTDbfont
color=#00{$this-KeepName[$i]}/font/b; }
 print TD{$this-KeepOwner[$i]}/TD;
 print TD{$this-KeepClaimant[$i]}/TD/TR\n;
   }
 }

 function SetName($name) {
 $this-KeepName[] = $name;
 }

 function SetOwner($owner) {
   $this-KeepOwner[] = $owner;
 }

 function SetRealm($realm) {
   $this-KeepRealm[] = $realm;
 }

 function SetClaimant($claim) {
   $this-KeepClaimant[] = $claim;
 }
}

class RelicInfo {

  var $RelicName = Array();
  var $RelicType = Array();
  var $RelicRealm = Array();
  var $RelicOwner = Array();

   function PrintHeader() {
   print TRTDbr/TDTD/TDTD/TD/TR;
   print
TRTDbRelicname/b/TDTDbRelictype/b/TDTDbRelicowner/b
/TD/TR;
 }

 function PrintInfo() {
   for ($i = 0; $i  count($this-RelicName); $i++) {
 if ($this-RelicRealm[$i] == Albion) { print TRTDbfont
color=#ff{$this-RelicName[$i]}/font/b; }
 if ($this-RelicRealm[$i] == Midgard) { print TRTDbfont
color=#ff{$this-RelicName[$i]}/font/b; }
 if ($this-RelicRealm[$i] == Hibernia) { print TRTDbfont
color=#00ff00{$this-RelicName[$i]}/font/b; }
 print TD{$this-RelicType[$i]}/TD;
 print TD{$this-RelicOwner[$i]}/TD/TR\n;
   }
 }

 function SetName($name) {
 $this-RelicName[] = $name;
 }

 function SetType($type) {
   $this-RelicType[] = $type;
 }

 function SetRealm($realm) {
   $this-RelicRealm[] = $realm;
 }

 function SetRelicOwner($owner) {
   $this-RelicOwner[] = $owner;
 }

}

class ServerInfo {
  var $ServerName = Array();
  var $ServerPopulation = Array();
  var $ServerType = Array();
  var $ServerStatus = Array();
  var $Totalpop = 0;

   function PrintHeader() {
   print TRTDbr/TDTD/TDTD/TD/TR;
   print
TRTDbServername/type/b/TDTDbStatus/b/TDTDbPopulation
/b/TD/TR;
 }

 function PrintInfo() {
   for ($i = 0; $i  count($this-ServerName); $i++) {
 print TRTDb{$this-ServerName[$i]}/b;
 if ($this-ServerType[$i]) { print
(i{$this-ServerType[$i]}/i); }
 print /TD;
 print TD{$this-ServerStatus[$i]}/TD;
 print TD{$this-ServerPopulation[$i]}/TD/TR\n;
   }
 }

 function PrintTotal() {
   print $this-Totalpop;
 }

 function SetServer($server) {
 $this-ServerName[] = $server;
 }

 function SetType($type) {
   $this-ServerType[] = $type;
 }

 function SetStatus($status) {
   $this-ServerStatus[] = $status;
 }

 function SetPopulation($pop) {
   $this-ServerPopulation[] = $pop;
   $this-Totalpop += $pop;
 }

}

function startElement($parser, $tagName, $attrs) {
global $ServerToPrint, $server, $depth, $insideitem, $insidekeep, $tag,
$da_server, $da_type, $da_relicname, $da_relictype, $da_relicrealm,
$da_keepname, $da_keeprealm;
 if ($insideitem) {
  $tag = $tagName;
 } elseif ($tagName == RELIC)   {
 $insideitem = true;
 while (list ($key, $val) = each ($attrs)) {
  switch($key) {
  case NAME: $da_relicname=$val;break;
  case TYPE: $da_relictype=$val;break;
  case REALM: $da_relicrealm=$val;break;
  } // end case
 } // end while

 } elseif($tagName == SERVER)  {
   $depth[$parser]++;
 $insideitem = true;
 while (list ($key, $val) = each ($attrs)) {
  if ($key == NAME) { $da_server=$val; if($val == $ServerToPrint) {
$server = true; } else { $server = false; } }
  if ($key == TYPE) { $da_type=$val; }
 } // end while
 } elseif($tagName == KEEP)  {
 $insideitem = true;
 $insidekeep = true;
 

[PHP] mail and attachments

2002-08-19 Thread Pafo

i got a script that the user signs up on and send a profile to the owners
email address
but i want to implement a file upland and that the uploaded file should be
submitted with the mail..

is this possible in php?
i know its possible in cg..

regards
patrick



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] array's

2002-08-18 Thread Pafo

now it works, thx alot  :)

regards
patrick

Jason Wong [EMAIL PROTECTED] skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Sunday 18 August 2002 12:25, Pafo wrote:
  anyone that can find the problem..?
  description below.



   function PrintInfo() {
 for ($this-i = 0; $this-i  count($this-RelicName); $this-i++) {
 print $this-RelicName[$this-i]  :  $this-RelicType[$this-i]  :
  $this-RelicRealm[$this-i]  :  $this-RelicOwner[$this-i]br;
 }
   }

 Not sure why you're defining your counter as $this-i. I would just use
$i.
 Your problem is that inside double quotes the expression:

   $this-RelicName[$this-i]

 is ambiguous. In this case what the interpreter has done is to print
 $this-RelicName, which is an array, so your output contains 'Array'. It
then
 prints a literal bracket '[', then the value of $this-i, then another
literal
 bracket ']', and thus that is what you see.

 To remove the ambiguity to need to state exactly what you mean and enclose
 your expression in {} :

 print {$this-RelicName[$this-i]} ...


  the function PrintInfo prints out this:
  '***' OUTPUT
  '**'
 
  Array[0] : Array[0] : Array[0] : Array[0]
  Array[1] : Array[1] : Array[1] : Array[1]
  Array[2] : Array[2] : Array[2] : Array[2]
 
  heh,, not exacly what i wanted  :/


 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 Argue for your limitations, and sure enough, they're yours.
 -- Messiah's Handbook : Reminders for the Advanced Soul
 */




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] xml and a big script

2002-08-18 Thread Pafo

i was almost done with everything  :)  and ofcourse i find a problem with
the xml parser...
the parser is not collection some vital information, and i dont know why...
the xmlsite is: http://www.camelotherald.com/xml/servers.xml

the problem is market with a -- :
server name=Guinevere type=Roleplay lastguildupdate=2002-08-18
12:28:53 lastcharupdate=2002-08-16 18:09:06
  population1707/population
  statusUp/status
- relic name=Scabbard of Excalibur type=Melee realm=Albion
--, the parser dosent retrive this line,, it gets every
line except this.
  ownerMidgard/owner
  /relic
- relic name=Merlin's Staff type=Magic realm=Albion
  ownerHibernia/owner
  /relic
- relic name=Thor's Hammer type=Melee realm=Midgard
  ownerMidgard/owner
  /relic
- relic name=Horn of Valhalla type=Magic realm=Midgard
  ownerHibernia/owner
  /relic
- relic name=Lug's Spear of Lightning type=Melee realm=Hibernia
  ownerMidgard/owner
  /relic
- relic name=Cauldron of Dagda type=Magic realm=Hibernia
  ownerHibernia/owner
  /relic
...

if u run this script, it prints out everything except that.
?php

//  **  Settings  
$ServerToPrint = Guinevere;

// ***
//
// START OF THE CODE
$printedserver = false;
$printedrelic = false;
$printedkeep = false;
$depth = array();
$insideitem = false;
$insidekeep = false;
$tag = ;
$server = false;
$crelic = new RelicInfo;
$cserver = new ServerInfo;
$ckeep = new KeepInfo;

class KeepInfo {
  var $KeepName = Array();
  var $KeepOwner = Array();
  var $KeepRealm = Array();
  var $KeepClaimant = Array();


 function PrintInfo() {
   for ($i = 0; $i  count($this-KeepName); $i++) {
 print TRTDb{$this-KeepName[$i]}/b;
 print TD{$this-KeepRealm[$i]}/TD;
 print TD{$this-KeepOwner[$i]}/TD;
 print TD{$this-KeepClaimant[$i]}/TD/TR\n;

   }
 }

 function SetName($name) {
 $this-KeepName[] = $name;
 }

 function SetOwner($owner) {
   $this-KeepOwner[] = $owner;
 }

 function SetRealm($realm) {
   $this-KeepRealm[] = $realm;
 }

 function SetClaimant($claim) {
   $this-KeepClaimant[] = $claim;
 }
}

class RelicInfo {

  var $RelicName = Array();
  var $RelicType = Array();
  var $RelicRealm = Array();
  var $RelicOwner = Array();

 function PrintInfo() {
   for ($i = 0; $i  count($this-RelicName); $i++) {
 print TRTDb{$this-RelicName[$i]}/b;
 print TD{$this-RelicType[$i]}/TD;
 print TD{$this-RelicRealm[$i]}/TD;
 print TD{$this-RelicOwner[$i]}/TD/TR\n;
   }
 }

 function SetName($name) {
 $this-RelicName[] = $name;
 }

 function SetType($type) {
   $this-RelicType[] = $type;
 }

 function SetRealm($realm) {
   $this-RelicRealm[] = $realm;
 }

 function SetRelicOwner($owner) {
   $this-RelicOwner[] = $owner;
 }

}

class ServerInfo {
  var $ServerName = Array();
  var $ServerPopulation = Array();
  var $ServerType = Array();
  var $ServerStatus = Array();
  var $Totalpop = 0;
 function PrintInfo() {
   for ($i = 0; $i  count($this-ServerName); $i++) {
 print TRTDb{$this-ServerName[$i]}/b;
 if ($this-ServerType[$i]) { print
(i{$this-ServerType[$i]}/i); }
 print /TD;
 print TD{$this-ServerStatus[$i]}/TD;
 print TD{$this-ServerPopulation[$i]}/TD/TR\n;
   }
 }

 function PrintTotal() {
   print $this-Totalpop;
 }

 function SetServer($server) {
 $this-ServerName[] = $server;
 }

 function SetType($type) {
   $this-ServerType[] = $type;
 }

 function SetStatus($status) {
   $this-ServerStatus[] = $status;
 }

 function SetPopulation($pop) {
   $this-ServerPopulation[] = $pop;
   $this-Totalpop += $pop;
 }

}

function startElement($parser, $tagName, $attrs) {
global $ServerToPrint, $server, $depth, $insideitem, $insidekeep, $tag,
$da_server, $da_type, $da_relicname, $da_relictype, $da_relicrealm,
$da_keepname, $da_keeprealm;
 if ($insideitem) {
  $tag = $tagName;
 } elseif ($tagName == RELIC)   {
 $insideitem = true;
 while (list ($key, $val) = each ($attrs)) {
  switch($key) {
  case NAME: $da_relicname=$val;print $val;break;
  case TYPE: $da_relictype=$val;break;
  case REALM: $da_relicrealm=$val;break;
  } // end case
 } // end while

 } elseif($tagName == SERVER)  {
   $depth[$parser]++;
 $insideitem = true;
 while (list ($key, $val) = each ($attrs)) {
  if ($key == NAME) { $da_server=$val; if($val == $ServerToPrint) {
$server = true; } else { $server = false; } }
  if ($key == TYPE) { $da_type=$val; }
 } // end while
 } elseif($tagName == KEEP)  {
 $insideitem = true;
 $insidekeep = true;
 while (list ($key, $val) = each ($attrs)) {
  switch($key) {
  case NAME: $da_keepname=$val;break;
  case REALM: $da_keeprealm=$val;break;
  } // end case
 } // end while
 }
}


function characterData($parser, $data) {
global $insideitem, $insidekeep, $tag, $da_server, $da_population, $da_type,
$da_status,$da_totalpop, $da_relicowner, $da_keepowner, 

[PHP] Re: xml and a big script

2002-08-18 Thread Pafo

this line is only for debugging: print $val
located within these tags in startElement

  case NAME: $da_relicname=$val;print $val;break;
  case TYPE: $da_relictype=$val;break;


Pafo [EMAIL PROTECTED] skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 i was almost done with everything  :)  and ofcourse i find a problem with
 the xml parser...
 the parser is not collection some vital information, and i dont know
why...
 the xmlsite is: http://www.camelotherald.com/xml/servers.xml

 the problem is market with a -- :
 server name=Guinevere type=Roleplay lastguildupdate=2002-08-18
 12:28:53 lastcharupdate=2002-08-16 18:09:06
   population1707/population
   statusUp/status
 - relic name=Scabbard of Excalibur type=Melee realm=Albion
 --, the parser dosent retrive this line,, it gets
every
 line except this.
   ownerMidgard/owner
   /relic
 - relic name=Merlin's Staff type=Magic realm=Albion
   ownerHibernia/owner
   /relic
 - relic name=Thor's Hammer type=Melee realm=Midgard
   ownerMidgard/owner
   /relic
 - relic name=Horn of Valhalla type=Magic realm=Midgard
   ownerHibernia/owner
   /relic
 - relic name=Lug's Spear of Lightning type=Melee realm=Hibernia
   ownerMidgard/owner
   /relic
 - relic name=Cauldron of Dagda type=Magic realm=Hibernia
   ownerHibernia/owner
   /relic
 ...

 if u run this script, it prints out everything except that.
 ?php

 //  **  Settings  
 $ServerToPrint = Guinevere;

 // ***
 //
 // START OF THE CODE
 $printedserver = false;
 $printedrelic = false;
 $printedkeep = false;
 $depth = array();
 $insideitem = false;
 $insidekeep = false;
 $tag = ;
 $server = false;
 $crelic = new RelicInfo;
 $cserver = new ServerInfo;
 $ckeep = new KeepInfo;

 class KeepInfo {
   var $KeepName = Array();
   var $KeepOwner = Array();
   var $KeepRealm = Array();
   var $KeepClaimant = Array();


  function PrintInfo() {
for ($i = 0; $i  count($this-KeepName); $i++) {
  print TRTDb{$this-KeepName[$i]}/b;
  print TD{$this-KeepRealm[$i]}/TD;
  print TD{$this-KeepOwner[$i]}/TD;
  print TD{$this-KeepClaimant[$i]}/TD/TR\n;

}
  }

  function SetName($name) {
  $this-KeepName[] = $name;
  }

  function SetOwner($owner) {
$this-KeepOwner[] = $owner;
  }

  function SetRealm($realm) {
$this-KeepRealm[] = $realm;
  }

  function SetClaimant($claim) {
$this-KeepClaimant[] = $claim;
  }
 }

 class RelicInfo {

   var $RelicName = Array();
   var $RelicType = Array();
   var $RelicRealm = Array();
   var $RelicOwner = Array();

  function PrintInfo() {
for ($i = 0; $i  count($this-RelicName); $i++) {
  print TRTDb{$this-RelicName[$i]}/b;
  print TD{$this-RelicType[$i]}/TD;
  print TD{$this-RelicRealm[$i]}/TD;
  print TD{$this-RelicOwner[$i]}/TD/TR\n;
}
  }

  function SetName($name) {
  $this-RelicName[] = $name;
  }

  function SetType($type) {
$this-RelicType[] = $type;
  }

  function SetRealm($realm) {
$this-RelicRealm[] = $realm;
  }

  function SetRelicOwner($owner) {
$this-RelicOwner[] = $owner;
  }

 }

 class ServerInfo {
   var $ServerName = Array();
   var $ServerPopulation = Array();
   var $ServerType = Array();
   var $ServerStatus = Array();
   var $Totalpop = 0;
  function PrintInfo() {
for ($i = 0; $i  count($this-ServerName); $i++) {
  print TRTDb{$this-ServerName[$i]}/b;
  if ($this-ServerType[$i]) { print
 (i{$this-ServerType[$i]}/i); }
  print /TD;
  print TD{$this-ServerStatus[$i]}/TD;
  print TD{$this-ServerPopulation[$i]}/TD/TR\n;
}
  }

  function PrintTotal() {
print $this-Totalpop;
  }

  function SetServer($server) {
  $this-ServerName[] = $server;
  }

  function SetType($type) {
$this-ServerType[] = $type;
  }

  function SetStatus($status) {
$this-ServerStatus[] = $status;
  }

  function SetPopulation($pop) {
$this-ServerPopulation[] = $pop;
$this-Totalpop += $pop;
  }

 }

 function startElement($parser, $tagName, $attrs) {
 global $ServerToPrint, $server, $depth, $insideitem, $insidekeep, $tag,
 $da_server, $da_type, $da_relicname, $da_relictype, $da_relicrealm,
 $da_keepname, $da_keeprealm;
  if ($insideitem) {
   $tag = $tagName;
  } elseif ($tagName == RELIC)   {
  $insideitem = true;
  while (list ($key, $val) = each ($attrs)) {
   switch($key) {
   case NAME: $da_relicname=$val;print $val;break;
   case TYPE: $da_relictype=$val;break;
   case REALM: $da_relicrealm=$val;break;
   } // end case
  } // end while

  } elseif($tagName == SERVER)  {
$depth[$parser]++;
  $insideitem = true;
  while (list ($key, $val) = each ($attrs)) {
   if ($key == NAME) { $da_server=$val; if($val == $ServerToPrint) {
 $server = true; } else { $server = false; } }
   if ($key == TYPE) { $da_type=$val; }
  } // end while
  } elseif(

[PHP] php string match problem

2002-08-18 Thread Pafo

heh,, is it just me or can anyone see whats wrong with this code...

$query = SELECT * FROM logininfo WHERE loginname = '$LOGINNAME';
if ($result = mysql_query($query)){
while ($row = mysql_fetch_row($result)){
$temp = $row[8];
$temp2 = $LOGINNAME;
if ($temp == $temp2) {  --  this dosent work
$ierror = Loginnamnet är redan upptaget!br . $ierror; }
}
} else { print error; }
mysql_close($db);

i have tried:
if ($row[8] == $LOGINNAME) {

dosent work either, and when i write:

while ($row = mysql_fetch_row($result)){
print $row[8] . - . $LOGINNAME;

it shows the exact same information

anyone got any idea?

patrick



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] array's

2002-08-17 Thread Pafo

anyone that can find the problem..?
description below.

html
head
titledebug/title
/head
body
'***' OUTPUT
'**'brbr
?php

class Relic {

  var $RelicName = Array();
  var $RelicType = Array();
  var $RelicRealm = Array();
  var $RelicOwner = Array();
  var $i;

 function PrintInfo() {
   for ($this-i = 0; $this-i  count($this-RelicName); $this-i++) {
   print $this-RelicName[$this-i]  :  $this-RelicType[$this-i]  :
$this-RelicRealm[$this-i]  :  $this-RelicOwner[$this-i]br;
   }
 }

 function SetName($name) {
 $this-RelicName[] = $name;
 }

 function SetType($type) {
   $this-RelicType[] = $type;
 }

 function SetRealm($realm) {
   $this-RelicRealm[] = $realm;
 }

 function SetRelicOwner($owner) {
   $this-RelicOwner[] = $owner;
 }

}

$temp = new Relic();
$temp-SetName(olle);
$temp-SetType(melee);
$temp-SetRealm(Hibernia);
$temp-SetRelicOwner(Albion);
$temp-SetName(bertil);
$temp-SetType(melee);
$temp-SetRealm(Albion);
$temp-SetRelicOwner(Hibernia);
$temp-SetName(sture);
$temp-SetType(magic);
$temp-SetRealm(Midgard);
$temp-SetRelicOwner(Midgard);
$temp-PrintInfo();
?

/body
/html

the function PrintInfo prints out this:
'***' OUTPUT
'**'

Array[0] : Array[0] : Array[0] : Array[0]
Array[1] : Array[1] : Array[1] : Array[1]
Array[2] : Array[2] : Array[2] : Array[2]

heh,, not exacly what i wanted  :/

regards
patrick




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: php and classes

2002-08-16 Thread Pafo

the problem is that i dont have access to php.ini  :/
on a shared webhotel  :(

regards
patrick

Jason Wong [EMAIL PROTECTED] skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Friday 16 August 2002 11:40, Pafo wrote:
  nm, now it works,, forgot the silly ()

 Always set error reporting to FULL, and always error log to a file (see
 settings in php.ini). That way you probably could have figured out what
the
 problem was by examining the logs.

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 Your fly might be open (but don't check it just now).
 */




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] array and a class

2002-08-16 Thread Pafo

i got my nice looking class like this:
?php

class Relic {
  var $RelicName;
  var $RelicType;
  var $RelicRealm;
  var $RelicOwner;

 function PrintInfo() {
   print $this-RelicName  :  $this-RelicType  :  $this-RelicRealm  :
$this-RelicOwnerbr;
 }

 function CheckForPrint() {
   if ($this-RelicName ==  || $this-RelicType ==  || $this-RelicRealm
==  || $this-RelicOwner == ) {
   return false;
   } else {
   return true;
   }
 }

 function Clean() {
   $this-RelicName = ;
   $this-RelicType = ;
   $this-RelicRealm = ;
   $this-RelicOwner = ;
 }

 function SetName($name) {
 $this-RelicName = $name;
 }

 function SetType($type) {
   $this-RelicType = $type;
 }

 function SetRealm($realm) {
   $this-RelicRealm = $realm;
 }

 function SetOwner($owner) {
   $this-RelicOwner = $owner;
 }

 function DebugPrint() {
   print $this-RelicName;
 }
}

$temp = new Relic();
$temp-SetName(test);
$temp-DebugPrint();
?

but the thing is i want an array that is based on my class, so i want to use
$relicarray[1]-DebugPrint();
how does it work,, anyone that can give me a working example, cause i cant
find any  :/

regards
patrick



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] silly arrays

2002-08-16 Thread Pafo

i got a php-script like this, just to make sure that it works before i try
to implement it:
html
head
titledebug/title
/head
body
'***' OUTPUT
'**'brbr
?php

class Relic {

  var $RelicName = Array();
  var $RelicType = Array();
  var $RelicRealm = Array();
  var $RelicOwner = Array();
  var $i;

 function PrintInfo() {
   for ($this-i = 0; $this-i  count($this-RelicName); $this-i++) {
   print $this-RelicName[$this-i]  :  $this-RelicType[$this-i]  :
$this-RelicRealm[$this-i]  :  $this-RelicOwner[$this-i]br;
   }
 }

 function SetName($name) {
 $this-RelicName[] = $name;
 }

 function SetType($type) {
   $this-RelicType[] = $type;
 }

 function SetRealm($realm) {
   $this-RelicRealm[] = $realm;
 }

 function SetRelicOwner($owner) {
   $this-RelicOwner[] = $owner;
 }

}

$temp = new Relic();
$temp-SetName(olle);
$temp-SetType(melee);
$temp-SetRealm(Hibernia);
$temp-SetRelicOwner(Albion);
$temp-SetName(bertil);
$temp-SetType(melee);
$temp-SetRealm(Albion);
$temp-SetRelicOwner(Hibernia);
$temp-SetName(sture);
$temp-SetType(magic);
$temp-SetRealm(Midgard);
$temp-SetRelicOwner(Midgard);
$temp-PrintInfo();
?

/body
/html

the function PrintInfo prints out this:
'***' OUTPUT
'**'

Array[0] : Array[0] : Array[0] : Array[0]
Array[1] : Array[1] : Array[1] : Array[1]
Array[2] : Array[2] : Array[2] : Array[2]

heh,, not exacly what i wanted  :/

regards
patrick



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: array and a class

2002-08-16 Thread Pafo

solved it  thx anyway
Pafo [EMAIL PROTECTED] skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 i got my nice looking class like this:
 ?php

 class Relic {
   var $RelicName;
   var $RelicType;
   var $RelicRealm;
   var $RelicOwner;

  function PrintInfo() {
print $this-RelicName  :  $this-RelicType  :  $this-RelicRealm  :
 $this-RelicOwnerbr;
  }

  function CheckForPrint() {
if ($this-RelicName ==  || $this-RelicType ==  ||
$this-RelicRealm
 ==  || $this-RelicOwner == ) {
return false;
} else {
return true;
}
  }

  function Clean() {
$this-RelicName = ;
$this-RelicType = ;
$this-RelicRealm = ;
$this-RelicOwner = ;
  }

  function SetName($name) {
  $this-RelicName = $name;
  }

  function SetType($type) {
$this-RelicType = $type;
  }

  function SetRealm($realm) {
$this-RelicRealm = $realm;
  }

  function SetOwner($owner) {
$this-RelicOwner = $owner;
  }

  function DebugPrint() {
print $this-RelicName;
  }
 }

 $temp = new Relic();
 $temp-SetName(test);
 $temp-DebugPrint();
 ?

 but the thing is i want an array that is based on my class, so i want to
use
 $relicarray[1]-DebugPrint();
 how does it work,, anyone that can give me a working example, cause i cant
 find any  :/

 regards
 patrick





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] xml and php

2002-08-15 Thread Pafo

iwill rephrase my question, where can i find good xml-php links?
how would you extract all information about the Guinevere server in this
xmlpage,
http://www.camelotherald.com/xml/servers.xml

its aprox in the middle of the list, and i want all information there so i
could display it on a page.

regards
patrick



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: xml and php

2002-08-15 Thread Pafo
/TR\n;
 }

  $da_server = ;
  $da_lastguildupdate = ;
  $da_lastcharupdate = ;
  $da_population = ;
  $da_type = ;
  $da_status = ;
  $da_relicorig = ;
  $da_relicname = ;
  $da_relictype = ;
  $da_relicowner = ;
  $da_keeporig = ;
  $da_keepname = ;
  $da_keepowner = ;
  $da_keepclaimant = ;
  $insideitem = false;
  $insiderelic = false;
  $insidekeep = false;
}



// gotta have this for the php-NUKE block stuff to work
global $da_totalpop;

// Create an XML parser
$xml_parser = xml_parser_create();

// Set the functions to handle opening and closing tags
xml_set_element_handler($xml_parser, startElement, endElement);

// Set the function to handle blocks of character data
xml_set_character_data_handler($xml_parser, characterData);


// print hr\n;
print TABLE BORDER=0 WIDTH=0%\n;
print TRGuild: Obliteration/Midgard/TD/TR\n\n;


// Open the XML file for reading
$fp = fopen(http://www.camelotherald.com/xml/servers.xml,r;)  or
die(Error reading RSS data.);

// Read the XML file 4KB at a time
while ($data = fread($fp, 4096))
// Parse each 4KB chunk with the XML parser created above
xml_parse($xml_parser, $data, feof($fp))
  or die(sprintf(XML error: %s at line %d,
   xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
// Close the XML filef
fclose($fp);

print /TABLE\n;


// Free up memory used by the XML parser
xml_parser_free($xml_parser);

?

Manuel Lemos [EMAIL PROTECTED] skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello,

 On 08/15/2002 10:30 AM, Pafo wrote:
  iwill rephrase my question, where can i find good xml-php links?
  how would you extract all information about the Guinevere server in this
  xmlpage,
  http://www.camelotherald.com/xml/servers.xml
 
  its aprox in the middle of the list, and i want all information there so
i
  could display it on a page.

 They have PHP support for that already:

 http://www.camelotherald.com/xml.php#unix




 --

 Regards,
 Manuel Lemos




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] php and classes

2002-08-15 Thread Pafo

i reed thru my code and i noticed that it wasent readable, like Dan said in
one of my other post xml and php.
so i thought, why not create afew classes to make everything look good  :)
i managed to make this class, but it just dosent work,, anyone got any idea
why it wont work..?

?php

class Relic {
  var $RelicName;
  var $RelicType;
  var $RelicRealm;
  var $RelicOwner;

 function PrintInfo() {
   print $this-RelicName  :  $this-RelicType  :  $this-RelicRealm  :
$this-RelicOwnerbr;
 }

 function CheckForPrint() {
   if ($this-RelicName ==  || $this-RelicType ==  || $this-RelicRealm
==  || $this-RelicOwner == ) {
   return false;
   } else {
   return true;
   }
 }

 function Clean() {
   $this-RelicName = ;
   $this-RelicType = ;
   $this-RelicRealm = ;
   $this-RelicOwner = ;
 }

 function SetName($name) {
 $this-RelicName = $name;
 }

 function SetType($type) {
   $this-RelicType = $type;
 }

 function SetRealm($realm) {
   $this-RelicRealm = $realm;
 }

 function SetOwner($owner) {
   $this-RelicOwner = $owner;
 }

 function DebugPrint() {
   print $this-RelicName;
 }
}

$temp = new Relic;
$temp-SetName(test);
$temp-DebugPrint;
?


i have tried,
class Relic {
}; 
dosent work


regards
patrick



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Code for db connection errors

2002-08-15 Thread Pafo

why not:
?php
$error[] = Connection to the database failed;


$db = pg_connect(dbname=rap user=postgres) die (error(0));


function error ($code) {
  switch ($code) {
case 0 : reportErrMsg($error[$code]); break;
...
  }
}
?

i think ive would have done something like that...

but im not the greatest expert on php  :)

regards
patrick
Andre Dubuc [EMAIL PROTECTED] skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Suppose, during an attempted connection to a database, an error condition
 occurs, where the connection cannot be made.

 ?php
 . . .
 $db = pg_connect(dbname=rap user=postgres) die (Connection failed -
please
 try again.);
 . . . .
 ?

 Is it advisable for such a message to be displayed to the User, or should
 such reporting be sent to a log of some sort.

 (I'm unclear of what use the message would be to the User, and since the
site
 is not on my server, but on my IP's, I would definetly like to know if a
 failed connection occurs, so that I could investigate the problem)

 What code could/should I place in the error message -- for example, how
can I
 arrange for an e-mail to be sent to me (if that would be advisable)? How
 would you handle this situation?


 Any guidance would be greatly appreciated,
 Tia,
 Andre



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: php and classes

2002-08-15 Thread Pafo

dosent printout anything, here have a look:
http://www.ant.nu/phpclass.php

regards
patrick
Bogdan Stancescu [EMAIL PROTECTED] skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 So what happens exactly?


 Pafo wrote:
  i reed thru my code and i noticed that it wasent readable, like Dan said
in
  one of my other post xml and php.
  so i thought, why not create afew classes to make everything look good
:)
  i managed to make this class, but it just dosent work,, anyone got any
idea
  why it wont work..?
 
  ?php
 
  class Relic {
var $RelicName;
var $RelicType;
var $RelicRealm;
var $RelicOwner;
 
   function PrintInfo() {
 print $this-RelicName  :  $this-RelicType  :  $this-RelicRealm  :
  $this-RelicOwnerbr;
   }
 
   function CheckForPrint() {
 if ($this-RelicName ==  || $this-RelicType ==  ||
$this-RelicRealm
  ==  || $this-RelicOwner == ) {
 return false;
 } else {
 return true;
 }
   }
 
   function Clean() {
 $this-RelicName = ;
 $this-RelicType = ;
 $this-RelicRealm = ;
 $this-RelicOwner = ;
   }
 
   function SetName($name) {
   $this-RelicName = $name;
   }
 
   function SetType($type) {
 $this-RelicType = $type;
   }
 
   function SetRealm($realm) {
 $this-RelicRealm = $realm;
   }
 
   function SetOwner($owner) {
 $this-RelicOwner = $owner;
   }
 
   function DebugPrint() {
 print $this-RelicName;
   }
  }
 
  $temp = new Relic;
  $temp-SetName(test);
  $temp-DebugPrint;
  ?
 
 
  i have tried,
  class Relic {
  }; 
  dosent work
 
 
  regards
  patrick
 
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: php and classes

2002-08-15 Thread Pafo

nm, now it works,, forgot the silly ()

thx, Gurhan  :)

regards
patrick
Pafo [EMAIL PROTECTED] skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 dosent printout anything, here have a look:
 http://www.ant.nu/phpclass.php

 regards
 patrick
 Bogdan Stancescu [EMAIL PROTECTED] skrev i meddelandet
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  So what happens exactly?
 
 
  Pafo wrote:
   i reed thru my code and i noticed that it wasent readable, like Dan
said
 in
   one of my other post xml and php.
   so i thought, why not create afew classes to make everything look good
 :)
   i managed to make this class, but it just dosent work,, anyone got any
 idea
   why it wont work..?
  
   ?php
  
   class Relic {
 var $RelicName;
 var $RelicType;
 var $RelicRealm;
 var $RelicOwner;
  
function PrintInfo() {
  print $this-RelicName  :  $this-RelicType  :  $this-RelicRealm
:
   $this-RelicOwnerbr;
}
  
function CheckForPrint() {
  if ($this-RelicName ==  || $this-RelicType ==  ||
 $this-RelicRealm
   ==  || $this-RelicOwner == ) {
  return false;
  } else {
  return true;
  }
}
  
function Clean() {
  $this-RelicName = ;
  $this-RelicType = ;
  $this-RelicRealm = ;
  $this-RelicOwner = ;
}
  
function SetName($name) {
$this-RelicName = $name;
}
  
function SetType($type) {
  $this-RelicType = $type;
}
  
function SetRealm($realm) {
  $this-RelicRealm = $realm;
}
  
function SetOwner($owner) {
  $this-RelicOwner = $owner;
}
  
function DebugPrint() {
  print $this-RelicName;
}
   }
  
   $temp = new Relic;
   $temp-SetName(test);
   $temp-DebugPrint;
   ?
  
  
   i have tried,
   class Relic {
   }; 
   dosent work
  
  
   regards
   patrick
  
  
 
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] php and xml problem

2002-08-14 Thread Pafo

i got 2 problems with this code:

?php
$insideitem = false;
$insidekeep = false;
$insiderelic = false;
$printed = false;
$printedkeep = false;
$tag = ;
$server = false;
$da_server = ;
$da_lastguildupdate = ;
$da_lastcharupdate = ;
$da_population = ;
$da_type = ;
$da_status = ;
$da_relicorig = ;
$da_relicname = ;
$da_relictype = ;
$da_relicowner = ;
$da_keeporig = ;
$da_keepname = ;
$da_keepowner = ;
$da_keepclaimant = ;


function startElement($parser, $tagName, $attrs) {
global $insideitem, $insidekeep, $insiderelic, $tag, $da_server, $da_type,
$da_lastguildupdate, $da_lastcharupdate, $server, $da_relictype,
$da_relicname, $da_relicorig, $da_keepname, $da_keeporig;

 if ($insideitem || $insiderelic || $insidekeep) {
  $tag = $tagName;
 }

   elseif ($tagName == SERVER) {
 $insideitem = true;

// PROBLEM 1, LOOK BELOW FOR DESCRIPTION!
 while (list ($key, $val) = each ($attrs)) {
 if ($key == NAME  $val == Guinevere) { $server = true;  $da_server =
$val; print Sant, $key - $val; }
 else { $server = false; }
 } // end WHILE
// ENDS HERE!!!

 if ($server) {
 while (list ($key, $val) = each ($attrs)) {
  switch($key) {
   case TYPE : $da_type = $val; break;
   case LASTGUILDUPDATE : $da_lastguildupdate = $val; break;
   case LASTCHARUPDATE : $da_lastcharupdate = $val; break;
  }
   } // end WHILE
   }
   }

// PROBLEM 2,, LOOK BELOW FOR DESCRIPTION!
   elseif ($tagName == RELIC  $server) {
 $insiderelic = true;
 while (list ($key, $val) = each ($attrs)) {
   if ($key == TYPE) { $da_relictype = $val; }
 if ($key == NAME) { $da_relicname = $val; }
 if ($key == REALM) { $da_relicorig = $val; }
 } // End While
 }
// ENDS HERE!!!

   elseif ($tagName == KEEP  $server) {
   $insidekeep = true;
 while (list ($key, $val) = each ($attrs)) {
   if ($key == NAME) { $da_keepname = $val; }
 if ($key == REALM) { $da_keeporig = $val; }
 } // End While
 }
}


function characterData($parser, $data) {
global $insideitem, $insidekeep, $insiderelic, $tag, $da_population,
$da_status, $da_relicowner, $da_keepowner, $da_keepclaimant;
 if ($insideitem) {
switch ($tag) {
  case POPULATION: $da_population .= $data; break;
  case STATUS: $da_status .= $data; break;
  }
 }
 if ($insiderelic) {
  $da_relicowner .=  $data;
 }
 if ($insidekeep) {
switch ($tag) {
  case OWNER :  $da_keepowner .=  $data; break;
  case CLAIMANT : $da_keepclaimant .= $data; break;
}
 }
}


function endElement($parser, $tagName) {
global $insideitem, $insidekeep, $insiderelic, $tag, $da_server,
$da_population, $da_type, $da_status, $da_lastguildupdate,
$da_lastcharupdate, $da_relicname, $da_relicowner, $da_relicorig,
$da_relictype, $printed, $printedkeep, $da_keeporig, $da_keepname,
$da_keepowner, $da_keepclaimant;
 if ($tagName == SERVER  $server == true) {
  print
TRTDbServer/b/TDTDbStatus/b/TDTDbPopulation/b/TD
/TR\n;
  print TRTD$da_server;
  if ($da_type) { print (i$da_type/i); }
  print /TD;
  print TD$da_status/TD;
  print TD$da_population/TD/TR\n;
  print TRTD/TD/TR\n;
  print
TRTDbLastguildupdate/b/TDTDbLastcharupdate/b/TDTD/TD
/TR\n;
  print
TRTD$da_lastguildupdate/TDTD$da_lastcharupdate/TD/TR\n;
 }
 elseif ($tagName == RELIC  $server == true) {
  if (!$printed) { print TRTD/TD/TR\n; print TRTDbRelic
Name/b/TDTDbRelic Owner/b/TDTDbRelic Type/b/TD/TR\n;
$printed = true; }
  print TRTD;
  if ($da_relicorig == Albion) { print font
color=\#ff$da_relicname/font; }
  elseif ($da_relicorig == Midgard) { print font
color=\#ff$da_relicname/font; }
  else { print font color=\#00ff00$da_relicname/font; }
  print /TDTD;
  if ($da_relicowner == Albion) { print font
color=\#ff$da_relicowner/font; }
  elseif ($da_relicowner == Midgard) { print font
color=\#ff$da_relicowner/font; }
  else { print font color=\#00ff00$da_relicowner/font; }
  print /TDTD$da_relictype/TD/TR\n;
 }
 elseif ($tagName == KEEP  $server == true) {
  if (!$printedkeep) {  print TRTD/TD/TR\n; print TRTDbKeep
Name/b/TDTDbKeep Owner/b/TDTDbClaimant/b/TD/TR\n;
$printedkeep = true; }
  print TRTD;
  if ($da_keeporig == Albion) { print font
color=\#ff$da_keepname/font; }
  elseif ($da_keeporig == Midgard) { print font
color=\#ff$da_keepname/font; }
  else { print font color=\#00ff00$da_keepname/font; }
  print /TDTD;
  if ($da_keepowner == Albion) { print font
color=\#ff$da_keepowner/font; }
  elseif ($da_keepowner == Midgard) { print font
color=\#ff$da_keepowner/font; }
  else { print font color=\#00ff00$da_keepowner/font; }
  print /TDTD$da_keepclaimant/TD/TR\n;
 }

  $da_server = ;
  $da_lastguildupdate = ;
  $da_lastcharupdate = ;
  $da_population = ;
  $da_type = ;
  $da_status = ;
  $da_relicorig = ;
  $da_relicname = ;
  $da_relictype = ;
  $da_relicowner = ;
  $da_keeporig = ;
  $da_keepname = ;
  $da_keepowner = ;
  $da_keepclaimant = ;
  $insideitem = false;
  $insiderelic = false;
  $insidekeep = false;
}



// gotta have this for the php-NUKE block stuff to work
global $da_totalpop;

// Create an XML 

[PHP] Hi - newbie questions...

2002-01-31 Thread Pafo

1st
How to start a cookie/how to delete a cookie and how to change/retrive
information from it

2nd
How to start a session/how to delete a session and how to change/retrive
information from it

3rd
does php have application like asp??

4th
sessions, can they be accessed from an asp script and the other way round?

regards
pafo



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] new question

2002-01-31 Thread Pafo

you can get a file on your site to be exec every x minuts with lynx
but i dont understand how it works, i have created a  cron.txt file and
put it in the folder where i want my script to be executed...  the content
of this file looks like this:

*/5 * * * * /usr/bin/lynx --dump http://localhost/php/ppp.php  /dev/null

but it dosent work, do i have to register the cronfile somewhere to make it
work...?
cause i want it to run this file every 5mins...  is there any other way???

regards
pafo



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] newbie question 2

2002-01-31 Thread Pafo

ok, i have reed the manual and i are having a hard time understanding it...
i tryed some examples with sessions but neither one of them did work
thats why i asked about sessions and cookies

cause in asp u use sessions like this,
Session(name) = Steve
or
Session(ANumber) = 12345

u dont have to declare them or anything...

about the application, i dont know if u have been programming in asp..?
in asp u have something called global.asa  where u have your startcode
with startcode i mean the code that exec when someone enters your site...

in that global.asa u have something called application like this,

Sub application_start()
if application(number_of_peops_on_my_site) =  then
application(number_of_peops_on_my_site) = 1
else
application(number_of_peops_on_my_site) =
application(number_of_peops_on_my_site) + 1
end if
end sub

and then u have the opposit, the decreasing one...

cause i cant think of an another way to keep track of the number of peops
that are currently on my site...
and since im not familiar with php i thought that it was something like the
application to php to...

how would u keep track of current number of peop on your site, and i dont
mean a ordinary counter...
cause in asp i would be able to do this:

Number of peop on my site: %= application(number_of_peops_on_my_site) %
regards
pafo



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]