....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 195.3.193.33  /  Your IP : 216.73.216.125
Web Server : Apache
System : Linux server3 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User : web032 ( 1035)
PHP Version : 7.3.33
Disable Function : show_source, highlight_file, apache_child_terminate, apache_get_modules, apache_note, apache_setenv, virtual, dl, disk_total_space, posix_getpwnam, posix_getpwuid, posix_mkfifo, posix_mknod, posix_setpgid, posix_setsid, posix_setuid, posix_uname, proc_nice, openlog, syslog, pfsockopen
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/web032/html/subdomain/test/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/web032/html/subdomain/test/scripts/fh_manager.php
<?php

$cgiDir = $nof_rootDir ."/". $nof_scriptDir;
$componentid = $nof_componentId;
$xmlPropertyFile   = $cgiDir . "/" . $nof_scriptInterfaceFile;


if (NOF_fileExists($cgiDir . '/fh_xmlparser.php')) {
      require_once($cgiDir . '/fh_xmlparser.php');
} else {
      exit();
}

$conf          = "";
$fieldsDBArray = "";
$errorLabel    = "";
$errorField    = "";
$firstLineUD   = "";
$MCompIdent    = "";

$commonPath    = $cgiDir . "/fh_common.php";
$formName      = "form".$nof_componentId;



if (NOF_fileExists($commonPath)) {
      require_once($commonPath);
} else {
      exit();
}
?>
<div style="width:500px;" id="errorshow"></div>
<script type="text/javascript">
    function fh_changePage(op) {
    	document.<?=$formName?>.fhpageoperation.value = op;
    	document.<?=$formName?>.submit();

    }

    function fh_changeOp(op) {
    	document.<?=$formName?>.fhoperation.value = op;
    	//document.<?=$formName?>.submit();

    }
</script>
<?


//read the XML property file
$conf = fhParseXmlFile($xmlPropertyFile);

if(!isset($componentid)) {
      NOF_throwError(800,array("{1}"=>"componentid","{2}"=>$nof_suiteName));
      exit();
}


$MCompIdent = "manager" . "."  . $componentid . ".";

$tmp_DBname = $conf[$MCompIdent . "dbPath"];

//TODO: have to get this from xml or post
$FHID = getFHID($conf[$MCompIdent . "dbPath"]);
if($FHID == -1) {
    NOF_throwError(602,array("{1}"=>$nof_suiteName,"{2}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"])));
    exit();
}
$FHCompIdent = "formshandler." . $FHID . ".";



//add the cgi-bin path ahead of the DB file name if its a pure file name without whole path
//(when the file path is just a name its asssumed that its in cgi-bin)
if( !preg_match("/^\//" , $conf[$MCompIdent . 'dbPath'])
   && !preg_match('/[a-z]\:\//i' , $conf[$MCompIdent . 'dbPath'])
   && !preg_match('/[a-z]\:(\\\\)/i' , $conf[$MCompIdent . 'dbPath'])   ) {
          $conf[$MCompIdent . 'dbPath']=$cgiDir . "/" . $conf[$MCompIdent . 'dbPath'];
}
/*
if( !preg_match("/\//" , $conf[$MCompIdent . "dbPath"]) && !preg_match('/(\\\\)/' , $conf[$MCompIdent . "dbPath"])   ) {
      $conf[$MCompIdent . "dbPath"]=$cgiDir . "/" . $conf[$MCompIdent . "dbPath"];
}
*/


//get the names of fields present in the database
getExpectedDBFields($FHCompIdent);



