0

All -

Sure could use a fresh set of eyes on the following code .... as, I can not find the following error:

Parse error: syntax error, unexpected $end in /homepages/xx/xxxxxx/htdocs/mysite/folder/index.php on line 6566

Have read that a possible cause for the error message is a missing curly bracket '{' or '}', but I can not find it or what is causing the error message.

Here is the file's code:

<?php
  if (!empty($_GET)) while(list($name, $value) = each($_GET)) $$name = $value;
  if (!empty($_POST)) while(list($name, $value) = each($_POST)) $$name = $value;
	$groupswithaccess="ADMIN";
	$noaccesspage="";
  require("sitelokpw.php");
  @set_time_limit(86400);
  // If main admin form submitted then store data in session
  if ((!empty( $_POST )) && ($recordsperpage!=""))
  {
    if (get_magic_quotes_gpc())
    {
      $fildata1=stripslashes($fildata1);
      $fildata2=stripslashes($fildata2);
      $fildata3=stripslashes($fildata3);
      $fildata4=stripslashes($fildata4);
      $sqlquery=stripslashes($sqlquery);
      $sqlinput=stripslashes($sqlinput);
      if (isset($body))
  	    $body=stripslashes($body);
    }
    if (($sqlquery!="") && ($DemoMode))
      $sqlquery="";
    $_SESSION['ses_admin_tablestart']=$tablestart;
    $_SESSION['ses_admin_sqlquery']=$sqlquery;
    $_SESSION['ses_admin_sqlinput']=$sqlinput;
    $_SESSION['ses_admin_filfield1']=$filfield1;
    $_SESSION['ses_admin_filcond1']=$filcond1;
    $_SESSION['ses_admin_fildata1']=$fildata1;
    $_SESSION['ses_admin_filfield2']=$filfield2;
    $_SESSION['ses_admin_filcond2']=$filcond2;
    $_SESSION['ses_admin_fildata2']=$fildata2;
    $_SESSION['ses_admin_filfield3']=$filfield3;
    $_SESSION['ses_admin_filcond3']=$filcond3;
    $_SESSION['ses_admin_fildata3']=$fildata3;
    $_SESSION['ses_admin_filfield4']=$filfield4;
    $_SESSION['ses_admin_filcond4']=$filcond4;
    $_SESSION['ses_admin_fildata4']=$fildata4;
    $_SESSION['ses_admin_filbool1']=$filbool1;
    $_SESSION['ses_admin_filbool2']=$filbool2;
    $_SESSION['ses_admin_filbool3']=$filbool3;
    $_SESSION['ses_admin_sortf']=$sortf;
    $_SESSION['ses_admin_sortd']=$sortd;
    $_SESSION['ses_admin_filteron']=$filteron;
    $_SESSION['ses_admin_recordsperpage']=$recordsperpage;
  }
  if (($sqlquery!="") && ($DemoMode))
    $sqlquery="";
  $tablestart=$_SESSION['ses_admin_tablestart'];
  $sqlquery=$_SESSION['ses_admin_sqlquery'];
  $sqlinput=$_SESSION['ses_admin_sqlinput'];
  $filfield1=$_SESSION['ses_admin_filfield1'];
  $filcond1=$_SESSION['ses_admin_filcond1'];
  $fildata1=$_SESSION['ses_admin_fildata1'];
  $filfield2=$_SESSION['ses_admin_filfield2'];
  $filcond2=$_SESSION['ses_admin_filcond2'];
  $fildata2=$_SESSION['ses_admin_fildata2'];
  $filfield3=$_SESSION['ses_admin_filfield3'];
  $filcond3=$_SESSION['ses_admin_filcond3'];
  $fildata3=$_SESSION['ses_admin_fildata3'];
  $filfield4=$_SESSION['ses_admin_filfield4'];
  $filcond4=$_SESSION['ses_admin_filcond4'];
  $fildata4=$_SESSION['ses_admin_fildata4'];
  $filbool1=$_SESSION['ses_admin_filbool1'];
  $filbool2=$_SESSION['ses_admin_filbool2'];
  $filbool3=$_SESSION['ses_admin_filbool3'];
  $sortf=$_SESSION['ses_admin_sortf'];
  $sortd=$_SESSION['ses_admin_sortd'];
  $filteron=$_SESSION['ses_admin_filteron'];
  $recordsperpage=$_SESSION['ses_admin_recordsperpage'];
	if ($recordsperpage!="")
	{ 
	  if (substr($recordsperpage,0,3)=="ALL")
	    $ShowRows=substr($recordsperpage,3);
	  else
	    $ShowRows=$recordsperpage;	      
	}  
	else
	  $recordsperpage=$ShowRows;    
  if (!isset($tablestart))
    $tablestart=0;
  if ($sljustloggedin)
    $act="start";
  if (($sqlquery!="") && ($DemoMode))
    $sqlquery="";    
	$emailsent=0;
	$emailblocked=0;
	$emailfail=0;  
  $mysql_link=sl_DBconnect();
  if ($mysql_link==false)
  {
    print("Can't connect to MySQL server");
    exit;
  }
  // Updated records if select clicked previously
  if (($act=="query") || ($act=="filter") || ($act=="showall") || ($act=="start"))
  {
		$mysql_result=mysql_query("UPDATE ".$DbTableName." SET ".$SelectedField."='No'",$mysql_link);
  }
  else
  {
    $k=0;
		$pvar1="sl".$k;
		$pvar2="us".$k;
    while (isset($$pvar1))
	  {
	    if ($$pvar1=="1")
	    {
		    $mysql_result=mysql_query("UPDATE ".$DbTableName." SET ".$SelectedField."='Yes' WHERE ".$UsernameField."=".sl_quote_smart($$pvar2),$mysql_link);
	    }
	    if ($$pvar1=="0")
	    {
		    $mysql_result=mysql_query("UPDATE ".$DbTableName." SET ".$SelectedField."='No' WHERE ".$UsernameField."=".sl_quote_smart($$pvar2),$mysql_link);
		  }
		  $k++;
			$pvar1="sl".$k;
			$pvar2="us".$k;		  
	  }
  }
  if ((!isset($sortf)) || (!isset($sortd)))
  {
    $mysql_result=mysql_query("SELECT * FROM ".$DbConfigTableName." LIMIT 1",$mysql_link);
    if ($mysql_result!=False)
    {
    	$row=mysql_fetch_array($mysql_result,MYSQL_ASSOC);
      if ($row!=false)
      {
        $sortf=$row["sortfield"];
        $sortd=$row["sortdirection"];
      }
    }  
  }
  
  // If opening another admin page
  if ($act=="openadminpage")
  {
    if (get_magic_quotes_gpc())
      $adminpage=stripslashes($adminpage);
    header("Location: ".$adminpage);
    exit;
  }
  if ($act=="sort")
  {
    // Store sort field and direction in configuration table
    $query="UPDATE ".$DbConfigTableName." SET sortfield='".$sortf."', sortdirection='".$sortd."' WHERE confignum=1";
    $mysql_result=mysql_query($query,$mysql_link);
  }  
  if (($act=="delete") && ($user!=""))
  {
    if (!$DemoMode)
    {
      // If required call event handler
      $mysql_result=mysql_query("SELECT * FROM ".$DbTableName." WHERE ".$UsernameField."=".sl_quote_smart($user),$mysql_link);
      if ($mysql_result!=false)
      {
        $row=mysql_fetch_array($mysql_result,MYSQL_ASSOC);
        $paramdata['oldusername']=$row[$UsernameField];
        $paramdata['username']=$row[$UsernameField];
        $paramdata['userid']=$row[$IdField];        
        $paramdata['password']=$row[$PasswordField];
        $paramdata['enabled']=$row[$EnabledField];
        $paramdata['name']=$row[$NameField];
        $paramdata['email']=$row[$EmailField];
        $paramdata['usergroups']=$row[$UsergroupsField];
        $paramdata['custom1']=$row[$Custom1Field];
        $paramdata['custom2']=$row[$Custom2Field];
        $paramdata['custom3']=$row[$Custom3Field];
        $paramdata['custom4']=$row[$Custom4Field];
        $paramdata['custom5']=$row[$Custom5Field];
        $paramdata['custom6']=$row[$Custom6Field];
        $paramdata['custom7']=$row[$Custom7Field];
        $paramdata['custom8']=$row[$Custom8Field];
        $paramdata['custom9']=$row[$Custom9Field];
        $paramdata['custom10']=$row[$Custom10Field];
        $paramdata['custom11']=$row[$Custom11Field];
        $paramdata['custom12']=$row[$Custom12Field];
        $paramdata['custom13']=$row[$Custom13Field];
        $paramdata['custom14']=$row[$Custom14Field];
        $paramdata['custom15']=$row[$Custom15Field];
        $paramdata['custom16']=$row[$Custom16Field];
        $paramdata['custom17']=$row[$Custom17Field];
        $paramdata['custom18']=$row[$Custom18Field];
        $paramdata['custom19']=$row[$Custom19Field];
        $paramdata['custom20']=$row[$Custom20Field];
        $paramdata['custom21']=$row[$Custom21Field];
        $paramdata['custom22']=$row[$Custom22Field];
        $paramdata['custom23']=$row[$Custom23Field];
        $paramdata['custom24']=$row[$Custom24Field];
        $paramdata['custom25']=$row[$Custom25Field];
        $paramdata['custom26']=$row[$Custom26Field];
        $paramdata['custom27']=$row[$Custom27Field];
        $paramdata['custom28']=$row[$Custom28Field];
        $paramdata['custom29']=$row[$Custom29Field];
        $paramdata['custom30']=$row[$Custom30Field];
        $paramdata['custom31']=$row[$Custom31Field];
        $paramdata['custom32']=$row[$Custom32Field];
        $paramdata['custom33']=$row[$Custom33Field];
        $paramdata['custom34']=$row[$Custom34Field];
        $paramdata['custom35']=$row[$Custom35Field];
        $paramdata['custom36']=$row[$Custom36Field];
        $paramdata['custom37']=$row[$Custom37Field];
        $paramdata['custom38']=$row[$Custom38Field];
        $paramdata['custom39']=$row[$Custom39Field];
        $paramdata['custom40']=$row[$Custom40Field];
        $paramdata['custom41']=$row[$Custom41Field];
        $paramdata['custom42']=$row[$Custom42Field];
        $paramdata['custom43']=$row[$Custom43Field];
        $paramdata['custom44']=$row[$Custom44Field];
        $paramdata['custom45']=$row[$Custom45Field];
        $paramdata['custom46']=$row[$Custom46Field];
        $paramdata['custom47']=$row[$Custom47Field];
        $paramdata['custom48']=$row[$Custom48Field];
        $paramdata['custom49']=$row[$Custom49Field];
        $paramdata['custom50']=$row[$Custom50Field];
        $paramdata['custom51']=$row[$Custom51Field];
        $paramdata['custom52']=$row[$Custom52Field];
        $paramdata['custom53']=$row[$Custom53Field];
        $paramdata['custom54']=$row[$Custom54Field];
        $paramdata['custom55']=$row[$Custom55Field];
        $paramdata['custom56']=$row[$Custom56Field];
        $paramdata['custom57']=$row[$Custom57Field];
        $paramdata['custom58']=$row[$Custom58Field];
        $paramdata['custom59']=$row[$Custom59Field];
        $paramdata['custom60']=$row[$Custom60Field];
        $paramdata['custom61']=$row[$Custom61Field];
        $paramdata['custom62']=$row[$Custom62Field];
        $paramdata['custom63']=$row[$Custom63Field];
        $paramdata['custom64']=$row[$Custom64Field];
        $paramdata['custom65']=$row[$Custom65Field];
        $paramdata['custom66']=$row[$Custom66Field];
        $paramdata['custom67']=$row[$Custom67Field];
        $paramdata['custom68']=$row[$Custom68Field];
        $paramdata['custom69']=$row[$Custom69Field];
        $paramdata['custom70']=$row[$Custom70Field];
        $paramdata['custom71']=$row[$Custom71Field];
        $paramdata['custom72']=$row[$Custom72Field];
        $paramdata['custom73']=$row[$Custom73Field];
        $paramdata['custom74']=$row[$Custom74Field];
        $paramdata['custom75']=$row[$Custom75Field];
        $paramdata['custom76']=$row[$Custom76Field];
        $paramdata['custom77']=$row[$Custom77Field];
        $paramdata['custom78']=$row[$Custom78Field];
        $paramdata['custom79']=$row[$Custom79Field];
        $paramdata['custom80']=$row[$Custom80Field];
        $paramdata['custom81']=$row[$Custom81Field];
        $paramdata['custom82']=$row[$Custom82Field];
        $paramdata['custom83']=$row[$Custom83Field];
        $paramdata['custom84']=$row[$Custom84Field];
        $paramdata['custom85']=$row[$Custom85Field];
        $paramdata['custom86']=$row[$Custom86Field];
        $paramdata['custom87']=$row[$Custom87Field];
        $paramdata['custom88']=$row[$Custom88Field];
        $paramdata['custom89']=$row[$Custom89Field];
        $paramdata['custom90']=$row[$Custom80Field];
        $paramdata['custom91']=$row[$Custom91Field];
        $paramdata['custom92']=$row[$Custom92Field];
        $paramdata['custom93']=$row[$Custom93Field];
        $paramdata['custom94']=$row[$Custom94Field];
        $paramdata['custom95']=$row[$Custom95Field];
        $paramdata['custom96']=$row[$Custom46Field];
        $paramdata['custom47']=$row[$Custom97Field];
        $paramdata['custom98']=$row[$Custom98Field];
        $paramdata['custom99']=$row[$Custom99Field];
        $paramdata['custom100']=$row[$Custom100Field];
        $paramdata['custom101']=$row[$Custom101Field];
        $paramdata['custom102']=$row[$Custom102Field];
        $paramdata['custom103']=$row[$Custom103Field];
        $paramdata['custom104']=$row[$Custom104Field];
        $paramdata['custom105']=$row[$Custom105Field];
        // Call plugin event
        for ($p=0;$p<$slnumplugins;$p++)
        {
          if (function_exists($slplugin_event_onDeleteUser[$p]))
            call_user_func($slplugin_event_onDeleteUser[$p],$slpluginid[$p],$paramdata);
        }
        // Call user event handler       
        if (function_exists(sl_onDeleteUser))
          sl_onDeleteUser($paramdata);  
      }
      $mysql_result=mysql_query("DELETE FROM ".$DbTableName." WHERE ".$UsernameField."=".sl_quote_smart($user),$mysql_link);
      // Process after deleting user
      sl_userdeleted($user);
    }
  }
  if (($act=="emailuser") && ($user!=""))
  {
    if (get_magic_quotes_gpc())
    {
      $body=stripslashes($body);
      $subject=stripslashes($subject);    
    }    
    $mysql_result=mysql_query("SELECT * FROM ".$DbTableName." WHERE ".$UsernameField."=".sl_quote_smart($user),$mysql_link);
	  if ($mysql_result!=False)
	  {
      $row=mysql_fetch_array($mysql_result,MYSQL_ASSOC);
      if ($row!=False)
      {
        $selected=$row[$SelectedField];
        $created=$row[$CreatedField];
        $user=$row[$UsernameField];
        $pass=$row[$PasswordField];
        $enabled=$row[$EnabledField];
        $name=$row[$NameField];
        $email=$row[$EmailField];
        $groups=$row[$UsergroupsField];
        $Cus1=$row[$Custom1Field];
        $cus2=$row[$Custom2Field];
        $cus3=$row[$Custom3Field];
        $cus4=$row[$Custom4Field];
        $cus5=$row[$Custom5Field];
        $cus6=$row[$Custom6Field];
        $cus7=$row[$Custom7Field];
        $cus8=$row[$Custom8Field];
        $cus9=$row[$Custom9Field];
        $cus10=$row[$Custom10Field];
        $cus11=$row[$Custom11Field];
        $cus12=$row[$Custom12Field];
        $cus13=$row[$Custom13Field];
        $cus14=$row[$Custom14Field];
        $cus15=$row[$Custom15Field];
        $cus16=$row[$Custom16Field];
        $cus17=$row[$Custom17Field];
        $cus18=$row[$Custom18Field];
        $cus19=$row[$Custom19Field];
        $cus20=$row[$Custom20Field];
        $cus21=$row[$Custom21Field];
        $cus22=$row[$Custom22Field];
        $cus23=$row[$Custom23Field];
        $cus24=$row[$Custom24Field];
        $cus25=$row[$Custom25Field];
        $cus26=$row[$Custom26Field];
        $cus27=$row[$Custom27Field];
        $cus28=$row[$Custom28Field];
        $cus29=$row[$Custom29Field];
        $cus30=$row[$Custom30Field];
        $cus31=$row[$Custom31Field];
        $cus32=$row[$Custom32Field];
        $cus33=$row[$Custom33Field];
        $cus34=$row[$Custom34Field];
        $cus35=$row[$Custom35Field];
        $cus36=$row[$Custom36Field];
        $cus37=$row[$Custom37Field];
        $cus38=$row[$Custom38Field];
        $cus39=$row[$Custom39Field];
        $cus40=$row[$Custom40Field];
        $cus41=$row[$Custom41Field];
        $cus42=$row[$Custom42Field];
        $cus43=$row[$Custom43Field];
        $cus44=$row[$Custom44Field];
        $cus45=$row[$Custom45Field];
        $cus46=$row[$Custom46Field];
        $cus47=$row[$Custom47Field];
        $cus48=$row[$Custom48Field];
        $cus49=$row[$Custom49Field];
        $cus50=$row[$Custom50Field];
        $cus51=$row[$Custom51Field];
        $cus52=$row[$Custom52Field];
        $cus53=$row[$Custom53Field];
        $cus54=$row[$Custom54Field];
        $cus55=$row[$Custom55Field];
        $cus56=$row[$Custom56Field];
        $cus57=$row[$Custom57Field];
        $cus58=$row[$Custom58Field];
        $cus59=$row[$Custom59Field];
        $cus60=$row[$Custom60Field];
        $cus61=$row[$Custom61Field];
        $cus62=$row[$Custom62Field];
        $cus63=$row[$Custom63Field];
        $cus64=$row[$Custom64Field];
        $cus65=$row[$Custom65Field];
        $cus66=$row[$Custom66Field];
        $cus67=$row[$Custom67Field];
        $cus68=$row[$Custom68Field];
        $cus69=$row[$Custom69Field];
        $cus70=$row[$Custom70Field];
        $cus71=$row[$Custom71Field];
        $cus72=$row[$Custom72Field];
        $cus73=$row[$Custom73Field];
        $cus74=$row[$Custom74Field];
        $cus75=$row[$Custom75Field];
        $cus76=$row[$Custom76Field];
        $cus77=$row[$Custom77Field];
        $cus78=$row[$Custom78Field];
        $cus79=$row[$Custom79Field];
        $cus80=$row[$Custom80Field];
        $cus81=$row[$Custom81Field];
        $cus82=$row[$Custom82Field];
        $cus83=$row[$Custom83Field];
        $cus84=$row[$Custom84Field];
        $cus85=$row[$Custom85Field];
        $cus86=$row[$Custom86Field];
        $cus87=$row[$Custom87Field];
        $cus88=$row[$Custom88Field];
        $cus89=$row[$Custom89Field];
        $cus90=$row[$Custom90Field];
        $cus91=$row[$Custom91Field];
        $cus92=$row[$Custom92Field];
        $cus93=$row[$Custom93Field];
        $cus94=$row[$Custom94Field];
        $cus95=$row[$Custom95Field];
        $cus96=$row[$Custom96Field];
        $cus97=$row[$Custom97Field];
        $cus98=$row[$Custom98Field];
        $cus99=$row[$Custom99Field];
        $cus100=$row[$Custom100Field];
        $cus101=$row[$Custom101Field];
        $cus102=$row[$Custom102Field];
        $cus103=$row[$Custom103Field];
        $cus104=$row[$Custom104Field];
        $cus105=$row[$Custom105Field];
        $emres=sl_SendEmail($email,$body,$subject,$htmlformat,$user,$pass,$name,$email,$groups,$cus1,$cus2,$cus3,$cus4,$cus5,$cus6,$cus7,$cus8,$cus9,$cus10,
        $cus11,$cus12,$cus13,$cus14,$cus15,$cus16,$cus17,$cus18,$cus19,$cus20,$cus21,$cus22,$cus23,$cus24,$cus25,$cus26,$cus27,$cus28,$cus29,$cus30,
        $cus31,$cus32,$cus33,$cus34,$cus35,$cus36,$cus37,$cus38,$cus39,$cus40,$cus41,$cus42,$cus43,$cus44,$cus45,$cus46,$cus47,$cus48,$cus49,$cus50,
        $cus51,$cus52,$cus53,$cus54,$cus55,$cus56,$cus57,$cus58,$cus59,$cus60,$cus61,$cus62,$cus63,$cus64,$cus65,$cus66,$cus67,$cus68,$cus69,$cus70,
        $cus71,$cus72,$cus73,$cus74,$cus75,$cus76,$cus77,$cus78,$cus79,$cus80,$cus81,$cus82,$cus83,$cus84,$cus85,$cus86,$cus87,$cus88,$cus89,$cus90,
        $cus91,$cus92,$cus93,$cus94,$cus95,$cus96,$cus97,$cus98,$cus99,$cus100,$cus101,$cus102,$cus103,$cus104,$cus105);
        if ($emres==1)
	       	$emailsent++;
        if ($emres==2)
	       	$emailblocked++;
        if ($emres==0)
	      	$emailfail++;
      }
    }
  }
  if (($act=="emaildirect") && ($email!=""))
  {
    if (get_magic_quotes_gpc())
    {
      $body=stripslashes($body);
      $subject=stripslashes($subject);    
    }    
    $emailaddresses=explode(",",$email);
    for ($k=0;$k<count($emailaddresses);$k++)
    {
      $emailaddresses[$k]=trim($emailaddresses[$k]);
      $mysql_result=mysql_query("SELECT * FROM ".$DbTableName." WHERE ".$EmailField."=".sl_quote_smart($emailaddresses[$k]),$mysql_link);
  	  if ($mysql_result!=False)
  	  {
        $row=mysql_fetch_array($mysql_result,MYSQL_ASSOC);
        if ($row!=False)
        {
          $selected=$row[$SelectedField];
          $created=$row[$CreatedField];
          $user=$row[$UsernameField];
          $pass=$row[$PasswordField];
          $enabled=$row[$EnabledField];
          $name=$row[$NameField];
          //$email=$row[$EmailField];
          $groups=$row[$UsergroupsField];
          $cus1=$row[$Custom1Field];
          $cus2=$row[$Custom2Field];
          $cus3=$row[$Custom3Field];
          $cus4=$row[$Custom4Field];
          $cus5=$row[$Custom5Field];
          $cus6=$row[$Custom6Field];
          $cus7=$row[$Custom7Field];
          $cus8=$row[$Custom8Field];
          $cus9=$row[$Custom9Field];
          $cus10=$row[$Custom10Field];
          $cus11=$row[$Custom11Field];
          $cus12=$row[$Custom12Field];
          $cus13=$row[$Custom13Field];
          $cus14=$row[$Custom14Field];
          $cus15=$row[$Custom15Field];
          $cus16=$row[$Custom16Field];
          $cus17=$row[$Custom17Field];
          $cus18=$row[$Custom18Field];
          $cus19=$row[$Custom19Field];
          $cus20=$row[$Custom20Field];
          $cus21=$row[$Custom21Field];
          $cus22=$row[$Custom22Field];
          $cus23=$row[$Custom23Field];
          $cus24=$row[$Custom24Field];
          $cus25=$row[$Custom25Field];
          $cus26=$row[$Custom26Field];
          $cus27=$row[$Custom27Field];
          $cus28=$row[$Custom28Field];
          $cus29=$row[$Custom29Field];
          $cus30=$row[$Custom30Field];
          $cus31=$row[$Custom31Field];
          $cus32=$row[$Custom32Field];
          $cus33=$row[$Custom33Field];
          $cus34=$row[$Custom34Field];
          $cus35=$row[$Custom35Field];
          $cus36=$row[$Custom36Field];
          $cus37=$row[$Custom37Field];
          $cus38=$row[$Custom38Field];
          $cus39=$row[$Custom39Field];
          $cus40=$row[$Custom40Field];
          $cus41=$row[$Custom41Field];
          $cus42=$row[$Custom42Field];
          $cus43=$row[$Custom43Field];
          $cus44=$row[$Custom44Field];
          $cus45=$row[$Custom45Field];
          $cus46=$row[$Custom46Field];
          $cus47=$row[$Custom47Field];
          $cus48=$row[$Custom48Field];
          $cus49=$row[$Custom49Field];
          $cus50=$row[$Custom50Field];
          $cus51=$row[$Custom51Field];
          $cus52=$row[$Custom52Field];
          $cus53=$row[$Custom53Field];
          $cus54=$row[$Custom54Field];
          $cus55=$row[$Custom55Field];
          $cus56=$row[$Custom56Field];
          $cus57=$row[$Custom57Field];
          $cus58=$row[$Custom58Field];
          $cus59=$row[$Custom59Field];
          $cus60=$row[$Custom60Field];
          $cus61=$row[$Custom61Field];
          $cus62=$row[$Custom62Field];
          $cus63=$row[$Custom63Field];
          $cus64=$row[$Custom64Field];
          $cus65=$row[$Custom65Field];
          $cus66=$row[$Custom66Field];
          $cus67=$row[$Custom67Field];
          $cus68=$row[$Custom68Field];
          $cus69=$row[$Custom69Field];
          $cus70=$row[$Custom70Field];
          $cus71=$row[$Custom71Field];
          $cus72=$row[$Custom72Field];
          $cus73=$row[$Custom73Field];
          $cus74=$row[$Custom74Field];
          $cus75=$row[$Custom75Field];
          $cus76=$row[$Custom76Field];
          $cus77=$row[$Custom77Field];
          $cus78=$row[$Custom78Field];
          $cus79=$row[$Custom79Field];
          $cus80=$row[$Custom80Field];
          $cus81=$row[$Custom81Field];
          $cus82=$row[$Custom82Field];
          $cus83=$row[$Custom83Field];
          $cus84=$row[$Custom84Field];
          $cus85=$row[$Custom85Field];
          $cus86=$row[$Custom86Field];
          $cus87=$row[$Custom87Field];
          $cus88=$row[$Custom88Field];
          $cus89=$row[$Custom89Field];
          $cus90=$row[$Custom90Field];
          $cus91=$row[$Custom91Field];
          $cus92=$row[$Custom92Field];
          $cus93=$row[$Custom93Field];
          $cus94=$row[$Custom94Field];
          $cus95=$row[$Custom95Field];
          $cus96=$row[$Custom96Field];
          $cus97=$row[$Custom97Field];
          $cus98=$row[$Custom98Field];
          $cus99=$row[$Custom99Field];
          $cus100=$row[$Custom100Field];
          $cus101=$row[$Custom101Field];
          $cus102=$row[$Custom102Field];
          $cus103=$row[$Custom103Field];
          $cus104=$row[$Custom104Field];
          $cus105=$row[$Custom105Field];
          $emres=sl_SendEmail($emailaddresses[$k],$body,$subject,$htmlformat,$user,$pass,$name,$emailaddresses[$k],$groups,$cus1,$cus2,$cus3,$cus4,$cus5,$cus6,$cus7,$cus8,$cus9,$cus10,
          $cus11,$cus12,$cus13,$cus14,$cus15,$cus16,$cus17,$cus18,$cus19,$cus20,$cus21,$cus22,$cus23,$cus24,$cus25,$cus26,$cus27,$cus28,$cus29,$cus30,
	$cus31,$cus32,$cus33,$cus34,$cus35,$cus36,$cus37,$cus38,$cus39,$cus40,$cus41,$cus42,$cus43,$cus44,$cus45,$cus46,$cus47,$cus48,$cus49,$cus50,
	$cus51,$cus52,$cus53,$cus54,$cus55,$cus56,$cus57,$cus58,$cus59,$cus60,$cus61,$cus62,$cus63,$cus64,$cus65,$cus66,$cus67,$cus68,$cus69,$cus70,
	$cus71,$cus72,$cus73,$cus74,$cus75,$cus76,$cus77,$cus78,$cus79,$cus80,$cus81,$cus82,$cus83,$cus84,$cus85,$cus86,$cus87,$cus88,$cus89,$cus90,
	$cus91,$cus92,$cus93,$cus94,$cus95,$cus96,$cus97,$cus98,$cus99,$cus100,$cus101,$cus102,$cus103,$cus104,$cus105);
          if ($emres==1)
           	$emailsent++;
          if ($emres==2)
           	$emailblocked++;
          if ($emres==0)
          	$emailfail++;
        }
        else
        {
          $emres=sl_SendEmail($emailaddresses[$k],$body,$subject,$htmlformat,"","","",$emailaddresses[$k],"","","","","","","","","","","");
          if ($emres==1)
           	$emailsent++;
          if ($emres==2)
           	$emailblocked++;
          if ($emres==0)
          	$emailfail++;
        }
  	  }  
    } 	
  }
  if ($act=="deleteselected")
  {
    if (!$DemoMode)
    {
      // Remove user from log entries, order control and Sitelok
      $delquery="DELETE ".$DbLogTableName.".* ";
      $delquery.="FROM ".$DbTableName.", ".$DbLogTableName." ";
      $delquery.="WHERE ".$DbTableName.".".$UsernameField." = ".$DbLogTableName.".username ";
      $delquery.="AND ".$DbTableName.".".$SelectedField."='Yes'"; 
      $mysql_result=mysql_query($delquery,$mysql_link);
      
      $delquery="DELETE ".$DbOrdersTableName.".* ";
      $delquery.="FROM ".$DbTableName.", ".$DbOrdersTableName." ";
      $delquery.="WHERE ".$DbTableName.".".$UsernameField." = ".$DbOrdersTableName.".username ";
      $delquery.="AND ".$DbTableName.".".$SelectedField."='Yes'"; 
      $mysql_result=mysql_query($delquery,$mysql_link);
      
      // If required call sl_onDeleteUser() event for each user being deleted
      $mysql_result=mysql_query("SELECT * FROM ".$DbTableName." WHERE ".$SelectedField."='Yes'",$mysql_link);
      if ($mysql_result!=false)
      {
        while ($row=mysql_fetch_array($mysql_result,MYSQL_ASSOC))
        {
          $paramdata['oldusername']=$row[$UsernameField];
          $paramdata['username']=$row[$UsernameField];
          $paramdata['userid']=$row[$IdField];
          $paramdata['password']=$row[$PasswordField];
          $paramdata['enabled']=$row[$EnabledField];
          $paramdata['name']=$row[$NameField];
          $paramdata['email']=$row[$EmailField];
          $paramdata['usergroups']=$row[$UsergroupsField];
          $paramdata['custom1']=$row[$Custom1Field];
          $paramdata['custom2']=$row[$Custom2Field];
          $paramdata['custom3']=$row[$Custom3Field];
          $paramdata['custom4']=$row[$Custom4Field];
          $paramdata['custom5']=$row[$Custom5Field];
          $paramdata['custom6']=$row[$Custom6Field];
          $paramdata['custom7']=$row[$Custom7Field];
          $paramdata['custom8']=$row[$Custom8Field];
          $paramdata['custom9']=$row[$Custom9Field];
          $paramdata['custom10']=$row[$Custom10Field];
          $paramdata['custom11']=$row[$Custom11Field];
          $paramdata['custom12']=$row[$Custom12Field];
          $paramdata['custom13']=$row[$Custom13Field];
          $paramdata['custom14']=$row[$Custom14Field];
          $paramdata['custom15']=$row[$Custom15Field];
          $paramdata['custom16']=$row[$Custom16Field];
          $paramdata['custom17']=$row[$Custom17Field];
          $paramdata['custom18']=$row[$Custom18Field];
          $paramdata['custom19']=$row[$Custom19Field];
          $paramdata['custom20']=$row[$Custom20Field];
          $paramdata['custom21']=$row[$Custom21Field];
          $paramdata['custom22']=$row[$Custom22Field];
          $paramdata['custom23']=$row[$Custom23Field];
          $paramdata['custom24']=$row[$Custom24Field];
          $paramdata['custom25']=$row[$Custom25Field];
          $paramdata['custom26']=$row[$Custom26Field];
          $paramdata['custom27']=$row[$Custom27Field];
          $paramdata['custom28']=$row[$Custom28Field];
          $paramdata['custom29']=$row[$Custom29Field];
          $paramdata['custom30']=$row[$Custom30Field];
          $paramdata['custom31']=$row[$Custom31Field];
          $paramdata['custom32']=$row[$Custom32Field];
          $paramdata['custom33']=$row[$Custom33Field];
          $paramdata['custom34']=$row[$Custom34Field];
          $paramdata['custom35']=$row[$Custom35Field];
          $paramdata['custom36']=$row[$Custom36Field];
          $paramdata['custom37']=$row[$Custom37Field];
          $paramdata['custom38']=$row[$Custom38Field];
          $paramdata['custom39']=$row[$Custom39Field];
          $paramdata['custom40']=$row[$Custom40Field];
          $paramdata['custom41']=$row[$Custom41Field];
          $paramdata['custom42']=$row[$Custom42Field];
          $paramdata['custom43']=$row[$Custom43Field];
          $paramdata['custom44']=$row[$Custom44Field];
          $paramdata['custom45']=$row[$Custom45Field];
          $paramdata['custom46']=$row[$Custom46Field];
          $paramdata['custom47']=$row[$Custom47Field];
          $paramdata['custom48']=$row[$Custom48Field];
          $paramdata['custom49']=$row[$Custom49Field];
          $paramdata['custom50']=$row[$Custom50Field];
          $paramdata['custom51']=$row[$Custom51Field];
        $paramdata['custom52']=$row[$Custom52Field];
        $paramdata['custom53']=$row[$Custom53Field];
        $paramdata['custom54']=$row[$Custom54Field];
        $paramdata['custom55']=$row[$Custom55Field];
        $paramdata['custom56']=$row[$Custom56Field];
        $paramdata['custom57']=$row[$Custom57Field];
        $paramdata['custom58']=$row[$Custom58Field];
        $paramdata['custom59']=$row[$Custom59Field];
        $paramdata['custom60']=$row[$Custom60Field];
        $paramdata['custom61']=$row[$Custom61Field];
        $paramdata['custom62']=$row[$Custom62Field];
        $paramdata['custom63']=$row[$Custom63Field];
        $paramdata['custom64']=$row[$Custom64Field];
        $paramdata['custom65']=$row[$Custom65Field];
        $paramdata['custom66']=$row[$Custom66Field];
        $paramdata['custom67']=$row[$Custom67Field];
        $paramdata['custom68']=$row[$Custom68Field];
        $paramdata['custom69']=$row[$Custom69Field];
        $paramdata['custom70']=$row[$Custom70Field];
        $paramdata['custom71']=$row[$Custom71Field];
        $paramdata['custom72']=$row[$Custom72Field];
        $paramdata['custom73']=$row[$Custom73Field];
        $paramdata['custom74']=$row[$Custom74Field];
        $paramdata['custom75']=$row[$Custom75Field];
        $paramdata['custom76']=$row[$Custom76Field];
        $paramdata['custom77']=$row[$Custom77Field];
        $paramdata['custom78']=$row[$Custom78Field];
        $paramdata['custom79']=$row[$Custom79Field];
        $paramdata['custom80']=$row[$Custom80Field];
        $paramdata['custom81']=$row[$Custom81Field];
        $paramdata['custom82']=$row[$Custom82Field];
        $paramdata['custom83']=$row[$Custom83Field];
        $paramdata['custom84']=$row[$Custom84Field];
        $paramdata['custom85']=$row[$Custom85Field];
        $paramdata['custom86']=$row[$Custom86Field];
        $paramdata['custom87']=$row[$Custom87Field];
        $paramdata['custom88']=$row[$Custom88Field];
        $paramdata['custom89']=$row[$Custom89Field];
        $paramdata['custom90']=$row[$Custom80Field];
        $paramdata['custom91']=$row[$Custom91Field];
        $paramdata['custom92']=$row[$Custom92Field];
        $paramdata['custom93']=$row[$Custom93Field];
        $paramdata['custom94']=$row[$Custom94Field];
        $paramdata['custom95']=$row[$Custom95Field];
        $paramdata['custom96']=$row[$Custom46Field];
        $paramdata['custom47']=$row[$Custom97Field];
        $paramdata['custom98']=$row[$Custom98Field];
        $paramdata['custom99']=$row[$Custom99Field];
        $paramdata['custom100']=$row[$Custom100Field];
        $paramdata['custom101']=$row[$Custom101Field];
        $paramdata['custom102']=$row[$Custom102Field];
        $paramdata['custom103']=$row[$Custom103Field];
        $paramdata['custom104']=$row[$Custom104Field];
        $paramdata['custom105']=$row[$Custom105Field];
          // Call plugin event
          for ($p=0;$p<$slnumplugins;$p++)
          {
            if (function_exists($slplugin_event_onDeleteUser[$p]))
              call_user_func($slplugin_event_onDeleteUser[$p],$slpluginid[$p],$paramdata);
          }
          // Call user event handler
          if (function_exists(sl_onDeleteUser))
              sl_onDeleteUser($paramdata);
        }
      }  
      // Delete selected users   
      $delquery="DELETE FROM ".$DbTableName." WHERE ".$SelectedField."='Yes'";
      $mysql_result=mysql_query($delquery,$mysql_link);
    }
  }
  if ($act=="exportselected")
  {
    if (!isset($ExportSeparator))
      $ExportSeparator=",";
    header("Content-type: application/octet-stream");
    header("Content-disposition: attachment; filename=sitelokusers.csv");
    header("Content-transfer-encoding: binary");
  	if (($sortf!="") && ($sortf!=""))
  	  $sortquery=" ORDER BY ".mysql_real_escape_string($sortf)." ".mysql_real_escape_string($sortd);
  	else
  		$sortquery="";
    $mysql_result=mysql_query("SELECT * FROM ".$DbTableName." WHERE ".$SelectedField."='Yes'".$sortquery,$mysql_link);
	  if ($mysql_result!=False)
	  {
      while ($row=mysql_fetch_array($mysql_result,MYSQL_ASSOC))
      {
        $Selected=$row[$SelectedField];
        $Created=$row[$CreatedField];
        $Username=$row[$UsernameField];
        $Password=$row[$PasswordField];
        $Enabled=$row[$EnabledField];
        $Name=$row[$NameField];
        $Email=$row[$EmailField];
        $Usergroups=$row[$UsergroupsField];
        $Cus1=$row[$Custom1Field];
        $Cus2=$row[$Custom2Field];
        $Cus3=$row[$Custom3Field];
        $Cus4=$row[$Custom4Field];
        $Cus5=$row[$Custom5Field];
        $Cus6=$row[$Custom6Field];
        $Cus7=$row[$Custom7Field];
        $Cus8=$row[$Custom8Field];
        $Cus9=$row[$Custom9Field];
        $Cus10=$row[$Custom10Field];
        $Cus11=$row[$Custom11Field];
        $Cus12=$row[$Custom12Field];
        $Cus13=$row[$Custom13Field];
        $Cus14=$row[$Custom14Field];
        $Cus15=$row[$Custom15Field];
        $Cus16=$row[$Custom16Field];
        $Cus17=$row[$Custom17Field];
        $Cus18=$row[$Custom18Field];
        $Cus19=$row[$Custom19Field];
        $Cus20=$row[$Custom20Field];
        $Cus21=$row[$Custom21Field];
        $Cus22=$row[$Custom22Field];
        $Cus23=$row[$Custom23Field];
        $Cus24=$row[$Custom24Field];
        $Cus25=$row[$Custom25Field];
        $Cus26=$row[$Custom26Field];
        $Cus27=$row[$Custom27Field];
        $Cus28=$row[$Custom28Field];
        $Cus29=$row[$Custom29Field];
        $Cus30=$row[$Custom30Field];
        $Cus31=$row[$Custom31Field];
        $Cus32=$row[$Custom32Field];
        $Cus33=$row[$Custom33Field];
        $Cus34=$row[$Custom34Field];
        $Cus35=$row[$Custom35Field];
        $Cus36=$row[$Custom36Field];
        $Cus37=$row[$Custom37Field];
        $Cus38=$row[$Custom38Field];
        $Cus39=$row[$Custom39Field];
        $Cus40=$row[$Custom40Field];
        $Cus41=$row[$Custom41Field];
        $Cus42=$row[$Custom42Field];
        $Cus43=$row[$Custom43Field];
        $Cus44=$row[$Custom44Field];
        $Cus45=$row[$Custom45Field];
        $Cus46=$row[$Custom46Field];
        $Cus47=$row[$Custom47Field];
        $Cus48=$row[$Custom48Field];
        $Cus49=$row[$Custom49Field];
        $Cus50=$row[$Custom50Field];
        $Cus51=$row[$Custom51Field];
          $Cus52=$row[$Custom52Field];
          $Cus53=$row[$Custom53Field];
          $Cus54=$row[$Custom54Field];
          $Cus55=$row[$Custom55Field];
          $Cus56=$row[$Custom56Field];
          $Cus57=$row[$Custom57Field];
          $Cus58=$row[$Custom58Field];
          $Cus59=$row[$Custom59Field];
          $Cus60=$row[$Custom60Field];
          $Cus61=$row[$Custom61Field];
          $Cus62=$row[$Custom62Field];
          $Cus63=$row[$Custom63Field];
          $Cus64=$row[$Custom64Field];
          $Cus65=$row[$Custom65Field];
          $Cus66=$row[$Custom66Field];
          $Cus67=$row[$Custom67Field];
          $Cus68=$row[$Custom68Field];
          $Cus69=$row[$Custom69Field];
          $Cus70=$row[$Custom70Field];
          $Cus71=$row[$Custom71Field];
          $Cus72=$row[$Custom72Field];
          $Cus73=$row[$Custom73Field];
          $Cus74=$row[$Custom74Field];
          $Cus75=$row[$Custom75Field];
          $Cus76=$row[$Custom76Field];
          $Cus77=$row[$Custom77Field];
          $Cus78=$row[$Custom78Field];
          $Cus79=$row[$Custom79Field];
          $Cus80=$row[$Custom80Field];
          $Cus81=$row[$Custom81Field];
          $Cus82=$row[$Custom82Field];
          $Cus83=$row[$Custom83Field];
          $Cus84=$row[$Custom84Field];
          $Cus85=$row[$Custom85Field];
          $Cus86=$row[$Custom86Field];
          $Cus87=$row[$Custom87Field];
          $Cus88=$row[$Custom88Field];
          $Cus89=$row[$Custom89Field];
          $Cus90=$row[$Custom90Field];
          $Cus91=$row[$Custom91Field];
          $Cus92=$row[$Custom92Field];
          $Cus93=$row[$Custom93Field];
          $Cus94=$row[$Custom94Field];
          $Cus95=$row[$Custom95Field];
          $Cus96=$row[$Custom96Field];
          $Cus97=$row[$Custom97Field];
          $Cus98=$row[$Custom98Field];
          $Cus99=$row[$Custom99Field];
          $Cus100=$row[$Custom100Field];
          $Cus101=$row[$Custom101Field];
          $Cus102=$row[$Custom102Field];
          $Cus103=$row[$Custom103Field];
          $Cus104=$row[$Custom104Field];
          $Cus105=$row[$Custom105Field];
        if (($DateFormat=="DDMMYY") && (strlen($Created)==6))
          $cdate=substr($Created,4,2)."/".substr($Created,2,2)."/".substr($Created,0,2);
        else
          $cdate=substr($Created,2,2)."/".substr($Created,4,2)."/".substr($Created,0,2);
        print "\"$cdate\"$ExportSeparator\"$Username\"$ExportSeparator\"$Password\"$ExportSeparator\"$Enabled\"$ExportSeparator\"$Name\"$ExportSeparator\"$Email\"$ExportSeparator\"$Usergroups\"";
        for ($i=1;$i<=108;$i++)
        {
          $pvar1="CustomTitle".$i;
          $pvar2="Cus".$i;
          if ($$pvar1!="")
            print "$ExportSeparator\"".$$pvar2."\"";
          else
            break;
        }
        print "\n";
      }
    }
  exit;
  }
  // Count total number of records
  $mysql_result = mysql_query("SELECT count(*) from $DbTableName");
  $totalrows = ($mysql_result>0) ? mysql_result($mysql_result,0,0) : 0;
