Can I have your help please ?
[email protected] (Dinesh) Tue, 07 Aug 2001 15:23:58 +0200
| Newsgroups | php.gtk |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'd like make de chat with PHP-GTK.
But, I have some errors.
Here is the code:
==============================================
<?
if(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')
dl('php_gtk.dll');
else
dl('php_gtk.so');
// Début des fonctions
function false()
{
return false;
}
function quitter()
{
GTK::main_quit();
}
function get_msg()
{
global $ifp;
$ipointer = 0;
$fp = fopen("http://www.dinsoft.net/softdy/chat/get_msg.php","r");
while($ipointer <= $ifp)
{
$ligne = fgets($fp, 65);
$ipointer++;
}
$ifp++;
fclose($fp);
return $ligne;
}
// Fin des fonctions
// Création de la fenêtre principale
$window = &new GtkWindow();
$window->set_title('Softdy FTP: Le chat');
$window->set_name('principal');
$window->connect('destroy', 'quitter');
$window->connect('delete-event', 'false');
$vbox = &new GtkVBox();
$msg = &new GtkEntry();
$zone = &new GtkText();
$zone->set_editable(1);
function update()
{
global $pause, $old_buffer, $vbox, $window, $zone, $msg;
while($pause == 0)
{
if($change == 1)
{
$buffer = get_msg();
if($buffer != "$old_buffer")
{
$zone->insert(NULL, NULL, NULL, $buffer, strlen($buffer));
$old_buffer = $buffer;
}
$change = 0;
}
else
{
if($i == 0)
{
$vbox->pack_start($zone);
$vbox->pack_start($msg);
$window->add($vbox);
$window->show_all();
$i++;
}
$change = 1;
}
}
}
update();
GTK::main();
?>
==============================================
If you can help me...
Thanks !
(Why can't y connect to the IRC server of PHP-GTK ?)