usr; $pas = $inf->pwd; $ipu = str_replace(' ', '', $inf->ipu); if ($i == 0) { $ipus = $ipu; } else { $ipus = $ipu.','.$ipus; } if ($i == 0) { $string = $use.'=>'.$pas; } else { $string = $use.'=>'.$pas.','.$string; } $i++; } // MAKE ARRAY OF VALID IP'S str_replace(' ', '', $string); $ipus = explode(",",$ipus); // UNSET UNUSEFUL DATA FOR SAFETY unset($use); unset($pas); unset($ipu); // PARSE ABOVE STRING TO ARRAY function string2array( $string, $delimiter = ',', $kv = '=>') { if ($element = explode( $delimiter, $string )) { // create parts foreach ( $element as $key_value ) { // key -> value pair or single value $atom = explode( $kv, $key_value ); if( trim($atom[1]) ) { $key_arr[trim($atom[0])] = trim($atom[1]); } else { $key_arr[] = trim($atom[0]); } } } else { $key_arr = false; } return $key_arr; } $users = string2array($string); // DEFINE ERROR LOG XML FILE $file = 'admin/data/errorlog.xml'; // GET IP CLIENT if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARTDED_FOR'] != '') { $ip = substr(str_replace(":", ".", $_SERVER['HTTP_X_FORWARDED_FOR']),0,14); $errip = 'ip'.str_replace(".", "_", $ip); } else { $ip = substr(str_replace(":", ".", $_SERVER['REMOTE_ADDR']),0,14); $errip = 'ip'.str_replace(".", "_", $ip); } // IPv6: MAKE SURE IN THE USER FILE YOU CONVERT AN IPv6 // TO 14 CHARACTERS AND REPLACE THE ':' FOR '.'. // EXAMPLE: // FROM: 2a02:a46b:dc29:1:fcad:b965:16ae:29c1 // TO: 2a02.a46b.dc29 // GET $errip - NUMBER OF ERRORS -OR- TIME OF LAST ERROR - FROM XML FILE $xml = new SimpleXMLElement($file, 0, true); $err = $xml->$errip; // UNSET ERROR STATUS AFTER 1 HOUR BLOCK if ($err > 2 && $err < time() - 3600) { $xml->$errip = 0; // END IP BLOCK $xmlsave = true; } // LOGIN if (isset($_POST[$user])) { $usrname = trim(strip_tags($_POST[$user])); } else if (isset($_COOKIE[$user])) { $usrname = trim(strip_tags($_COOKIE[$user])); } if (array_key_exists($usrname, $users)) { if (isset($_POST[$pass])) { $pwd = md5(sha1($_POST[$pass])); } else if (isset($_COOKIE[$pass])) { $pwd = $_COOKIE[$pass]; } $pwd = trim(strip_tags($pwd)); if ($users[$usrname] == $pwd) { setcookie($user, $usrname, $expire_day); // SET COOKIE USER $xml->$errip = 0; // END IP BLOCK $xmlsave = true; $login = true; if (!isset($_COOKIE[$pass])) { setcookie($pass, $pwd, $expire_hour); // SET COOKIE PASS $loginexp = date('H:i', strtotime('+1 hour')); // DEFINE DATE COOKIE setcookie($time, $loginexp, $expire_hour); // SET COOKIE LOGIN EXPIRE TIME header('Location: '.$_SERVER['PHP_SELF']); //////////////////////////////////////// REFRESH VOOR JUISTE WEERGAVE SPECIALE KARAKTERS } unset($users); $admin = true; // GET EXTRA USER INFO $usrinfo = 'admin/data/users/'.$usrname.'.xml'; $xmlinfo = new SimpleXMLElement($usrinfo, 0, true); $nmu = $xmlinfo->nmu; $emu = $xmlinfo->emu; } else if (isset($_POST[$pass])) { $errorpwd = 'error'; // WRONG PASS $admin = true; $dump = true; } } else if ($username != false) { $errorusr = 'error'; // WRONG USER $admin = true; $dump = true; } // RE-DEFINE $errip + SET LOGIN ERRORS TO XML FILE if ($dump == true) { $errdate = time(); // SAVE LOGIN ERRORS IN UNIQUE XML FILE $xmllog = new SimpleXMLElement(''); $xmllog->datum = $errdate; $xmllog->ip = $ip; $xmllog->user = $usrname; $xmllog->asXML('admin/data/errorlog/'.$errdate.'.xml'); // UPDATE ERRORLOG.XML $err = $err+1; if ($err == 1 || $err == 2) { $xml->$errip = $err; $xmlsave = true; } else if ($err == 3) { $xml->$errip = $errdate; $xmlsave = true; } } // CHECK IF LOGIN IS BLOCKED if ($xml->$errip > time() - 3600) { $blockip = true; } // SAVE NEW ERROR STATUS IN XML if ($xmlsave == true) { $xml->asXML($file); } // LOGOUT - UNSET PASS COOKIE $sts = $_GET['admin']; if ($sts == 'logout') { setcookie($pass, "", time()-3600); setcookie($time, "", time()-3600); $admin = true; $login = false; } else if ($sts == 'recovered' || $sts == 'changed') { $admin = true; $login = false; } // MAKE TEXTAREAS EDITABLE WHEN LOGGED IN & SET INPUT FIELDS BEHAVIOR if ($login == true) { $x = 'autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"'; } else { $x = 'onfocus="this.blur()" readonly'; } // GET PAGE ID $loc = explode("/", $_SERVER['SCRIPT_NAME']); $tlr = count($loc)-1; $idp = substr($loc[$tlr], 0, 3); // GET XML DATA FOR PRINTING IN WEBSITE $webdata = 'data/website.xml'; if(file_exists($webdata)){ $xml = new SimpleXMLElement($webdata, 0, true); $url = $xml->url; $pages = $xml->pages; $pages = explode(",", $pages); foreach($pages as $page) { $page = str_replace(' ','_',$page); $pga = substr($page, 0, 3); if ($idp == 'ind') { $page = 'index'; $txtpge = 'txtind'; $lnkpge = 'lnkind'; break; } else if ($idp == $pga) { $txtpge = 'txt'.$idp; $lnkpge = 'lnk'.$lnk; $hdn = 'hdn'.$pga; $hdnpga = $xml->$hdn; $hidden = false; if ($hdnpga == 'Y') { // IF PAGE IS HIDDEN $hidden = true; } break; } } $ltst = 1; foreach ($pages as $pge) { $pga = substr($pge, 0, 3); $hdn = 'hdn'.$pga; $hdnpga = $xml->$hdn; if ($hdnpga == 'N') { $ltst++; } } }wti; $wds = $xml->wds; $wkw = $xml->wkw; $pgs = $xml->pages; $lip = $xml->lip; $fbp = $xml->fbp; $igp = $xml->igp; // Block 02 on website $txt02 = $xml->$txtpge; $txt02 = stripslashes(str_replace("\'","'",$txt02)); $txt02 = stripslashes(str_replace("\"","'",$txt02)); if($login==false){$txt02=str_replace("\n","
",$txt02);} $lnk02 = $xml->$lnkpge; } function getBigmenu($page,$pgs) { if ($page != 'profile') { $webdata = 'data/website.xml'; $xml = new SimpleXMLElement($webdata, 0, true); $pgs = explode(",", $pgs); $ltst = 1; foreach ($pgs as $pge) { $pga = substr($pge, 0, 3); $hdn = 'hdn'.$pga; $hdnpga = $xml->$hdn; if ($hdnpga == 'N') { $ltst++; } } if (is_array($pgs)) { $pgs = array_reverse($pgs); } $no = 1; $tot = count($pgs)-1; $idx = $pgs[$tot]; foreach ($pgs as $pge) { $pg_e = str_replace(' ','_',$pge); if ($no == $ltst) { if ($ltst != 1) { $pg_e = 'index'; print ''.$idx.''; break; } } else { // FIRST CHECK IF PAGE IS HIDDEN OR PUBLISHED $pga = substr($pge, 0, 3); $hdn = 'hdn'.$pga; $hdnpga = $xml->$hdn; if ($hdnpga == 'N') { // IF PAGE IS NOT HIDDEN print ''.$pge.''; $no++; } } } } } // MOBILE MENU function getMobmenu($page,$pgs) { if ($page != 'profile') { $webdata = 'data/website.xml'; $xml = new SimpleXMLElement($webdata, 0, true); $pgs = explode(",", $pgs); $ltst = 1; foreach ($pgs as $pge) { $pga = substr($pge, 0, 3); $hdn = 'hdn'.$pga; $hdnpga = $xml->$hdn; if ($hdnpga == 'N') { $ltst++; } } $no = 1; foreach ($pgs as $pge) { $pg_e = str_replace(' ','_',$pge); if ($no == 1) { if ($ltst != 1) { $pg_e = 'index'; print ''.$pge.''; $no++; } } else { // FIRST CHECK IF PAGE IS HIDDEN OR PUBLISHED $pga = substr($pge, 0, 3); $hdn = 'hdn'.$pga; $hdnpga = $xml->$hdn; if ($hdnpga == 'N') { // IF PAGE IS NOT HIDDEN print ''.$pge.''; $no++; } } } } } // SOCIAL MENU function getSocialmenu($lip,$fbp,$igp) { if ($lip != '') { print 'linkedin'; } if ($fbp != '') { print 'facebook'; } if ($igp != '') { print 'instagram'; } } // FUNCTIONS FOR PROFILE IN ADMIN function getMenu($page,$pgs) { if ($page == 'profile') { $webdata = 'data/website.xml'; $xml = new SimpleXMLElement($webdata, 0, true); $pgs = explode(",", $pgs); $no = 1; foreach ($pgs as $pge) { $pg_e = str_replace(' ','_',$pge); print ' '.$no.' '; if ($no != 1) { // FIRST CHECK IF PAGE IS HIDDEN OR PUBLISHED $pga = substr($pge, 0, 3); $hdn = 'hdn'.$pga; $hdnpga = $xml->$hdn; if ($hdnpga == 'N') { print 'Make private'; } else { print 'Make public'; } print '×
Delete '.$pge.'?No!Yep, delete it!
'; } else { print ''; } $no++; } if ($no < 6) { print ' '.$no.' '; } } } function getErrorlog($page) { $webdata = 'data/website.xml'; if(file_exists($webdata) && $page == 'profile'){ $glob = glob("admin/data/errorlog/*.xml"); $i = 0; print ''; if (is_array($glob)) { print ''; $errorlogs = array_reverse($glob); foreach ($errorlogs as $erl) { if ($i < 10) { $xmli = new SimpleXMLElement($erl, 0, true); $timestamp = $xmli->datum; $dtmi = date('d-m-Y, H:i', (float)$timestamp); $ipi = $xmli->ip; $usri = $xmli->user; print ' '; $i++; } else { break; } } print '
DateIP addressUser
'.$dtmi.' '.$xmli->ip.' '.$xmli->user.'
Clear all log files'; } if ($i == 0) { print '
Hooray! No failed login attempts.
'; } } } <? print $wti; ?> '; } include_once('admin/admin.php'); ?>
'; include_once('admin/alerts.php'); } else { require_once('inc/lightbox.php'); } ?>