Hi,

Sorry about not showing the code, there is a lot of it. Now this script
works in my pc, running IIS5 but not on my web host.

If you remove various parts of the main if statments then it manages more
than 20. Depending which if statement is removed, changes how many
iterations it will last for. However it will iterate the the correct amount
if it never chooses a if statement. That make sense?

The posted below, sorry there is quite a lot of it in the for loop :)

Cheers,

Ash Young





for($n=3;$n<count($fcontents);$n++) {
/*
****************************************************************************
*****
* FIRST CHECK TO EVALUATE WHAT THE LINE IS.
****************************************************************************
*****
*/
  $pos[MODECHANGE] = strpos($fcontents[$n],"**");
  $pos[NOTICE] = strpos($fcontents[$n],"-");
  $pos[MESSAGE] = strpos($fcontents[$n],"<");
  $pos[ACTION] = strpos($fcontents[$n],"* ");
  $pos[SESSION] = strpos($fcontents[$n],"Session");
  $pos[DONTKNOW] = 999;
  if(!is_integer($pos[MODECHANGE]))  $pos[MODECHANGE]=1000;
  if(!is_integer($pos[NOTICE]))  $pos[NOTICE]=1000;
  if(!is_integer($pos[MESSAGE]))  $pos[MESSAGE]=1000;
  if(!is_integer($pos[ACTION]))  $pos[ACTION]=1000;
  if(!is_integer($pos[SESSION]))  $pos[SESSION]=1000;
  asort($pos);reset($pos);
  $key = key($pos);
  if($key==MESSAGE) $mode = MESSAGE;
  elseif($key==MODECHANGE) $mode = MODECHANGE;
  elseif($key==ACTION) $mode = ACTION;
  elseif($key==SESSION) $mode = SESSION;
  elseif($key==NOTICE) $mode = NOTICE;
  elseif($key==DONTKNOW) $mode = DONTKNOW;
/*
****************************************************************************
*****
* NOW EXECUTE THE CODE FOR OUR PARTICULAR ACTION
****************************************************************************
*****
*/

  if($mode==MESSAGE) {
/*
****************************************************************************
*****
* MESSSAGE CODE
* GET NICKNAME, THEN CHECK TO SEE IF EXISTS IN NICK ARRAY IF NOT ADD,
CREATING
* A NEW NICKNAME OBJECT WITH IT.
* ELSE INCREMENT ADD THE LINENO TO THE OBJECT FOR RANDOM LINE PROCESSING
****************************************************************************
*****
*/
    $currentnick =
substr($fcontents[$n],$pos[MESSAGE]+1,strpos($fcontents[$n],">") -
$pos[MESSAGE]-1);
    // See if it exists already in our nicklist array
    if (!isset($nicklist)) {
      $nicklist[$currentnick] = new NickName($currentnick,$n,0,0);
    }
    elseif (@array_key_exists($currentnick, $nicklist)) {
      $nicklist[$currentnick]->addLine($n);
    }
    else {
      $nicklist[$currentnick] = new NickName($currentnick,$n,0,0);
    }
/*
****************************************************************************
*****
* NOW CREATE TIME OF DAY ARRAY
****************************************************************************
*****
*/
    $currenthr = substr($fcontents[$n],1,2);
    if(is_numeric($currenthr))
      $timeofday[$currenthr]++;
  }
  elseif($mode==MODECHANGE) {
/*
****************************************************************************
*****
* CHANGE MODE CODE
*
* FIRST SEE IF TOPIC LINE
****************************************************************************
*****
*/
    $lstart = $pos[MODECHANGE]+4;
    if (substr($fcontents[$n],$lstart,5)=="Topic") {
/*
****************************************************************************
*****
* DEAL WITH TOPIC ON JOIN, ADD TO TOPIC ARRAY, THEN WITH TOPIC CHANGE
****************************************************************************
*****
*/
      $prevtopics[] =
substr($fcontents[$n],$lstart+10,strlen($fcontents[$n])-$lstart-13);
    }
    elseif(strpos($fcontents[$n],"changes topic") <> NULL) {
      $temppos = strpos($fcontents[$n],"changes topic")+18;
      $prevtopics[] =
substr($fcontents[$n],$temppos,strlen($fcontents[$n])-$temppos-2);
    }
  }
  elseif($mode==ACTION) {
/*
****************************************************************************
*****
* ACTION CODE
* GET NICKNAME, THEN CHECK TO SEE IF EXISTS IN NICK ARRAY IF NOT ADD,
CREATING
* A NEW NICKNAME OBJECT WITH IT.
* ELSE INCREMENT ADD THE LINENO TO THE OBJECT FOR RANDOM LINE PROCESSING
****************************************************************************
*****
*/
    $currentnick =
substr($fcontents[$n],$pos[ACTION]+2,strpos(substr_replace($fcontents[$n],""
,0,$pos[ACTION]+2)," "));
    // See if it exists already in our nicklist array
    if (!isset($nicklist)) {
      $nicklist[$currentnick] = new NickName($currentnick,0,0,$n);
    }
    elseif (@array_key_exists($currentnick, $nicklist)) {
      $nicklist[$currentnick]->addAction($n);
    }
    else {
      $nicklist[$currentnick] = new NickName($currentnick,0,0,$n);
    }
  }
  elseif($mode==NOTICE) {
/*
****************************************************************************
*****
* NOTICE CODE
* CHECK IF NOTICE IS ACTUALLY WHOIS. IF SO SKIP THE WHOIS AND CONTINUE
PROCESSING
****************************************************************************
*****
*/
    if(strlen($fcontents[$n])==3) {
      $i=$n+1; while(strlen($fcontents[$n])!=3 && $i<=$linecount) $i++;
$n=$i;
    }
  }
  elseif($mode==SESSION) {
/*
****************************************************************************
*****
* SESSION CODE
* SET THE DATE OF THE SESSION END
****************************************************************************
*****
*/
    $logenddate =
strtotime(substr_replace(substr($fcontents[$n],19,20),"",7,9));
  }
}




-- 
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]

Reply via email to