if ($conf[$MCompIdent . "writeToDB"]!="false") {
    if (!file_exists(dirname($conf[$MCompIdent . "dbPath"]))) {
        NOF_throwError(540,array("{1}"=>dirname(NOF_mapPath($conf[$MCompIdent . "dbPath"])),"{2}"=>NOF_mappath(getcwd())));
    }

//    if (!is_writable(dirname($conf[$MCompIdent . "dbPath"]))) {
//        NOF_throwError(541,array("{1}"=>dirname(NOF_mapPath($conf[$MCompIdent . "dbPath"])),"{2}"=>NOF_mappath(getcwd())));
//    }
    //if DB does not exist or if first line of dbColumns.db(column headings
    //does not match first line of DB meaning that
    //the file has to be created/overwritten with new columns from dbColumns.db
    if( !checkIfDBmatch($MCompIdent) ) {
        //open DB file for writing
        if (!$FILE = @fopen($conf[$MCompIdent . "dbPath"], 'wb')) {
            NOF_throwError(500,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
            exit();
        }

        //write first line of UD file, to the DB file
        if (!fputs($FILE, "$firstLineUD\n")) {
            NOF_throwError(502,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
            exit();
        }
        fclose($FILE);
    }
}

if ( GetPostVariable("fhpageoperation")=='' ) {
      SetPostVariable("fhpageoperation", "");
}

$fh_var["begin"] = 1;
if ( GetPostVariable("begin")!='' ) {
      $fh_var["begin"] = GetPostVariable("begin");
}

if ( GetPostVariable("fhpageoperation")=='Next' ) {
      $fh_var["begin"] = $fh_var["begin"] + 10;
} elseif( GetPostVariable("fhpageoperation")=='Prev') {
      $fh_var["begin"] = $fh_var["begin"] - 10;
} elseif( GetPostVariable("fhpageoperation")=='First' ) {
      $fh_var["begin"] = 1;
} elseif( GetPostVariable("fhpageoperation")=='Last' ) {
      $fh_var["begin"] = -100;
      fhDisplayLastEntriesList();
}


//if no operation was passed (meaning page is loaded the first time)
if( GetPostVariable("fhoperation") == '' )  {
      //display upto 10 entries beginning from 1
      if($fh_var["begin"] > -90){ fhDisplayEntriesList($fh_var["begin"]); }
} elseif( GetPostVariable("fhoperation")=='delete' && GetPostVariable("begin")!='' ) { //if remove entry button was pressed
      //the entry selected in the radio group
      if( GetPostVariable("radiogroup")!='' ) {
            //get the numer of the entry that needs to removed
            $entryToBeRemoved = GetPostVariable("radiogroup");
            //remove the entry
            fhRemoveEntry($entryToBeRemoved);
      }
      //display upto 10 entries from $_POST["begin"]
      fhDisplayEntriesList(GetPostVariable("begin"));
} elseif ( GetPostVariable("fhoperation")=='view' && GetPostVariable("begin")!='' ) { //if View button was pressed
      //the user name selected in the radio group
      if( GetPostVariable("radiogroup")!='' ) {
            //get the numer of the entry that needs to removed
            $entryToBeViewed = GetPostVariable("radiogroup");
            //display details of the selected user
            fhDisplayEntryDetails($entryToBeViewed, GetPostVariable("begin"));
      }
} elseif ( GetPostVariable("fhoperation")=='edit' && GetPostVariable("begin")!='' ) { //if Edit button was pressed
      //the user name selected in the radio group
      if( GetPostVariable("radiogroup")!='' ) {
            //get the numer of the entry that needs to removed
            $entryToBeEdited = GetPostVariable("radiogroup");
            //display details of the selected user
            fhDisplayEditEntry($entryToBeEdited, GetPostVariable("begin"));
      }
} elseif ( GetPostVariable("fhoperation")=='add' && GetPostVariable("begin")!='' ) { //if add user button was pressed
      //display add user form
      fhDisplayAddEntry(GetPostVariable("begin"));
} elseif( GetPostVariable("fhoperation")=='back' && GetPostVariable("begin")!='' ) { //if back to entries list was pressed
      //display the list of entries from "begin"
      fhDisplayEntriesList(GetPostVariable("begin"));
} elseif( GetPostVariable("fhoperation")=='reset' && GetPostVariable("entrytobeedited")!='' ) { //if Reset was pressed
      //display the edit form
      fhDisplayEditEntry(GetPostVariable("entrytobeedited"), GetPostVariable("begin"));
} elseif ( GetPostVariable("fhoperation")=='saveentry' && GetPostVariable("entrytobeedited")!='' ) { //if save entry button was pressed
      $errorFlag=FALSE;
      //if the required parameters were unfilled
      if ( fhCheckIfRequiredUnfilled() ) {
            //display the error
            fhDisplayError($errorLabel,$errorField);
            //display the edit form filled with previous values
            fhDisplayEditEntryError(GetPostVariable("entrytobeedited"), GetPostVariable("begin"), $errorField);
            exit();
      }

      //if fields are not within their length limitations
      if( fhCheckIfFieldsLengthInvalid() ) {
            $errorFlag=TRUE; //set error flag to true
      }

      //on error
      if( $errorFlag ) {
            //display the error
            fhDisplayError($errorLabel,$errorField);
            //display the edit form with previous values filled
            fhDisplayEditEntryError(GetPostVariable("entrytobeedited"),GetPostVariable("begin"), $errorField);
            exit();
      } else {  //if no errors were encountered in user input
            //change the entry details
            fhChangeEntry(GetPostVariable("entrytobeedited"));
            //display success message
            fhDisplaySuccessMessage($GLOBALS['nof_resources']->get('FH.Manager.Text.EditSuccess'));
            //display the edit entry form with the changed details
            fhDisplayEditEntry(GetPostVariable("entrytobeedited"), GetPostVariable("begin"));
            exit();
      }
} elseif ( GetPostVariable("fhoperation")=='addentry' && GetPostVariable("begin")!='' ) {
      //if add user button was pressed
      $errorFlag=FALSE;

      //if the required parameters were unfilled
      if ( fhCheckIfRequiredUnfilled() ) {
            //display error at the top
            fhDisplayError($errorLabel,$errorField);
            //display the add form with previous values filled
            fhDisplayAddEntryError(GetPostVariable("begin"), $errorField);
            exit();
      }
      //if fields are not within their length limitations
      if( fhCheckIfFieldsLengthInvalid() ) {
            $errorFlag=TRUE; //set error flag
      }

      //if uploaded files had any errors
      if( checkIfUploadedFilesInvalid($FHCompIdent) ) {
            $errorFlag=TRUE; //set error flag to true
      }
      //on error
      if( $errorFlag ) {
            //display error at the top
            fhDisplayError($errorLabel,$errorField);
            //display the add form with the previous values filled
            fhDisplayAddEntryError(GetPostVariable("begin"), $errorField);
            exit();
      } else {
            //if no errors were encountered in user input
            //store the uploaded file in the directory specified in the property file
            getUploadedFile($MCompIdent);
            //add the new entry to the end of the DB file
            fhInsertInDB();
            //display the successmessage
            fhDisplaySuccessMessage($GLOBALS['nof_resources']->get('FH.Manager.Text.AddSuccess'));
            //display the last entries of the DB
            fhDisplayLastEntriesList();
            exit();
      }
}




//function to remove a particular entry from the DB
function fhRemoveEntry($entryToBeRemoved) {
      global $conf,$cgiDir,$MCompIdent;

      //get the db in an array
      if(!$lines = @file($conf[$MCompIdent . "dbPath"])) {
            NOF_throwError(501,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
            exit();
      }

      //open db file for writing
      if (!$FILE = @fopen($conf[$MCompIdent. "dbPath"], 'wb')) {
            NOF_throwError(502,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
            exit();
      }

      //dump into the file all lines except where the user to be removed was found
      for( $i=0; $i<count($lines); $i++ ) {
            if($i!=$entryToBeRemoved) {
                  if (!fputs($FILE, $lines[$i]) ) {
                        NOF_throwError(502,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
                        exit();
                  }
            }
      }
}


//function to display upto 10 entries from $begin
function fhDisplayEntriesList($begin) {
      global $conf,$fieldsDBArray,$MCompIdent,$formName;

      //get the whole database in an array
      if(!$lines = @file($conf[$MCompIdent. "dbPath"])) {
            NOF_throwError(501,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
            exit();
      }

      if ($begin >= count($lines)) {
            $begin = $begin -10;
      }

      if ($begin < 1 ) {
            $begin = 1;
      }

      //begin form
      echo "<FORM NAME=\"$formName\" TARGET=\"_self\" ACTION=\"" . GetServerVariable('PHP_SELF') . "\"  METHOD=\"POST\">" . "\r\n";

      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"begin\" VALUE=\"" . $begin . "\">" . "\r\n";
      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"fhpageoperation\" value=\"\">" . "\r\n";
      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"fhoperation\" value=\"\">" . "\r\n";

      echo "<TABLE BGCOLOR=\"#C3C3C3\" BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"5\">" . "\r\n";

      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<TD ALIGN=\"center\" COLSPAN=\"6\">" . "\r\n";
      echo "<b>".$GLOBALS['nof_resources']->get('FH.Manager.Text.BrowseEntries')."</b>" . "\r\n";
      echo "</TD>" . "\r\n";
      echo "</TR>" . "\r\n";

      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<td><b>&nbsp;</b></TD>" . "\r\n";
      //print the column names
      $noofcols=min(5,count($fieldsDBArray));
      for($i=0;$i<$noofcols;$i++) {
            echo "<td ALIGN=\"center\"><b>" . ucfirst(strtolower($fieldsDBArray[$i])) . "</b></TD>" . "\r\n";
      }
      echo "</TR>" . "\r\n";
      $end = min(count($lines),$begin+10);
      //display 10 entries from beginning
      for( $i=$begin; $i< $end; $i++ ) {
            echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
            echo "<TD>";
            //display the radio button
            if($i==$begin) { //if its the first row
                  //make the radio button be checked
                  echo "<input type=\"radio\" name=\"radiogroup\" value=\"" . $i ."\" CHECKED>" . "\r\n";
            } else {  //if not the first user
                  //make the radio button unchecked
                  echo "<input type=\"radio\" name=\"radiogroup\" value=\"" . $i ."\">" . "\r\n";
            }
            echo "</TD>" . "\r\n";
            //display each column entry for the row
                  $noofcols=min(5,count($fieldsDBArray));
                  for($j=0;$j<$noofcols;$j++) {
                        $field = getField(getColumnPos($fieldsDBArray[$j]),$lines[$i]);
                        echo "<TD align=\"left\">";
                        echo fhHrefSurroundIfFile($fieldsDBArray[$j],$field);
                        echo "</TD>" . "\r\n";
                  }
                  echo "</TR>" . "\r\n";
      }

      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<td ALIGN=\"CENTER\" COLSPAN=\"6\">" . "\r\n";
      //add entry button
      if ($conf[$MCompIdent . "writeToDB"]=="false") {
            $canedit = "disabled";
      } else {
            $canedit = "";
      }
      echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('add');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.add')."\" $canedit>&nbsp;&nbsp;" . "\r\n";
      if($end<=1) { //if there are not entries in the database
            //make the view details, edit entry and remove entry buttons disabled
            echo "<INPUT TYPE=\"BUTTON\" DISABLED VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.edit')."\" $canedit>&nbsp;" . "\r\n";
            echo "<INPUT TYPE=\"BUTTON\" DISABLED VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.view')."\">&nbsp;&nbsp;" . "\r\n";
            echo "<INPUT TYPE=\"BUTTON\" DISABLED VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.delete')."\" $canedit>" . "\r\n";
      } else {  // if there are entries in the database
            //make the view details, edit entry and remove entry buttons as enabled
            echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('edit');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.edit')."\" $canedit>&nbsp;&nbsp;" . "\r\n";
            echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('view');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.view')."\">&nbsp;&nbsp;" . "\r\n";
            echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('delete');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.delete')."\" $canedit>" . "\r\n";
      }
      echo "</TD>" . "\r\n";
      echo "</TR>" . "\r\n";
      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<TD ALIGN=\"center\" COLSPAN=\"6\">" . "\r\n";
      echo "<TABLE BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"2\" WIDTH=\"90%\">" . "\r\n";
      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<TD ALIGN=\"left\">";
      if($begin > 1) {
            echo "<A HREF=\"#\" target=\"_self\" ONCLICK=\"fh_changePage('First');\">".$GLOBALS['nof_resources']->get('FH.Manager.Link.FirstPage')."</A>&nbsp;&nbsp;";
            echo "<A HREF=\"#\" target=\"_self\" ONCLICK=\"fh_changePage('Prev');\">".$GLOBALS['nof_resources']->get('FH.Manager.Link.PreviousPage')."</A>";
      } else {
            echo $GLOBALS['nof_resources']->get('FH.Manager.Link.FirstPage')."&nbsp;&nbsp;";
            echo $GLOBALS['nof_resources']->get('FH.Manager.Link.PreviousPage');
      }
      echo "</TD>" . "\r\n";
      echo "<TD ALIGN=\"right\">";

      if($end < count($lines)) {
            echo "<A HREF=\"#\" target=\"_self\" ONCLICK=\"fh_changePage('Next');\">".$GLOBALS['nof_resources']->get('FH.Manager.Link.NextPage')."</A>&nbsp;&nbsp;" ;
            echo "<A HREF=\"#\" target=\"_self\" ONCLICK=\"fh_changePage('Last');\">".$GLOBALS['nof_resources']->get('FH.Manager.Link.LastPage')."</A>" ;
      } else {
            echo $GLOBALS['nof_resources']->get('FH.Manager.Link.NextPage')."&nbsp;&nbsp;";
            echo $GLOBALS['nof_resources']->get('FH.Manager.Link.LastPage');
      }

      echo "</TD>" . "\r\n";
      echo "</TR>" . "\r\n";
      echo "</TABLE>" . "\r\n";
      echo "</TD>" . "\r\n";
      echo "</TR>" . "\r\n";
      echo "</TABLE>" . "\r\n";
      echo "</FORM>" . "\r\n";
}


//function to display the last page of entries
function fhDisplayLastEntriesList() {
      global $conf,$fieldsDBArray,$MCompIdent,$formName;
      //get the whole database in an array
      if(!$lines = @file($conf[$MCompIdent . "dbPath"])) {
            NOF_throwError(501,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
            exit();
      }
      //set begin
      $begin=count($lines) - (count($lines)-1)%10;
      if ($begin < 1 ) {
            $begin = 1;
      }
      if ($begin >= count($lines)) {
            $begin = $begin -10;
      }

      //begin form
      echo "<FORM NAME=\"$formName\" TARGET=\"_self\" ACTION=\"" . GetServerVariable('PHP_SELF') . "\"  METHOD=\"POST\">" . "\r\n";
      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"fhpageoperation\" value=\"\">" . "\r\n";
      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"begin\" VALUE=\"" . $begin . "\">" . "\r\n";
      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"fhoperation\" value=\"\">" . "\r\n";

      echo "<TABLE BGCOLOR=\"#C3C3C3\" BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"5\">" . "\r\n";
      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<TD ALIGN=\"center\" COLSPAN=\"6\">" . "\r\n";
      echo "<b>".$GLOBALS['nof_resources']->get('FH.Manager.Text.BrowseEntries')."</b>" . "\r\n";
      echo "</TD>" . "\r\n";
      echo "</TR>" . "\r\n";

      echo "<tr bgcolor=\"#E3E3E3\">" . "\r\n";
      echo "<td><b>&nbsp;</b></td>" . "\r\n";
      //print the column names
            $noofcols=min(5,count($fieldsDBArray));
            for($i=0;$i<$noofcols;$i++) {
                  echo "<td align=\"center\"><b>" . ucfirst(strtolower($fieldsDBArray[$i])) . "</b></td>" . "\r\n";
            }

            $end = min(count($lines),$begin+10);
            //display 10 entries from beginning
            for( $i=$begin; $i< $end; $i++ ) {

                  echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
                  echo "<TD>";
                  if($i==$begin) {
                        echo "<input type=\"radio\" name=\"radiogroup\" value=\"" . $i ."\" CHECKED>" . "\r\n";
                  } else {
                        echo "<input type=\"radio\" name=\"radiogroup\" value=\"" . $i ."\">" . "\r\n";
                  }
                  echo "</TD>" . "\r\n";

                  $noofcols=min(5,count($fieldsDBArray));
                  for($j=0;$j<$noofcols;$j++) {
                        $field = getField(getColumnPos($fieldsDBArray[$j]),$lines[$i]);
                        echo "<TD align=\"left\">";
                        echo fhHrefSurroundIfFile($fieldsDBArray[$j],$field);
                        echo "</TD>";
                  }

                  echo "</TR>" . "\r\n";
            }

            echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
            echo "<td ALIGN=\"CENTER\" COLSPAN=\"6\">";
            //add entry button
            echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('add');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.add')."\">&nbsp;&nbsp;";
            if($end<=1) { //if there are not entries in the database
                  //make the view details, edit entry and remove entry buttons disabled
                  echo "<INPUT TYPE=\"BUTTON\" DISABLED VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.edit')."\">&nbsp;";
                  echo "<INPUT TYPE=\"BUTTON\" DISABLED VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.view')."\">&nbsp;&nbsp;";
                  echo "<INPUT TYPE=\"BUTTON\" DISABLED VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.delete')."\">";
            } else {  // if there are entries in the database
                  //make the view details, edit entry and remove entry buttons as enabled
                  echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('edit');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.edit')."\">&nbsp;&nbsp;";
                  echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('view');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.view')."\">&nbsp;&nbsp;";
                  echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('delete');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.delete')."\">";
            }
            echo "</TD>" . "\r\n";
            echo "</TR>" . "\r\n";

            echo "<TR BGCOLOR=\"#E3E3E3\">";
            echo "<TD ALIGN=\"center\" COLSPAN=\"6\">";
            echo "<TABLE BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"2\" WIDTH=\"90%\">";
            echo "<TR BGCOLOR=\"#E3E3E3\">";
            echo "<TD ALIGN=\"left\">";
            if($begin > 1) {
                  echo "<A HREF=\"#\" target=\"_self\" ONCLICK=\"fh_changePage('First');\">".$GLOBALS['nof_resources']->get('FH.Manager.Link.FirstPage')."</A>&nbsp;&nbsp;" ;
                  echo "<A HREF=\"#\" target=\"_self\" ONCLICK=\"fh_changePage('Prev');\">".$GLOBALS['nof_resources']->get('FH.Manager.Link.PreviousPage')."</A>" ;
            } else {
                  echo $GLOBALS['nof_resources']->get('FH.Manager.Link.FirstPage')."&nbsp;&nbsp;";
                  echo $GLOBALS['nof_resources']->get('FH.Manager.Link.PreviousPage') ;
            }

            echo "</TD>";
            echo "<TD ALIGN=\"right\">";

            if($end < count($lines)) {
                  echo "<A HREF=\"#\" target=\"_self\" ONCLICK=\"fh_changePage('Next');\">".$GLOBALS['nof_resources']->get('FH.Manager.Link.NextPage')."</A>&nbsp;&nbsp;" ;
                  echo "<A HREF=\"#\" target=\"_self\" ONCLICK=\"fh_changePage('Last');\">".$GLOBALS['nof_resources']->get('FH.Manager.Link.LastPage')."</A>" ;
            } else {
                  echo $GLOBALS['nof_resources']->get('FH.Manager.Link.NextPage')."&nbsp;&nbsp;";
                  echo $GLOBALS['nof_resources']->get('FH.Manager.Link.LastPage');
            }

            echo "</TD>";
            echo "</TR>" . "\r\n";
            echo "</TABLE>" . "\r\n";
            echo "</TD>";
            echo "</TR>" . "\r\n";
            echo "</TABLE>" . "\r\n";
            echo "</FORM>" . "\r\n";
}



//function to display form to edit entry details
function fhDisplayEditEntry($entryToBeEdited,$begin) {

      global $conf,$cgiDir,$fieldsDBArray,$MCompIdent,$formName;

      //get the db in an array
      if(!$lines = @file($conf[$MCompIdent. "dbPath"])) {
            NOF_throwError(501,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
            exit();
      }

      //begin form
      echo "<FORM NAME=\"$formName\"   TARGET=\"_self\" ACTION=\"" . GetServerVariable('PHP_SELF') . "\"  METHOD=\"POST\">" . "\r\n";

      //begin table
      echo "<TABLE BGCOLOR=\"#C3C3C3\" BORDER=\"1\" CELLPADDING=\"0\" CELLSPACING=\"5\">" . "\r\n";

      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<TD ALIGN=\"CENTER\" COLSPAN=\"2\">";
      echo "<b>".$GLOBALS['nof_resources']->get('FH.Manager.Title.editentry')."</b>";
      echo "</TD>" . "\r\n";
      echo "</TR>" . "\r\n";

      //printout details of the entry
      for($i=0;$i<count($fieldsDBArray);$i++) {
            echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
            echo "<td><b>" . $fieldsDBArray[$i] . "</b></td>";

            echo "<td><INPUT TYPE=\"TEXT\" NAME=\"" . $fieldsDBArray[$i] . "\""
            . "VALUE=\""
            . getField(getColumnPos($fieldsDBArray[$i]),$lines[$entryToBeEdited])
            . "\"></td>";

            echo "</TR>" . "\r\n";
      }

      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<TD ALIGN=\"center\" COLSPAN=\"2\">";
      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"fhoperation\" value=\"\">" . "\r\n";
      echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('saveentry');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.saveentry')."\">&nbsp;&nbsp;&nbsp;";
      echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('reset');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.reset')."\">&nbsp;&nbsp;&nbsp;";
      echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('back');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.back')."\">";
      echo "</TD>" . "\r\n";
      echo "</TR>" . "\r\n";
      echo "</TABLE>" . "\r\n";

      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"begin\" VALUE=\"" . $begin . "\">" . "\r\n";
      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"entrytobeedited\" VALUE=\"" . $entryToBeEdited . "\">" . "\r\n";
      echo "</FORM>" . "\r\n";

}




//function to display form to view entry details
function fhDisplayEntryDetails($entryToBeViewed,$begin) {

      global $conf,$cgiDir,$fieldsDBArray,$MCompIdent,$formName;

      //get the db in an array
      if(!$lines = @file($conf[$MCompIdent. "dbPath"])) {
            NOF_throwError(501,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
            exit();
      }

      //begin form
      echo "<FORM NAME=\"$formName\"   TARGET=\"_self\" ACTION=\"" . GetServerVariable('PHP_SELF') . "\"  METHOD=\"POST\">" . "\r\n";

      //begin table
      echo "<TABLE BGCOLOR=\"#C3C3C3\" BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"5\">" . "\r\n";
      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<TD ALIGN=\"CENTER\" COLSPAN=\"2\">";
      echo "<b>".$GLOBALS['nof_resources']->get('FH.Manager.Title.viewentry')."</b>";
      echo "</TD>" . "\r\n";
      echo "</TR>" . "\r\n";

      //printout details of the entry
      for($i=0;$i<count($fieldsDBArray);$i++) {
            echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
            echo "<td><b>" . ucfirst(strtolower($fieldsDBArray[$i])) . "</b></td>" . "\r\n";

            echo "<td>"
            . fhHrefSurroundIfFile($fieldsDBArray[$i],getField(getColumnPos($fieldsDBArray[$i]),$lines[$entryToBeViewed]))
            ."</td>" . "\r\n";

            echo "</TR>" . "\r\n";
      }

      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<td align=\"center\" colspan=\"2\">";
      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"fhoperation\" value=\"\">" . "\r\n";
      echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('back');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.back')."\"></TD>";
      echo "</TR>" . "\r\n";

      echo "</TABLE>" . "\r\n";
      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"begin\" VALUE=\"" . $begin . "\">";

      echo "</FORM>" . "\r\n";
}




//function to display form to add an entry to the db
function fhDisplayAddEntry($begin) {

      global $conf,$cgiDir,$fieldsDBArray,$formName;

        //begin form
      echo "<FORM NAME=\"$formName\"   TARGET=\"_self\" ACTION=\"" . GetServerVariable('PHP_SELF') . "\"  METHOD=\"POST\" enctype=\"multipart/form-data\">" . "\r\n";

        //begin table
      echo "<TABLE BGCOLOR=\"#C3C3C3\" BORDER=\"1\" CELLPADDING=\"0\" CELLSPACING=\"5\">" . "\r\n";

      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<TD ALIGN=\"CENTER\" COLSPAN=\"2\">";
      echo "<b>".$GLOBALS['nof_resources']->get('FH.Manager.Title.addentry')."</b>";
      echo "</TD>" . "\r\n";
      echo "</TR>" . "\r\n";

      //display the textfields with names same as the columns of db
      for($i=0;$i<count($fieldsDBArray);$i++) {
            echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
            echo "<td><b>" . ucfirst(strtolower($fieldsDBArray[$i])) . "</b></td>" . "\r\n";
            //if its a file field
            if(fhIsFileField($fieldsDBArray[$i])) {
                  echo "<td><INPUT TYPE=\"FILE\" NAME=\""
                   . $fieldsDBArray[$i] . "\""
                   . "VALUE=\"\"></td>";

            } else { //for all other fields
                 echo "<td><INPUT TYPE=\"TEXT\" NAME=\""
                   . $fieldsDBArray[$i] . "\""
                   . "VALUE=\"\"></td>";
            }
            echo "</tr>" . "\r\n";
      }

      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<TD colspan=\"2\" align=\"center\">";
      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"fhoperation\" value=\"\">" . "\r\n";
      echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('addentry');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.addentry')."\">&nbsp;&nbsp;&nbsp;";
      echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('back');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.back')."\">";
      echo "</TD>" . "\r\n";
      echo "</TR>" . "\r\n";

      //end table
      echo "</TABLE>" . "\r\n";

      echo "<INPUT TYPE=HIDDEN NAME=\"begin\" VALUE=\"" . $begin . "\">" . "\r\n";

      echo "</FORM>" . "\r\n";
}


function fhDisplayAddEntryError($begin,$errorField) {
      global $conf,$cgiDir,$fieldsDBArray,$formName;

      $errorFields = explode(",",$errorField);

        //begin form
      echo "<FORM NAME=\"$formName\"   TARGET=\"_self\" ACTION=\"" . GetServerVariable('PHP_SELF') . "\"  METHOD=\"POST\" enctype=\"multipart/form-data\">" . "\r\n";

        //begin table
      echo "<TABLE BGCOLOR=\"#C3C3C3\" BORDER=\"1\" CELLPADDING=\"0\" CELLSPACING=\"5\">" . "\r\n";

      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<TD ALIGN=\"CENTER\" COLSPAN=\"3\">";
      echo "<b>".$GLOBALS['nof_resources']->get('FH.Manager.Title.addentry')."</b>";
      echo "</TD>" . "\r\n";
      echo "</TR>" . "\r\n";
      //printout entry details
      for($i=0;$i<count($fieldsDBArray);$i++) {
            echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
            echo "<td><b>" . $fieldsDBArray[$i] . "</b></td>" . "\r\n";
            if(in_array($fieldsDBArray[$i],$errorFields)) {
                  echo "<td><b>&nbsp;<font color=\"red\" >!</font>&nbsp;</b></td>" . "\r\n";
            } else {
                  echo "<td>&nbsp;&nbsp;&nbsp;</td>" . "\r\n";
            }
            if(!fhIsFileField($fieldsDBArray[$i])) {
                 echo "<td><INPUT TYPE=\"TEXT\" NAME=\""
                 . $fieldsDBArray[$i] . "\""
                  . " VALUE=\"" . escapeString(stripslashes(GetPostVariable($fieldsDBArray[$i]))) ."\"></td>";
            } else {
                 echo "<td><INPUT TYPE=\"FILE\" NAME=\"" . $fieldsDBArray[$i] . "\"" . "VALUE=\"\"></td>" . "\r\n";
            }
            echo "</tr>" . "\r\n";
      }

      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<TD colspan=\"3\" align=\"center\">";
      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"fhoperation\" value=\"\">" . "\r\n";
      echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('addentry');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.addentry')."\">&nbsp;&nbsp;&nbsp;";
      echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('back');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.back')."\">";
      echo "</TD>";
      echo "</TR>";

      //end table
      echo "</TABLE>" . "\r\n";

      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"begin\" VALUE=\"" . $begin . "\">" . "\r\n";

      echo "</FORM>" . "\r\n";
}




function fhDisplayEditEntryError($entryToBeEdited,$begin,$errorField) {
      global $conf,$cgiDir,$fieldsDBArray,$MCompIdent,$formName;

      $errorFields = explode("'",$errorField);

      //get the db in an array
      if(!$lines = @file($conf[$MCompIdent. "dbPath"])) {
            NOF_throwError(501,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
            exit();
      }

      //begin form
      echo "<FORM NAME=\"$formName\" TARGET=\"_self\" ACTION=\"" . GetServerVariable('PHP_SELF') . "\"  METHOD=\"POST\">" . "\r\n";

      //begin table
      echo "<TABLE BGCOLOR=\"#C3C3C3\" BORDER=\"1\" CELLPADDING=\"0\" CELLSPACING=\"5\">" . "\r\n";
      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<TD ALIGN=\"CENTER\" COLSPAN=\"3\">";
      echo "<b>".$GLOBALS['nof_resources']->get('FH.Manager.Title.editentry')."</b>";
      echo "</TD>" . "\r\n";
      echo "</TR>" . "\r\n";

      //printout entry details
      for($i=0;$i<count($fieldsDBArray);$i++) {
            echo "<TR BGCOLOR=\"#E3E3E3\">";
            echo "<td><b>" . ucfirst(strtolower($fieldsDBArray[$i])) . "</b></td>" . "\r\n";
            if(in_array($fieldsDBArray[$i],$errorFields)) {
                  echo "<td><b>&nbsp;<font color=\"red\" >!</font>&nbsp;</b></td>" . "\r\n";
            } else{
                  echo "<td>&nbsp;&nbsp;&nbsp;</td>" . "\r\n";
            }
            echo "<td><INPUT TYPE=\"TEXT\" NAME=\""
            . $fieldsDBArray[$i] . "\""
            . "VALUE=\""
            . escapeString(stripslashes(GetPostVariable($fieldsDBArray[$i]))) . "\"></td>" . "\r\n";

            echo "</tr>" . "\r\n";
      }


      echo "<TR BGCOLOR=\"#E3E3E3\">" . "\r\n";
      echo "<TD align=\"center\" colspan=\"3\">";
      echo "<INPUT TYPE=\"HIDDEN\" NAME=\"fhoperation\" value=\"\">" . "\r\n";
      echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('saveentry');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.saveentry')."\">&nbsp;&nbsp;&nbsp;";
      echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('reset');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.reset')."\">&nbsp;&nbsp;&nbsp;";
      echo "<INPUT TYPE=\"BUTTON\" ONCLICK =\"fh_changeOp('back');document.$formName.submit();\" VALUE=\"".$GLOBALS['nof_resources']->get('FH.Manager.Button.back')."\">&nbsp;&nbsp;&nbsp;";
      echo "</TD>" . "\r\n";
      echo "</TR>" . "\r\n";
      echo "</TABLE>" . "\r\n";

      echo "<INPUT TYPE=HIDDEN NAME=\"begin\" VALUE=\"" . $begin . "\">" . "\r\n";
      echo "<INPUT TYPE=HIDDEN NAME=\"entrytobeedited\" VALUE=\"" . $entryToBeEdited . "\">" . "\r\n";
      echo "</FORM>" . "\r\n";
}



//function to change a particular entry in the DB
function fhChangeEntry($entryToBeChanged) {
      global $conf,$fieldsDBArray,$MCompIdent,$formName;

      //get the db in an array
      if(!$lines = @file($conf[$MCompIdent. "dbPath"])) {
            NOF_throwError(501,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
            exit();
      }

      //make the changed row entry
      $entry="";
      for($i=0;$i<count($fieldsDBArray);$i++) {
            if($entry=="") {
                  $entry = preprocess(GetPostVariable($fieldsDBArray[$i]));
            } else {
                  $entry = $entry . "," .  preprocess(GetPostVariable($fieldsDBArray[$i]));
            }
      }

      //replace the entry in the DB with the new entry
      $lines[$entryToBeChanged]=$entry . "\n";

      //open db file for writing
      if (!$FILE = @fopen($conf[$MCompIdent. "dbPath"], 'wb')) {
            NOF_throwError(502,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
            exit();
      }

      //dump into the db
      for($i=0;$i<count($lines);$i++) {
            if (!fputs($FILE, $lines[$i]) ){
                  NOF_throwError(502,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
                  exit();
            }
      }
      fclose($FILE);
}


//function to see if all required values are filled
function fhCheckIfRequiredUnfilled() {
      global $conf,$FHCompIdent;

      $errorFoundFlag=FALSE;

      $postArr = GetPostVariable('');
      reset($postArr);
      while (list($field, $value) = each ($postArr)) {
            $property = $FHCompIdent . $field . ".errorevent.required.active";
            //if a field is empty and the required property for the field is
            //set in the property file
            if(  preg_match("/^\s*$/",$postArr[$field]) && isset($conf[$property])) {
                  if ($conf[$property]=="true" ) {
                        $label=$FHCompIdent . $field . ".errorevent.required.message" ;
                        clubError($label,$field);
                        $errorFoundFlag=TRUE;
                  }
            }
      }

      $postFiles = GetFileVariable('');
      reset($postFile);
      while(list($field, $value)=each($postFile)) {
            $property = $FHCompIdent . $field . ".errorevent.required.active";
            //if a file field is not filled and the required property for the field is
            //set in the property file
            if( !isset($postFile[$field]['name'])
            || empty($postFile[$field]['name'])
            && isset($conf[$property])) {
                  if ($conf[$property]=="true") {
                        $label=$FHCompIdent . $field . ".errorevent.required.message" ;
                        clubError($label,$field);
                        $errorFoundFlag=TRUE;
                  }

            }
      }

      return $errorFoundFlag;
}


//function to see if the field lengths are within the limits
function fhCheckIfFieldsLengthInvalid() {
      global $conf,$FHCompIdent;

      $errorFoundFlag=FALSE;

      $postArr = GetPostVariable('');
      reset($postArr);
      while( list($field,$value)= each($postArr) ) {

            $shortErrorEventActiveProperty = $FHCompIdent . $field . ".errorevent.short.active";
            //if the short property for the field is set
            if( $postArr[$field]!="" &&
            isset($conf[$shortErrorEventActiveProperty]) ){
                  if ($conf[$shortErrorEventActiveProperty]=="true" ){
                        $minimumLengthProperty = $FHCompIdent . $field . ".errorevent.short.minimumlength";
                        //if the length of the field is lesser than the limit set in
                        //the property file
                        if( preg_match("/^[-+]{0,1}\d+$/" ,$conf[$minimumLengthProperty] ) ) {
                              if( strlen($postArr[$field]) < $conf[$minimumLengthProperty] ) {
                                    clubError($FHCompIdent . $field . ".errorevent.short.message", $field);
                                    $errorFoundFlag=TRUE;
                              }
                        }
                  }
            }

            $longErrorEventActiveProperty = $FHCompIdent . $field . ".errorevent.long.active";
            //if the long property for the field is set
            if(!isset($conf[$longErrorEventActiveProperty])) {
                  $conf[$longErrorEventActiveProperty] = "false";
            }
            if($conf[$longErrorEventActiveProperty]=="true"){
                  $maximumLengthProperty = $FHCompIdent . $field . ".errorevent.long.maximumlength";
                  //if the length of the field is greater than the limit set in
                  //the property file
                  if( preg_match("/^\+{0,1}\d+$/" ,$conf[$maximumLengthProperty] ) ) {
                        if( strlen($postArr[$field]) > $conf[$maximumLengthProperty] ) {
                              clubError($FHCompIdent . $field . ".errorevent.long.message", $field);
                              $errorFoundFlag=TRUE;
                        }
                  }
            }
      }

      return $errorFoundFlag;
}


//display error message
function fhDisplayError($errorLabel,$errorField) {
      global $conf;
      //get the error labels and associated fields in arrays
      $errorLabel = explode(",",$errorLabel);
      //for each error
      echo "<TABLE BORDER=\"0\" WIDTH=\"100%\">" . "\r\n";
      for($i=0;$i< count($errorLabel);$i++) {
            $property = $errorLabel[$i];
            echo "<TR><TD NOWRAP><FONT COLOR=\"red\"><li>" . stripslashes($conf[$property]) . "</li></FONT></TD></TR>" . "\r\n";
      }
      echo "</TABLE>" . "\r\n";
}


//display success message
function fhDisplaySuccessMessage($messg) {
      echo "<TABLE BORDER=\"0\"  WIDTH=\"100%\">" . "\r\n";
      echo "<TR><TD NOWRAP><FONT COLOR=\"blue\">"  . stripslashes($messg) . "</FONT></TD></TR>" . "\r\n";
      echo "</TABLE>" . "\r\n";
}



//function to check if a field is a file type
//and if so make it a link
function fhHrefSurroundIfFile($fieldName,$fieldValue) {
      global $conf,$cgiDir,$MCompIdent;

      //if the fieldvalue is empty return without doing much
      if(empty($fieldValue)) {
            return $fieldValue;
      }

      //if this field is indeed a file type
      if(fhIsFileField($fieldName)) {
            //if this upload directory specified by the user is not an absolute path
            if(!preg_match("/^[a-z]\:/i",$conf[$MCompIdent. "dbFileUploadDir"])
            &&!preg_match("/^\//",$conf[$MCompIdent. "dbFileUploadDir"]) ) {
                  //get the file path relative to the current page
                  $filePath = $cgiDir  ."/"  //this is how we get to the cgi-bin directory from current page
                  . $conf[$MCompIdent. "dbFileUploadDir"]  //this is how we get to upload directory from cgi-bin
                  . "/" . $fieldValue; //finally the filename
                  if(file_exists($filePath)) {
                        //surround by href tags, file preview available only if path is relative to page
                        $filePathHref = "<A HREF=\"javascript:void(0)\" onclick=\"window.open('". $filePath ."','_blank','width=600,height=500,menubar=no,toolbar=no,scrollbars=yes')\">" . basename($fieldValue) . "</A>";
                        return $filePathHref;
                  } else {
                        $filePathHref = "<A HREF=\"javascript:void(0)\" onclick=\"alert('".addslashes(html_entity_decode($GLOBALS['nof_resources']->get('FH.Manager.Text.FileDoesNotExist',array("{1}"=>$filePath))))."');\">" . basename($fieldValue) . "</A>";
                        return $filePathHref;

                  }

            } else {  //if upload directory specified by user is an absolute path
                  //no surrounding by href tag will take place
                  //cause absolute path may not be in the
                  //public_html directory.
                  return $fieldValue;
            }

      } else { //if field was not of type file return field value as it is
            return $fieldValue;
      }

}


//function that takes the upload dir and
//filename and returns the upload path
//also it changes the name of the file in
//the global file array
function fhSetUploadFilePath($dbFileUploadDir,$fileName,$key) {
      global $conf,$cgiDir;

      //if no upload directory was specified then
      //make it the cgi-bin directory
      $dbFileUploadDir= trim($dbFileUploadDir);

      if(!preg_match("/^[a-z]\:/i",$dbFileUploadDir) && !preg_match("/^\//",$dbFileUploadDir)) {
            //if this upload directory specified by the user
            //is a relative path (relative to cgi-bin)
            //make it relative to the page
            $dbFileUploadDir = $cgiDir . "/" . $dbFileUploadDir;
      }

      $uploadFilePath = $dbFileUploadDir . "/" . $fileName;

      $i=1;
      while(file_exists($uploadFilePath)) {
            $fileNameArr =  explode("." , $fileName);
            if(isset($fileNameArr[1])) {
                  $newFileName = $fileNameArr[0] . $i . "." . $fileNameArr[1];
            } else {
                  $newFileName = $fileNameArr[0] . $i;
            }
            $uploadFilePath = $dbFileUploadDir . "/" . $newFileName;
            $postFile = GetFileVariable($key);
            $postFile['name'] = $newFileName;
            $i++;
      }

      return $uploadFilePath;
}



//function that returns true only if a field is a file type
function fhIsFileField($fieldName) {
      global $conf,$FHCompIdent;

      //this property exists only for file fields in the property file
      $property=$FHCompIdent . $fieldName . ".errorevent.invalidextension.active" ;

      //if the property is set then return true
      return isset($conf[$property]);
}



//insert the field values in the DB
function fhInsertInDB() {
      global $conf,$requiredForPassRetv,$fieldsDBArray,$firstLineUD,$MCompIdent;

      //for every expected field in the DB get its value from post request
      for($i=0;$i<count($fieldsDBArray);$i++) {
            //check if the input is of type file
            $postFile = '';
            if ( GetFileVariable($fieldsDBArray[$i])!='' ) { $postFile = GetFileVariable($fieldsDBArray[$i]); }
            if( $postFile != '' ) {
                  //if the input was left blank
                  if ( empty($postFile['name']) ) {
                        $entryAppend = "";
                  } else {
                        //just put the name of the file in the database
                        $entryAppend = $postFile['name'];
                  }
                  if(!isset($entry)) {
                        $entry = '"' . $entryAppend . '"';
                  } else {
                        $entry = $entry . "," .  '"' . $entryAppend . '"';
                  }
            } else {
                  //if input is not of type file
                  $entryAppend = GetPostVariable($fieldsDBArray[$i]);

                  if(!isset($entry)) {
                        $entry = preprocess($entryAppend);
                  } else {
                        $entry = $entry . "," .  preprocess($entryAppend);
                  }

            }

      }

      //open DB file for appending
      if (!$FILE = @fopen($conf[$MCompIdent. "dbPath"], 'ab')) {
            NOF_throwError(502,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
            exit();
      }

      //append entry to the file
      if (!fputs($FILE, "$entry\n")) {
            NOF_throwError(502,array("{1}"=>NOF_mapPath($conf[$MCompIdent . "dbPath"]),"{2}"=>NOF_mapPath(dirname($conf[$MCompIdent . "dbPath"]))));
            exit();
      }
      //close file handle
      fclose($FILE);

}



function getFHID($managerDBPath) {
      global $conf;

      $cmp = -1;
      reset($conf);

      while (list($key,$value) = each($conf)) {
            if(preg_match("/^formshandler\.(\d+)\.dbPath$/",$key,$match)) {
                  if($value == $managerDBPath) {
                        $cmp = $match[1];
                        //return $match[1];
                  }
            }
      }

      return $cmp;
}


?>

Youez - 2016 - github.com/yon3zu
LinuXploit