PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Bollebus on 28 September, 2004, 21:09:36

Title: Convert XML to LUA
Post by: Bollebus on 28 September, 2004, 21:09:36
Here are the XLM script i want to convert to lua

http://bollebus.mine.nu/isps.xml

please help me

//Bolle


Hey
i need someone who can convert XML to ptokax LUA script

i cant paste the xml script here its to long if u can convert  i can mail it to u or something

//Bolle

Title:
Post by: plop on 28 September, 2004, 22:51:22
QuoteOriginally posted by Bollebus
Hey
i need someone who can convert XML to ptokax LUA script

i cant paste the xml script here its to long if u can convert  i can mail it to u or something

//Bolle


try the search from the board.
rabitwombat posted a xml parsing script for lua.

plop
Title:
Post by: Bollebus on 29 September, 2004, 16:59:29
i have try to search for it but no answers

no one who can convert ?

//Bolle

QuoteOriginally posted by plop
QuoteOriginally posted by Bollebus
Hey
i need someone who can convert XML to ptokax LUA script

i cant paste the xml script here its to long if u can convert  i can mail it to u or something

//Bolle


try the search from the board.
rabitwombat posted a xml parsing script for lua.

plop
Title:
Post by: Bollebus on 02 October, 2004, 12:17:23
no one who can ???

please help med

//bolle
Title:
Post by: plop on 02 October, 2004, 16:13:09
QuoteOriginally posted by Bollebus
no one who can ???

please help med

//bolle
mutor posted the function for you, what more help do you need ?


plop
Title:
Post by: Bollebus on 02 October, 2004, 19:08:59
the script mutor paste to me will not work i have only past it in a txt documet and chage the name to *.lua

but the script now work so i voudering if the ip number shall paste in the script them i who is 10Mbit

i cant nothing about makeing script

//Bolle

QuoteOriginally posted by plop
QuoteOriginally posted by Bollebus
no one who can ???

please help med

//bolle
mutor posted the function for you, what more help do you need ?


plop
Title:
Post by: Bollebus on 02 October, 2004, 19:44:05
hey

i need a ip script i can put in the  ip number but i wont the script

//bolle
Title:
Post by: Psycho_Chihuahua on 04 October, 2004, 00:33:15
with an xml like this...


29145
Psycho_Johnnie
25.06.2004 16:17
03.10.2004 23:23
8d 07h 58m 58s
4d 07h 42m 49s
19d 03h 40m 40s
Windows 2000
4
2195
2384/6686
[URL]http://www.uptime-project.net/profile.php?uid=29145[/URL]
03.10.2004 23:24


where in that XML Parser would i enter like or ?

like say i enter #servtime then it should show something like this.. Hub Server Uptime: [$uptime]
 Hub Server Average: [$average]
 Hub Uptime Record: [$record]
 Hub OS: [$os SP $os_sp]
 Stats generated: [$generated]

any ideas?

My XML Parser (via webserver)
// Variablendefinition ->>

// Uptime Project User-ID
$config[uid] = 29145;
// (Path to) Temp-File
$config[tmp] = "serveruptime.dat";

// <<- Variablendefinition



// Programmablauf ->>

if(@filemtime($config[tmp]) <= time() - 1800 || @filesize($config[tmp]) == 0)
{
$input_xml = @fopen("http://data.uptime-project.net/xml.php?uid=$config[uid]","r");
$input = @fread($input_xml,2048);
@fclose($input_xml);

if($input)
{
$tmpfile = @fopen($config[tmp],w);
if($tmpfile)
{
@fwrite($tmpfile,$input);
}
else
{
echo "Kann nicht in Temp-File schreiben. Fehlende Rechte.";
exit;
}
@fclose($tmpfile);
}

unset($input,$input_xml,$tmpfile);
}

$tmpfile = @fopen($config[tmp],r);
$input = @fread($tmpfile,2048);

if($input)
{
$parser = xml_parser_create();
xml_parse_into_struct($parser,$input,$values);
xml_parser_free($parser);

$xml = array();

foreach($values as $data)
{
if($data[tag] != "PROFILE")
{
$xml[strtolower($data[tag])] = $data[value];
}
}
}
else
{
echo "Kann Temp-Datei $config[tmp] nicht lesen.";
exit;
}

@fclose($tmpfile);
unset($tmpfile,$input,$parser,$values,$data);

