require './php/mysql.php';
#require './php/access.php';
Global $validatemessage,$bypassresponses,$newinsertHREF,$insertsList,$newsubtutorialHREF,
$subtutorialsList,$subpageID,$subtutorialID,$subtutorialDate,$mylowestsubtutorialID,$subtutorialDeletes;
$db=0;
$db=oc();
$mycookie='_ziToolkitvis'; # echo getenv("HTTP_COOKIE").'
';
$fuserID=get_cookie($mycookie); $specialjs=''; #echo '
'.$fuserID; die;
$setUID=(isset($_GET['u']))?$_GET['u']:'';$setT=(isset($_GET['t']))?$_GET['t']:'';
$fuserID=($setUID)?$setUID:$fuserID; $fuserID=(strlen($fuserID))?$fuserID:0;
$userID=0;
$pageID=(isset($pageID))?$pageID:0;
$giwdirection=0; getinwardlogon();
### inward login redirects
$inwardlogon=($giwdirection==2 && isset($goafterlogin))?$goafterlogin:'';
$inwardlogon=($giwdirection==1 && isset($goafterregister))?$goafterregister:$inwardlogon;
if($inwardlogon){
$nloc=$inwardlogon.((preg_match("/\?/",$inwardlogon))?'&':'?').'t='.$setT.'&u='.$fuserID;
print "\n
\n";} if(($isinner<1) && ($startdiv>0)){$startdiv=0; $result.="
\n'."$s[2]: ".((isset($myGroupNums[$s[2]]))?''.$myGroupNums[$s[2]]:'').'
'; } # end for loop } # end if(isEl($GroupByField)){ # echo count($myGroups); return $return;} ######################################################################## function lzero($i,$n=10){ while(strlen($i)<$n){$i="0$i";} return $i;} ######################################################################## function sortString($ReturnNoOfItems,$TopOrBottomSet,$ScoreValueField,$sortElement1,$SortBy1stOrder,$sortElement2,$SortBy2ndOrder,$ExtraValueField,$mystring){ $mySorts=(array) null; $myxSorts=(array) null; $myOuts=(array) null; $qArray=split('~',$mystring); $myFields=(array) null; $xn=1; while(list($k)=each($qArray)){ $nsort=''; $sort1=''; $sort2=''; $dsort=''; ### default sort is numerical entry point $dsort=lzero($xn); $myOuts[$xn]=$qArray[$k]; $rArray=split('\|',$qArray[$k]); if(isset($rArray[1])){ $r=rawurldecode($rArray[1]); $vArray=split('\|',$r); if(count($vArray)==4){ ## so has elements for($x=0;$x<4;$x++){$vArray[$x]=trim($vArray[$x]);} ### top or bottom sort if(strlen(trim($TopOrBottomSet)) && isEl($ScoreValueField)){ $nsort=(isInt($vArray[$ScoreValueField-1]))?lzero($vArray[$ScoreValueField-1]):$vArray[$ScoreValueField-1];} if(isEl($sortElement1)){$sort1=$vArray[$sortElement1-1];} if(isEl($sortElement2)){$sort2=$vArray[$sortElement2-1];} } # end if(count($vArray)==4) $nl="$nsort|$sort1|$sort2|$dsort|$xn"; #echo $nl.''.$label; if(isEl($ExtraValueField)){$return.=": ".''.$s[3];} $return.='
';} # end if(trim($s[0])){ } ### end for loop if(isEl($GroupByField)){$return=''; ### sort groups !! if((isEl($sortElement1) && $sortElement1==$GroupByField) || (isEl($sortElement2) && $sortElement2==$GroupByField)){ $sorder=($sortElement1==$GroupByField)?$SortBy1stOrder:$SortBy2ndOrder; if(preg_match("/DESC/i",$sorder)){rsort($myGroups); } else {sort($myGroups);} } ## end if((isEl($sortElement1) && $sortElement1 etc #echo "$GroupByField,$sortElement1,$SortBy1stOrder,$sortElement2,$SortBy2ndOrder'.$label; if(isEl($ExtraValueField)){$return.=": ".''.$s[3];} $return.='
';} # end if$label{ } # end for loop $y } # end if(isset($myGroupVals[$l])){ } # end if(trim($myGroups[$x])){ } # end for loop $x } # end if(isEl($GroupByField)){ # echo count($myGroups); return $return;} ######################################################################## function getNumber($v){ $v=preg_replace("/[^[0-9]\.\-]/",'',$v); $v=preg_replace("/\.+/",'.',$v); $v=preg_replace("/\-+/",'-',$v); $v=preg_replace("/^([0-9\-]*\.[0-9\-]*)\..*/","$1",$v); $v=preg_replace("/([0-9\-]+)\-.*/","$1",$v); if(!preg_match("/[1-9]/",$v)){$v=0;} return $v;} ######################################################################## function IScalculate($c=''){ Global $DATABASE,$_POST; $DCAT=array(); $PCAT=array(); $c=preg_replace("/ +/",'',$c); $c=preg_replace("/\[[\'\"]/",'[',$c); $c=preg_replace("/[\'\"]\]/",']',$c); #$c=preg_replace("/\/D\[([^\]]+)\]/","/((isset(\$DATABASE['$1']))?\$DATABASE['$1']:1)",$c); $x=0; while(preg_match("/D\[([^\]]+)\]/",$c,$g)){ $DCAT['ZX'."$x".'XZ']=$g[1]; $c=preg_replace("/D\[([^\]]+)\]/",'ZX'."$x".'XZ',$c,1); $x++;} $x=0; while(preg_match("/P\[([^\]]+)\]/",$c,$g)){ $PCAT['PX'."$x".'XP']=$g[1]; $c=preg_replace("/P\[([^\]]+)\]/",'PX'."$x".'XP',$c,1); $x++;} while(list($k)=each($DCAT)){ $v=(isset($DATABASE[$DCAT[$k]]))?$DATABASE[$DCAT[$k]]:0; $v=getNumber($v); $c=preg_replace("/$k/","$v",$c);} while(list($k)=each($PCAT)){ $v=(isset($_POST[$PCAT[$k]]))?$_POST[$PCAT[$k]]:0; $v=getNumber($v); $c=preg_replace("/$k/","$v",$c);} $c=preg_replace("/\/([\-]*)0([^\.])/","/$1 1$2",$c); $c=preg_replace("/ +/",'',$c); $a='IScalculate input incorrect'; error_reporting(0); eval('$a='.$c.';'); return $a;} ############## function isVal($i){$x=(preg_match("/^[1-9][0-9]*$/",$i))?1:0;return $x;} function isInt($i){$x=(preg_match("/^[0-9]+$/",$i))?1:0;return $x;} function isEl($i){$x=(preg_match("/^[1-4]$/",$i))?1:0;return $x;} ############## function goLog($nLoc){ echo "\n \n\n