|
Page 1 of 1 |
|
Posted: Mon, 21st Apr 2008 18:05 Post subject: PHP No ending script not working? |
|
 |
Code: | <?php
// Prevent PHP from stopping the script after 30 sec
set_time_limit(0);
// Opening the socket to the Rizon network
$socket = fsockopen("irc channel", 6667);
// Send auth info
fputs($socket,"USER USERNAME site :bot\n");
fputs($socket,"NICK BOT\n");
// Join channel
fputs($socket,"JOIN #channel\n");
// Force an endless while
while(1) {
// Continue the rest of the script here
while($data = fgets($socket, 128)) {
echo nl2br($data);
flush();
// Separate all data
$ex = explode(' ', $data);
// Send PONG back to the server
if($ex[0] == "PING"){
fputs($socket, "PONG ".$ex[1]."\n");
}
// Say something in the channel
$command = str_replace(array(chr(10), chr(13)), '', $ex[3]);
if ($command == ":!command") {
// Prepare TVGuide
$fh = file_get_contents("nownext.txt");
fputs($socket, "PRIVMSG ".$ex[2]." :$fh\n");
}
if ($command == ":!status") {
$state = file_get_contents("file.txt");
fputs($socket, "PRIVMSG ".$ex[2]." :The stream is currently flagged as $state\n");
}
if($command == ":!stop"){
fputs($socket,"PRIVMSG $ex[2] Bye\n");
die();
}
}
}
|
Why does this quit out every 5mins or so, when there is a limit of 0 and a endless while loop?
|
|
Back to top |
|
 |
Nui
VIP Member
Posts: 5720
Location: in a place with fluffy towels
|
Posted: Mon, 21st Apr 2008 18:15 Post subject: |
|
 |
doesn't php have a execution timelimit, which cannot be avoided? so you'll have to make a script rerun and start again where it left off?
kogel mogel
|
|
Back to top |
|
 |
|
Posted: Mon, 21st Apr 2008 18:48 Post subject: |
|
 |
Nui wrote: | doesn't php have a execution timelimit, which cannot be avoided? so you'll have to make a script rerun and start again where it left off? |
Thats what the time_limit(0) is for?
|
|
Back to top |
|
 |
Nui
VIP Member
Posts: 5720
Location: in a place with fluffy towels
|
Posted: Mon, 21st Apr 2008 21:43 Post subject: |
|
 |
DeMoN064 wrote: | Nui wrote: | doesn't php have a execution timelimit, which cannot be avoided? so you'll have to make a script rerun and start again where it left off? |
Thats what the time_limit(0) is for? |
I never used php, but the mysqldumper script for example loads itself again after some seconds, so it will not hit the limit.
That makes me wonder if a simple line as this one could achieve the same result.
|
|
Back to top |
|
 |
|
Posted: Mon, 21st Apr 2008 23:57 Post subject: |
|
 |
ignore_user_abort(TRUE);
Yay - Seems thats all I needed.
|
|
Back to top |
|
 |
|
Posted: Sat, 7th Mar 2009 10:52 Post subject: |
|
 |
don't want to make a new topic for a little question so where it goes
<?php
define('AUTOR', 'oriceon');
define('VARSTA', '20 ani');
echo AUTOR.' <br> '.VARSTA;
?>
what is wrong with this script ? i get an error.
>>>> >>>>>>> >>>>>>>>> ♪ Viva La Vida ♪ <<<<<< <<<<< <<<<<< <<<
|
|
Back to top |
|
 |
|
Posted: Fri, 13th Mar 2009 19:09 Post subject: |
|
 |
Laurentiu499 wrote: | don't want to make a new topic for a little question so where it goes
<?php
define('AUTOR', 'oriceon');
define('VARSTA', '20 ani');
echo AUTOR.' <br> '.VARSTA;
?>
what is wrong with this script ? i get an error. |
Try
Code: |
<?php
define("AUTOR","oriceon");
define("VARSTA","20 ani");
echo constant("AUTOR");
echo("<br>");
echo constant("VARSTA");
?> |
Tbh, I would just use varables because constants seem to be annoying to use in echo unless there is a better way I don't know about...
|
|
Back to top |
|
 |
Page 1 of 1 |
All times are GMT + 1 Hour |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group
|
|
 |
|