// <<- Programmablauf
header("Content-type: image/png");
$image = imagecreatefrompng("uptime10.png");
$black = imagecolorallocate($image, 0,0,0);
$font_size = 7.5;
ImageTTFText ($image, $font_size, 0, 60, 22, $black, "fonts/tahoma.ttf","User: $xml[username]");
ImageTTFText ($image, $font_size, 0, 60, 32, $black, "fonts/tahoma.ttf","Uptime: $xml[uptime]");
ImageTTFText ($image, $font_size, 0, 60, 42, $black, "fonts/tahoma.ttf","Record: $xml[record]");
ImageTTFText ($image, $font_size, 0, 60, 52, $black, "fonts/tahoma.ttf","OS: $xml[os] SP $xml[os_sp]");
ImageTTFText ($image, 7, 0, 40, 68, $black, "fonts/tahoma.ttf","Stats generiert: $xml[generated]");
imagepng($image);
imagedestroy($image);
?>

Title:
Post by: Psycho_Chihuahua on 04 October, 2004, 15:41:22
anyone got an Idea???
Title:
Post by: Psycho_Chihuahua on 04 October, 2004, 19:28:52
QuoteOriginally posted by Mutor
save the output of that php script to a text file that is of little use. I will be  working on an XML  solution. I am nearly finished with a revised version of the Web Reader script. Next on the chopping block is XML. Will post as soon as I have something of consequence.


well the xml only gets updated every 30 mins at max (<= time() - 1800 || @filesize($config[tmp]) == 0 ) which is the time it takes the uptime project servers to update and is then used as cached data in "serveruptime.dat" for the next 30 minutes, in other words its always accurate +- 29 minutes, so changing its path and ending is not a problem. looking forward to something a bit easier to use ^^ but no need to hurry



edited

i have changed my output file to a pure xml named serveruptime.xml...


29145
Psycho_Johnnie
25.06.2004 16:17
03.10.2004 23:23
8d 07h 58m 58s
4d 07h 42m 49s
19d 03h 40m 40s
Windows 2000
4
2195
2384/6686
[URL]http://www.uptime-project.net/profile.php?uid=29145[/URL]
03.10.2004 23:24

Title:
Post by: plop on 05 October, 2004, 13:25:05
why not use uptime.exe from M$.
PtokaX 10 day(s), 15 hour(s) 33 minute(s), 54 second(s)
  Server 17 day(s), 20 hour(s), 34 minute(s), 41 second(s)
if you enable enough logging in windows you can get even more info.
Since 3-6-2004:

           System Availability: 99.3717%
                  Total Uptime: 122d 23h:41m:46s
                Total Downtime: 0d 18h:39m:48s
                 Total Reboots: 14
     Mean Time Between Reboots: 8.84 days
             Total Bluescreens: 0

plop
Title:
Post by: Psycho_Chihuahua on 05 October, 2004, 17:14:17
i know of that one plop, just seeming that i have the xml anyway i would like to be able to use it as well...

I have the XML saved localy anyway thanks to the uptime project where i make my own images.

I would just like to know how i can use the certain keywords from the XML in a Hubscript like for instance $xml[uptime] for the xml variable XXXX found in the x.xml

I use various XML's for:

The Uptime Project (for my own Uptime Images)
SETI (also for own Images to display on website)
BOINC
Homepage

so if i had a script for something in that case i could adapt it to my needings ^^
 
Title:
Post by: Bollebus on 06 October, 2004, 19:23:13
Hey

i need a script there im write the ip number who let get in on my hub  

can u write thats script

//Bolle

QuoteOriginally posted by Mutor
I dont understand your request. Please explain what you want to do.
Title:
Post by: Psycho_Chihuahua on 08 October, 2004, 03:21:10
QuoteOriginally posted by Psycho_Chihuahua
I have the XML saved localy anyway thanks to the uptime project where i make my own images.

I would just like to know how i can use the certain keywords from the XML in a Hubscript like for instance $xml[uptime] for the xml variable XXXX found in the x.xml

I use various XML's for:

The Uptime Project (for my own Uptime Images)
SETI (also for own Images to display on website)
BOINC
Homepage

so if i had a script for something in that case i could adapt it to my needings ^^
 
Title:
Post by: Bollebus on 20 December, 2004, 21:05:06
no one who have or can write some to me ??

//Bolle

QuoteOriginally posted by Bollebus
Here are the XLM script i want to convert to lua

http://bollebus.mine.nu/isps.xml

please help me

//Bolle


Hey
i need someone who can convert XML to ptokax LUA script

i cant paste the xml script here its to long if u can convert  i can mail it to u or something

//Bolle