Code: Select all
# Channel to export to xml
set chanxml(channel) "#sheep"
# Export file name
set chanxml(filename) "sheep.xml"
if {![info exists chanxml(timer)]} {
set chanxml(timer) [timer 5 chanxml_timer]
}
proc chanxml_timer {args} {
global chanxml
set chanxml(timer) [timer 5 chanxml_timer]
set fp [open $chanxml(filename) w]
puts $fp "<?xml version=\"1.0\"?>"
# Add dtd and all that here if you want
puts $fp "<!-- Generated by stdragon's cool script -->"
puts $fp "<channel_list>"
puts $fp " <channel>"
puts $fp " <name>$chanxml(channel)</name>"
puts $fp " <topic>[topic $chanxml(channel)]</topic>"
puts $fp " <chanmode>[getchanmode $chanxml(channel)]</chanmode"
foreach nick [chanlist $chanxml(channel)] {
# Skip bot's nick
if {[isbotnick $nick]} { continue }
puts $fp " <user>"
puts $fp " <nick>$nick</nick>"
puts $fp " <uhost>[getchanhost $nick]</uhost>"
puts $fp " <jointime>[getchanjoin $nick $chanxml(channel)]</jointime>"
puts $fp " <idletime>[getchanidle $nick $chanxml(channel)]</idletime>"
# Get channel mode for user
set mode ""
if {[isvoice $nick $chanxml(channel)]} { append mode "v" }
if {[isop $nick $chanxml(channel)]} { append mode "o" }
puts $fp " <mode>$mode</mode>"
# Done with this user
puts $fp " </user>"
}
puts $fp " </channel>"
puts $fp "</channel_list>"
close $fp
}
Uh... yea... if he wanted the word "unixtime" ....CrazyCat wrote:Code: Select all
set now unixtime
Code: Select all
set now [unixtime]
Code: Select all
set now [clock seconds]
Code: Select all
proc chanxml_timer {args} {
global chanxml
# Reset timer
set chanxml(timer) [timer 1 chanxml_timer]
# Write file
set fp [open $chanxml(filename) w]
puts $fp "<?xml version=\"1.0\"?>"
puts $fp "<!-- $chanxml(channel) channel user statistics -->"
puts $fp "<channel_list time=\"[unixtime]\">"
puts $fp " <channel>"
puts $fp " <name>$chanxml(channel)</name>"
puts $fp " <topic>[topic $chanxml(channel)]</topic>"
puts $fp " <chanmode>[getchanmode $chanxml(channel)]</chanmode>"
# Loop users
foreach nick [chanlist $chanxml(channel)] {
# Skip bot's nick
if {[isbotnick $nick]} { continue }
puts $fp " <user>"
puts $fp " <nick>$nick</nick>"
puts $fp " <uhost>[getchanhost $nick]</uhost>"
puts $fp " <jointime>[getchanjoin $nick $chanxml(channel)]</jointime>"
puts $fp " <idletime>[getchanidle $nick $chanxml(channel)]</idletime>"
# Get channel mode for user
set mode ""
if {[isvoice $nick $chanxml(channel)]} { append mode "v" }
if {[isop $nick $chanxml(channel)]} { append mode "o" }
puts $fp " <mode>$mode</mode>"
# Done with this user
puts $fp " </user>"
}
# Finish file
puts $fp " </channel>"
puts $fp "</channel_list>"
close $fp
}
Code: Select all
# Channel to export to xml
set chanxml(channel) "#EQrus"
# Export file name
set chanxml(filename) "../WWW/eqrus.xml"
# Set initial timer
if {![info exists chanxml(timer)]} {
set chanxml(timer) [timer 1 chanxml_timer]
}
proc chanxml_timer {args} {
global chanxml
# Reset timer
set chanxml(timer) [timer 1 chanxml_timer]
# Write file
set fp [open $chanxml(filename) w]
puts $fp "<?xml version=\"1.0\"?>"
puts $fp "<!-- $chanxml(channel) channel user statistics -->"
puts $fp "<channel_list>"
puts $fp " <time>[unixtime]</time>"
puts $fp " <channel>"
puts $fp " <name>$chanxml(channel)</name>"
puts $fp " <topic>[topic $chanxml(channel)]</topic>"
puts $fp " <chanmode>[getchanmode $chanxml(channel)]</chanmode>"
# Loop users
foreach nick [chanlist $chanxml(channel)] {
# Skip bot's nick
if {[isbotnick $nick]} { continue }
puts $fp " <user>"
puts $fp " <nick>$nick</nick>"
puts $fp " <uhost>[getchanhost $nick]</uhost>"
puts $fp " <jointime>[getchanjoin $nick $chanxml(channel)]</jointime>"
puts $fp " <idletime>[getchanidle $nick $chanxml(channel)]</idletime>"
# Get channel mode for user
set mode ""
if {[isvoice $nick $chanxml(channel)]} { append mode "v" }
if {[isop $nick $chanxml(channel)]} { append mode "o" }
puts $fp " <mode>$mode</mode>"
# Done with this user
puts $fp " </user>"
}
# Finish file
puts $fp " </channel>"
puts $fp "</channel_list>"
close $fp
}
Sure you can.blood_x wrote:Dear fahr,
Can I see online example of this script?
Code: Select all
<?
// Error handling
error_reporting(E_ALL);
// Handler
require('IRCChannelInfo.inc.php');
// Get XML
$fXML = file_get_contents('http://www.lycantrope.com/~ircbots/eqrus.xml');
// Create object
$IRC = new IRCChannelInfo($fXML);
var_dump($IRC);
?>
Code: Select all
$fXML = file_get_contents(
Code: Select all
Fatal error: Call to undefined function: file_get_contents() in /var/www/html/xml/users.php on line 10
Then you're running on a seriously outdated version of PHP.cvanmeer wrote:this part:gives an error:Code: Select all
$fXML = file_get_contents(
Just to mention it. Not TCL related at allCode: Select all
Fatal error: Call to undefined function: file_get_contents() in /var/www/html/xml/users.php on line 10
gr.
Chrizz
Code: Select all
<?
// Error handling
error_reporting(E_ALL);
// Handler
require('IRCChannelInfo.inc.php');
// Get XML
$fXML = fopen('myfile.xml', 'r');
$sXML = fread($fXML, filesize('myfile.xml'));
fclose($fXML);
// Create object
$IRC = new IRCChannelInfo($sXML);
var_dump($IRC);
?>