//  $sqlinput="";
  $rowsaffected=-1;
  $queryerror=False;
  // If no filter or sql query then reset to show all records
  if (($filteron!="1") && ($sqlquery==""))
    $sqlquerytodo="SELECT * FROM ".$DbTableName;
  // If filtering required and groupexpiry not selected we can use SQL
  if (($filteron=="1") && ($filfield1!="groupexpiry") && ($filfield2!="groupexpiry") && ($filfield3!="groupexpiry") && ($filfield4!="groupexpiry"))
  {
  	// If filtering with created date then convert user entered data to YYMMDD
  	if (($filfield1==$CreatedField) && (strlen($fildata1)==6))
  	{
      $enteredfildata1=$fildata1;
      if ($DateFormat=="DDMMYY")
        $fildata1=substr($fildata1,4,2).substr($fildata1,2,2).substr($fildata1,0,2);
      else
        $fildata1=substr($fildata1,2,2).substr($fildata1,4,2).substr($fildata1,0,2);
  	}
  	if (($filfield2==$CreatedField) && (strlen($fildata2)==6))
  	{
      $enteredfildata2=$fildata2;
      if ($DateFormat=="DDMMYY")
        $fildata2=substr($fildata2,4,2).substr($fildata2,2,2).substr($fildata2,0,2);
      else
        $fildata2=substr($fildata2,2,2).substr($fildata2,4,2).substr($fildata2,0,2);
  	}
  	if (($filfield3==$CreatedField) && (strlen($fildata3)==6))
  	{
      $enteredfildata3=$fildata3;
      if ($DateFormat=="DDMMYY")
        $fildata3=substr($fildata3,4,2).substr($fildata3,2,2).substr($fildata3,0,2);
      else
        $fildata3=substr($fildata3,2,2).substr($fildata3,4,2).substr($fildata3,0,2);
  	}
  	if (($filfield4==$CreatedField) && (strlen($fildata4)==6))
  	{
      $enteredfildata4=$fildata4;
      if ($DateFormat=="DDMMYY")
        $fildata4=substr($fildata4,4,2).substr($fildata4,2,2).substr($fildata4,0,2);
      else
        $fildata4=substr($fildata4,2,2).substr($fildata4,4,2).substr($fildata4,0,2);
  	}
    $sqlquerytodo="SELECT * FROM ".$DbTableName." WHERE ";
    if ($filcond1=="equals")
      $query1=mysql_real_escape_string($filfield1)." = ".sl_quote_smart($fildata1);
    if ($filcond1=="notequal")
      $query1=mysql_real_escape_string($filfield1)." != ".sl_quote_smart($fildata1);
    if ($filcond1=="contains")
      $query1=mysql_real_escape_string($filfield1)." LIKE ".sl_quote_smart("%".$fildata1."%");
    if ($filcond1=="notcontain")
      $query1=mysql_real_escape_string($filfield1)." NOT LIKE ".sl_quote_smart("%".$fildata1."%");
    if ($filcond1=="less")
      $query1=mysql_real_escape_string($filfield1)." < ".sl_quote_smart($fildata1);
    if ($filcond1=="greater")
      $query1=mysql_real_escape_string($filfield1)." > ".sl_quote_smart($fildata1);
    if ($filcond1=="starts")
      $query1=mysql_real_escape_string($filfield1)." LIKE ".sl_quote_smart($fildata1."%");
    if ($filcond1=="ends")
      $query1=mysql_real_escape_string($filfield1)." LIKE ".sl_quote_smart("%".$fildata1);
    if ($filcond1=="lessnum")
      $query1=mysql_real_escape_string($filfield1)." < ".mysql_real_escape_string($fildata1);
    if ($filcond1=="greaternum")
      $query1=mysql_real_escape_string($filfield1)." > ".mysql_real_escape_string($fildata1);
    $sqlquerytodo=$sqlquerytodo.$query1;
	  if (($filfield2!="") && ($filfield2!="groupexpiry"))
	  {
	    if ($filcond2=="equals")
	      $query2=mysql_real_escape_string($filfield2)." = ".sl_quote_smart($fildata2);
	    if ($filcond2=="notequal")
	      $query2=mysql_real_escape_string($filfield2)." != ".sl_quote_smart($fildata2);
	    if ($filcond2=="contains")
	      $query2=mysql_real_escape_string($filfield2)." LIKE ".sl_quote_smart("%".$fildata2."%");
	    if ($filcond2=="notcontain")
	      $query2=mysql_real_escape_string($filfield2)." NOT LIKE ".sl_quote_smart("%".$fildata2."%");
	    if ($filcond2=="less")
	      $query2=mysql_real_escape_string($filfield2)." < ".sl_quote_smart($fildata2);
	    if ($filcond2=="greater")
	      $query2=mysql_real_escape_string($filfield2)." > ".sl_quote_smart($fildata2);
	    if ($filcond2=="starts")
	      $query2=mysql_real_escape_string($filfield2)." LIKE ".$sl_quote_smart(fildata2."%");
	    if ($filcond2=="ends")
	      $query2=mysql_real_escape_string($filfield2)." LIKE ".sl_quote_smart("%".$fildata2);
	    if ($filcond2=="lessnum")
	      $query2=mysql_real_escape_string($filfield2)." < ".mysql_real_escape_string($fildata2);
	    if ($filcond2=="greaternum")
	      $query2=mysql_real_escape_string($filfield2)." > ".mysql_real_escape_string($fildata2);
	    $sqlquerytodo=$sqlquerytodo." ".$filbool1." ".$query2;
	    if (($filfield3!="") && ($filfield3!="groupexpiry"))
	    {
	      if ($filcond3=="equals")
	        $query3=mysql_real_escape_string($filfield3)." = ".sl_quote_smart($fildata3);
	      if ($filcond3=="notequal")
	        $query3=mysql_real_escape_string($filfield3)." != ".sl_quote_smart($fildata3);
	      if ($filcond3=="contains")
	        $query3=mysql_real_escape_string($filfield3)." LIKE ".sl_quote_smart("%".$fildata3."%");
	      if ($filcond3=="notcontain")
	        $query3=mysql_real_escape_string($filfield3)." NOT LIKE ".sl_quote_smart("%".$fildata3."%");
	      if ($filcond3=="less")
	        $query3=mysql_real_escape_string($filfield3)." < ".sl_quote_smart($fildata3);
	      if ($filcond3=="greater")
	        $query3=mysql_real_escape_string($filfield3)." > ".sl_quote_smart($fildata3);
	      if ($filcond3=="starts")
	        $query3=mysql_real_escape_string($filfield3)." LIKE ".sl_quote_smart($fildata3."%");
	      if ($filcond3=="ends")
	        $query3=mysql_real_escape_string($filfield3)." LIKE ".sl_quote_smart("%".$fildata3);
	      if ($filcond3=="lessnum")
	        $query3=mysql_real_escape_string($filfield3)." < ".mysql_real_escape_string($fildata3);
	      if ($filcond3=="greaternum")
	        $query3=mysql_real_escape_string($filfield3)." > ".mysql_real_escape_string($fildata3);
		    $sqlquerytodo=$sqlquerytodo." ".$filbool2." ".$query3;
  	    if (($filfield4!="") && ($filfield4!="groupexpiry"))
  	    {
  	      if ($filcond4=="equals")
  	        $query4=mysql_real_escape_string($filfield4)." = ".sl_quote_smart($fildata4);
  	      if ($filcond4=="notequal")
  	        $query4=mysql_real_escape_string($filfield4)." != ".sl_quote_smart($fildata4);
  	      if ($filcond4=="contains")
  	        $query4=mysql_real_escape_string($filfield4)." LIKE ".sl_quote_smart("%".$fildata4."%");
  	      if ($filcond4=="notcontain")
  	        $query4=mysql_real_escape_string($filfield4)." NOT LIKE ".sl_quote_smart("%".$fildata4."%");
  	      if ($filcond4=="less")
  	        $query4=mysql_real_escape_string($filfield4)." < ".sl_quote_smart($fildata4);
  	      if ($filcond4=="greater")
  	        $query4=mysql_real_escape_string($filfield4)." > ".sl_quote_smart($fildata4);
  	      if ($filcond4=="starts")
  	        $query4=mysql_real_escape_string($filfield4)." LIKE ".sl_quote_smart($fildata4."%");
  	      if ($filcond4=="ends")
  	        $query4=mysql_real_escape_string($filfield4)." LIKE ".sl_quote_smart("%".$fildata4);
  	      if ($filcond4=="lessnum")
  	        $query4=mysql_real_escape_string($filfield4)." < ".mysql_real_escape_string($fildata4);
  	      if ($filcond4=="greaternum")
  	        $query4=mysql_real_escape_string($filfield4)." > ".mysql_real_escape_string($fildata4);
  		    $sqlquerytodo=$sqlquerytodo." ".$filbool3." ".$query4;
  	    }	    
	    }
	  }
	  // Put back the date in user entered format if we filtered using created date
  	if (($filfield1==$CreatedField) && (strlen($fildata1)==6))
  	{
      $fildata1=$enteredfildata1;
    }
  	if (($filfield2==$CreatedField) && (strlen($fildata2)==6))
  	{
      $fildata2=$enteredfildata2;
    }
  	if (($filfield3==$CreatedField) && (strlen($fildata3)==6))
  	{
      $fildata3=$enteredfildata3;
    }
  	if (($filfield4==$CreatedField) && (strlen($fildata4)==6))
  	{
      $fildata4=$enteredfildata4;
    }
  }
  if (($filteron=="1") && (($filfield1=="groupexpiry") || ($filfield2=="groupexpiry") || ($filfield3=="groupexpiry") || ($filfield4=="groupexpiry")))
  {
  	// We will filter manually so set query for all records
    $sqlquerytodo="SELECT * FROM ".$DbTableName;
  }
  if ($sqlquery!="")
  	$sqlquerytodo=$sqlquery;
  if (($act=="query") || ($act=="filter"))
  {
  	$tablestart=0;
    $mysql_result=mysql_query($sqlquerytodo,$mysql_link);
    if ($mysql_result!=false)
    {
      if (strlen(trim($sqlquerytodo))>=6)
      {
        if (strcasecmp(substr(trim($sqlquerytodo),0,6),"SELECT")!=0)
	      {
	        $rowsaffected=mysql_affected_rows($mysql_link);
          $sqlquery="SELECT * FROM ".$DbTableName;
		      $sqlquerytodo=$sqlquery;
		      $sqlinput="";
	      }
	      else
	      {
	      	$sqlinput=$sqlquery;
	      }
      }
    }
    else
    {
      $queryerror=True;
      $sqlinput=$sqlquery;
      $sqlquery="SELECT * FROM ".$DbTableName;
      $sqlquerytodo=$sqlquery;
	    $mysql_result=mysql_query($sqlquerytodo,$mysql_link);
    }
  }
  // ********************************
  if (($filteron=="1") && (($filfield1=="groupexpiry") || ($filfield2=="groupexpiry") || ($filfield3=="groupexpiry") || ($filfield4=="groupexpiry")))
  {
  	// As groupexpiry field selected we need to filter manually
  	if (($sortf!="") && ($sortf!=""))
  	  $sortquery=" ORDER BY ".mysql_real_escape_string($sortf)." ".mysql_real_escape_string($sortd);
    $mysql_result=mysql_query($sqlquerytodo.$sortquery,$mysql_link);
	  if ($mysql_result!=False)
	  {
	    $numrows=0;
	    $numselected=0;
	    for ($k=0;$k<$totalrows;$k++)
	    {
	      $row=mysql_fetch_array($mysql_result,MYSQL_ASSOC);
	      if ($row!=False)
	      {
          $Selectedtofil=$row[$SelectedField];
          $Createdtofil=$row[$CreatedField];
          $Usernametofil=$row[$UsernameField];
          $Passwordtofil=$row[$PasswordField];
          $Enabledtofil=$row[$EnabledField];
          $Nametofil=$row[$NameField];
          $Emailtofil=$row[$EmailField];
          $Usergroupstofil=$row[$UsergroupsField];
          $Cus1tofil=$row[$Custom1Field];
          $Cus2tofil=$row[$Custom2Field];
          $Cus3tofil=$row[$Custom3Field];
          $Cus4tofil=$row[$Custom4Field];
          $Cus5tofil=$row[$Custom5Field];
          $Cus6tofil=$row[$Custom6Field];
          $Cus7tofil=$row[$Custom7Field];
          $Cus8tofil=$row[$Custom81Field];
          $Cus9tofil=$row[$Custom9Field];
          $Cus10tofil=$row[$Custom10Field];
          $Cus11tofil=$row[$Custom11Field];
          $Cus12tofil=$row[$Custom12Field];
          $Cus13tofil=$row[$Custom13Field];
          $Cus14tofil=$row[$Custom14Field];
          $Cus15tofil=$row[$Custom15Field];
          $Cus16tofil=$row[$Custom16Field];
          $Cus17tofil=$row[$Custom17Field];
          $Cus18tofil=$row[$Custom18Field];
          $Cus19tofil=$row[$Custom19Field];
          $Cus20tofil=$row[$Custom20Field];
          $Cus21tofil=$row[$Custom21Field];
          $Cus22tofil=$row[$Custom22Field];
          $Cus23tofil=$row[$Custom23Field];
          $Cus24tofil=$row[$Custom24Field];
          $Cus25tofil=$row[$Custom25Field];
          $Cus26tofil=$row[$Custom26Field];
          $Cus27tofil=$row[$Custom27Field];
          $Cus28tofil=$row[$Custom28Field];
          $Cus29tofil=$row[$Custom29Field];
          $Cus30tofil=$row[$Custom30Field];
          $Cus31tofil=$row[$Custom31Field];
          $Cus32tofil=$row[$Custom32Field];
          $Cus33tofil=$row[$Custom33Field];
          $Cus34tofil=$row[$Custom34Field];
          $Cus35tofil=$row[$Custom35Field];
          $Cus36tofil=$row[$Custom36Field];
          $Cus37tofil=$row[$Custom37Field];
          $Cus38tofil=$row[$Custom38Field];
          $Cus39tofil=$row[$Custom39Field];
          $Cus40tofil=$row[$Custom40Field];
          $Cus41tofil=$row[$Custom41Field];
          $Cus42tofil=$row[$Custom42Field];
          $Cus43tofil=$row[$Custom43Field];
          $Cus44tofil=$row[$Custom44Field];
          $Cus45tofil=$row[$Custom45Field];
          $Cus46tofil=$row[$Custom46Field];
          $Cus47tofil=$row[$Custom47Field];
          $Cus48tofil=$row[$Custom48Field];
          $Cus49tofil=$row[$Custom49Field];
          $Cus50tofil=$row[$Custom50Field];
          $Cus51tofil=$row[$Custom51Field];
          $Cus52tofil=$row[$Custom52Field];
          $Cus53tofil=$row[$Custom53Field];
          $Cus54tofil=$row[$Custom54Field];
          $Cus55tofil=$row[$Custom55Field];
          $Cus56tofil=$row[$Custom56Field];
          $Cus57tofil=$row[$Custom57Field];
          $Cus58tofil=$row[$Custom58Field];
          $Cus59tofil=$row[$Custom59Field];
          $Cus60tofil=$row[$Custom60Field];
          $Cus61tofil=$row[$Custom61Field];
          $Cus62tofil=$row[$Custom62Field];
          $Cus63tofil=$row[$Custom63Field];
          $Cus64tofil=$row[$Custom64Field];
          $Cus65tofil=$row[$Custom65Field];
          $Cus66tofil=$row[$Custom66Field];
          $Cus67tofil=$row[$Custom67Field];
          $Cus68tofil=$row[$Custom68Field];
          $Cus69tofil=$row[$Custom69Field];
          $Cus70tofil=$row[$Custom70Field];
          $Cus71tofil=$row[$Custom71Field];
          $Cus72tofil=$row[$Custom72Field];
          $Cus73tofil=$row[$Custom73Field];
          $Cus74tofil=$row[$Custom74Field];
          $Cus75tofil=$row[$Custom75Field];
          $Cus76tofil=$row[$Custom76Field];
          $Cus77tofil=$row[$Custom77Field];
          $Cus78tofil=$row[$Custom78Field];
          $Cus79tofil=$row[$Custom79Field];
          $Cus80tofil=$row[$Custom80Field];
          $Cus81tofil=$row[$Custom81Field];
          $Cus82tofil=$row[$Custom82Field];
          $Cus83tofil=$row[$Custom83Field];
          $Cus84tofil=$row[$Custom84Field];
          $Cus85tofil=$row[$Custom85Field];
          $Cus86tofil=$row[$Custom86Field];
          $Cus87tofil=$row[$Custom87Field];
          $Cus88tofil=$row[$Custom88Field];
          $Cus89tofil=$row[$Custom89Field];
          $Cus90tofil=$row[$Custom90Field];
          $Cus91tofil=$row[$Custom91Field];
          $Cus92tofil=$row[$Custom92Field];
          $Cus93tofil=$row[$Custom93Field];
          $Cus94tofil=$row[$Custom94Field];
          $Cus95tofil=$row[$Custom95Field];
          $Cus96tofil=$row[$Custom96Field];
          $Cus97tofil=$row[$Custom97Field];
          $Cus98tofil=$row[$Custom98Field];
          $Cus99tofil=$row[$Custom99Field];
          $Cus100tofil=$row[$Custom100Field];
          $Cus101tofil=$row[$Custom101Field];
          $Cus102tofil=$row[$Custom102Field];
          $Cus103tofil=$row[$Custom103Field];
          $Cus104tofil=$row[$Custom104Field];
          $Cus105tofil=$row[$Custom105Field];
          // Now see if matches filter 1
          if ($filfield1==$SelectedField)
            $datatocheck=$Selectedtofil;
          if ($filfield1==$CreatedField)
            $datatocheck=$Createdtofil;
          if ($filfield1==$UsernameField)
            $datatocheck=$Usernametofil;
          if ($filfield1==$PasswordField)
            $datatocheck=$Passwordtofil;
          if ($filfield1==$EnabledField)
            $datatocheck=$Enabledtofil;
          if ($filfield1==$NameField)
            $datatocheck=$Nametofil;
          if ($filfield1==$EmailField)
            $datatocheck=$Emailtofil;
          if ($filfield1==$UsergroupsField)
            $datatocheck=$Usergroupstofil;
          if ($filfield1==$Custom1Field)
            $datatocheck=$Cus1tofil;
          if ($filfield1==$Custom2Field)
            $datatocheck=$Cus2tofil;
          if ($filfield1==$Custom3Field)
            $datatocheck=$Cus3tofil;
          if ($filfield1==$Custom4Field)
            $datatocheck=$Cus4tofil;
          if ($filfield1==$Custom5Field)
            $datatocheck=$Cus5tofil;
          if ($filfield1==$Custom6Field)
            $datatocheck=$Cus6tofil;
          if ($filfield1==$Custom7Field)
            $datatocheck=$Cus7tofil;
          if ($filfield1==$Custom8Field)
            $datatocheck=$Cus8tofil;
          if ($filfield1==$Custom9Field)
            $datatocheck=$Cus9tofil;
          if ($filfield1==$Custom10Field)
            $datatocheck=$Cus10tofil;
          if ($filfield1==$Custom11Field)
            $datatocheck=$Cus11tofil;
          if ($filfield1==$Custom12Field)
            $datatocheck=$Cus12tofil;
          if ($filfield1==$Custom13Field)
            $datatocheck=$Cus13tofil;
          if ($filfield1==$Custom14Field)
            $datatocheck=$Cus14tofil;
          if ($filfield1==$Custom15Field)
            $datatocheck=$Cus15tofil;
          if ($filfield1==$Custom16Field)
            $datatocheck=$Cus16tofil;
          if ($filfield1==$Custom17Field)
            $datatocheck=$Cus17tofil;
          if ($filfield1==$Custom18Field)
            $datatocheck=$Cus18tofil;
          if ($filfield1==$Custom19Field)
            $datatocheck=$Cus19tofil;
          if ($filfield1==$Custom20Field)
            $datatocheck=$Cus20tofil;
          if ($filfield1==$Custom21Field)
            $datatocheck=$Cus21tofil;
          if ($filfield1==$Custom22Field)
            $datatocheck=$Cus22tofil;
          if ($filfield1==$Custom23Field)
            $datatocheck=$Cus23tofil;
          if ($filfield1==$Custom24Field)
            $datatocheck=$Cus24tofil;
          if ($filfield1==$Custom25Field)
            $datatocheck=$Cus25tofil;
          if ($filfield1==$Custom26Field)
            $datatocheck=$Cus26tofil;
          if ($filfield1==$Custom27Field)
            $datatocheck=$Cus27tofil;
          if ($filfield1==$Custom28Field)
            $datatocheck=$Cus28tofil;
          if ($filfield1==$Custom29Field)
            $datatocheck=$Cus29tofil;
          if ($filfield1==$Custom30Field)
            $datatocheck=$Cus30tofil;
          if ($filfield1==$Custom31Field)
            $datatocheck=$Cus31tofil;
          if ($filfield1==$Custom32Field)
            $datatocheck=$Cus32tofil;
          if ($filfield1==$Custom33Field)
            $datatocheck=$Cus33tofil;
          if ($filfield1==$Custom34Field)
            $datatocheck=$Cus34tofil;
          if ($filfield1==$Custom35Field)
            $datatocheck=$Cus35tofil;
          if ($filfield1==$Custom36Field)
            $datatocheck=$Cus36tofil;
          if ($filfield1==$Custom37Field)
            $datatocheck=$Cus37tofil;
          if ($filfield1==$Custom38Field)
            $datatocheck=$Cus38tofil;
          if ($filfield1==$Custom39Field)
            $datatocheck=$Cus39tofil;
          if ($filfield1==$Custom40Field)
            $datatocheck=$Cus40tofil;
          if ($filfield1==$Custom41Field)
            $datatocheck=$Cus41tofil;
          if ($filfield1==$Custom42Field)
            $datatocheck=$Cus42tofil;
          if ($filfield1==$Custom43Field)
            $datatocheck=$Cus43tofil;
          if ($filfield1==$Custom44Field)
            $datatocheck=$Cus44tofil;
          if ($filfield1==$Custom45Field)
            $datatocheck=$Cus45tofil;
          if ($filfield1==$Custom46Field)
            $datatocheck=$Cus46tofil;
          if ($filfield1==$Custom47Field)
            $datatocheck=$Cus47tofil;
          if ($filfield1==$Custom48Field)
            $datatocheck=$Cus48tofil;
          if ($filfield1==$Custom49Field)
            $datatocheck=$Cus49tofil;
          if ($filfield1==$Custom50Field)
            $datatocheck=$Cus50tofil;
          if ($filfield1==$Custom51Field)
            $datatocheck=$Cus51tofil;
          if ($filfield1==$Custom52Field)
            $datatocheck=$Cus52tofil;
          if ($filfield1==$Custom53Field)
            $datatocheck=$Cus53tofil;
          if ($filfield1==$Custom54Field)
            $datatocheck=$Cus54tofil;
          if ($filfield1==$Custom55Field)
            $datatocheck=$Cus55tofil;
          if ($filfield1==$Custom56Field)
            $datatocheck=$Cus56tofil;
          if ($filfield1==$Custom57Field)
            $datatocheck=$Cus57tofil;
          if ($filfield1==$Custom58Field)
            $datatocheck=$Cus58tofil;
          if ($filfield1==$Custom59Field)
            $datatocheck=$Cus59tofil;
          if ($filfield1==$Custom60Field)
            $datatocheck=$Cus60tofil;
          if ($filfield1==$Custom61Field)
            $datatocheck=$Cus61tofil;
          if ($filfield1==$Custom62Field)
            $datatocheck=$Cus62tofil;
          if ($filfield1==$Custom63Field)
            $datatocheck=$Cus63tofil;
          if ($filfield1==$Custom64Field)
            $datatocheck=$Cus64tofil;
          if ($filfield1==$Custom65Field)
            $datatocheck=$Cus65tofil;
          if ($filfield1==$Custom66Field)
            $datatocheck=$Cus66tofil;
          if ($filfield1==$Custom67Field)
            $datatocheck=$Cus67tofil;
          if ($filfield1==$Custom68Field)
            $datatocheck=$Cus68tofil;
          if ($filfield1==$Custom69Field)
            $datatocheck=$Cus69tofil;
          if ($filfield1==$Custom70Field)
            $datatocheck=$Cus70tofil;
          if ($filfield1==$Custom71Field)
            $datatocheck=$Cus71tofil;
          if ($filfield1==$Custom72Field)
            $datatocheck=$Cus72tofil;
          if ($filfield1==$Custom73Field)
            $datatocheck=$Cus73tofil;
          if ($filfield1==$Custom74Field)
            $datatocheck=$Cus74tofil;
          if ($filfield1==$Custom75Field)
            $datatocheck=$Cus75tofil;
          if ($filfield1==$Custom76Field)
            $datatocheck=$Cus76tofil;
          if ($filfield1==$Custom77Field)
            $datatocheck=$Cus77tofil;
          if ($filfield1==$Custom78Field)
            $datatocheck=$Cus78tofil;
          if ($filfield1==$Custom79Field)
            $datatocheck=$Cus79tofil;
          if ($filfield1==$Custom80Field)
            $datatocheck=$Cus80tofil;
          if ($filfield1==$Custom81Field)
            $datatocheck=$Cus81tofil;
          if ($filfield1==$Custom82Field)
            $datatocheck=$Cus82tofil;
          if ($filfield1==$Custom83Field)
            $datatocheck=$Cus83tofil;
          if ($filfield1==$Custom84Field)
            $datatocheck=$Cus84tofil;
          if ($filfield1==$Custom85Field)
            $datatocheck=$Cus85tofil;
          if ($filfield1==$Custom86Field)
            $datatocheck=$Cus86tofil;
          if ($filfield1==$Custom87Field)
            $datatocheck=$Cus87tofil;
          if ($filfield1==$Custom88Field)
            $datatocheck=$Cus88tofil;
          if ($filfield1==$Custom89Field)
            $datatocheck=$Cus89tofil;
          if ($filfield1==$Custom90Field)
            $datatocheck=$Cus90tofil;
          if ($filfield1==$Custom91Field)
            $datatocheck=$Cus91tofil;
          if ($filfield1==$Custom92Field)
            $datatocheck=$Cus92tofil;
          if ($filfield1==$Custom93Field)
            $datatocheck=$Cus93tofil;
          if ($filfield1==$Custom94Field)
            $datatocheck=$Cus94tofil;
          if ($filfield1==$Custom95Field)
            $datatocheck=$Cus95tofil;
          if ($filfield1==$Custom96Field)
            $datatocheck=$Cus96tofil;
          if ($filfield1==$Custom97Field)
            $datatocheck=$Cus97tofil;
          if ($filfield1==$Custom98Field)
            $datatocheck=$Cus98tofil;
          if ($filfield1==$Custom99Field)
            $datatocheck=$Cus99tofil;
          if ($filfield1==$Custom100Field)
            $datatocheck=$Cus100tofil;
          if ($filfield1==$Custom101Field)          
            $datatocheck=$Cus101tofil;
          if ($filfield1==$Custom102Field)
            $datatocheck=$Cus102tofil;
          if ($filfield1==$Custom103Field)          
            $datatocheck=$Cus103tofil;
          if ($filfield1==$Custom104Field)
            $datatocheck=$Cus104tofil;
          if ($filfield1==$Custom105Field)          
            $datatocheck=$Cus105tofil;     
          if (($filfield1==$UsernameField) || ($filfield1==$PasswordField) || ($filfield1==$EnabledField) || ($filfield1==$NameField) || ($filfield1==$EmailField) || ($filfield1==$UsergroupsField) || ($filfield1==$CreatedField)
          || ($filfield1==$Custom1Field) || ($filfield1==$Custom2Field) ||($filfield1==$Custom3Field) ||($filfield1==$Custom4Field) ||($filfield1==$Custom5Field)
          || ($filfield1==$Custom6Field) || ($filfield1==$Custom7Field) ||($filfield1==$Custom8Field) ||($filfield1==$Custom9Field) ||($filfield1==$Custom10Field)
          || ($filfield1==$Custom11Field) || ($filfield1==$Custom12Field) ||($filfield1==$Custom13Field) ||($filfield1==$Custom14Field) ||($filfield1==$Custom15Field)
          || ($filfield1==$Custom16Field) || ($filfield1==$Custom17Field) ||($filfield1==$Custom18Field) ||($filfield1==$Custom19Field) ||($filfield1==$Custom20Field)
          || ($filfield1==$Custom21Field) || ($filfield1==$Custom22Field) ||($filfield1==$Custom23Field) ||($filfield1==$Custom24Field) ||($filfield1==$Custom25Field)
          || ($filfield1==$Custom26Field) || ($filfield1==$Custom27Field) ||($filfield1==$Custom28Field) ||($filfield1==$Custom29Field) ||($filfield1==$Custom30Field)
          || ($filfield1==$Custom31Field) || ($filfield1==$Custom32Field) ||($filfield1==$Custom33Field) ||($filfield1==$Custom34Field) ||($filfield1==$Custom35Field)
          || ($filfield1==$Custom36Field) || ($filfield1==$Custom37Field) ||($filfield1==$Custom38Field) ||($filfield1==$Custom39Field) ||($filfield1==$Custom40Field)
          || ($filfield1==$Custom41Field) || ($filfield1==$Custom42Field) ||($filfield1==$Custom43Field) ||($filfield1==$Custom44Field) ||($filfield1==$Custom45Field)
          || ($filfield1==$Custom46Field) || ($filfield1==$Custom47Field) ||($filfield1==$Custom48Field) ||($filfield1==$Custom49Field) ||($filfield1==$Custom50Field)
          || ($filfield1==$Custom51Field) || ($filfield1==$Custom52Field) ||($filfield1==$Custom53Field) ||($filfield1==$Custom54Field) ||($filfield1==$Custom55Field)
          || ($filfield1==$Custom56Field) || ($filfield1==$Custom57Field) ||($filfield1==$Custom58Field) ||($filfield1==$Custom59Field) ||($filfield1==$Custom60Field)
          || ($filfield1==$Custom61Field) || ($filfield1==$Custom62Field) ||($filfield1==$Custom63Field) ||($filfield1==$Custom64Field) ||($filfield1==$Custom65Field)
          || ($filfield1==$Custom66Field) || ($filfield1==$Custom67Field) ||($filfield1==$Custom68Field) ||($filfield1==$Custom69Field) ||($filfield1==$Custom70Field)
          || ($filfield1==$Custom71Field) || ($filfield1==$Custom72Field) ||($filfield1==$Custom73Field) ||($filfield1==$Custom74Field) ||($filfield1==$Custom75Field)
          || ($filfield1==$Custom76Field) || ($filfield1==$Custom77Field) ||($filfield1==$Custom78Field) ||($filfield1==$Custom79Field) ||($filfield1==$Custom80Field)
          || ($filfield1==$Custom81Field) || ($filfield1==$Custom82Field) ||($filfield1==$Custom83Field) ||($filfield1==$Custom84Field) ||($filfield1==$Custom85Field)
          || ($filfield1==$Custom86Field) || ($filfield1==$Custom87Field) ||($filfield1==$Custom88Field) ||($filfield1==$Custom89Field) ||($filfield1==$Custom90Field)
          || ($filfield1==$Custom91Field) || ($filfield1==$Custom92Field) ||($filfield1==$Custom93Field) ||($filfield1==$Custom94Field) ||($filfield1==$Custom95Field)
          || ($filfield1==$Custom96Field) || ($filfield1==$Custom97Field) ||($filfield1==$Custom98Field) ||($filfield1==$Custom99Field) ||($filfield1==$Custom100Field)
          || ($filfield1==$Custom101Field) || ($filfield1==$Custom102Field) ||($filfield1==$Custom103Field) ||($filfield1==$Custom104Field)
          ||($filfield1==$Custom104Field))
          {
          	$fildata=strtolower($fildata1);
          	// If checking Created field then convert date to YYMMDD
          	if (($filfield1==$CreatedField) && (strlen($fildata)==6))
          	{
	            if ($DateFormat=="DDMMYY")
	              $fildata=substr($fildata,4,2).substr($fildata,2,2).substr($fildata,0,2);
	            else
	              $fildata=substr($fildata,2,2).substr($fildata,4,2).substr($fildata,0,2);
          	}
          	$datatocheck=strtolower($datatocheck);
	          if ($filcond1=="equals")
	            $comp1=($fildata==$datatocheck);
	          if ($filcond1=="notequal")
	            $comp1=($fildata!=$datatocheck);
	          if ($filcond1=="contains")
	            $comp1=is_integer(strpos($datatocheck,$fildata));
	          if ($filcond1=="notcontain")
	            $comp1=(strpos($datatocheck,$fildata)===false);
	          if ($filcond1=="less")
	            $comp1=($datatocheck<$fildata);
	          if ($filcond1=="greater")
	            $comp1=($datatocheck>$fildata);
	          if ($filcond1=="starts")
	            $comp1=(strpos($datatocheck,$fildata)===0);
	          if ($filcond1=="ends")
	            $comp1=(strpos($datatocheck,$fildata)===(strlen($datatocheck)-strlen($fildata)));
          }
          if ($filfield1=="groupexpiry")
          {
          	$fildata=strtolower($fildata1);
            // Compare the expiry dates. If any match then set comp to true
            $allgroups=explode("^",$Usergroupstofil);
            for ($j=0;$j<count($allgroups);$j++)
            {
              $exdate=strtok($allgroups[$j],":");
              $exdate=trim(strtok(":"));
              if (strlen($exdate)!=6)
              {
                if (($filcond1=="notequal") || ($filcond1=="greater"))
                	$comp1=true;
                else
                	$comp1=false;
              	continue;
              }
	            if ($filcond1=="equals")
	              $comp1=($fildata==$exdate);
	            if ($filcond1=="notequal")
	              $comp1=($fildata!=$exdate);
	            if ($filcond1=="contains")
	              $comp1=is_integer(strpos($exdate,$fildata));
	            if ($filcond1=="greater")
	              $comp1=($datatocheck>$fildata);
	            if ($filcond1=="starts")
	              $comp1=(strpos($exdate,$fildata)===0);
	            if ($filcond1=="ends")
	              $comp1=(strpos($exdate,$fildata)===(strlen($exdate)-strlen($fildata)));
	            if (($filcond1=="less") || ($filcond1=="greater"))
	            {
	            	if (strlen($fildata)!=6)
	            		$comp1=false;
	            	else
	            	{
	                if ($DateFormat=="DDMMYY")
	                {
	                   $exday=intval(substr($exdate,0,2));
	                   $exmonth=intval(substr($exdate,2,2));
	                   $exyear=intval(substr($exdate,4,2))+2000;
					           $extime=gmmktime(23,59,59,$exmonth,$exday,$exyear);
	                   $fiday=intval(substr($fildata,0,2));
	                   $fimonth=intval(substr($fildata,2,2));
	                   $fiyear=intval(substr($fildata,4,2))+2000;
					           $fitime=gmmktime(23,59,59,$fimonth,$fiday,$fiyear);
	                }
	                else
	                {
	                   $exday=intval(substr($exdate,2,2));
	                   $exmonth=intval(substr($exdate,0,2));
	                   $exyear=intval(substr($exdate,4,2))+2000;
					           $extime=gmmktime(23,59,59,$exmonth,$exday,$exyear);
	                   $fiday=intval(substr($fildata,2,2));
	                   $fimonth=intval(substr($fildata,0,2));
	                   $fiyear=intval(substr($fildata,4,2))+2000;
					           $fitime=gmmktime(23,59,59,$fimonth,$fiday,$fiyear);
	                }
	                $comp1=false;
	                if (($filcond1=="less") && ($extime<$fitime))
										$comp1=true;
	                if (($filcond1=="greater") && ($extime>$fitime))
										$comp1=true;
                }
	            }
	            if ($comp1)
	              break; // We only need one match
            }
          }
          $finalcomp="\$comp1";
          // Now see if matches filter 2
          if ($filfield2!="")
          {
	          if ($filfield2==$UsernameField)
	            $datatocheck=$Usernametofil;
	          if ($filfield2==$PasswordField)
	            $datatocheck=$Passwordtofil;
	          if ($filfield2==$EnabledField)
	            $datatocheck=$Enabledtofil;
	          if ($filfield2==$NameField)
	            $datatocheck=$Nametofil;
	          if ($filfield2==$EmailField)
	            $datatocheck=$Emailtofil;
	          if ($filfield2==$UsergroupsField)
	            $datatocheck=$Usergroupstofil;
	          if ($filfield2==$Custom1Field)
	            $datatocheck=$Cus1tofil;
	          if ($filfield2==$Custom2Field)
	            $datatocheck=$Cus2tofil;
	          if ($filfield2==$Custom3Field)
	            $datatocheck=$Cus3tofil;
	          if ($filfield2==$Custom4Field)
	            $datatocheck=$Cus4tofil;
	          if ($filfield2==$Custom5Field)
	            $datatocheck=$Cus5tofil;
	          if ($filfield2==$Custom6Field)
	            $datatocheck=$Cus6tofil;
	          if ($filfield2==$Custom7Field)
	            $datatocheck=$Cus7tofil;
	          if ($filfield2==$Custom8Field)
	            $datatocheck=$Cus8tofil;
	          if ($filfield2==$Custom9Field)
	            $datatocheck=$Cus9tofil;
	          if ($filfield2==$Custom10Field)
	            $datatocheck=$Cus10tofil;
            if ($filfield2==$Custom11Field)
              $datatocheck=$Cus11tofil;
            if ($filfield2==$Custom12Field)
              $datatocheck=$Cus12tofil;
            if ($filfield2==$Custom13Field)
              $datatocheck=$Cus13tofil;
            if ($filfield2==$Custom14Field)
              $datatocheck=$Cus14tofil;
            if ($filfield2==$Custom15Field)
              $datatocheck=$Cus15tofil;
            if ($filfield2==$Custom16Field)
              $datatocheck=$Cus16tofil;
            if ($filfield2==$Custom17Field)
              $datatocheck=$Cus17tofil;
            if ($filfield2==$Custom18Field)
              $datatocheck=$Cus18tofil;
            if ($filfield2==$Custom19Field)
              $datatocheck=$Cus19tofil;
            if ($filfield2==$Custom20Field)
              $datatocheck=$Cus20tofil;
            if ($filfield2==$Custom21Field)
              $datatocheck=$Cus21tofil;
            if ($filfield2==$Custom22Field)
              $datatocheck=$Cus22tofil;
            if ($filfield2==$Custom23Field)
              $datatocheck=$Cus23tofil;
            if ($filfield2==$Custom24Field)
              $datatocheck=$Cus24tofil;
            if ($filfield2==$Custom25Field)
              $datatocheck=$Cus25tofil;
            if ($filfield2==$Custom26Field)
              $datatocheck=$Cus26tofil;
            if ($filfield2==$Custom27Field)
              $datatocheck=$Cus27tofil;
            if ($filfield2==$Custom28Field)
              $datatocheck=$Cus28tofil;
            if ($filfield2==$Custom29Field)
              $datatocheck=$Cus29tofil;
            if ($filfield2==$Custom30Field)
              $datatocheck=$Cus30tofil;
            if ($filfield2==$Custom31Field)
              $datatocheck=$Cus31tofil;
            if ($filfield2==$Custom32Field)
              $datatocheck=$Cus32tofil;
            if ($filfield2==$Custom33Field)
              $datatocheck=$Cus33tofil;
            if ($filfield2==$Custom34Field)
              $datatocheck=$Cus34tofil;
            if ($filfield2==$Custom35Field)
              $datatocheck=$Cus35tofil;
            if ($filfield2==$Custom36Field)
              $datatocheck=$Cus36tofil;
            if ($filfield2==$Custom37Field)
              $datatocheck=$Cus37tofil;
            if ($filfield2==$Custom38Field)
              $datatocheck=$Cus38tofil;
            if ($filfield2==$Custom39Field)
              $datatocheck=$Cus39tofil;
            if ($filfield2==$Custom40Field)
              $datatocheck=$Cus40tofil;
            if ($filfield2==$Custom41Field)
              $datatocheck=$Cus41tofil;
            if ($filfield2==$Custom42Field)
              $datatocheck=$Cus42tofil;
            if ($filfield2==$Custom43Field)
              $datatocheck=$Cus43tofil;
            if ($filfield2==$Custom44Field)
              $datatocheck=$Cus44tofil;
            if ($filfield2==$Custom45Field)
              $datatocheck=$Cus45tofil;
            if ($filfield2==$Custom46Field)
              $datatocheck=$Cus46tofil;
            if ($filfield2==$Custom47Field)
              $datatocheck=$Cus47tofil;
            if ($filfield2==$Custom48Field)
              $datatocheck=$Cus48tofil;
            if ($filfield2==$Custom49Field)
              $datatocheck=$Cus49tofil;
            if ($filfield2==$Custom50Field)
              $datatocheck=$Cus50tofil;
            if ($filfield2==$Custom51Field)
              $datatocheck=$Cus51tofil;
            if ($filfield2==$Custom52Field)
	            $datatocheck=$Cus52tofil;
	          if ($filfield2==$Custom53Field)
	            $datatocheck=$Cus53tofil;
	          if ($filfield2==$Custom54Field)
	            $datatocheck=$Cus54tofil;
	          if ($filfield2==$Custom55Field)
	            $datatocheck=$Cus55tofil;
	          if ($filfield2==$Custom56Field)
	            $datatocheck=$Cus56tofil;
	          if ($filfield2==$Custom57Field)
	            $datatocheck=$Cus57tofil;
	          if ($filfield2==$Custom58Field)
	            $datatocheck=$Cus58tofil;
	          if ($filfield2==$Custom59Field)
	            $datatocheck=$Cus59tofil;
	          if ($filfield2==$Custom60Field)
	            $datatocheck=$Cus60tofil;
            if ($filfield2==$Custom61Field)
              $datatocheck=$Cus61tofil;
            if ($filfield2==$Custom62Field)
              $datatocheck=$Cus62tofil;
            if ($filfield2==$Custom63Field)
              $datatocheck=$Cus63tofil;
            if ($filfield2==$Custom64Field)
              $datatocheck=$Cus64tofil;
            if ($filfield2==$Custom65Field)
              $datatocheck=$Cus65tofil;
            if ($filfield2==$Custom66Field)
              $datatocheck=$Cus66tofil;
            if ($filfield2==$Custom67Field)
              $datatocheck=$Cus67tofil;
            if ($filfield2==$Custom68Field)
              $datatocheck=$Cus68tofil;
            if ($filfield2==$Custom69Field)
              $datatocheck=$Cus69tofil;
            if ($filfield2==$Custom70Field)
              $datatocheck=$Cus70tofil;
            if ($filfield2==$Custom71Field)
              $datatocheck=$Cus71tofil;
            if ($filfield2==$Custom72Field)
              $datatocheck=$Cus72tofil;
            if ($filfield2==$Custom73Field)
              $datatocheck=$Cus73tofil;
            if ($filfield2==$Custom74Field)
              $datatocheck=$Cus74tofil;
            if ($filfield2==$Custom75Field)
              $datatocheck=$Cus75tofil;
            if ($filfield2==$Custom76Field)
              $datatocheck=$Cus76tofil;
            if ($filfield2==$Custom77Field)
              $datatocheck=$Cus77tofil;
            if ($filfield2==$Custom78Field)
              $datatocheck=$Cus78tofil;
            if ($filfield2==$Custom79Field)
              $datatocheck=$Cus79tofil;
            if ($filfield2==$Custom80Field)
              $datatocheck=$Cus80tofil;
            if ($filfield2==$Custom81Field)
              $datatocheck=$Cus81tofil;
            if ($filfield2==$Custom82Field)
              $datatocheck=$Cus82tofil;
            if ($filfield2==$Custom83Field)
              $datatocheck=$Cus83tofil;
            if ($filfield2==$Custom84Field)
              $datatocheck=$Cus84tofil;
            if ($filfield2==$Custom85Field)
              $datatocheck=$Cus85tofil;
            if ($filfield2==$Custom86Field)
              $datatocheck=$Cus86tofil;
            if ($filfield2==$Custom87Field)
              $datatocheck=$Cus87tofil;
            if ($filfield2==$Custom88Field)
              $datatocheck=$Cus88tofil;
            if ($filfield2==$Custom89Field)
              $datatocheck=$Cus89tofil;
            if ($filfield2==$Custom90Field)
              $datatocheck=$Cus90tofil;
            if ($filfield2==$Custom91Field)
              $datatocheck=$Cus91tofil;
            if ($filfield2==$Custom92Field)
              $datatocheck=$Cus92tofil;
            if ($filfield2==$Custom93Field)
              $datatocheck=$Cus93tofil;
            if ($filfield2==$Custom94Field)
              $datatocheck=$Cus94tofil;
            if ($filfield2==$Custom95Field)
              $datatocheck=$Cus95tofil;
            if ($filfield2==$Custom96Field)
              $datatocheck=$Cus96tofil;
            if ($filfield2==$Custom97Field)
              $datatocheck=$Cus97tofil;
            if ($filfield2==$Custom98Field)
              $datatocheck=$Cus98tofil;
            if ($filfield2==$Custom99Field)
              $datatocheck=$Cus99tofil;
            if ($filfield2==$Custom100Field)
              $datatocheck=$Cus100tofil;
            if ($filfield2==$Custom101Field)
              $datatocheck=$Cus101tofil;
            if ($filfield2==$Custom102Field)
              $datatocheck=$Cus102tofil;
            if ($filfield2==$Custom103Field)
              $datatocheck=$Cus103tofil;            
            if ($filfield2==$Custom104Field)
              $datatocheck=$Cus104tofil;
            if ($filfield2==$Custom105Field)
              $datatocheck=$Cus105tofil; 
          if (($filfield2==$UsernameField) || ($filfield2==$PasswordField) || ($filfield2==$EnabledField) || ($filfield2==$NameField) || ($filfield2==$EmailField) || ($filfield2==$UsergroupsField) || ($filfield2==$CreatedField)
	          || ($filfield2==$Custom1Field) || ($filfield2==$Custom2Field) ||($filfield2==$Custom3Field) ||($filfield2==$Custom4Field) ||($filfield2==$Custom5Field)
	          || ($filfield2==$Custom6Field) || ($filfield2==$Custom7Field) ||($filfield2==$Custom8Field) ||($filfield2==$Custom9Field) ||($filfield2==$Custom10Field)
            || ($filfield2==$Custom11Field) || ($filfield2==$Custom12Field) ||($filfield2==$Custom13Field) ||($filfield2==$Custom14Field) ||($filfield2==$Custom15Field)
            || ($filfield2==$Custom16Field) || ($filfield2==$Custom17Field) ||($filfield2==$Custom18Field) ||($filfield2==$Custom19Field) ||($filfield2==$Custom20Field)
            || ($filfield2==$Custom21Field) || ($filfield2==$Custom22Field) ||($filfield2==$Custom23Field) ||($filfield2==$Custom24Field) ||($filfield2==$Custom25Field)
            || ($filfield2==$Custom26Field) || ($filfield2==$Custom27Field) ||($filfield2==$Custom28Field) ||($filfield2==$Custom29Field) ||($filfield2==$Custom30Field)
            || ($filfield2==$Custom31Field) || ($filfield2==$Custom32Field) ||($filfield2==$Custom33Field) ||($filfield2==$Custom34Field) ||($filfield2==$Custom35Field)
            || ($filfield2==$Custom36Field) || ($filfield2==$Custom37Field) ||($filfield2==$Custom38Field) ||($filfield2==$Custom39Field) ||($filfield2==$Custom40Field)
            || ($filfield2==$Custom41Field) || ($filfield2==$Custom42Field) ||($filfield2==$Custom43Field) ||($filfield2==$Custom44Field) ||($filfield2==$Custom45Field)
            || ($filfield2==$Custom46Field) || ($filfield2==$Custom47Field) ||($filfield2==$Custom48Field) ||($filfield2==$Custom49Field) ||($filfield2==$Custom50Field)
            || ($filfield2==$Custom51Field) || ($filfield2==$Custom52Field) ||($filfield2==$Custom53Field) ||($filfield2==$Custom54Field) ||($filfield2==$Custom55Field)
            || ($filfield2==$Custom56Field) || ($filfield2==$Custom57Field) ||($filfield2==$Custom58Field) ||($filfield2==$Custom59Field) ||($filfield2==$Custom60Field)
            || ($filfield2==$Custom61Field) || ($filfield2==$Custom62Field) ||($filfield2==$Custom63Field) ||($filfield2==$Custom64Field) ||($filfield2==$Custom65Field)
            || ($filfield2==$Custom66Field) || ($filfield2==$Custom67Field) ||($filfield2==$Custom68Field) ||($filfield2==$Custom69Field) ||($filfield2==$Custom70Field)
            || ($filfield2==$Custom71Field) || ($filfield2==$Custom72Field) ||($filfield2==$Custom73Field) ||($filfield2==$Custom74Field) ||($filfield2==$Custom75Field)
            || ($filfield2==$Custom76Field) || ($filfield2==$Custom77Field) ||($filfield2==$Custom78Field) ||($filfield2==$Custom79Field) ||($filfield2==$Custom80Field)
            || ($filfield2==$Custom81Field) || ($filfield2==$Custom82Field) ||($filfield2==$Custom83Field) ||($filfield2==$Custom84Field) ||($filfield2==$Custom85Field)
            || ($filfield2==$Custom86Field) || ($filfield2==$Custom87Field) ||($filfield2==$Custom88Field) ||($filfield2==$Custom89Field) ||($filfield2==$Custom90Field)
            || ($filfield2==$Custom91Field) || ($filfield2==$Custom92Field) ||($filfield2==$Custom93Field) ||($filfield2==$Custom94Field) ||($filfield2==$Custom95Field)
            || ($filfield2==$Custom96Field) || ($filfield2==$Custom97Field) ||($filfield2==$Custom98Field) ||($filfield2==$Custom99Field) ||($filfield2==$Custom100Field)
            || ($filfield2==$Custom101Field) || ($filfield2==$Custom102Field) ||($filfield2==$Custom103Field) ||($filfield2==$Custom104Field)
            || ($filfield2==$Custom105Field))
	          {
	            $fildata=strtolower($fildata2);
	            if (($filfield2==$CreatedField) && (strlen($fildata)==6))
	            {
	              if ($DateFormat=="DDMMYY")
	                $fildata=substr($fildata,4,2).substr($fildata,2,2).substr($fildata,0,2);
	              else
	                $fildata=substr($fildata,2,2).substr($fildata,4,2).substr($fildata,0,2);
	            }
	            $datatocheck=strtolower($datatocheck);
	            if ($filcond2=="equals")
	              $comp2=($fildata==$datatocheck);
	            if ($filcond2=="notequal")
	              $comp2=($fildata!=$datatocheck);
	            if ($filcond2=="contains")
	              $comp2=is_integer(strpos($datatocheck,$fildata));
	            if ($filcond2=="notcontain")
	              $comp2=(strpos($datatocheck,$fildata)===false);
	            if ($filcond2=="less")
	              $comp2=($datatocheck<$fildata);
	            if ($filcond2=="greater")
	              $comp2=($datatocheck>$fildata);
	            if ($filcond2=="starts")
	              $comp2=(strpos($datatocheck,$fildata)===0);
	            if ($filcond2=="ends")
	              $comp2=(strpos($datatocheck,$fildata)===(strlen($datatocheck)-strlen($fildata)));
	          }
	          if ($filfield2=="groupexpiry")
	          {
	            $fildata=strtolower($fildata2);
	            // Compare the expiry dates. If any match then set comp to true
	            $allgroups=explode("^",$Usergroupstofil);
	            for ($j=0;$j<count($allgroups);$j++)
	            {
	              $exdate=strtok($allgroups[$j],":");
	              $exdate=trim(strtok(":"));
	              if (strlen($exdate)!=6)
	              {
	                if (($filcond2=="notequal") || ($filcond2=="greater"))
	                  $comp2=true;
	                else
	                  $comp2=false;
	                continue;
	              }
	              if ($filcond2=="equals")
	                $comp2=($fildata==$exdate);
	              if ($filcond2=="notequal")
	                $comp2=($fildata!=$exdate);
	              if ($filcond2=="contains")
	                $comp2=is_integer(strpos($exdate,$fildata));
	              if ($filcond2=="greater")
	                $comp2=($datatocheck>$fildata);
	              if ($filcond2=="starts")
	                $comp2=(strpos($exdate,$fildata)===0);
	              if ($filcond2=="ends")
	                $comp2=(strpos($exdate,$fildata)===(strlen($exdate)-strlen($fildata)));
	              if (($filcond2=="less") || ($filcond2=="greater"))
	              {
	                if (strlen($fildata)!=6)
	                  $comp2=false;
	                else
	                {
	                  if ($DateFormat=="DDMMYY")
	                  {
	                     $exday=intval(substr($exdate,0,2));
	                     $exmonth=intval(substr($exdate,2,2));
	                     $exyear=intval(substr($exdate,4,2))+2000;
	                     $extime=gmmktime(23,59,59,$exmonth,$exday,$exyear);
	                     $fiday=intval(substr($fildata,0,2));
	                     $fimonth=intval(substr($fildata,2,2));
	                     $fiyear=intval(substr($fildata,4,2))+2000;
	                     $fitime=gmmktime(23,59,59,$fimonth,$fiday,$fiyear);
	                  }
	                  else
	                  {
	                     $exday=intval(substr($exdate,2,2));
	                     $exmonth=intval(substr($exdate,0,2));
	                     $exyear=intval(substr($exdate,4,2))+2000;
	                     $extime=gmmktime(23,59,59,$exmonth,$exday,$exyear);
	                     $fiday=intval(substr($fildata,2,2));
	                     $fimonth=intval(substr($fildata,0,2));
	                     $fiyear=intval(substr($fildata,4,2))+2000;
	                     $fitime=gmmktime(23,59,59,$fimonth,$fiday,$fiyear);
	                  }
	                  $comp2=false;
	                  if (($filcond2=="less") && ($extime<$fitime))
	                    $comp2=true;
	                  if (($filcond2=="greater") && ($extime>$fitime))
	                    $comp2=true;
	                }
	              }
	              if ($comp2)
	                break; // We only need one match
	            }
	          }
	          if ($filbool1=="AND")
		          $finalcomp=$finalcomp." & "."\$comp2";
	          else
		          $finalcomp=$finalcomp." | "."\$comp2";
          }
          // Now see if matches filter 3
          if ($filfield3!="")
          {
	          if ($filfield3==$UsernameField)
	            $datatocheck=$Usernametofil;
	          if ($filfield3==$PasswordField)
	            $datatocheck=$Passwordtofil;
	          if ($filfield3==$EnabledField)
	            $datatocheck=$Enabledtofil;
	          if ($filfield3==$NameField)
	            $datatocheck=$Nametofil;
	          if ($filfield3==$EmailField)
	            $datatocheck=$Emailtofil;
	          if ($filfield3==$UsergroupsField)
	            $datatocheck=$Usergroupstofil;
	          if ($filfield3==$Custom1Field)
	            $datatocheck=$Cus1tofil;
	          if ($filfield3==$Custom2Field)
	            $datatocheck=$Cus2tofil;
	          if ($filfield3==$Custom3Field)
	            $datatocheck=$Cus3tofil;
	          if ($filfield3==$Custom4Field)
	            $datatocheck=$Cus4tofil;
	          if ($filfield3==$Custom5Field)
	            $datatocheck=$Cus5tofil;
	          if ($filfield3==$Custom6Field)
	            $datatocheck=$Cus6tofil;
	          if ($filfield3==$Custom7Field)
	            $datatocheck=$Cus7tofil;
	          if ($filfield3==$Custom8Field)
	            $datatocheck=$Cus8tofil;
	          if ($filfield3==$Custom9Field)
	            $datatocheck=$Cus9tofil;
	          if ($filfield3==$Custom10Field)
	            $datatocheck=$Cus10tofil;
            if ($filfield3==$Custom11Field)
              $datatocheck=$Cus11tofil;
            if ($filfield3==$Custom12Field)
              $datatocheck=$Cus12tofil;
            if ($filfield3==$Custom13Field)
              $datatocheck=$Cus13tofil;
            if ($filfield3==$Custom14Field)
              $datatocheck=$Cus14tofil;
            if ($filfield3==$Custom15Field)
              $datatocheck=$Cus15tofil;
            if ($filfield3==$Custom16Field)
              $datatocheck=$Cus16tofil;
            if ($filfield3==$Custom17Field)
              $datatocheck=$Cus17tofil;
            if ($filfield3==$Custom18Field)
              $datatocheck=$Cus18tofil;
            if ($filfield3==$Custom19Field)
              $datatocheck=$Cus19tofil;
            if ($filfield3==$Custom20Field)
              $datatocheck=$Cus20tofil;
            if ($filfield3==$Custom21Field)
              $datatocheck=$Cus21tofil;
            if ($filfield3==$Custom22Field)
              $datatocheck=$Cus22tofil;
            if ($filfield3==$Custom23Field)
              $datatocheck=$Cus23tofil;
            if ($filfield3==$Custom24Field)
              $datatocheck=$Cus24tofil;
            if ($filfield3==$Custom25Field)
              $datatocheck=$Cus25tofil;
            if ($filfield3==$Custom26Field)
              $datatocheck=$Cus26tofil;
            if ($filfield3==$Custom27Field)
              $datatocheck=$Cus27tofil;
            if ($filfield3==$Custom28Field)
              $datatocheck=$Cus28tofil;
            if ($filfield3==$Custom29Field)
              $datatocheck=$Cus29tofil;
            if ($filfield3==$Custom30Field)
              $datatocheck=$Cus30tofil;
            if ($filfield3==$Custom31Field)
              $datatocheck=$Cus31tofil;
            if ($filfield3==$Custom32Field)
              $datatocheck=$Cus32tofil;
            if ($filfield3==$Custom33Field)
              $datatocheck=$Cus33tofil;
            if ($filfield3==$Custom34Field)
              $datatocheck=$Cus34tofil;
            if ($filfield3==$Custom35Field)
              $datatocheck=$Cus35tofil;
            if ($filfield3==$Custom36Field)
              $datatocheck=$Cus36tofil;
            if ($filfield3==$Custom37Field)
              $datatocheck=$Cus37tofil;
            if ($filfield3==$Custom38Field)
              $datatocheck=$Cus38tofil;
            if ($filfield3==$Custom39Field)
              $datatocheck=$Cus39tofil;
            if ($filfield3==$Custom40Field)
              $datatocheck=$Cus40tofil;
            if ($filfield3==$Custom41Field)
              $datatocheck=$Cus41tofil;
            if ($filfield3==$Custom42Field)
              $datatocheck=$Cus42tofil;
            if ($filfield3==$Custom43Field)
              $datatocheck=$Cus43tofil;
            if ($filfield3==$Custom44Field)
              $datatocheck=$Cus44tofil;
            if ($filfield3==$Custom45Field)
              $datatocheck=$Cus45tofil;
            if ($filfield3==$Custom46Field)
              $datatocheck=$Cus46tofil;
            if ($filfield3==$Custom47Field)
              $datatocheck=$Cus47tofil;
            if ($filfield3==$Custom48Field)
              $datatocheck=$Cus48tofil;
            if ($filfield3==$Custom49Field)
              $datatocheck=$Cus49tofil;
            if ($filfield3==$Custom50Field)
              $datatocheck=$Cus50tofil;
            if ($filfield3==$Custom51Field)
              $datatocheck=$Cus51tofil;
            if ($filfield2==$Custom52Field)
	            $datatocheck=$Cus52tofil;
	          if ($filfield3==$Custom53Field)
	            $datatocheck=$Cus53tofil;
	          if ($filfield3==$Custom54Field)
	            $datatocheck=$Cus54tofil;
	          if ($filfield3==$Custom55Field)
	            $datatocheck=$Cus55tofil;
	          if ($filfield3==$Custom56Field)
	            $datatocheck=$Cus56tofil;
	          if ($filfield3==$Custom57Field)
	            $datatocheck=$Cus57tofil;
	          if ($filfield3==$Custom58Field)
	            $datatocheck=$Cus58tofil;
	          if ($filfield3==$Custom59Field)
	            $datatocheck=$Cus59tofil;
	          if ($filfield3==$Custom60Field)
	            $datatocheck=$Cus60tofil;
            if ($filfield3==$Custom61Field)
              $datatocheck=$Cus61tofil;
            if ($filfield3==$Custom62Field)
              $datatocheck=$Cus62tofil;
            if ($filfield3==$Custom63Field)
              $datatocheck=$Cus63tofil;
            if ($filfield3==$Custom64Field)
              $datatocheck=$Cus64tofil;
            if ($filfield3==$Custom65Field)
              $datatocheck=$Cus65tofil;
            if ($filfield3==$Custom66Field)
              $datatocheck=$Cus66tofil;
            if ($filfield3==$Custom67Field)
              $datatocheck=$Cus67tofil;
            if ($filfield3==$Custom68Field)
              $datatocheck=$Cus68tofil;
            if ($filfield3==$Custom69Field)
              $datatocheck=$Cus69tofil;
            if ($filfield3==$Custom70Field)
              $datatocheck=$Cus70tofil;
            if ($filfield3==$Custom71Field)
              $datatocheck=$Cus71tofil;
            if ($filfield3==$Custom72Field)
              $datatocheck=$Cus72tofil;
            if ($filfield3==$Custom73Field)
              $datatocheck=$Cus73tofil;
            if ($filfield3==$Custom74Field)
              $datatocheck=$Cus74tofil;
            if ($filfield3==$Custom75Field)
              $datatocheck=$Cus75tofil;
            if ($filfield3==$Custom76Field)
              $datatocheck=$Cus76tofil;
            if ($filfield3==$Custom77Field)
              $datatocheck=$Cus77tofil;
            if ($filfield3==$Custom78Field)
              $datatocheck=$Cus78tofil;
            if ($filfield3==$Custom79Field)
              $datatocheck=$Cus79tofil;
            if ($filfield3==$Custom80Field)
              $datatocheck=$Cus80tofil;
            if ($filfield3==$Custom81Field)
              $datatocheck=$Cus81tofil;
            if ($filfield3==$Custom82Field)
              $datatocheck=$Cus82tofil;
            if ($filfield3==$Custom83Field)
              $datatocheck=$Cus83tofil;
            if ($filfield3==$Custom84Field)
              $datatocheck=$Cus84tofil;
            if ($filfield3==$Custom85Field)
              $datatocheck=$Cus85tofil;
            if ($filfield3==$Custom86Field)
              $datatocheck=$Cus86tofil;
            if ($filfield3==$Custom87Field)
              $datatocheck=$Cus87tofil;
            if ($filfield3==$Custom88Field)
              $datatocheck=$Cus88tofil;
            if ($filfield3==$Custom89Field)
              $datatocheck=$Cus89tofil;
            if ($filfield3==$Custom90Field)
              $datatocheck=$Cus90tofil;
            if ($filfield3==$Custom91Field)
              $datatocheck=$Cus91tofil;
            if ($filfield3==$Custom92Field)
              $datatocheck=$Cus92tofil;
            if ($filfield3==$Custom93Field)
              $datatocheck=$Cus93tofil;
            if ($filfield3==$Custom94Field)
              $datatocheck=$Cus94tofil;
            if ($filfield3==$Custom95Field)
              $datatocheck=$Cus95tofil;
            if ($filfield3==$Custom96Field)
              $datatocheck=$Cus96tofil;
            if ($filfield3==$Custom97Field)
              $datatocheck=$Cus97tofil;
            if ($filfield3==$Custom98Field)
              $datatocheck=$Cus98tofil;
            if ($filfield3==$Custom99Field)
              $datatocheck=$Cus99tofil;
            if ($filfield3==$Custom100Field)
              $datatocheck=$Cus100tofil;
            if ($filfield3==$Custom101Field)
              $datatocheck=$Cus101tofil;
            if ($filfield3==$Custom102Field)
              $datatocheck=$Cus102tofil;
            if ($filfield3==$Custom103Field)
              $datatocheck=$Cus103tofil;            
            if ($filfield3==$Custom104Field)
              $datatocheck=$Cus104tofil;
            if ($filfield3==$Custom105Field)
              $datatocheck=$Cus105tofil;
            if (($filfield3==$UsernameField) || ($filfield3==$PasswordField) || ($filfield3==$EnabledField) || ($filfield3==$NameField) || ($filfield3==$EmailField) || ($filfield3==$UsergroupsField) || ($filfield3==$CreatedField)
	         || ($filfield3==$Custom1Field) || ($filfield3==$Custom2Field) ||($filfield3==$Custom3Field) ||($filfield3==$Custom4Field) ||($filfield3==$Custom5Field)
	        || ($filfield3==$Custom6Field) || ($filfield3==$Custom7Field) ||($filfield3==$Custom8Field) ||($filfield3==$Custom9Field) ||($filfield3==$Custom10Field)
            || ($filfield3==$Custom11Field) || ($filfield3==$Custom12Field) ||($filfield3==$Custom13Field) ||($filfield3==$Custom14Field) ||($filfield3==$Custom15Field)
            || ($filfield3==$Custom16Field) || ($filfield3==$Custom17Field) ||($filfield3==$Custom18Field) ||($filfield3==$Custom19Field) ||($filfield3==$Custom20Field)
            || ($filfield3==$Custom21Field) || ($filfield3==$Custom22Field) ||($filfield3==$Custom23Field) ||($filfield3==$Custom24Field) ||($filfield3==$Custom25Field)
            || ($filfield3==$Custom26Field) || ($filfield3==$Custom27Field) ||($filfield3==$Custom28Field) ||($filfield3==$Custom29Field) ||($filfield3==$Custom30Field)
            || ($filfield3==$Custom31Field) || ($filfield3==$Custom32Field) ||($filfield3==$Custom33Field) ||($filfield3==$Custom34Field) ||($filfield3==$Custom35Field)
            || ($filfield3==$Custom36Field) || ($filfield3==$Custom37Field) ||($filfield3==$Custom38Field) ||($filfield3==$Custom39Field) ||($filfield3==$Custom40Field)
            || ($filfield3==$Custom41Field) || ($filfield3==$Custom42Field) ||($filfield3==$Custom43Field) ||($filfield3==$Custom44Field) ||($filfield3==$Custom45Field)
            || ($filfield3==$Custom46Field) || ($filfield3==$Custom47Field) ||($filfield3==$Custom48Field) ||($filfield3==$Custom49Field) ||($filfield3==$Custom50Field)
            || ($filfield3==$Custom51Field) || ($filfield3==$Custom52Field) ||($filfield3==$Custom53Field) ||($filfield3==$Custom54Field) ||($filfield3==$Custom55Field)
            || ($filfield3==$Custom56Field) || ($filfield3==$Custom57Field) ||($filfield3==$Custom58Field) ||($filfield3==$Custom59Field) ||($filfield3==$Custom60Field)
            || ($filfield3==$Custom61Field) || ($filfield3==$Custom62Field) ||($filfield3==$Custom63Field) ||($filfield3==$Custom64Field) ||($filfield3==$Custom65Field)
            || ($filfield3==$Custom66Field) || ($filfield3==$Custom67Field) ||($filfield3==$Custom68Field) ||($filfield3==$Custom69Field) ||($filfield3==$Custom70Field)
            || ($filfield3==$Custom71Field) || ($filfield3==$Custom72Field) ||($filfield3==$Custom73Field) ||($filfield3==$Custom74Field) ||($filfield3==$Custom75Field)
            || ($filfield3==$Custom76Field) || ($filfield3==$Custom77Field) ||($filfield3==$Custom78Field) ||($filfield3==$Custom79Field) ||($filfield3==$Custom80Field)
            || ($filfield3==$Custom81Field) || ($filfield3==$Custom82Field) ||($filfield3==$Custom83Field) ||($filfield3==$Custom84Field) ||($filfield3==$Custom85Field)
            || ($filfield3==$Custom86Field) || ($filfield3==$Custom87Field) ||($filfield3==$Custom88Field) ||($filfield3==$Cus
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by blocblue
0

I don't mean to be rude, but that code is a mess. 7000 lines in a single file? No wonder you're having issues.

Anyhow, that doesn't help you.

The issue could be further up the file, seeing as you have nested if/else statements, etc so I would suggest you use divide and conquer to find the problem.

Comment out or die 1/2 way through the code, ensuring your code is still valid, and check to see if the error disappears. If it does, move down to 3/4 way through and repeat until you find the problem.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.