diff --git a/application/classes/phpmailer.php b/application/classes/phpmailer.php
index fc3c4b3392a388a4127e3e4f84621678bef1a4ed..0f65df5ac3008804947f259b4f400b36f2c3c743 100644
--- a/application/classes/phpmailer.php
+++ b/application/classes/phpmailer.php
@@ -13,20 +13,26 @@ class custom_phpmailer {
 		$mail = new PHPMailer;
 		$mail->CharSet = "UTF-8";
 		$mail->isSMTP(); 
-		//$mail->SMTPDebug = 2; // 0 = off (for production use) - 1 = client messages - 2 = client and server messages
-		$mail->Host = "xxx"; // use $mail->Host = gethostbyname('smtp.gmail.com'); // if your network does not support SMTP over IPv6
-		$mail->Port = 465; // TLS only
-		$mail->SMTPSecure = 'ssl'; // ssl is depracated
+		$mail->SMTPDebug = 0; // 0 = off (for production use) - 1 = client messages - 2 = client and server messages
+		//$mail->Host = "smtp.gmail.com"; // use $mail->Host = gethostbyname('smtp.gmail.com'); // if your network does not support SMTP over IPv6
+		$mail->Host = "in-v3.mailjet.com";
+		//$mail->Port = 465; // TLS only
+		$mail->Port = 587; // TLS only
+		//$mail->SMTPSecure = 'ssl'; // ssl is deprecated
 		$mail->SMTPAuth = true;
-		$mail->Username = 'xxx@xxx';
-		$mail->Password = 'xxx';
-		$mail->setFrom('noreply@xxx', 'Test IDP portal');
+		//$mail->Username = 'geant.incubator@gmail.com';
+		$mail->Username = 'eaa84e1afc080e61cdf87e021b2b3f8e';
+		//$mail->Password = '=xtJEq&>+]TS&qu7-719}B{E[4';
+		$mail->Password = 'f444618af6955a1aba1c29f219fe6746';
+		//$mail->setFrom('noreply@testidp.incubator.geant.org', 'Test IDP portal');
+		$mail->setFrom('tikrasseo@gmail.com', 'Test IDP portal');
 		if (security::check_request_data($to_name)) {
 			$mail->addAddress($to, $to_name);
 		} else {
 			$mail->addAddress($to);
 		}
 		$mail->Subject = $subject;
+		/*
 		$from_ip = '';
 		if(filter_var('', FILTER_VALIDATE_IP)) {
 			$from_ip = @$_SERVER['HTTP_CLIENT_IP'];
@@ -36,6 +42,7 @@ class custom_phpmailer {
 			$from_ip = @$_SERVER['REMOTE_ADDR'];
 		}
 		$message .= '<br />Sent from IP: '.$from_ip;
+		*/
 		$mail->msgHTML($message); //$mail->msgHTML(file_get_contents('contents.html'), __DIR__); //Read an HTML message body from an external file, convert referenced images to embedded,
 		$mail->AltBody = strip_tags(str_replace('<br />', "\n\r", $message));
 		if(!$mail->send()){
@@ -45,4 +52,4 @@ class custom_phpmailer {
 		}	
 	}
 }
-?>
\ No newline at end of file
+?>
diff --git a/application/components/header.php b/application/components/header.php
index 5682e6cb0fb0eb2443ffe032e22fe762d2cd615b..3191c3fcc8ad048f734008815e7bf89e44b68829 100644
--- a/application/components/header.php
+++ b/application/components/header.php
@@ -1,11 +1,9 @@
 <section id="header">
 	<a href="<?php echo WEB_BASE_URL; ?>" id="logo"><img src="<?php echo MEDIA_URL; ?>/images/logo.png" /></a>
-	<center>
 	<p>GÉANT Test IdP is a SAML 2.0 SP testing service based on SimpleSAMLPHP and focused on the needs of R&E.<br />
 	Please register for the service by uploading your SP metadata which will then be validated.</p>
 	<p>Once registered you can login to your Test IdP instance and select a user test profile.<br />
 	User test profiles check different success and error scenarios for your SP and may be edited.</p>
 	<p>Then login to your SP as usual and any issues resulting from the test will be indicated.<br />
 	Detailed logs are availble to assitst further investigation of any issues.</p>
-	</center>
 </section>
\ No newline at end of file
diff --git a/application/components/login.php b/application/components/login.php
new file mode 100644
index 0000000000000000000000000000000000000000..d14d5ec686bd5b5106980c10b9c55bc1b877a262
--- /dev/null
+++ b/application/components/login.php
@@ -0,0 +1,262 @@
+<?php
+	// if (isset($_GET['logout'])) {
+		// $user = new user();
+		// $user::logOut();
+	// }
+		if (isset($_GET['login_token']) || (isset($_POST['login']) && isset($_POST['login_token']))) {
+			if (isset($_GET['login_token'])) {
+				$token = $_GET['login_token'];
+			} else {
+				$token = $_POST['login_token'];
+			}
+			$mysql = new mysql();
+			$request_array[':token'] = $token;
+			if ($res = $mysql->select('SELECT * FROM `accounts` WHERE `token`= :token AND `status`= \'initiated\'',$request_array)) {
+				while($ftc = $res->fetch(PDO::FETCH_ASSOC)) {
+					$found = 'yes';
+					$entity = $ftc;
+				}
+			}
+			if ($res = $mysql->select('SELECT * FROM `accounts` WHERE `token`= :token AND `status`= \'registered\'',$request_array)) {
+				while($ftc = $res->fetch(PDO::FETCH_ASSOC)) {
+					$found_reg = 'yes';
+					$entity = $ftc;
+				}
+			}
+			if (!$found || $found!='yes') {
+				if ($found_reg && $found_reg=='yes') {
+					$_SESSION['user_id'] = $entity['entity_id'];
+					$_SESSION['user_name'] = $entity['email'];
+					echo '<p>You are now logged in as '.$_SESSION['user_id'].' ('.$_SESSION['user_name'].')';
+					echo '<script type="text/javascript">window.location.href="'.WEB_BASE_URL.'"</script>';
+				} else {
+					echo 'User with current token not found or the account has already been approved.';
+				}
+			} elseif ($found && $found=='yes') {
+				$a = "1234567890abcdefghijklmnopqrstuvwxyz"; $host = "";
+				for ($i=0; $i<31; $i+=4) $host .= $a[hexdec(substr(md5($entity['entity_id']), $i, 4)) % strlen($a)];
+				echo '<p>Your account has been successfully registered!</p>';
+				echo '<b>Entity ID:</b> '.$entity['entity_id'].'<br />';
+				echo '<b>Host:</b> <a href="https://'.$host.'.testidp.incubator.geant.org" target=_blank>https://'.$host.'.testidp.incubator.geant.org</a><br />';
+				echo '<b>E-mail:</b> '.$entity['email'].'<br />';
+				echo '<b>Metadata:</b><pre>'.htmlspecialchars($entity['metadata']).'</pre>';
+				$request_array[':token'] = $token;
+				$mysql->update('UPDATE `accounts` SET `status`= \'registered\' WHERE `token`= :token', $request_array);
+				$_SESSION['user_id'] = $entity['entity_id'];
+				$_SESSION['user_name'] = $entity['email'];
+				$mysql->query('INSERT INTO `idps` SET 
+				`host`= \''.$host.'\', 
+				`comment`= \''.$entity['entity_id'].'\',  
+				`sp_metadata`= \''.addslashes($entity['metadata']).'\'');
+				$last_id = $mysql->selectLastEntryId('idps', '', '', 'idp_id');
+				//for ($i=1; $i<=15; $i++) {
+				//	$mysql->query('INSERT INTO `config` SET 
+				//	`idp_id`= \''.$last_id.'\', 
+				//	`option_id`= \''.$i.'\'');
+				//}
+			}
+		} else {	
+			if (isset($_POST['register']) && isset($_POST['metadata'])) {
+				$metadata = $_POST['metadata'];
+				if (strlen($metadata)<1) {
+					$message = '<span style="color:red;">XML not provided.</span>';
+					$allok = 'no';
+					if (isset($_FILES)) {
+						if ($_FILES['xml_file']['type']=='text/xml') {
+							if ($_FILES['xml_file']['size']>0) {
+								$metadata = file_get_contents($_FILES['xml_file']['tmp_name']);
+								$xml = new XMLReader();
+								if (!$xml->xml($metadata, NULL, LIBXML_DTDVALID)) {
+									$message .= "XML not valid: load error.<br />";
+									$message_color = '#ff0000';
+									$allok = 'no';
+								}
+								libxml_use_internal_errors(TRUE);
+								$xml_array = xml2assoc($xml);
+								$arErrors = libxml_get_errors();
+								$xml_errors = "";
+								foreach ($arErrors as $xmlError) {
+									if ($xmlError->message != 'Validation failed: no DTD found !') {
+									$xml_errors .= $xmlError->message.'<br />';
+									}
+									$allok = 'no';
+								}
+								if ($xml_errors != "") {
+									$message .= "XML not valid: ".$xml_errors;
+									$message_color = '#ff0000';
+									$allok = 'no';
+								} else {
+									$message = 'Your XML looks fine.<br />';
+									$message_color = '#00aa00';
+									$allok = 'yes';
+									if (preg_match_all('/\<md\:EmailAddress\>(.*)\<\/md\:EmailAddress\>/', $metadata, $email_matches)) {
+										foreach ($email_matches[1] as $k=>$v) {
+											$emails .= $v.', ';
+										}
+										if (preg_match_all('/entityID\=\"(.*)\"/', $metadata, $entity_id_matches)) {
+											$entity_id = $entity_id_matches[1][0];										
+											$timestamp = time();
+											$emails = substr($emails, 0, -2);
+											$allok = 'yes';
+											$email_clean = str_replace('mailto:', '', $email_matches[1][0]);
+											$token = md5($_SERVER['REMOTE_ADDR'].$email_clean.$timestamp);
+											$message .= 'We have found '.count($email_matches[1]).' e-mail addresses provided in your metadata: '.$emails.'.<br />We have sent an account activation e-mail to the first e-mail address <b>'.$email_clean.'</b>.<br />'.'If you didn\'t receive any e-mails, please contact our administrator and provide your token <b>'.$token.'</b>.';
+											$mysql = new mysql();
+											$request_array[':email'] = $email_clean;
+											$request_array[':entity_id'] = $entity_id;
+											//echo '<pre>'; print_r($request_array); echo '</pre>';
+											if ($res = $mysql->select('SELECT * FROM `accounts` WHERE `email`= :email AND `entity_id`= :entity_id',$request_array)) {
+												while($ftc = $res->fetch(PDO::FETCH_ASSOC)) {
+													$found_similar_entity = 'yes';
+												}
+											}
+											if ($found_similar_entity) {
+												$message = 'This IdP has already been created.<br /><a href=".">Register a new IdP</a>';
+											} else {
+												$mysql->query('INSERT INTO `accounts` SET 
+												`token`= \''.$token.'\', 
+												`email`= \''.$email_clean.'\', 
+												`entity_id`= \''.$entity_id.'\', 
+												`timestamp`= \''.$timestamp.'\', 
+												`ip`= \''.$_SERVER['REMOTE_ADDR'].'\', 
+												`metadata`= \''.$metadata.'\', 
+												`status`= \'initiated\'');
+												require_once(APP_BASE_DIR.'/classes/phpmailer.php');
+												$mailer = new custom_phpmailer();
+												$email_message = 'You have been approved to login to the Test IDP portal. Please follow <a href="'.WEB_BASE_URL.'/en/?login_token='.$token.'">THIS LINK</a> to login.';
+												$mailer::send_email($email_clean, '', $subject='Message from Test IDP portal', $email_message, 'Your message has been sent');
+											}
+										} else {
+											$message .= '<span style="color:red;">We could not find an entity id in your metadata. In order to proceed, please input a metadata that contains an entity id.</span><br />';
+											$allok = 'no';
+										}
+									} else {
+										$message .= '<span style="color:red;">We could not find any e-mails in your metadata. In order to proceed, please input a metadata that contains at least one contact e-mail address.</span><br />';
+										$allok = 'no';
+									}							
+								}
+							} else {
+								$message = '<span style="color:red;">Your provided file is empty.</span>';
+								$allok = 'no';
+							}
+						} else {
+							$message = '<span style="color:red;">Please, provide a file in XML format.</span>';
+							$allok = 'no';
+						}
+					}
+				} else {
+					$xml = new XMLReader();
+					if (!$xml->xml($metadata, NULL, LIBXML_DTDVALID)) {
+						$message .= "XML not valid: load error.<br />";
+						$message_color = '#ff0000';
+						$allok = 'no';
+					}
+					libxml_use_internal_errors(TRUE);
+					$xml_array = xml2assoc($xml);
+					$arErrors = libxml_get_errors();
+					$xml_errors = "";
+					foreach ($arErrors as $xmlError) {
+						if ($xmlError->message != 'Validation failed: no DTD found !') {
+						$xml_errors .= $xmlError->message.'<br />';
+						}
+						$allok = 'no';
+					}
+					if ($xml_errors != "") {
+						$message .= "XML not valid: ".$xml_errors;
+						$message_color = '#ff0000';
+						$allok = 'no';
+					} else {
+						$message = 'Your XML looks fine.<br />';
+						$message_color = '#00aa00';
+						$allok = 'yes';
+						if (preg_match_all('/\<md\:EmailAddress\>(.*)\<\/md\:EmailAddress\>/', $metadata, $email_matches)) {
+							foreach ($email_matches[1] as $k=>$v) {
+								$emails .= $v.', ';
+							}
+							if (preg_match_all('/entityID\=\"(.*)\"/', $metadata, $entity_id_matches)) {
+								$entity_id = $entity_id_matches[1][0];										
+								$timestamp = time();
+								$emails = substr($emails, 0, -2);
+								$allok = 'yes';
+								$email_clean = str_replace('mailto:', '', $email_matches[1][0]);
+								$token = md5($_SERVER['REMOTE_ADDR'].$email_clean.$timestamp);
+								$message .= 'We have found '.count($email_matches[1]).' e-mail addresses provided in your metadata: '.$emails.'.<br />We have sent an account activation e-mail to the first e-mail address <b>'.$email_clean.'</b>.<br />'.'If you didn\'t receive any e-mails, please contact our administrator and provide your token <b>'.$token.'</b>.';
+								$mysql = new mysql();
+								$request_array[':email'] = $email_clean;
+								$request_array[':entity_id'] = $entity_id;
+								if ($res = $mysql->select('SELECT * FROM `accounts` WHERE `email`= :email AND `entity_id`= :entity_id',$request_array)) {
+									while($ftc = $res->fetch(PDO::FETCH_ASSOC)) {
+										$found_similar_entity = 'yes';
+									}
+								}
+								if ($found_similar_entity) {
+									$message = 'This IdP has already been created.<br /><a href=".">Register a new IdP</a>';
+								} else {
+									$query = 'INSERT INTO `accounts` SET 
+									`token`= \''.$token.'\', 
+									`email`= \''.$email_clean.'\', 
+									`entity_id`= \''.$entity_id.'\', 
+									`timestamp`= \''.$timestamp.'\', 
+									`ip`= \''.$_SERVER['REMOTE_ADDR'].'\', 
+									`metadata`= \''.addslashes($metadata).'\', 
+									`status`= \'initiated\'';
+									$mysql->query($query);
+									require_once(APP_BASE_DIR.'/classes/phpmailer.php');
+									$mailer = new custom_phpmailer();
+									$email_message = 'You have been approved to login to the Test IDP portal. Please follow <a href="'.WEB_BASE_URL.'/en/?login_token='.$token.'">THIS LINK</a> to login.';
+									$mailer::send_email($email_clean, '', $subject='Message from Test IDP portal', $email_message, 'Your message has been sent');
+								}
+							} else {
+								$message .= '<span style="color:red;">We could not find an entity id in your metadata. In order to proceed, please input a metadata that contains an entity id.</span><br />';
+								$allok = 'no';
+							}
+						} else {
+							$message .= '<span style="color:red;">We could not find any e-mails in your metadata. In order to proceed, please input a metadata that contains at least one contact e-mail address.</span><br />';
+							$allok = 'no';
+						}							
+					}
+				}
+				
+				//echo '<pre>'; print_r($xml_array); echo '</pre>';
+			} ?>
+			<?php
+			/*
+			if (isset($_POST['login']) && isset($_POST['login_token'])) {
+				$message_login = '<span style="color:red;">Token not found.</span>';
+			}
+			*/
+			?>
+			<section id="forms_wrapper">
+				<section id="forms_content">
+					<div id="form_register">
+						<?php if (!isset($allok) || $allok=='no') { ?>
+						<h2>Register a new IdP</h2>
+						<form method="post" enctype="multipart/form-data">
+							<p>Paste your SP metadata into the text field below.</p>
+							<textarea rows="5" name="metadata" /><?php echo $_POST['metadata']; ?></textarea>
+							<p>Or upload your SP metadata xml file.</p>
+							<label for="xml_file" id="xml_file_label">
+								Select a file
+							</label>
+							<input type="file" name="xml_file" id="xml_file" onchange="upload_xml_file(this);" />
+							<input type="submit" class="button post_menu_button_2 login" name="register" value="Register" />
+						</form>
+						<?php } ?>
+						<p class="message" style="color:<?php echo $message_color; ?>;"><?php echo $message; ?></p>
+						<br class="cb" />
+					</div>
+					<div id="form_login">
+						<?php if (!isset($allok) || $allok=='no') { ?>
+						<h2>Edit your IdP</h2>
+						<form method="post">
+							<p>Login to your account via Token</p>
+							<input type="text" name="login_token" />
+							<input type="submit" class="button post_menu_button_2 login" name="login" value="Login" />
+						</form>
+						<?php } ?>
+						<p class="message_login" style="color:<?php echo $message_login_color; ?>;"><?php echo $message_login; ?></p>
+						<br class="cb" />
+					</div>
+				</section>
+			</section>
+<?php	} ?>
diff --git a/application/config.php b/application/config.php
index c53b3ff4d9a2d750fa450d4f89680836f81fdd15..408b97116d5fd283634fbe348406ca6e9d5315f0 100644
--- a/application/config.php
+++ b/application/config.php
@@ -2,10 +2,10 @@
 
 //Basic web data (one time domain settings)
 define('WEB_BASE_PRO', 'https');
-define('WEB_BASE_URL', WEB_BASE_PRO.'://projects.andy.lt/GEANT/test-idp'); //Without trailing slash
-define('WEB_BASE_DIR', '/home/sc2forum/domains/projects.andy.lt/public_html/GEANT/test-idp'); //Without trailing slash
-define('APP_BASE_DIR', WEB_BASE_DIR.'/application'); //Without trailing slash
-define('UPL_BASE_URL', WEB_BASE_URL.'/application/uploads'); //Without trailing slash
+define('WEB_BASE_URL', WEB_BASE_PRO.'://admin.testidp.incubator.geant.org'); //Without trailing slash
+define('WEB_BASE_DIR', '/var/www/test-idp-admin/public_html'); //Without trailing slash
+define('APP_BASE_DIR', '/var/www/test-idp-admin/application'); //Without trailing slash
+define('UPL_BASE_URL', WEB_BASE_URL.'/uploads'); //Without trailing slash
 define('UPL_BASE_DIR', APP_BASE_DIR.'/uploads'); //Without trailing slash
 
 //Pages links (for easier bulk links change)
@@ -13,9 +13,9 @@ define('USER_HOME', WEB_BASE_URL.'/');
 
 //MySQL connection data
 define('MYSQL_HOST', 'localhost');
-define('MYSQL_USER', 'xxx');
-define('MYSQL_PASS', 'xxx');
-define('MYSQL_DB', 'xxx');
+define('MYSQL_USER', 'admin');
+define('MYSQL_PASS', '1YdThVDLQ4jP');
+define('MYSQL_DB', 'testidp');
 
 //Security data
 define('SEC_SALT', 'flYs8dfp35dsotq'); //Possible values: any
@@ -24,7 +24,7 @@ define('SEC_CAPTCHA', true); //Possible values: true / false
 //Status data (turn the system and debug mode on or off)
 //When STATUS_ACTIVE is set to false, the system will display maintenance mode page.
 define('STATUS_ACTIVE', true); //Possible values: true / false
-define('STATUS_DEBUG', false); //Possible values: true / false
+define('STATUS_DEBUG', true); //Possible values: true / false
 define('STATUS_DEBUG_MODE', E_ALL); //Possible values: E_ALL / E_ERROR / E_WARNING / E_NOTICE / E_NONE
 
 //Misc data
@@ -53,4 +53,4 @@ define('PAGE_DEFAULT_META_DESCRIPTION', 'Test IDP tool');
 //Start the session
 session_start();
 
-?>
\ No newline at end of file
+?>
diff --git a/application/logs/mysql_error_log.txt b/application/logs/mysql_error_log.txt
index cc3ef32f561a40e08066b0bcd3c7c85729bdabcb..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644
--- a/application/logs/mysql_error_log.txt
+++ b/application/logs/mysql_error_log.txt
@@ -1,57 +0,0 @@
-# CONNECTION ERROR 2021-05-20 12:15:20 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 13:59:11 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:24:57 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:24:58 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:27:28 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:27:28 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:40:29 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:40:30 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:53:06 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:53:07 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:53:13 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:53:14 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:53:14 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:53:14 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:53:14 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:53:14 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:53:14 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:53:14 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
-# CONNECTION ERROR 2021-05-20 14:53:14 #
-ERROR MESSAGE: SQLSTATE[HY000] [1045] Access denied for user 'gyvuneliailt'@'localhost' (using password: YES)
-
diff --git a/application/pages/home.php b/application/pages/home.php
index 01d05af8844256c4a5bbb3d8777f19e6319ae915..8b837a777a09b0a3d19fb9d2798f948864533255 100644
--- a/application/pages/home.php
+++ b/application/pages/home.php
@@ -5,7 +5,9 @@ echo '<p style="color:red;"><i><b>IMPORTANT!</b> For testing purposes, please, u
 
 $mysql = new mysql();
 unset($request_array);
-$request_array['host'] = $_SESSION['user_id'];
+$a = "1234567890abcdefghijklmnopqrstuvwxyz"; $host = "";
+for ($i=0; $i<31; $i+=4) $host .= $a[hexdec(substr(md5($_SESSION['user_id']), $i, 4)) % strlen($a)];
+$request_array['host'] = $host;
 if ($res = $mysql->select('SELECT * FROM `idps` WHERE `host`= :host LIMIT 1', $request_array)) {
 	while($ftc = $res->fetch(PDO::FETCH_ASSOC)) {
 		$current_idp = $ftc['idp_id'];
@@ -16,7 +18,8 @@ if (isset($_POST['update_idp'])) {
 	for($i=1; $i<=15; $i++) {
 		unset($request_array);
 		$request_array[':value'] = $_POST[$i];
-		$mysql->update('UPDATE `config` SET `value`= :value WHERE `idp_id`= '.$current_idp.' AND `option_id`='.$i, $request_array);
+		$query = 'REPLACE INTO `config` SET `idp_id`='.$current_idp.', `option_id`='.$i.', `value`=:value';
+		$mysql->update($query, $request_array);
 	}
 }
 
@@ -25,6 +28,7 @@ if (isset($_POST['update_idp'])) {
 
 <h2>Your IDP data</h2>
 <?php
+echo "Host: <a href=\"https://$host.testidp.incubator.geant.org/\" target=_blank>https://$host.testidp.incubator.geant.org/</a>\n";
 unset($request_array);
 $request_array['idp_id'] = $current_idp;
 if ($res1 = $mysql->select('SELECT * FROM `config` WHERE `idp_id`= :idp_id', $request_array)) {
@@ -53,4 +57,4 @@ if ($res1 = $mysql->select('SELECT * FROM `config` WHERE `idp_id`= :idp_id', $re
 	<br /><br /><br />
 </form>
 
-<br class="cb" />
\ No newline at end of file
+<br class="cb" />
diff --git a/mailtest.php b/mailtest.php
new file mode 100755
index 0000000000000000000000000000000000000000..31214316d53518ba4846c1897b2bbe3026119cea
--- /dev/null
+++ b/mailtest.php
@@ -0,0 +1,9 @@
+#!/usr/bin/php
+<?php
+define('APP_BASE_DIR', '/var/www/test-idp-admin/application');
+require_once(APP_BASE_DIR.'/classes/security.php');
+require_once(APP_BASE_DIR.'/classes/phpmailer.php');
+$mailer = new custom_phpmailer();
+$email_message = 'Test message';
+$email_clean = 'martin.vanes@surf.nl';
+$mailer::send_email($email_clean, '', $subject='Message from Test IDP portal', $email_message, 'Your message has been sent');
diff --git a/.htaccess b/public_html/.htaccess
similarity index 63%
rename from .htaccess
rename to public_html/.htaccess
index 9bb2d68e31d5a329c4a8bededfe80a5dfe5a7949..480b1aebfcbc773106c1f036fa7fc0f4f5c07982 100644
--- a/.htaccess
+++ b/public_html/.htaccess
@@ -4,13 +4,11 @@ Order Deny,Allow
 <IfModule mod_rewrite.c>
 Options +FollowSymLinks
 RewriteEngine on
-RewriteBase /GEANT/test-idp/
-RewriteCond %{SERVER_PORT} 80 
-RewriteRule ^(.*)$ https://projects.andy.lt/GEANT/test-idp/$1 [R=301,L]
 
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-l
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !favicon.ico
 RewriteCond %{REQUEST_FILENAME} !.(ico,css,js,jpg,gif,png)$
-RewriteRule ^.*$ index.php [NC,L]
\ No newline at end of file
+RewriteRule ^.*$ index.php [NC,L]
+</IfModule>
diff --git a/public_html/asha231asdfw/.htaccess b/public_html/asha231asdfw/.htaccess
new file mode 100644
index 0000000000000000000000000000000000000000..a1dc1c792a54b2f8e1512ffd93c2085114321b02
--- /dev/null
+++ b/public_html/asha231asdfw/.htaccess
@@ -0,0 +1,5 @@
+#Protect Directory
+AuthName "Dialog prompt"
+AuthType Basic
+AuthUserFile /var/www/test-idp-admin/public_html/asha231asdfw/.htpasswd
+Require valid-user
\ No newline at end of file
diff --git a/public_html/asha231asdfw/.htpasswd b/public_html/asha231asdfw/.htpasswd
new file mode 100644
index 0000000000000000000000000000000000000000..ac25fd0ded9975acb4f3c7560ed2d4444e621c0e
--- /dev/null
+++ b/public_html/asha231asdfw/.htpasswd
@@ -0,0 +1 @@
+andrej:$2y$10$prgrlRiWdCiufD9enMFHpOFttJBjifiByR.m7ZUfX0pJJ.E5s17Ra
\ No newline at end of file
diff --git a/public_html/asha231asdfw/phpminiadmin.php b/public_html/asha231asdfw/phpminiadmin.php
new file mode 100644
index 0000000000000000000000000000000000000000..3c0a49c48da8be0e00c27a8780ed96bc8fba3cb7
--- /dev/null
+++ b/public_html/asha231asdfw/phpminiadmin.php
@@ -0,0 +1,1282 @@
+<?php
+/*
+ PHP Mini MySQL Admin
+ (c) 2004-2017 Oleg Savchuk <osalabs@gmail.com> http://osalabs.com
+
+ Light standalone PHP script for quick and easy access MySQL databases.
+ http://phpminiadmin.sourceforge.net
+
+ Dual licensed: GPL v2 and MIT, see texts at http://opensource.org/licenses/
+*/
+
+$ACCESS_PWD=''; #!!!IMPORTANT!!! this is script access password, SET IT if you want to protect you DB from public access
+
+#DEFAULT db connection settings
+# --- WARNING! --- if you set defaults - it's recommended to set $ACCESS_PWD to protect your db!
+$DBDEF=array(
+'user'=>"",#required
+'pwd'=>"", #required
+'db'=>"",  #optional, default DB
+'host'=>"",#optional
+'port'=>"",#optional
+'chset'=>"utf8",#optional, default charset
+);
+$IS_COUNT=false; #set to true if you want to see Total records when pagination occurs (SLOWS down all select queries!)
+$DUMP_FILE=dirname(__FILE__).'/pmadump'; #path to file without extension used for server-side exports (timestamp, .sql/.csv/.gz extension added) or imports(.sql)
+file_exists($f=dirname(__FILE__) . '/phpminiconfig.php')&&require($f); // Read from config (easier to update)
+if (function_exists('date_default_timezone_set')) date_default_timezone_set('UTC');#required by PHP 5.1+
+
+//constants
+$VERSION='1.9.170730';
+$MAX_ROWS_PER_PAGE=50; #max number of rows in select per one page
+$D="\r\n"; #default delimiter for export
+$BOM=chr(239).chr(187).chr(191);
+$SHOW_D="SHOW DATABASES";
+$SHOW_T="SHOW TABLE STATUS";
+$DB=array(); #working copy for DB settings
+
+$self=$_SERVER['PHP_SELF'];
+
+session_set_cookie_params(0, null, null, false, true);
+session_start();
+if (!isset($_SESSION['XSS'])) $_SESSION['XSS']=get_rand_str(16);
+$xurl='XSS='.$_SESSION['XSS'];
+
+ini_set('display_errors',0);  #turn on to debug db or script issues
+error_reporting(E_ALL ^ E_NOTICE);
+
+//strip quotes if they set
+if (get_magic_quotes_gpc()){
+  $_COOKIE=array_map('killmq',$_COOKIE);
+  $_REQUEST=array_map('killmq',$_REQUEST);
+}
+
+if ($_REQUEST['login']){
+  if ($_REQUEST['pwd']!=$ACCESS_PWD){
+    $err_msg="Invalid password. Try again";
+  }else{
+    $_SESSION['is_logged']=true;
+    loadcfg();
+  }
+}
+
+if ($_REQUEST['logoff']){
+  check_xss();
+  $_SESSION = array();
+  savecfg();
+  session_destroy();
+  $url=$self;
+  if (!$ACCESS_PWD) $url='/';
+  header("location: $url");
+  exit;
+}
+
+if (!$_SESSION['is_logged']){
+  if (!$ACCESS_PWD) {
+    $_SESSION['is_logged']=true;
+    loadcfg();
+  }else{
+    print_login();
+    exit;
+  }
+}
+
+if ($_REQUEST['savecfg']){
+  check_xss();
+  savecfg();
+}
+
+loadsess();
+
+if ($_REQUEST['showcfg']){
+  print_cfg();
+  exit;
+}
+
+//get initial values
+$SQLq=trim(b64d($_REQUEST['q']));
+$page=$_REQUEST['p']+0;
+if ($_REQUEST['refresh'] && $DB['db'] && preg_match('/^show/',$SQLq) ) $SQLq=$SHOW_T;
+
+if (db_connect('nodie')){
+  $time_start=microtime_float();
+
+  if ($_REQUEST['pi']){
+    ob_start();phpinfo();$html=ob_get_clean();preg_match("/<body[^>]*>(.*?)<\/body>/is",$html,$m);
+    $sqldr='<div class="pi">'.$m[1].'</div>';
+  }else{
+   if ($DB['db']){
+    if ($_REQUEST['shex']){
+     print_export();
+    }elseif ($_REQUEST['doex']){
+     check_xss();do_export();
+    }elseif ($_REQUEST['shim']){
+     print_import();
+    }elseif ($_REQUEST['doim']){
+     check_xss();do_import();
+    }elseif ($_REQUEST['dosht']){
+     check_xss();do_sht();
+    }elseif (!$_REQUEST['refresh'] || preg_match('/^select|show|explain|desc/i',$SQLq) ){
+     if ($SQLq)check_xss();
+     do_sql($SQLq);#perform non-select SQL only if not refresh (to avoid dangerous delete/drop)
+    }
+   }else{
+    if ( $_REQUEST['refresh'] ){
+       check_xss();do_sql($SHOW_D);
+    }elseif ($_REQUEST['crdb']){
+      check_xss();do_sql('CREATE DATABASE `'.$_REQUEST['new_db'].'`');do_sql($SHOW_D);
+    }elseif ( preg_match('/^(?:show\s+(?:databases|status|variables|process)|create\s+database|grant\s+)/i',$SQLq) ){
+       check_xss();do_sql($SQLq);
+    }else{
+       $err_msg="Select Database first";
+       if (!$SQLq) do_sql($SHOW_D);
+    }
+   }
+  }
+  $time_all=ceil((microtime_float()-$time_start)*10000)/10000;
+
+  print_screen();
+}else{
+  print_cfg();
+}
+
+function do_sql($q){
+ global $dbh,$last_sth,$last_sql,$reccount,$out_message,$SQLq,$SHOW_T;
+ $SQLq=$q;
+
+ if (!do_multi_sql($q)){
+    $out_message="Error: ".mysqli_error($dbh);
+ }else{
+    if ($last_sth && $last_sql){
+       $SQLq=$last_sql;
+       if (preg_match("/^select|show|explain|desc/i",$last_sql)) {
+          if ($q!=$last_sql) $out_message="Results of the last select displayed:";
+          display_select($last_sth,$last_sql);
+       } else {
+         $reccount=mysqli_affected_rows($dbh);
+         $out_message="Done.";
+         if (preg_match("/^insert|replace/i",$last_sql)) $out_message.=" Last inserted id=".get_identity();
+         if (preg_match("/^drop|truncate/i",$last_sql)) do_sql($SHOW_T);
+       }
+    }
+ }
+}
+
+function display_select($sth,$q){
+ global $dbh,$DB,$sqldr,$reccount,$is_sht,$xurl,$is_sm;
+ $rc=array("o","e");
+ $dbn=ue($DB['db']);
+ $sqldr='';
+
+ $is_shd=(preg_match('/^show\s+databases/i',$q));
+ $is_sht=(preg_match('/^show\s+tables|^SHOW\s+TABLE\s+STATUS/',$q));
+ $is_show_crt=(preg_match('/^show\s+create\s+table/i',$q));
+
+ if ($sth===FALSE or $sth===TRUE) return;#check if $sth is not a mysql resource
+
+ $reccount=mysqli_num_rows($sth);
+ $fields_num=mysqli_field_count($dbh);
+
+ $w='';
+ if ($is_sm) $w='sm ';
+ if ($is_sht || $is_shd) {$w='wa';
+   $url='?'.$xurl."&db=$dbn";
+   $sqldr.="<div class='dot'>
+ MySQL Server:
+ &#183; <a href='$url&q=".b64u("show variables")."'>Show Configuration Variables</a>
+ &#183; <a href='$url&q=".b64u("show status")."'>Show Statistics</a>
+ &#183; <a href='$url&q=".b64u("show processlist")."'>Show Processlist</a> ";
+   if ($is_shd) $sqldr.="&#183; <label>Create new database: <input type='text' name='new_db' placeholder='type db name here'></label> <input type='submit' name='crdb' value='Create'>";
+   $sqldr.="<br>";
+   if ($is_sht) $sqldr.="Database: &#183; <a href='$url&q=".b64u("show table status")."'>Show Table Status</a>";
+   $sqldr.="</div>";
+ }
+ if ($is_sht){
+   $abtn="<div><input type='submit' value='Export' onclick=\"sht('exp')\">
+ <input type='submit' value='Drop' onclick=\"if(ays()){sht('drop')}else{return false}\">
+ <input type='submit' value='Truncate' onclick=\"if(ays()){sht('trunc')}else{return false}\">
+ <input type='submit' value='Optimize' onclick=\"sht('opt')\">
+ <b>selected tables</b></div>";
+   $sqldr.=$abtn."<input type='hidden' name='dosht' value=''>";
+ }
+
+ $sqldr.="<div><table id='res' class='res $w'>";
+ $headers="<tr class='h'>";
+ if ($is_sht) $headers.="<td><input type='checkbox' name='cball' value='' onclick='chkall(this)'></td>";
+ for($i=0;$i<$fields_num;$i++){
+    if ($is_sht && $i>0) break;
+    $meta=mysqli_fetch_field($sth);
+    $headers.="<th><div>".hs($meta->name)."</div></th>";
+ }
+ if ($is_shd) $headers.="<th>show create database</th><th>show table status</th><th>show triggers</th>";
+ if ($is_sht) $headers.="<th>engine</th><th>~rows</th><th>data size</th><th>index size</th><th>show create table</th><th>explain</th><th>indexes</th><th>export</th><th>drop</th><th>truncate</th><th>optimize</th><th>repair</th><th>comment</th>";
+ $headers.="</tr>\n";
+ $sqldr.=$headers;
+ $swapper=false;
+ while($row=mysqli_fetch_row($sth)){
+   $sqldr.="<tr class='".$rc[$swp=!$swp]."' onclick='tc(this)'>";
+   $v=$row[0];
+   if ($is_sht){
+     $vq='`'.$v.'`';
+     $url='?'.$xurl."&db=$dbn&t=".b64u($v);
+     $sqldr.="<td><input type='checkbox' name='cb[]' value=\"".hs($vq)."\"></td>"
+     ."<td><a href=\"$url&q=".b64u("select * from $vq")."\">".hs($v)."</a></td>"
+     ."<td>".hs($row[1])."</td>"
+     ."<td align='right'>".hs($row[4])."</td>"
+     ."<td align='right'>".hs($row[6])."</td>"
+     ."<td align='right'>".hs($row[8])."</td>"
+     ."<td>&#183;<a href=\"$url&q=".b64u("show create table $vq")."\">sct</a></td>"
+     ."<td>&#183;<a href=\"$url&q=".b64u("explain $vq")."\">exp</a></td>"
+     ."<td>&#183;<a href=\"$url&q=".b64u("show index from $vq")."\">ind</a></td>"
+     ."<td>&#183;<a href=\"$url&shex=1&rt=".hs(ue($vq))."\">export</a></td>"
+     ."<td>&#183;<a href=\"$url&q=".b64u("drop table $vq")."\" onclick='return ays()'>dr</a></td>"
+     ."<td>&#183;<a href=\"$url&q=".b64u("truncate table $vq")."\" onclick='return ays()'>tr</a></td>"
+     ."<td>&#183;<a href=\"$url&q=".b64u("optimize table $vq")."\" onclick='return ays()'>opt</a></td>"
+     ."<td>&#183;<a href=\"$url&q=".b64u("repair table $vq")."\" onclick='return ays()'>rpr</a></td>"
+     ."<td>".hs($row[$fields_num-1])."</td>";
+   }elseif ($is_shd){
+     $url='?'.$xurl."&db=".ue($v);
+     $sqldr.="<td><a href=\"$url&q=".b64u("SHOW TABLE STATUS")."\">".hs($v)."</a></td>"
+     ."<td><a href=\"$url&q=".b64u("show create database `$v`")."\">scd</a></td>"
+     ."<td><a href=\"$url&q=".b64u("show table status")."\">status</a></td>"
+     ."<td><a href=\"$url&q=".b64u("show triggers")."\">trig</a></td>";
+   }else{
+     for($i=0;$i<$fields_num;$i++){
+      $v=$row[$i];
+      if (is_null($v)) $v="<i>NULL</i>";
+      elseif (preg_match('/[\x00-\x09\x0B\x0C\x0E-\x1F]+/',$v)){#all chars <32, except \n\r(0D0A)
+       $vl=strlen($v);$pf='';
+       if ($vl>16 && $fields_num>1){#show full dump if just one field
+         $v=substr($v, 0, 16);$pf='...';
+       }
+       $v='BINARY: '.chunk_split(strtoupper(bin2hex($v)),2,' ').$pf;
+      }else $v=hs($v);
+      if ($is_show_crt) $v="<pre>$v</pre>";
+      $sqldr.="<td><div>$v".(!strlen($v)?"<br>":'')."</div></td>";
+     }
+   }
+   $sqldr.="</tr>\n";
+ }
+ $sqldr.="</table></div>\n".$abtn;
+}
+
+function print_header(){
+ global $err_msg,$VERSION,$DB,$dbh,$self,$is_sht,$xurl,$SHOW_T;
+ $dbn=$DB['db'];
+?>
+<!DOCTYPE html>
+<html>
+<head><title>phpMiniAdmin</title>
+<meta charset="utf-8">
+<style type="text/css">
+*{box-sizing:border-box;}
+body{font-family:Arial,sans-serif;font-size:80%;padding:0;margin:0}
+div{padding:3px}
+pre{font-size:125%}
+textarea{width:100%}
+.nav{text-align:center}
+.ft{text-align:right;margin-top:20px;font-size:smaller}
+.inv{background-color:#069;color:#FFF}
+.inv a{color:#FFF}
+table{border-collapse:collapse}
+table.res{width:100%}
+table.wa{width:auto}
+table.res th,table.res td{padding:2px;border:1px solid #fff;vertical-align:top}
+table.sm th,table.sm td{max-width:30em}
+table.sm th>div,table.sm td>div{max-height:3.5em;overflow:hidden}
+table.sm th.lg,table.sm td.lg{max-width:inherit}
+table.sm th.lg>div,table.sm td.lg>div{max-height:inherit;overflow:inherit}
+table.restr{vertical-align:top}
+tr.e{background-color:#CCC}
+tr.o{background-color:#EEE}
+tr.e:hover, tr.o:hover{background-color:#FF9}
+tr.h{background-color:#99C}
+tr.s{background-color:#FF9}
+.err{color:#F33;font-weight:bold;text-align:center}
+.frm{width:400px;border:1px solid #999;background-color:#eee;text-align:left}
+.frm label .l{width:100px;float:left}
+.dot{border-bottom:1px dotted #000}
+.ajax{text-decoration:none;border-bottom: 1px dashed}
+.qnav{width:30px}
+.sbtn{width:100px}
+.clear{clear:both;height:0;display:block}
+.pi a{text-decoration:none}
+.pi hr{display:none}
+.pi img{float:right}
+.pi .center{text-align:center}
+.pi table{margin:0 auto}
+.pi table td, .pi table th{border:1px solid #000000;text-align:left;vertical-align:baseline}
+.pi table .e{background-color:#ccccff;font-weight:bold}
+.pi table .v{background-color:#cccccc}
+</style>
+
+<script type="text/javascript">
+var LSK='pma_',LSKX=LSK+'max',LSKM=LSK+'min',qcur=0,LSMAX=32;
+
+function $(i){return document.getElementById(i)}
+function frefresh(){
+ var F=document.DF;
+ F.method='get';
+ F.refresh.value="1";
+ F.GoSQL.click();
+}
+function go(p,sql){
+ var F=document.DF;
+ F.p.value=p;
+ if(sql)F.q.value=sql;
+ F.GoSQL.click();
+}
+function ays(){
+ return confirm('Are you sure to continue?');
+}
+function chksql(){
+ var F=document.DF,v=F.qraw.value;
+ if(/^\s*(?:delete|drop|truncate|alter)/.test(v)) if(!ays())return false;
+ if(lschk(1)){
+  var lsm=lsmax()+1,ls=localStorage;
+  ls[LSK+lsm]=v;
+  ls[LSKX]=lsm;
+  //keep just last LSMAX queries in log
+  if(!ls[LSKM])ls[LSKM]=1;
+  var lsmin=parseInt(ls[LSKM]);
+  if((lsm-lsmin+1)>LSMAX){
+   lsclean(lsmin,lsm-LSMAX);
+  }
+ }
+ return true;
+}
+function tc(tr){
+ if (tr.className=='s'){
+  tr.className=tr.classNameX;
+ }else{
+  tr.classNameX=tr.className;
+  tr.className='s';
+ }
+}
+function lschk(skip){
+ if (!localStorage || !skip && !localStorage[LSKX]) return false;
+ return true;
+}
+function lsmax(){
+ var ls=localStorage;
+ if(!lschk() || !ls[LSKX])return 0;
+ return parseInt(ls[LSKX]);
+}
+function lsclean(from,to){
+ ls=localStorage;
+ for(var i=from;i<=to;i++){
+  delete ls[LSK+i];ls[LSKM]=i+1;
+ }
+}
+function q_prev(){
+ var ls=localStorage;
+ if(!lschk())return;
+ qcur--;
+ var x=parseInt(ls[LSKM]);
+ if(qcur<x)qcur=x;
+ $('qraw').value=ls[LSK+qcur];
+}
+function q_next(){
+ var ls=localStorage;
+ if(!lschk())return;
+ qcur++;
+ var x=parseInt(ls[LSKX]);
+ if(qcur>x)qcur=x;
+ $('qraw').value=ls[LSK+qcur];
+}
+function after_load(){
+ var F=document.DF;
+ var p=F['v[pwd]'];
+ if (p) p.focus();
+ qcur=lsmax();
+
+ F.addEventListener('submit',function(e){
+  if(!F.qraw)return;
+  if(!chksql()){e.preventDefault();return}
+  $('q').value=btoa(encodeURIComponent($('qraw').value).replace(/%([0-9A-F]{2})/g,function(m,p){return String.fromCharCode('0x'+p)}));
+ });
+ var res=$('res');
+ if(res)res.addEventListener('dblclick',function(e){
+  if(!$('is_sm').checked)return;
+  var el=e.target;
+  if(el.tagName!='TD')el=el.parentNode;
+  if(el.tagName!='TD')return;
+  if(el.className.match(/\b\lg\b/))el.className=el.className.replace(/\blg\b/,' ');
+  else el.className+=' lg';
+ });
+}
+function logoff(){
+ if(lschk()){
+  var ls=localStorage;
+  var from=parseInt(ls[LSKM]),to=parseInt(ls[LSKX]);
+  for(var i=from;i<=to;i++){
+   delete ls[LSK+i];
+  }
+  delete ls[LSKM];delete ls[LSKX];
+ }
+}
+function cfg_toggle(){
+ var e=$('cfg-adv');
+ e.style.display=e.style.display=='none'?'':'none';
+}
+function qtpl(s){
+ $('qraw').value=s.replace(/%T/g,'`<?php echo $_REQUEST['t']?b64d($_REQUEST['t']):'tablename'?>`');
+}
+function smview(){
+ if($('is_sm').checked){$('res').className+=' sm'}else{$('res').className = $('res').className.replace(/\bsm\b/,' ')}
+}
+<?php if($is_sht){?>
+function chkall(cab){
+ var e=document.DF.elements;
+ if (e!=null){
+  var cl=e.length;
+  for (i=0;i<cl;i++){var m=e[i];if(m.checked!=null && m.type=="checkbox"){m.checked=cab.checked}}
+ }
+}
+function sht(f){
+ document.DF.dosht.value=f;
+}
+<?php }?>
+</script>
+
+</head>
+<body onload="after_load()">
+<form method="post" name="DF" id="DF" action="<?php eo($self)?>" enctype="multipart/form-data">
+<input type="hidden" name="XSS" value="<?php eo($_SESSION['XSS'])?>">
+<input type="hidden" name="refresh" value="">
+<input type="hidden" name="p" value="">
+
+<div class="inv">
+<a href="http://phpminiadmin.sourceforge.net/" target="_blank"><b>phpMiniAdmin <?php eo($VERSION)?></b></a>
+<?php if ($_SESSION['is_logged'] && $dbh){ ?>
+ | <a href="?<?php eo($xurl.'&q='.b64u("show databases"))?>">Databases</a>: <select name="db" onChange="frefresh()"><option value='*'> - select/refresh -</option><option value=''> - show all -</option>
+<?php echo get_db_select($dbn)?></select>
+<?php if($dbn){ $z=" &#183; <a href='".hs($self."?$xurl&db=".ue($dbn)); ?>
+<?php echo $z.'&q='.b64u($SHOW_T)?>'>show tables</a>
+<?php echo $z?>&shex=1'>export</a>
+<?php echo $z?>&shim=1'>import</a>
+<?php } ?>
+ | <a href="?showcfg=1">Settings</a>
+<?php } ?>
+<?php if ($_SESSION['is_logged']){?> | <a href="?<?php eo($xurl)?>&logoff=1" onclick="logoff()">Logoff</a> <?php }?>
+ | <a href="?pi=1">phpinfo</a>
+</div>
+
+<div class="err"><?php eo($err_msg)?></div>
+
+<?php
+}
+
+function print_screen(){
+ global $out_message, $SQLq, $err_msg, $reccount, $time_all, $sqldr, $page, $MAX_ROWS_PER_PAGE, $is_limited_sql, $last_count, $is_sm;
+
+ $nav='';
+ if ($is_limited_sql && ($page || $reccount>=$MAX_ROWS_PER_PAGE) ){
+  $nav="<div class='nav'>".get_nav($page, 10000, $MAX_ROWS_PER_PAGE, "javascript:go(%p%)")."</div>";
+ }
+
+ print_header();
+?>
+
+<div class="dot" style="padding:3px 20px">
+<label for="qraw">SQL-query (or multiple queries separated by ";"):</label>&nbsp;<button type="button" class="qnav" onclick="q_prev()">&lt;</button><button type="button" class="qnav" onclick="q_next()">&gt;</button><br>
+<textarea id="qraw" cols="70" rows="10"><?php eo($SQLq)?></textarea><br>
+<input type="hidden" name="q" id="q" value="<?php b64e($SQLq);?>">
+<input type="submit" name="GoSQL" value="Go" class="sbtn">
+<input type="button" name="Clear" value=" Clear " onclick="$('qraw').value='';" style="width:100px">
+<?php if(!empty($_REQUEST['db'])){ ?>
+<div style="float:right">
+<input type="button" value="Select" class="sbtn" onclick="qtpl('SELECT *\nFROM %T\nWHERE 1')">
+<input type="button" value="Insert" class="sbtn" onclick="qtpl('INSERT INTO %T (`column`, `column`)\nVALUES (\'value\', \'value\')')">
+<input type="button" value="Update" class="sbtn" onclick="qtpl('UPDATE %T\nSET `column`=\'value\'\nWHERE 1=0')">
+<input type="button" value="Delete" class="sbtn" onclick="qtpl('DELETE FROM %T\nWHERE 1=0')">
+</div><br class="clear">
+<?php } ?>
+</div>
+<div class="dot">
+<div style="float:right;padding:0 15px"><label><input type="checkbox" name="is_sm" value="1" id="is_sm" onclick="smview()" <?php eo($is_sm?'checked':'')?>> compact view</label></div>
+Records: <b><?php eo($reccount); if(!is_null($last_count) && $reccount<$last_count){eo(' out of '.$last_count);}?></b> in <b><?php eo($time_all)?></b> sec<br>
+<b><?php eo($out_message)?></b>
+</div>
+<?php echo $nav.$sqldr.$nav; ?>
+<?php
+ print_footer();
+}
+
+function print_footer(){
+?>
+</form>
+<div class="ft">&copy; 2004-2017 <a href="http://osalabs.com" target="_blank">Oleg Savchuk</a></div>
+</body></html>
+<?php
+}
+
+function print_login(){
+ print_header();
+?>
+<center>
+<h3>Access protected by password</h3>
+<div style="width:400px;border:1px solid #999999;background-color:#eeeeee">
+<label>Password: <input type="password" name="pwd" value=""></label>
+<input type="hidden" name="login" value="1">
+<input type="submit" value=" Login ">
+</div>
+</center>
+<?php
+ print_footer();
+}
+
+
+function print_cfg(){
+ global $DB,$err_msg,$self;
+ print_header();
+?>
+<center>
+<h3>DB Connection Settings</h3>
+<div class="frm">
+<label><div class="l">DB user name:</div><input type="text" name="v[user]" value="<?php eo($DB['user'])?>"></label><br>
+<label><div class="l">Password:</div><input type="password" name="v[pwd]" value=""></label><br>
+<div style="text-align:right"><a href="#" class="ajax" onclick="cfg_toggle()">advanced settings</a></div>
+<div id="cfg-adv" style="display:none;">
+<label><div class="l">DB name:</div><input type="text" name="v[db]" value="<?php eo($DB['db'])?>"></label><br>
+<label><div class="l">MySQL host:</div><input type="text" name="v[host]" value="<?php eo($DB['host'])?>"></label> <label>port: <input type="text" name="v[port]" value="<?php eo($DB['port'])?>" size="4"></label><br>
+<label><div class="l">Charset:</div><select name="v[chset]"><option value="">- default -</option><?php echo chset_select($DB['chset'])?></select></label><br>
+<br><label for ="rmb"><input type="checkbox" name="rmb" id="rmb" value="1" checked> Remember in cookies for 30 days or until Logoff</label>
+</div>
+<center>
+<input type="hidden" name="savecfg" value="1">
+<input type="submit" value=" Apply "><input type="button" value=" Cancel " onclick="window.location='<?php eo($self)?>'">
+</center>
+</div>
+</center>
+<?php
+ print_footer();
+}
+
+
+//* utilities
+function db_connect($nodie=0){
+ global $dbh,$DB,$err_msg;
+
+ if ($DB['port']) {
+    $dbh=mysqli_connect($DB['host'],$DB['user'],$DB['pwd'],'',(int)$DB['port']);
+ } else {
+    $dbh=mysqli_connect($DB['host'],$DB['user'],$DB['pwd']);
+ }
+ if (!$dbh) {
+    $err_msg='Cannot connect to the database because: '.mysqli_connect_error();
+    if (!$nodie) die($err_msg);
+ }
+
+ if ($dbh && $DB['db']) {
+  $res=mysqli_select_db($dbh, $DB['db']);
+  if (!$res) {
+     $err_msg='Cannot select db because: '.mysqli_error($dbh);
+     if (!$nodie) die($err_msg);
+  }else{
+     if ($DB['chset']) db_query("SET NAMES ".$DB['chset']);
+  }
+ }
+
+ return $dbh;
+}
+
+function db_checkconnect($dbh1=NULL, $skiperr=0){
+ global $dbh;
+ if (!$dbh1) $dbh1=&$dbh;
+ if (!$dbh1 or !mysqli_ping($dbh1)) {
+    db_connect($skiperr);
+    $dbh1=&$dbh;
+ }
+ return $dbh1;
+}
+
+function db_disconnect(){
+ global $dbh;
+ mysqli_close($dbh);
+}
+
+function dbq($s){
+ global $dbh;
+ if (is_null($s)) return "NULL";
+ return "'".mysqli_real_escape_string($dbh,$s)."'";
+}
+
+function db_query($sql, $dbh1=NULL, $skiperr=0, $resmod=MYSQLI_STORE_RESULT){
+ $dbh1=db_checkconnect($dbh1, $skiperr);
+ $sth=mysqli_query($dbh1, $sql, $resmod);
+ if (!$sth && $skiperr) return;
+ if (!$sth) die("Error in DB operation:<br>\n".mysqli_error($dbh1)."<br>\n$sql");
+ return $sth;
+}
+
+function db_array($sql, $dbh1=NULL, $skiperr=0, $isnum=0){#array of rows
+ $sth=db_query($sql, $dbh1, $skiperr, MYSQLI_USE_RESULT);
+ if (!$sth) return;
+ $res=array();
+ if ($isnum){
+   while($row=mysqli_fetch_row($sth)) $res[]=$row;
+ }else{
+   while($row=mysqli_fetch_assoc($sth)) $res[]=$row;
+ }
+ mysqli_free_result($sth);
+ return $res;
+}
+
+function db_row($sql){
+ $sth=db_query($sql);
+ return mysqli_fetch_assoc($sth);
+}
+
+function db_value($sql,$dbh1=NULL,$skiperr=0){
+ $sth=db_query($sql,$dbh1,$skiperr);
+ if (!$sth) return;
+ $row=mysqli_fetch_row($sth);
+ return $row[0];
+}
+
+function get_identity($dbh1=NULL){
+ $dbh1=db_checkconnect($dbh1);
+ return mysqli_insert_id($dbh1);
+}
+
+function get_db_select($sel=''){
+ global $DB,$SHOW_D;
+ if (is_array($_SESSION['sql_sd']) && $_REQUEST['db']!='*'){//check cache
+    $arr=$_SESSION['sql_sd'];
+ }else{
+   $arr=db_array($SHOW_D,NULL,1);
+   if (!is_array($arr)){
+      $arr=array( 0 => array('Database' => $DB['db']) );
+    }
+   $_SESSION['sql_sd']=$arr;
+ }
+ return @sel($arr,'Database',$sel);
+}
+
+function chset_select($sel=''){
+ global $DBDEF;
+ $result='';
+ if ($_SESSION['sql_chset']){
+    $arr=$_SESSION['sql_chset'];
+ }else{
+   $arr=db_array("show character set",NULL,1);
+   if (!is_array($arr)) $arr=array(array('Charset'=>$DBDEF['chset']));
+   $_SESSION['sql_chset']=$arr;
+ }
+
+ return @sel($arr,'Charset',$sel);
+}
+
+function sel($arr,$n,$sel=''){
+ foreach($arr as $a){
+#   echo $a[0];
+   $b=$a[$n];
+   $res.="<option value='".hs($b)."' ".($sel && $sel==$b?'selected':'').">".hs($b)."</option>";
+ }
+ return $res;
+}
+
+function microtime_float(){
+ list($usec,$sec)=explode(" ",microtime());
+ return ((float)$usec+(float)$sec);
+}
+
+/* page nav
+ $pg=int($_[0]);     #current page
+ $all=int($_[1]);     #total number of items
+ $PP=$_[2];      #number if items Per Page
+ $ptpl=$_[3];      #page url /ukr/dollar/notes.php?page=    for notes.php
+ $show_all=$_[5];           #print Totals?
+*/
+function get_nav($pg, $all, $PP, $ptpl, $show_all=''){
+  $n='&nbsp;';
+  $sep=" $n|$n\n";
+  if (!$PP) $PP=10;
+  $allp=floor($all/$PP+0.999999);
+
+  $pname='';
+  $res='';
+  $w=array('Less','More','Back','Next','First','Total');
+
+  $sp=$pg-2;
+  if($sp<0) $sp=0;
+  if($allp-$sp<5 && $allp>=5) $sp=$allp-5;
+
+  $res="";
+
+  if($sp>0){
+    $pname=pen($sp-1,$ptpl);
+    $res.="<a href='$pname'>$w[0]</a>";
+    $res.=$sep;
+  }
+  for($p_p=$sp;$p_p<$allp && $p_p<$sp+5;$p_p++){
+     $first_s=$p_p*$PP+1;
+     $last_s=($p_p+1)*$PP;
+     $pname=pen($p_p,$ptpl);
+     if($last_s>$all){
+       $last_s=$all;
+     }
+     if($p_p==$pg){
+        $res.="<b>$first_s..$last_s</b>";
+     }else{
+        $res.="<a href='$pname'>$first_s..$last_s</a>";
+     }
+     if($p_p+1<$allp) $res.=$sep;
+  }
+  if($sp+5<$allp){
+    $pname=pen($sp+5,$ptpl);
+    $res.="<a href='$pname'>$w[1]</a>";
+  }
+  $res.=" <br>\n";
+
+  if($pg>0){
+    $pname=pen($pg-1,$ptpl);
+    $res.="<a href='$pname'>$w[2]</a> $n|$n ";
+    $pname=pen(0,$ptpl);
+    $res.="<a href='$pname'>$w[4]</a>";
+  }
+  if($pg>0 && $pg+1<$allp) $res.=$sep;
+  if($pg+1<$allp){
+    $pname=pen($pg+1,$ptpl);
+    $res.="<a href='$pname'>$w[3]</a>";
+  }
+  if ($show_all) $res.=" <b>($w[5] - $all)</b> ";
+
+  return $res;
+}
+
+function pen($p,$np=''){
+ return str_replace('%p%',$p, $np);
+}
+
+function killmq($value){
+ return is_array($value)?array_map('killmq',$value):stripslashes($value);
+}
+
+function savecfg(){
+ $v=$_REQUEST['v'];
+ $_SESSION['DB']=$v;
+ unset($_SESSION['sql_sd']);
+
+ if ($_REQUEST['rmb']){
+    $tm=time()+60*60*24*30;
+    newcookie("conn[db]",  $v['db'],$tm);
+    newcookie("conn[user]",$v['user'],$tm);
+    newcookie("conn[pwd]", $v['pwd'],$tm);
+    newcookie("conn[host]",$v['host'],$tm);
+    newcookie("conn[port]",$v['port'],$tm);
+    newcookie("conn[chset]",$v['chset'],$tm);
+ }else{
+    newcookie("conn[db]",  FALSE,-1);
+    newcookie("conn[user]",FALSE,-1);
+    newcookie("conn[pwd]", FALSE,-1);
+    newcookie("conn[host]",FALSE,-1);
+    newcookie("conn[port]",FALSE,-1);
+    newcookie("conn[chset]",FALSE,-1);
+ }
+}
+
+// Allow httponly cookies, or the password is stored plain text in a cookie
+function newcookie($n,$v,$e){$x;return setcookie($n,$v,$e,$x,$x,!!$x,!$x);}
+
+//during login only - from cookies or use defaults;
+function loadcfg(){
+ global $DBDEF;
+
+ if( isset($_COOKIE['conn']) ){
+    $_SESSION['DB']=$_COOKIE['conn'];
+ }else{
+    $_SESSION['DB']=$DBDEF;
+ }
+ if (!strlen($_SESSION['DB']['chset'])) $_SESSION['DB']['chset']=$DBDEF['chset'];#don't allow empty charset
+}
+
+//each time - from session to $DB_*
+function loadsess(){
+ global $DB, $is_sm;
+
+ $DB=$_SESSION['DB'];
+
+ $rdb=$_REQUEST['db'];
+ if ($rdb=='*') $rdb='';
+ if ($rdb) {
+    $DB['db']=$rdb;
+ }
+ if($_REQUEST['GoSQL']) $_SESSION['is_sm']=$_REQUEST['is_sm']+0;
+ $is_sm=$_SESSION['is_sm']+0;
+}
+
+function print_export(){
+ global $self,$xurl,$DB,$DUMP_FILE;
+ $t=$_REQUEST['rt'];
+ $l=($t)?"Table $t":"whole DB";
+ print_header();
+?>
+<center>
+<h3>Export <?php eo($l)?></h3>
+<div class="frm">
+<input type="checkbox" name="s" value="1" checked> Structure<br>
+<input type="checkbox" name="d" value="1" checked> Data<br><br>
+<div><label><input type="radio" name="et" value="" checked> .sql</label>&nbsp;</div>
+<div>
+<?php if ($t && !strpos($t,',')){?>
+ <label><input type="radio" name="et" value="csv"> .csv (Excel style, data only and for one table only)</label>
+<?php }else{?>
+<label>&nbsp;( ) .csv</label> <small>(to export as csv - go to 'show tables' and export just ONE table)</small>
+<?php }?>
+</div>
+<br>
+<div><label><input type="checkbox" name="sp" value="1"> import has super privileges</label></div>
+<div><label><input type="checkbox" name="gz" value="1"> compress as .gz</label></div>
+<br>
+<input type="hidden" name="doex" value="1">
+<input type="hidden" name="rt" value="<?php eo($t)?>">
+<input type="submit" value=" Download ">
+<input type="submit" name="srv" value=" Dump on Server ">
+<input type="button" value=" Cancel " onclick="window.location='<?php eo($self.'?'.$xurl.'&db='.ue($DB['db']))?>'">
+<p><small>"Dump on Server" exports to file:<br><?php eo(export_fname($DUMP_FILE).'.sql')?></small></p>
+</div>
+</center>
+<?php
+ print_footer();
+ exit;
+}
+
+function export_fname($f,$ist=false){
+ $t=$ist?date('Y-m-d-His'):'YYYY-MM-DD-HHMMSS';
+ return $f.$t;
+}
+
+function do_export(){
+ global $DB,$VERSION,$D,$BOM,$ex_isgz,$ex_issrv,$dbh,$out_message;
+ $rt=str_replace('`','',$_REQUEST['rt']);
+ $t=explode(",",$rt);
+ $th=array_flip($t);
+ $ct=count($t);
+ $z=db_row("show variables like 'max_allowed_packet'");
+ $MAXI=floor($z['Value']*0.8);
+ if(!$MAXI)$MAXI=838860;
+ $aext='';$ctp='';
+
+ $ex_super=($_REQUEST['sp'])?1:0;
+ $ex_isgz=($_REQUEST['gz'])?1:0;
+ if ($ex_isgz) {
+    $aext='.gz';$ctp='application/x-gzip';
+ }
+ $ex_issrv=($_REQUEST['srv'])?1:0;
+
+ if ($ct==1&&$_REQUEST['et']=='csv'){
+  ex_start('.csv');
+  ex_hdr($ctp?$ctp:'text/csv',"$t[0].csv$aext");
+  if ($DB['chset']=='utf8') ex_w($BOM);
+
+  $sth=db_query("select * from `$t[0]`",NULL,0,MYSQLI_USE_RESULT);
+  $fn=mysqli_field_count($dbh);
+  for($i=0;$i<$fn;$i++){
+   $m=mysqli_fetch_field($sth);
+   ex_w(qstr($m->name).(($i<$fn-1)?",":""));
+  }
+  ex_w($D);
+  while($row=mysqli_fetch_row($sth)) ex_w(to_csv_row($row));
+  mysqli_free_result($sth);
+ }else{
+  ex_start('.sql');
+  ex_hdr($ctp?$ctp:'text/plain',"$DB[db]".(($ct==1&&$t[0])?".$t[0]":(($ct>1)?'.'.$ct.'tables':'')).".sql$aext");
+  ex_w("-- phpMiniAdmin dump $VERSION$D-- Datetime: ".date('Y-m-d H:i:s')."$D-- Host: $DB[host]$D-- Database: $DB[db]$D$D");
+  if ($DB['chset']) ex_w("/*!40030 SET NAMES $DB[chset] */;$D");
+  $ex_super && ex_w("/*!40030 SET GLOBAL max_allowed_packet=16777216 */;$D$D");
+  ex_w("/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;$D$D");
+
+  $sth=db_query("show full tables from `$DB[db]`");
+  while($row=mysqli_fetch_row($sth)){
+    if (!$rt||array_key_exists($row[0],$th)) do_export_table($row[0],$row[1],$MAXI);
+  }
+
+  ex_w("/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;$D$D");
+  ex_w("$D-- phpMiniAdmin dump end$D");
+ }
+ ex_end();
+ if (!$ex_issrv) exit;
+ $out_message='Export done successfully';
+}
+
+function do_export_table($t='',$tt='',$MAXI=838860){
+ global $D,$ex_issrv;
+ @set_time_limit(600);
+
+ if($_REQUEST['s']){
+  $sth=db_query("show create table `$t`");
+  $row=mysqli_fetch_row($sth);
+  $ct=preg_replace("/\n\r|\r\n|\n|\r/",$D,$row[1]);
+  ex_w("DROP TABLE IF EXISTS `$t`;$D$ct;$D$D");
+ }
+
+ if ($_REQUEST['d']&&$tt!='VIEW'){//no dump for views
+  $exsql='';
+  ex_w("/*!40000 ALTER TABLE `$t` DISABLE KEYS */;$D");
+  $sth=db_query("select * from `$t`",NULL,0,MYSQLI_USE_RESULT);
+  while($row=mysqli_fetch_row($sth)){
+    $values='';
+    foreach($row as $v) $values.=(($values)?',':'').dbq($v);
+    $exsql.=(($exsql)?',':'')."(".$values.")";
+    if (strlen($exsql)>$MAXI) {
+       ex_w("INSERT INTO `$t` VALUES $exsql;$D");$exsql='';
+    }
+  }
+  mysqli_free_result($sth);
+  if ($exsql) ex_w("INSERT INTO `$t` VALUES $exsql;$D");
+  ex_w("/*!40000 ALTER TABLE `$t` ENABLE KEYS */;$D$D");
+ }
+ if (!$ex_issrv) flush();
+}
+
+function ex_hdr($ct,$fn){
+ global $ex_issrv;
+ if ($ex_issrv) return;
+ header("Content-type: $ct");
+ header("Content-Disposition: attachment; filename=\"$fn\"");
+}
+function ex_start($ext){
+ global $ex_isgz,$ex_gz,$ex_tmpf,$ex_issrv,$ex_f,$DUMP_FILE;
+ if ($ex_isgz){
+    $ex_tmpf=($ex_issrv?export_fname($DUMP_FILE,true).$ext:tmp_name()).'.gz';
+    if (!($ex_gz=gzopen($ex_tmpf,'wb9'))) die("Error trying to create gz tmp file");
+ }else{
+    if ($ex_issrv) {
+      if (!($ex_f=fopen(export_fname($DUMP_FILE,true).$ext,'wb'))) die("Error trying to create dump file");
+    }
+ }
+}
+function ex_w($s){
+ global $ex_isgz,$ex_gz,$ex_issrv,$ex_f;
+ if ($ex_isgz){
+    gzwrite($ex_gz,$s,strlen($s));
+ }else{
+    if ($ex_issrv){
+        fwrite($ex_f,$s);
+    }else{
+        echo $s;
+    }
+ }
+}
+function ex_end(){
+ global $ex_isgz,$ex_gz,$ex_tmpf,$ex_issrv,$ex_f;
+ if ($ex_isgz){
+    gzclose($ex_gz);
+    if (!$ex_issrv){
+      readfile($ex_tmpf);
+      unlink($ex_tmpf);
+    }
+ }else{
+    if ($ex_issrv) fclose($ex_f);
+ }
+}
+
+function print_import(){
+ global $self,$xurl,$DB,$DUMP_FILE;
+ print_header();
+?>
+<center>
+<h3>Import DB</h3>
+<div class="frm">
+<div><label><input type="radio" name="it" value="" checked> import by uploading <b>.sql</b> or <b>.gz</b> file:</label>
+ <input type="file" name="file1" value="" size=40><br>
+</div>
+<div><label><input type="radio" name="it" value="sql"> import from file on server:<br>
+ <?php eo($DUMP_FILE.'.sql')?></label></div>
+<div><label><input type="radio" name="it" value="gz"> import from file on server:<br>
+ <?php eo($DUMP_FILE.'.sql.gz')?></label></div>
+<input type="hidden" name="doim" value="1">
+<input type="submit" value=" Import " onclick="return ays()"><input type="button" value=" Cancel " onclick="window.location='<?php eo($self.'?'.$xurl.'&db='.ue($DB['db']))?>'">
+</div>
+<br><br><br>
+<!--
+<h3>Import one Table from CSV</h3>
+<div class="frm">
+.csv file (Excel style): <input type="file" name="file2" value="" size=40><br>
+<input type="checkbox" name="r1" value="1" checked> first row contain field names<br>
+<small>(note: for success, field names should be exactly the same as in DB)</small><br>
+Character set of the file: <select name="chset"><?php echo chset_select('utf8')?></select>
+<br><br>
+Import into:<br>
+<input type="radio" name="tt" value="1" checked="checked"> existing table:
+ <select name="t">
+ <option value=''>- select -</option>
+ <?php echo sel(db_array('show tables',NULL,0,1), 0, ''); ?>
+</select>
+<div style="margin-left:20px">
+ <input type="checkbox" name="ttr" value="1"> replace existing DB data<br>
+ <input type="checkbox" name="tti" value="1"> ignore duplicate rows
+</div>
+<input type="radio" name="tt" value="2"> create new table with name <input type="text" name="tn" value="" size="20">
+<br><br>
+<input type="hidden" name="doimcsv" value="1">
+<input type="submit" value=" Upload and Import " onclick="return ays()"><input type="button" value=" Cancel " onclick="window.location='<?php eo($self)?>'">
+</div>
+-->
+</center>
+<?php
+ print_footer();
+ exit;
+}
+
+function do_import(){
+ global $err_msg,$out_message,$dbh,$SHOW_T,$DUMP_FILE;
+ $err_msg='';
+ $it=$_REQUEST['it'];
+
+ if (!$it){
+    $F=$_FILES['file1'];
+    if ($F && $F['name']){
+       $filename=$F['tmp_name'];
+       $pi=pathinfo($F['name']);
+       $ext=$pi['extension'];
+    }
+ }else{
+    $ext=($it=='gz'?'sql.gz':'sql');
+    $filename=$DUMP_FILE.'.'.$ext;
+ }
+
+ if ($filename && file_exists($filename)){
+  if ($ext!='sql'){//if not sql - assume .gz and extract
+     $tmpf=tmp_name();
+     if (($gz=gzopen($filename,'rb')) && ($tf=fopen($tmpf,'wb'))){
+        while(!gzeof($gz)){
+           if (fwrite($tf,gzread($gz,8192),8192)===FALSE){$err_msg='Error during gz file extraction to tmp file';break;}
+        }//extract to tmp file
+        gzclose($gz);fclose($tf);$filename=$tmpf;
+     }else{$err_msg='Error opening gz file';}
+  }
+  if (!$err_msg){
+   if (!do_multi_sql('', $filename)){
+      $err_msg='Import Error: '.mysqli_error($dbh);
+   }else{
+      $out_message='Import done successfully';
+      do_sql($SHOW_T);
+      return;
+  }}
+
+ }else{
+    $err_msg="Error: Please select file first";
+ }
+ print_import();
+ exit;
+}
+
+// multiple SQL statements splitter
+function do_multi_sql($insql,$fname=''){
+ @set_time_limit(600);
+
+ $sql='';
+ $ochar='';
+ $is_cmt='';
+ $GLOBALS['insql_done']=0;
+ while ($str=get_next_chunk($insql,$fname)){
+    $opos=-strlen($ochar);
+    $cur_pos=0;
+    $i=strlen($str);
+    while ($i--){
+       if ($ochar){
+          list($clchar, $clpos)=get_close_char($str, $opos+strlen($ochar), $ochar);
+          if ( $clchar ) {
+             if ($ochar=='--' || $ochar=='#' || $is_cmt ){
+                $sql.=substr($str, $cur_pos, $opos-$cur_pos );
+             }else{
+                $sql.=substr($str, $cur_pos, $clpos+strlen($clchar)-$cur_pos );
+             }
+             $cur_pos=$clpos+strlen($clchar);
+             $ochar='';
+             $opos=0;
+          }else{
+             $sql.=substr($str, $cur_pos);
+             break;
+          }
+       }else{
+          list($ochar, $opos)=get_open_char($str, $cur_pos);
+          if ($ochar==';'){
+             $sql.=substr($str, $cur_pos, $opos-$cur_pos+1);
+             if (!do_one_sql($sql)) return 0;
+             $sql='';
+             $cur_pos=$opos+strlen($ochar);
+             $ochar='';
+             $opos=0;
+          }elseif(!$ochar) {
+             $sql.=substr($str, $cur_pos);
+             break;
+          }else{
+             $is_cmt=0;if ($ochar=='/*' && substr($str, $opos, 3)!='/*!') $is_cmt=1;
+          }
+       }
+    }
+ }
+
+ if ($sql){
+    if (!do_one_sql($sql)) return 0;
+    $sql='';
+ }
+ return 1;
+}
+
+//read from insql var or file
+function get_next_chunk($insql, $fname){
+ global $LFILE, $insql_done;
+ if ($insql) {
+    if ($insql_done){
+       return '';
+    }else{
+       $insql_done=1;
+       return $insql;
+    }
+ }
+ if (!$fname) return '';
+ if (!$LFILE){
+    $LFILE=fopen($fname,"r+b") or die("Can't open [$fname] file $!");
+ }
+ return fread($LFILE, 64*1024);
+}
+
+function get_open_char($str, $pos){
+ if ( preg_match("/(\/\*|^--|(?<=\s)--|#|'|\"|;)/", $str, $m, PREG_OFFSET_CAPTURE, $pos) ) {
+    $ochar=$m[1][0];
+    $opos=$m[1][1];
+ }
+ return array($ochar, $opos);
+}
+
+#RECURSIVE!
+function get_close_char($str, $pos, $ochar){
+ $aCLOSE=array(
+   '\'' => '(?<!\\\\)\'|(\\\\+)\'',
+   '"' => '(?<!\\\\)"',
+   '/*' => '\*\/',
+   '#' => '[\r\n]+',
+   '--' => '[\r\n]+',
+ );
+ if ( $aCLOSE[$ochar] && preg_match("/(".$aCLOSE[$ochar].")/", $str, $m, PREG_OFFSET_CAPTURE, $pos ) ) {
+    $clchar=$m[1][0];
+    $clpos=$m[1][1];
+    $sl=strlen($m[2][0]);
+    if ($ochar=="'" && $sl){
+       if ($sl % 2){ #don't count as CLOSE char if number of slashes before ' ODD
+          list($clchar, $clpos)=get_close_char($str, $clpos+strlen($clchar), $ochar);
+       }else{
+          $clpos+=strlen($clchar)-1;$clchar="'";#correction
+       }
+    }
+ }
+ return array($clchar, $clpos);
+}
+
+function do_one_sql($sql){
+ global $last_sth,$last_sql,$MAX_ROWS_PER_PAGE,$page,$is_limited_sql,$last_count,$IS_COUNT;
+ $sql=trim($sql);
+ $sql=preg_replace("/;$/","",$sql);
+ if ($sql){
+    $last_sql=$sql;$is_limited_sql=0;
+    $last_count=NULL;
+    if (preg_match("/^select/i",$sql) && !preg_match("/limit +\d+/i", $sql)){
+       if ($IS_COUNT){
+          #get total count
+          $sql1='select count(*) from ('.$sql.') ___count_table';
+          $last_count=db_value($sql1,NULL,'noerr');
+       }
+       $offset=$page*$MAX_ROWS_PER_PAGE;
+       $sql.=" LIMIT $offset,$MAX_ROWS_PER_PAGE";
+       $is_limited_sql=1;
+    }
+    $last_sth=db_query($sql,0,'noerr');
+    return $last_sth;
+ }
+ return 1;
+}
+
+function do_sht(){
+ global $SHOW_T;
+ $cb=$_REQUEST['cb'];
+ if (!is_array($cb)) $cb=array();
+ $sql='';
+ switch ($_REQUEST['dosht']){
+  case 'exp':$_REQUEST['t']=join(",",$cb);print_export();exit;
+  case 'drop':$sq='DROP TABLE';break;
+  case 'trunc':$sq='TRUNCATE TABLE';break;
+  case 'opt':$sq='OPTIMIZE TABLE';break;
+ }
+ if ($sq){
+  foreach($cb as $v){
+   $sql.=$sq." $v;\n";
+  }
+ }
+ if ($sql) do_sql($sql);
+ do_sql($SHOW_T);
+}
+
+function to_csv_row($adata){
+ global $D;
+ $r='';
+ foreach ($adata as $a){
+   $r.=(($r)?",":"").qstr($a);
+ }
+ return $r.$D;
+}
+function qstr($s){
+ $s=nl2br($s);
+ $s=str_replace('"','""',$s);
+ return '"'.$s.'"';
+}
+
+function get_rand_str($len){
+ $result='';
+ $chars=preg_split('//','ABCDEFabcdef0123456789');
+ for($i=0;$i<$len;$i++) $result.=$chars[rand(0,count($chars)-1)];
+ return $result;
+}
+
+function check_xss(){
+ global $self;
+ if ($_SESSION['XSS']!=trim($_REQUEST['XSS'])){
+    unset($_SESSION['XSS']);
+    header("location: $self");
+    exit;
+ }
+}
+
+function rw($s){#for debug
+ echo hs(var_dump($s))."<br>\n";
+}
+
+function tmp_name() {
+  if ( function_exists('sys_get_temp_dir')) return tempnam(sys_get_temp_dir(),'pma');
+
+  if( !($temp=getenv('TMP')) )
+    if( !($temp=getenv('TEMP')) )
+      if( !($temp=getenv('TMPDIR')) ) {
+        $temp=tempnam(__FILE__,'');
+        if (file_exists($temp)) {
+          unlink($temp);
+          $temp=dirname($temp);
+        }
+      }
+  return $temp ? tempnam($temp,'pma') : null;
+}
+
+function hs($s){
+  return htmlspecialchars($s, ENT_COMPAT|ENT_HTML401,'UTF-8');
+}
+function eo($s){//echo+escape
+  echo hs($s);
+}
+function ue($s){
+  return urlencode($s);
+}
+
+function b64e($s){
+  return base64_encode($s);
+}
+function b64u($s){
+  return ue(base64_encode($s));
+}
+function b64d($s){
+  return base64_decode($s);
+}
+?>
diff --git a/index.php b/public_html/index.php
similarity index 94%
rename from index.php
rename to public_html/index.php
index c3da94e2680547996f2e3c1df0881e9ff0899377..3b37289db46571316cfcdf73f3f556559b82bf82 100644
--- a/index.php
+++ b/public_html/index.php
@@ -1,8 +1,8 @@
 <?php
-require_once('application/config.php');
+require_once('../application/config.php');
 
 /* ERROR HANDLING : START */
-error_reporting(E_NONE);
+error_reporting(0);
 if (STATUS_DEBUG) {
 	error_reporting(STATUS_DEBUG_MODE);
 }
diff --git a/robots.txt b/public_html/robots.txt
similarity index 100%
rename from robots.txt
rename to public_html/robots.txt
diff --git a/public_html/templates/default/index.php b/public_html/templates/default/index.php
new file mode 100644
index 0000000000000000000000000000000000000000..3bc2ac13d429864e205a85415e4d958bf4283158
--- /dev/null
+++ b/public_html/templates/default/index.php
@@ -0,0 +1,95 @@
+<?php
+	/*
+		TODO:
+		- make meta data language dependable
+		- move the login check part to an external file in application folder
+	*/
+
+	function xml2assoc($xml) {
+		$tree = null;
+		while ($xml->read()) {
+			switch ($xml->nodeType) {
+				case XMLReader::END_ELEMENT:
+					return $tree;
+				case XMLReader::ELEMENT:
+					$node = array('tag' => $xml->name, 'value' => $xml->isEmptyElement ? '' : xml2assoc($xml));
+					if ($xml->hasAttributes) {
+						while ($xml->moveToNextAttribute()) {
+							$node['attributes'][$xml->name] = $xml->value;
+						}
+					}
+					$tree[] = $node;
+					break;
+				case XMLReader::TEXT:
+				case XMLReader::CDATA:
+					$tree .= $xml->value;
+			}
+		}
+		return $tree;
+	}
+	
+	
+?>
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, initial-scale=1.0">
+		<link rel="apple-touch-icon" sizes="57x57" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-57x57.png">
+		<link rel="apple-touch-icon" sizes="60x60" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-60x60.png">
+		<link rel="apple-touch-icon" sizes="72x72" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-72x72.png">
+		<link rel="apple-touch-icon" sizes="76x76" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-76x76.png">
+		<link rel="apple-touch-icon" sizes="114x114" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-114x114.png">
+		<link rel="apple-touch-icon" sizes="120x120" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-120x120.png">
+		<link rel="apple-touch-icon" sizes="144x144" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-144x144.png">
+		<link rel="apple-touch-icon" sizes="152x152" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-152x152.png">
+		<link rel="apple-touch-icon" sizes="180x180" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-180x180.png">
+		<link rel="icon" type="image/png" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/favicon-32x32.png" sizes="32x32">
+		<link rel="icon" type="image/png" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/android-chrome-192x192.png" sizes="192x192">
+		<link rel="icon" type="image/png" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/favicon-96x96.png" sizes="96x96">
+		<link rel="icon" type="image/png" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/favicon-16x16.png" sizes="16x16">
+		<link rel="manifest" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/manifest.json">
+		<link rel="mask-icon" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/safari-pinned-tab.svg" color="#5bbad5">
+		<meta name="msapplication-TileColor" content="#da532c">
+		<meta name="msapplication-TileImage" content="mstile-144x144.png">
+		<meta name="theme-color" content="#ffffff">
+		<title><?php echo PAGE_DEFAULT_META_TITLE; ?></title>
+		<meta name="description" content="<?php echo PAGE_DEFAULT_META_DESCRIPTION; ?>">
+		<meta name="author" content="Andy">
+		<!-- Fonts -->
+		<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700,400italic' rel='stylesheet' type='text/css'>
+		<link href='https://fonts.googleapis.com/css?family=Roboto:100,400,700,900&subset=latin,cyrillic,latin-ext' rel='stylesheet' type='text/css'>
+		<!-- Styles -->
+		<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
+		<link rel="stylesheet" type="text/css" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/styles/general.css?<?php echo time(); ?>" />
+	<?php if (!$page_type || security::secure_request_data($page_type)=='simple') { ?>
+			<link rel="stylesheet" type="text/css" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/styles/<?php echo $page; ?>.css?<?php echo time(); ?>" />
+		<?php } ?>
+		<!-- Scripts -->
+		<script src="<?php echo WEB_BASE_URL; ?>/templates/<?php echo CURRENT_TEMPLATE; ?>/scripts/jquery-3.2.1.min.js" type="text/javascript"></script>
+		<script src="<?php echo WEB_BASE_URL; ?>/templates/<?php echo CURRENT_TEMPLATE; ?>/scripts/fontawesome-all.min.js" type="text/javascript"></script>
+		<?php if (file_exists(WEB_BASE_DIR.'/templates/'.CURRENT_TEMPLATE.'/scripts/'.$page.'.js')) { ?>
+			<script src="<?php echo WEB_BASE_URL; ?>/templates/<?php echo CURRENT_TEMPLATE; ?>/scripts/<?php echo $page; ?>.js?<?php echo time(); ?>" type="text/javascript"></script>
+		<?php } ?>
+		<script src="<?php echo WEB_BASE_URL; ?>/templates/<?php echo CURRENT_TEMPLATE; ?>/scripts/login.js" type="text/javascript"></script>
+	</head>
+	<body>
+		<?php
+			if (!$page_type || security::secure_request_data($page_type)=='simple') {
+				echo '<section id="main_wrapper">';
+				require_once(APP_BASE_DIR.'/components/header.php');
+				echo '<section id="main_content">';
+				//echo '<pre>'; print_r($_SESSION); echo '</pre>'; die();
+				if (user::isLogged() || $page!=='home') {
+					require_once(APP_BASE_DIR.'/pages/'.$page.'.php');
+				} else {
+					require_once(APP_BASE_DIR.'/components/login.php');
+				}
+				echo '</section>';
+				require_once(APP_BASE_DIR.'/components/footer.php');
+				echo '</section>';
+			} else {
+			}
+		?>
+	</body>
+</html>
\ No newline at end of file
diff --git a/templates/default/media/images/favicons/android-chrome-144x144.png b/public_html/templates/default/media/images/favicons/android-chrome-144x144.png
similarity index 100%
rename from templates/default/media/images/favicons/android-chrome-144x144.png
rename to public_html/templates/default/media/images/favicons/android-chrome-144x144.png
diff --git a/templates/default/media/images/favicons/android-chrome-192x192.png b/public_html/templates/default/media/images/favicons/android-chrome-192x192.png
similarity index 100%
rename from templates/default/media/images/favicons/android-chrome-192x192.png
rename to public_html/templates/default/media/images/favicons/android-chrome-192x192.png
diff --git a/templates/default/media/images/favicons/android-chrome-36x36.png b/public_html/templates/default/media/images/favicons/android-chrome-36x36.png
similarity index 100%
rename from templates/default/media/images/favicons/android-chrome-36x36.png
rename to public_html/templates/default/media/images/favicons/android-chrome-36x36.png
diff --git a/templates/default/media/images/favicons/android-chrome-48x48.png b/public_html/templates/default/media/images/favicons/android-chrome-48x48.png
similarity index 100%
rename from templates/default/media/images/favicons/android-chrome-48x48.png
rename to public_html/templates/default/media/images/favicons/android-chrome-48x48.png
diff --git a/templates/default/media/images/favicons/android-chrome-72x72.png b/public_html/templates/default/media/images/favicons/android-chrome-72x72.png
similarity index 100%
rename from templates/default/media/images/favicons/android-chrome-72x72.png
rename to public_html/templates/default/media/images/favicons/android-chrome-72x72.png
diff --git a/templates/default/media/images/favicons/android-chrome-96x96.png b/public_html/templates/default/media/images/favicons/android-chrome-96x96.png
similarity index 100%
rename from templates/default/media/images/favicons/android-chrome-96x96.png
rename to public_html/templates/default/media/images/favicons/android-chrome-96x96.png
diff --git a/templates/default/media/images/favicons/apple-touch-icon-114x114.png b/public_html/templates/default/media/images/favicons/apple-touch-icon-114x114.png
similarity index 100%
rename from templates/default/media/images/favicons/apple-touch-icon-114x114.png
rename to public_html/templates/default/media/images/favicons/apple-touch-icon-114x114.png
diff --git a/templates/default/media/images/favicons/apple-touch-icon-120x120.png b/public_html/templates/default/media/images/favicons/apple-touch-icon-120x120.png
similarity index 100%
rename from templates/default/media/images/favicons/apple-touch-icon-120x120.png
rename to public_html/templates/default/media/images/favicons/apple-touch-icon-120x120.png
diff --git a/templates/default/media/images/favicons/apple-touch-icon-144x144.png b/public_html/templates/default/media/images/favicons/apple-touch-icon-144x144.png
similarity index 100%
rename from templates/default/media/images/favicons/apple-touch-icon-144x144.png
rename to public_html/templates/default/media/images/favicons/apple-touch-icon-144x144.png
diff --git a/templates/default/media/images/favicons/apple-touch-icon-152x152.png b/public_html/templates/default/media/images/favicons/apple-touch-icon-152x152.png
similarity index 100%
rename from templates/default/media/images/favicons/apple-touch-icon-152x152.png
rename to public_html/templates/default/media/images/favicons/apple-touch-icon-152x152.png
diff --git a/templates/default/media/images/favicons/apple-touch-icon-180x180.png b/public_html/templates/default/media/images/favicons/apple-touch-icon-180x180.png
similarity index 100%
rename from templates/default/media/images/favicons/apple-touch-icon-180x180.png
rename to public_html/templates/default/media/images/favicons/apple-touch-icon-180x180.png
diff --git a/templates/default/media/images/favicons/apple-touch-icon-57x57.png b/public_html/templates/default/media/images/favicons/apple-touch-icon-57x57.png
similarity index 100%
rename from templates/default/media/images/favicons/apple-touch-icon-57x57.png
rename to public_html/templates/default/media/images/favicons/apple-touch-icon-57x57.png
diff --git a/templates/default/media/images/favicons/apple-touch-icon-60x60.png b/public_html/templates/default/media/images/favicons/apple-touch-icon-60x60.png
similarity index 100%
rename from templates/default/media/images/favicons/apple-touch-icon-60x60.png
rename to public_html/templates/default/media/images/favicons/apple-touch-icon-60x60.png
diff --git a/templates/default/media/images/favicons/apple-touch-icon-72x72.png b/public_html/templates/default/media/images/favicons/apple-touch-icon-72x72.png
similarity index 100%
rename from templates/default/media/images/favicons/apple-touch-icon-72x72.png
rename to public_html/templates/default/media/images/favicons/apple-touch-icon-72x72.png
diff --git a/templates/default/media/images/favicons/apple-touch-icon-76x76.png b/public_html/templates/default/media/images/favicons/apple-touch-icon-76x76.png
similarity index 100%
rename from templates/default/media/images/favicons/apple-touch-icon-76x76.png
rename to public_html/templates/default/media/images/favicons/apple-touch-icon-76x76.png
diff --git a/templates/default/media/images/favicons/apple-touch-icon-precomposed.png b/public_html/templates/default/media/images/favicons/apple-touch-icon-precomposed.png
similarity index 100%
rename from templates/default/media/images/favicons/apple-touch-icon-precomposed.png
rename to public_html/templates/default/media/images/favicons/apple-touch-icon-precomposed.png
diff --git a/templates/default/media/images/favicons/apple-touch-icon.png b/public_html/templates/default/media/images/favicons/apple-touch-icon.png
similarity index 100%
rename from templates/default/media/images/favicons/apple-touch-icon.png
rename to public_html/templates/default/media/images/favicons/apple-touch-icon.png
diff --git a/templates/default/media/images/favicons/browserconfig.xml b/public_html/templates/default/media/images/favicons/browserconfig.xml
similarity index 100%
rename from templates/default/media/images/favicons/browserconfig.xml
rename to public_html/templates/default/media/images/favicons/browserconfig.xml
diff --git a/templates/default/media/images/favicons/favicon-16x16.png b/public_html/templates/default/media/images/favicons/favicon-16x16.png
similarity index 100%
rename from templates/default/media/images/favicons/favicon-16x16.png
rename to public_html/templates/default/media/images/favicons/favicon-16x16.png
diff --git a/templates/default/media/images/favicons/favicon-32x32.png b/public_html/templates/default/media/images/favicons/favicon-32x32.png
similarity index 100%
rename from templates/default/media/images/favicons/favicon-32x32.png
rename to public_html/templates/default/media/images/favicons/favicon-32x32.png
diff --git a/templates/default/media/images/favicons/favicon-96x96.png b/public_html/templates/default/media/images/favicons/favicon-96x96.png
similarity index 100%
rename from templates/default/media/images/favicons/favicon-96x96.png
rename to public_html/templates/default/media/images/favicons/favicon-96x96.png
diff --git a/templates/default/media/images/favicons/favicon.ico b/public_html/templates/default/media/images/favicons/favicon.ico
similarity index 100%
rename from templates/default/media/images/favicons/favicon.ico
rename to public_html/templates/default/media/images/favicons/favicon.ico
diff --git a/templates/default/media/images/favicons/manifest.json b/public_html/templates/default/media/images/favicons/manifest.json
similarity index 100%
rename from templates/default/media/images/favicons/manifest.json
rename to public_html/templates/default/media/images/favicons/manifest.json
diff --git a/templates/default/media/images/favicons/mstile-144x144.png b/public_html/templates/default/media/images/favicons/mstile-144x144.png
similarity index 100%
rename from templates/default/media/images/favicons/mstile-144x144.png
rename to public_html/templates/default/media/images/favicons/mstile-144x144.png
diff --git a/templates/default/media/images/favicons/mstile-150x150.png b/public_html/templates/default/media/images/favicons/mstile-150x150.png
similarity index 100%
rename from templates/default/media/images/favicons/mstile-150x150.png
rename to public_html/templates/default/media/images/favicons/mstile-150x150.png
diff --git a/templates/default/media/images/favicons/mstile-310x150.png b/public_html/templates/default/media/images/favicons/mstile-310x150.png
similarity index 100%
rename from templates/default/media/images/favicons/mstile-310x150.png
rename to public_html/templates/default/media/images/favicons/mstile-310x150.png
diff --git a/templates/default/media/images/favicons/mstile-310x310.png b/public_html/templates/default/media/images/favicons/mstile-310x310.png
similarity index 100%
rename from templates/default/media/images/favicons/mstile-310x310.png
rename to public_html/templates/default/media/images/favicons/mstile-310x310.png
diff --git a/templates/default/media/images/favicons/mstile-70x70.png b/public_html/templates/default/media/images/favicons/mstile-70x70.png
similarity index 100%
rename from templates/default/media/images/favicons/mstile-70x70.png
rename to public_html/templates/default/media/images/favicons/mstile-70x70.png
diff --git a/templates/default/media/images/favicons/safari-pinned-tab.svg b/public_html/templates/default/media/images/favicons/safari-pinned-tab.svg
similarity index 100%
rename from templates/default/media/images/favicons/safari-pinned-tab.svg
rename to public_html/templates/default/media/images/favicons/safari-pinned-tab.svg
diff --git a/templates/default/media/images/logo.png b/public_html/templates/default/media/images/logo.png
similarity index 100%
rename from templates/default/media/images/logo.png
rename to public_html/templates/default/media/images/logo.png
diff --git a/templates/default/scripts/fontawesome-all.min.js b/public_html/templates/default/scripts/fontawesome-all.min.js
similarity index 100%
rename from templates/default/scripts/fontawesome-all.min.js
rename to public_html/templates/default/scripts/fontawesome-all.min.js
diff --git a/public_html/templates/default/scripts/login.js b/public_html/templates/default/scripts/login.js
new file mode 100644
index 0000000000000000000000000000000000000000..b9f2b1b6bc9faa492cb82587550ef682cd5ba822
--- /dev/null
+++ b/public_html/templates/default/scripts/login.js
@@ -0,0 +1,5 @@
+function upload_xml_file(obj) {
+	var xml_file = obj.value;
+	var xml_file_name = xml_file.split("\\");
+	document.getElementById("xml_file_label").innerHTML = xml_file_name[xml_file_name.length - 1] + ' file selected.';
+}
\ No newline at end of file
diff --git a/public_html/templates/default/styles/general.css b/public_html/templates/default/styles/general.css
new file mode 100644
index 0000000000000000000000000000000000000000..87bd56cd7f80e9ce4be3065976678d3435fc96f0
--- /dev/null
+++ b/public_html/templates/default/styles/general.css
@@ -0,0 +1,679 @@
+* {
+	box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	-webkit-box-sizing: border-box;
+}
+
+html, body {
+	margin: 0;
+	padding: 0;
+	width: 100%;
+}
+
+body {
+	background: transparent url('../media/images/main_bg.png') 0 0 repeat;
+	font-size: 14px;
+	/*font-family: 'Roboto', sans-serif;*/
+	font-family: Open Sans, "Segoe UI", "Segoe", Helvetica, Open Sans, sans-serif, Tahoma, sans-serif;
+	color: #004361;
+}
+
+a {
+	outline: none;
+}
+
+
+
+/* MAIN BLOCKS : START */
+
+#main_wrapper {
+	position: relative;
+	display: block;
+	width: 1200px;
+	min-height: 100vh;
+	margin: 0 auto;
+	padding: 0 0 70px 0;
+	background: #fff;
+}
+
+#main_content {
+	position: relative;
+	display: block;
+	width: 1100px;
+	margin: 0 auto;
+	background: #fff;
+}
+
+/* MAIN BLOCKS : END */
+
+
+
+/* HEADER : START */
+
+#header {
+	position: relative;
+	display: block;
+	width: 1100px;
+	height: 300px;
+	margin: 0 auto;
+	background: #fff;
+}
+
+#logo {
+	position: relative;
+	display: block;
+	width: 200px;
+	height: 130px;
+	margin: 0 auto;
+}
+
+/*
+#languages {
+	position: absolute;
+	display: block;
+	top: 100px;
+	left: 200px;
+	width: 100px;
+	height: 20px;
+}
+
+#languages a {
+	position: relative;
+	display: block;
+	float: left;
+	height: 20px;
+	padding-left: 7px;
+	margin-left: 7px;
+	color: #895100;
+	border-left: 1px solid #e0c49c;
+	text-decoration: none;	
+	-webkit-transition: all 300ms ease;
+	-moz-transition: all 300ms ease;
+	-ms-transition: all 300ms ease;
+	-o-transition: all 300ms ease;
+	transition: all 300ms ease;
+}
+
+#languages a.current {
+	color: #e39500;
+	font-weight: bold;
+}
+
+#languages a:first-child {
+	padding-left: 5px;
+	margin-left: 5px;
+	border-left: none;
+}
+
+#languages a:hover {
+	color: #e39500;
+}
+*/
+
+/* HEADER : END */
+
+
+
+/* MENU : START */
+/*
+#top_menu {
+	position: relative;
+	display: block;
+	width: 1200px;
+	height: 53px;
+	margin-left: -50px;
+	background: transparent url('../media/images/menu_bg.png') 0 0 no-repeat;
+}
+
+#top_menu ul {
+	position: relative;
+	display: block;
+	width: 1200px;
+	height: 53px;
+	margin: 0;
+	padding: 0 100px;
+	list-style: none;
+}
+
+#top_menu ul li {
+	position: relative;
+	display: block;
+	height: 23px;
+	margin: 15px 0 0 0;
+	padding: 0 15px;
+	float: left;
+	border-left: 1px solid #fcb552;
+}
+
+#top_menu ul li:first-child {
+	border-left: none;
+}
+
+#top_menu ul li a {
+	position: relative;
+	display: block;
+	width: 100%;
+	height: 23px;
+	line-height: 23px;
+	margin: 0;
+	padding: 0;
+	color: #fff;
+	font-size: 15px;
+	text-decoration: none;
+	border-bottom: 1px solid transparent;
+	-webkit-transition: all 300ms ease;
+	-moz-transition: all 300ms ease;
+	-ms-transition: all 300ms ease;
+	-o-transition: all 300ms ease;
+	transition: all 300ms ease;
+}
+
+#top_menu ul li.current a {
+	border-bottom: 1px solid #fff;
+}
+
+#top_menu ul li a:hover {
+	border-bottom: 1px solid #fff;
+}
+
+#top_menu ul li.vip {
+	border-left: none;
+	text-shadow: 0 0 3px #000;
+	letter-spacing: 2px;
+	float: right;
+}
+
+#menu_button {
+	position: absolute;
+	display: none;
+	z-index: 99999;
+	top: 255px;
+	right: 30px;
+	font-size: 30px;
+	color: #e68e0c;
+	cursor: pointer;
+	-webkit-transition: all 300ms ease;
+	-moz-transition: all 300ms ease;
+	-ms-transition: all 300ms ease;
+	-o-transition: all 300ms ease;
+	transition: all 300ms ease;
+}
+
+#menu_button:hover {
+	color: #000;
+}
+*/
+/* MENU : END */
+
+/* CONTENT : START */
+
+#content {
+	position: relative;
+	display: block;
+	padding: 30px 50px 0 50px;
+	background: #fff;
+	color: #555;
+}
+
+#page_header {
+	position: relative;
+	display: block;
+	font-size: 27px;
+	color: #f29e00;
+	font-weight: 400;
+	margin: 0 0 50px 0;
+	padding: 0 10px 5px 10px;
+	border-bottom: 1px solid #dcdcdc;
+}
+
+#page_header a {
+	color: #f29e00;
+}
+
+#main_content h2 {
+	position: relative;
+	display: block;
+	font-size: 20px;
+	font-weight: 400;
+	margin: 10px 0 0;
+	padding: 0;
+}
+
+#main_content a {
+	color: #f29e00;
+}
+
+/* CONTENT : END */
+
+
+
+/* FOOTER : START */
+
+#footer {
+	position: absolute;
+	display: block;
+	width: 100%;
+	height: 70px;
+	line-height: 70px;
+	bottom: 0;
+	padding: 0 50px;
+	background: #1E4361;
+}
+
+#footer, #footer * {
+	color: #fff;
+}
+
+#footer a {
+	text-decoration: none;
+}
+
+#footer a {
+	text-decoration: underline;
+}
+
+/* FOOTER : END */
+
+
+
+/* POSITIONING AND ALIGNMENT STYLES : START */
+
+.fl {
+	float: left;
+}
+
+.fr {
+	float: right;
+}
+
+.cb {
+	clear: both;
+}
+
+.tal {
+	text-align: left;
+}
+
+.tac {
+	text-align: center;
+}
+
+.tar {
+	text-align: right;
+}
+
+.taj {
+	text-align: justify;
+}
+
+.w100p {
+	width: 100%;
+}
+
+.w80p {
+	width: 80%;
+}
+
+.w60p {
+	width: 60%;
+}
+
+.w40p {
+	width: 40%;
+}
+
+.w20p {
+	width: 20%;
+}
+
+.pb20 {
+	padding-bottom: 20px;
+}
+
+.pb10 {
+	padding-bottom: 10px;
+}
+
+.pb5 {
+	padding-bottom: 5px;
+}
+
+/* POSITIONING AND ALIGNMENT STYLES : END */
+
+
+
+
+/* GENERAL MESSAGES STYLES : START */
+
+.success {
+	color: #00aa00;
+}
+
+.warning, .error {
+	color: #ff0000;
+}
+
+.notice {
+	font-style: italic;
+}
+
+.notice, .notice a {
+	color: #777777;
+}
+
+.notice a:hover {
+	text-decoration: none;
+	color: #000000;
+}
+
+/* GENERAL MESSAGES STYLES : END */
+
+
+/* FORM ELEMENTS STYLES : START */
+
+.button {
+	position: relative;
+	display: inline-block;
+	height: 40px;
+	line-height: 40px;
+	padding: 0 30px;
+	font-size: 15px;
+	color: #D3D3D3 !important;
+	border: none;
+	border-radius: 5px;
+	background: #1E4360;
+	text-align: center;
+	cursor: pointer;
+	text-decoration: none;
+	-webkit-transition: all 300ms ease;
+	-moz-transition: all 300ms ease;
+	-ms-transition: all 300ms ease;
+	-o-transition: all 300ms ease;
+	transition: all 300ms ease;
+}
+
+.button:hover {
+	background: #366182;
+	color: #fff !important; 
+}
+
+.button_green {
+	background: #008200;
+}
+
+.button_green:hover {
+	background: #00b400;
+}
+
+.button_red {
+	background: #990000;
+}
+
+.button_red:hover {
+	background: #cc0000;
+}
+
+input[type="text"], input[type="password"], input[type="email"], input[type="phone"] {
+	position: relative;
+	display: inline-block;
+	height: 25px;
+	line-height: 25px;
+	padding: 0 5px;
+	color: #333;
+	border: 1px solid #aaa;
+}
+
+/* FORM ELEMENTS STYLES : END */
+
+
+
+
+/* FORMS : START */
+
+#forms_wrapper {
+	position: relative;
+	display: table;
+	width: 100%;
+	border-collapse: collapse;
+}
+
+#forms_content {
+	position: relative;
+	display: table-row;
+}
+
+#form_register, #form_login {
+	position: relative;
+	display: table-cell;
+	margin: 0 auto;
+	color: #555;
+	width: 50%;
+	height: 100%;
+	padding: 20px;
+	border: 1px solid #efefef;
+}
+
+#form_register textarea, #form_register input[type="file"] {
+	width: 100%;
+}
+
+#form_register input[type="submit"], #form_login input[type="submit"] {
+	margin-top: 10px;
+}
+
+#form_login input[type="text"] {
+	width: 100%;
+}
+
+#xml_file {
+	display: none;
+}
+
+#xml_file_label {
+	position: relative;
+	display: block;
+	height: 40px;
+	line-height: 40px;
+	padding: 0 30px;
+	font-size: 15px;
+	color: #D3D3D3 !important;
+	border: none;
+	border-radius: 5px;
+	background: #1E4360;
+	text-align: center;
+	cursor: pointer;
+	text-decoration: none;
+	-webkit-transition: all 300ms ease;
+	-moz-transition: all 300ms ease;
+	-ms-transition: all 300ms ease;
+	-o-transition: all 300ms ease;
+	transition: all 300ms ease;
+}
+
+#xml_file_label:hover {
+	background: #366182;
+	color: #fff !important; 
+}
+
+/* FORMS : END */
+
+
+
+
+/* /* RESPONSIVENESS */ */
+
+/* @media only screen and (max-width: 1220px) { */
+	
+	/* #main_wrapper { */
+		/* width: 100%; */
+	/* } */
+	/* #main_content { */
+		/* width: 100%; */
+	/* } */
+	
+	/* #top_menu { */
+		/* width: 100%; */
+		/* margin-left: 0; */
+		/* background: #ee8b00; */
+	/* } */
+	/* #top_menu ul { */
+		/* width: 100%; */
+		/* padding: 0 50px; */
+	/* } */
+
+/* } */
+
+/* @media only screen and (max-width: 1120px) { */
+	
+	/* #post_menu .info { */
+		/* width: 100%; */
+		/* float: none; */
+		/* display: block; */
+		/* margin-top: 20px; */
+		/* text-align: left; */
+		/* padding-left: 0; */
+	/* } */
+
+/* } */
+
+/* @media only screen and (max-width: 1020px) { */
+	
+	/* #post_menu { */
+		/* position: relative; */
+		/* display: block; */
+		/* margin: 20px; */
+		/* padding: 20px; */
+	/* } */
+	/* #post_menu .info { */
+		/* height: auto; */
+		/* line-height: 20px; */
+	/* } */
+	
+/* } */
+
+/* @media only screen and (max-width: 1000px) { */
+	
+	/* #header { */
+		/* height: 250px; */
+	/* } */
+	/* #logo { */
+		/* position: relative; */
+		/* top: auto; */
+		/* left: auto; */
+		/* margin: 0 auto; */
+		/* padding: 20px 0; */
+	/* } */
+	/* #top_banner { */
+		/* position: relative; */
+		/* top: auto; */
+		/* right: auto; */
+		/* margin: 10px auto; */
+		/* text-align: center; */
+	/* } */
+	/* #top_banner .fr { */
+		/* float: none; */
+	/* } */
+		
+	/* #top_menu { */
+		/* position: absolute; */
+		/* display: none; */
+		/* width: 80%; */
+		/* height: auto; */
+		/* margin-left: 0; */
+		/* padding-bottom: 20px; */
+		/* background: rgba(230, 142, 12, 0.9); */
+		/* z-index: 99999; */
+	/* } */
+
+	/* #top_menu ul { */
+		/* width: 100%; */
+		/* height: auto; */
+		/* padding: 0; */
+	/* } */
+
+	/* #top_menu ul li { */
+		/* position: relative; */
+		/* display: block; */
+		/* height: 50px; */
+		/* margin: 15px 0 0 0; */
+		/* padding: 0 15px; */
+		/* float: none; */
+		/* border-left: none; */
+	/* } */
+
+	/* #top_menu ul li:first-child { */
+		/* border-left: none; */
+	/* } */
+
+	/* #top_menu ul li a { */
+		/* height: 50px; */
+		/* line-height: 50px; */
+		/* font-size: 20px; */
+		/* padding-left: 20px; */
+	/* } */
+
+	
+	/* #menu_button { */
+		/* display: block; */
+	/* } */
+	
+	/* #footer { */
+		/* width: 100%; */
+		/* height: auto; */
+		/* line-height: auto; */
+	/* } */
+
+/* } */
+
+/* @media only screen and (max-width: 750px) { */
+	
+	/* #header { */
+		/* height: 100px; */
+	/* } */
+	/* #top_banner { */
+		/* display: none; */
+	/* } */
+	/* #menu_button { */
+		/* top: 30px; */
+	/* } */
+
+/* } */
+
+/* @media only screen and (max-width: 550px) { */
+
+	/* #footer_logo { */
+		/* display: none; */
+	/* } */
+	/* #footer { */
+		/* height: auto; */
+	/* } */
+	/* #footer span { */
+		/* position: relative; */
+		/* display: block; */
+		/* width: 100%; */
+		/* text-align: center; */
+	/* } */
+
+/* } */
+
+/* @media only screen and (max-width: 400px) { */
+	
+	/* #logo { */
+		/* right: 30px; */
+	/* } */
+	
+	/* #post_menu .button { */
+		/* float: none; */
+		/* width: 100%; */
+		/* height: 50px; */
+		/* line-height: 50px; */
+	/* } */
+	/* #post_menu .post_menu_button_2 { */
+		/* margin-left: 0; */
+		/* margin-top: 20px; */
+	/* } */
+	/* #post_menu .info { */
+		/* text-align: center; */
+	/* } */
+	
+/* } */
\ No newline at end of file
diff --git a/templates/default/index.php b/templates/default/index.php
deleted file mode 100644
index 972e213ff3e3b5a28f5fdbefe23c5d8ea3e4d883..0000000000000000000000000000000000000000
--- a/templates/default/index.php
+++ /dev/null
@@ -1,213 +0,0 @@
-<?php
-	/*
-		TODO:
-		- make meta data language dependable
-		- move the login check part to an external file in application folder
-	*/
-
-	function xml2assoc($xml) {
-		$tree = null;
-		while ($xml->read()) {
-			switch ($xml->nodeType) {
-				case XMLReader::END_ELEMENT:
-					return $tree;
-				case XMLReader::ELEMENT:
-					$node = array('tag' => $xml->name, 'value' => $xml->isEmptyElement ? '' : xml2assoc($xml));
-					if ($xml->hasAttributes) {
-						while ($xml->moveToNextAttribute()) {
-							$node['attributes'][$xml->name] = $xml->value;
-						}
-					}
-					$tree[] = $node;
-					break;
-				case XMLReader::TEXT:
-				case XMLReader::CDATA:
-					$tree .= $xml->value;
-			}
-		}
-		return $tree;
-	}
-	
-	
-?>
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, initial-scale=1.0">
-		<link rel="apple-touch-icon" sizes="57x57" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-57x57.png">
-		<link rel="apple-touch-icon" sizes="60x60" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-60x60.png">
-		<link rel="apple-touch-icon" sizes="72x72" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-72x72.png">
-		<link rel="apple-touch-icon" sizes="76x76" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-76x76.png">
-		<link rel="apple-touch-icon" sizes="114x114" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-114x114.png">
-		<link rel="apple-touch-icon" sizes="120x120" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-120x120.png">
-		<link rel="apple-touch-icon" sizes="144x144" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-144x144.png">
-		<link rel="apple-touch-icon" sizes="152x152" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-152x152.png">
-		<link rel="apple-touch-icon" sizes="180x180" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/apple-touch-icon-180x180.png">
-		<link rel="icon" type="image/png" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/favicon-32x32.png" sizes="32x32">
-		<link rel="icon" type="image/png" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/android-chrome-192x192.png" sizes="192x192">
-		<link rel="icon" type="image/png" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/favicon-96x96.png" sizes="96x96">
-		<link rel="icon" type="image/png" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/favicon-16x16.png" sizes="16x16">
-		<link rel="manifest" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/manifest.json">
-		<link rel="mask-icon" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/media/images/favicons/safari-pinned-tab.svg" color="#5bbad5">
-		<meta name="msapplication-TileColor" content="#da532c">
-		<meta name="msapplication-TileImage" content="mstile-144x144.png">
-		<meta name="theme-color" content="#ffffff">
-		<title><?php echo PAGE_DEFAULT_META_TITLE; ?></title>
-		<meta name="description" content="<?php echo PAGE_DEFAULT_META_DESCRIPTION; ?>">
-		<meta name="author" content="Andy">
-		<!-- Fonts -->
-		<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700,400italic' rel='stylesheet' type='text/css'>
-		<link href='https://fonts.googleapis.com/css?family=Roboto:100,400,700,900&subset=latin,cyrillic,latin-ext' rel='stylesheet' type='text/css'>
-		<!-- Styles -->
-		<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
-		<link rel="stylesheet" type="text/css" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/styles/general.css?<?php echo time(); ?>" />
-	<?php if (!$page_type || security::secure_request_data($page_type)=='simple') { ?>
-			<link rel="stylesheet" type="text/css" href="<?php echo WEB_BASE_URL;?>/templates/<?php echo CURRENT_TEMPLATE; ?>/styles/<?php echo $page; ?>.css?<?php echo time(); ?>" />
-		<?php } ?>
-		<!-- Scripts -->
-		<script src="<?php echo WEB_BASE_URL; ?>/templates/<?php echo CURRENT_TEMPLATE; ?>/scripts/jquery-3.2.1.min.js" type="text/javascript"></script>
-		<script src="<?php echo WEB_BASE_URL; ?>/templates/<?php echo CURRENT_TEMPLATE; ?>/scripts/fontawesome-all.min.js" type="text/javascript"></script>
-		<?php if (file_exists(WEB_BASE_DIR.'/templates/'.CURRENT_TEMPLATE.'/scripts/'.$page.'.js')) { ?>
-			<script src="<?php echo WEB_BASE_URL; ?>/templates/<?php echo CURRENT_TEMPLATE; ?>/scripts/<?php echo $page; ?>.js?<?php echo time(); ?>" type="text/javascript"></script>
-		<?php } ?>
-	</head>
-	<body>
-		<?php
-			if (!$page_type || security::secure_request_data($page_type)=='simple') {
-				echo '<section id="main_wrapper">';
-				require_once(APP_BASE_DIR.'/components/header.php');
-				echo '<section id="main_content">';
-				if (user::isLogged() || $page!=='home') {
-					require_once(APP_BASE_DIR.'/pages/'.$page.'.php');
-				} else { ?>
-					<?php
-						if (isset($_GET['login_token'])) {
-							$token = $_GET['login_token'];
-							$mysql = new mysql();
-							$request_array[':token'] = $token;
-							if ($res = $mysql->select('SELECT * FROM `accounts` WHERE `token`= :token AND `status`= \'initiated\'',$request_array)) {
-								while($ftc = $res->fetch(PDO::FETCH_ASSOC)) {
-									$found = 'yes';
-									$entity = $ftc;
-								}
-							}
-							if ($res = $mysql->select('SELECT * FROM `accounts` WHERE `token`= :token AND `status`= \'registered\'',$request_array)) {
-								while($ftc = $res->fetch(PDO::FETCH_ASSOC)) {
-									$found_reg = 'yes';
-									$entity = $ftc;
-								}
-							}
-							if (!$found || $found!='yes') {
-								if ($found_reg && $found_reg=='yes') {
-									$_SESSION['user_id'] = $entity['entity_id'];
-									$_SESSION['user_name'] = $entity['email'];
-									echo '<p>You are now logged in as '.$_SESSION['user_id'].' ('.$_SESSION['user_name'].')';
-									echo '<script type="text/javascript">window.location.href="https://projects.andy.lt/GEANT/test-idp/"</script>';
-								} else {
-									echo 'User with current token not found or the account has already been approved.';
-								}
-							} elseif ($found && $found=='yes') {
-								echo '<p>Your account has been successfully registered!</p>';
-								echo '<b>Entity ID:</b> '.$entity['entity_id'].'<br />';
-								echo '<b>E-mail:</b> '.$entity['email'].'<br />';
-								echo '<b>Metadata:</b><pre>'.htmlspecialchars($entity['metadata']).'</pre>';
-								$request_array[':token'] = $token;
-								$mysql->update('UPDATE `accounts` SET `status`= \'registered\' WHERE `token`= :token', $request_array);
-								$_SESSION['user_id'] = $entity['entity_id'];
-								$_SESSION['user_name'] = $entity['email'];
-								$mysql->query('INSERT INTO `idps` SET 
-								`host`= \''.$entity['entity_id'].'\', 
-								`comment`= \''.$entity['entity_id'].'\',  
-								`sp_metadata`= \''.$entity['metadata'].'\'');
-								$last_id = $mysql->selectLastEntryId('idps', '', '', 'idp_id');
-								for ($i=1; $i<=15; $i++) {
-									$mysql->query('INSERT INTO `config` SET 
-									`idp_id`= \''.$last_id.'\', 
-									`option_id`= \''.$i.'\'');
-								}
-							}
-						} else {
-							if (isset($_POST['login']) && isset($_POST['metadata'])) {
-								$metadata = $_POST['metadata'];
-								$xml = new XMLReader();
-								if (!$xml->xml($metadata, NULL, LIBXML_DTDVALID)) {
-									$message .= "XML not valid: load error.<br />";
-									$message_color = '#ff0000';
-									$allok = 'no';
-								}
-								libxml_use_internal_errors(TRUE);
-								$xml_array = xml2assoc($xml);
-								$arErrors = libxml_get_errors();
-								$xml_errors = "";
-								foreach ($arErrors AS $xmlError) {
-									if ($xmlError->message != 'Validation failed: no DTD found !') {
-									$xml_errors .= $xmlError->message.'<br />';
-									}
-									$allok = 'no';
-								}
-								if ($xml_errors != "") {
-									$message .= "XML not valid: ".$xml_errors;
-									$message_color = '#ff0000';
-									$allok = 'no';
-								} else {
-									$message = 'Your XML looks fine.<br />';
-									$message_color = '#00aa00';
-									$allok = 'yes';
-									if (preg_match_all('/\<md\:EmailAddress\>(.*)\<\/md\:EmailAddress\>/', $metadata, $email_matches)) {
-										foreach ($email_matches[1] as $k=>$v) {
-											$emails .= $v.', ';
-										}
-										if (preg_match_all('/entityID\=\"(.*)\"/', $metadata, $entity_id_matches)) {
-											$entity_id = $entity_id_matches[1][0];										
-											$timestamp = time();
-											$emails = substr($emails, 0, -2);
-											$allok = 'yes';
-											$token = md5($_SERVER['REMOTE_ADDR'].$email_matches[1][0].$timestamp);
-											$message .= 'We have found '.count($email_matches[1]).' e-mail addresses provided in your metadata: '.$emails.'.<br />We have sent an account activation e-mail to the first e-mail address <b>'.$email_matches[1][0].'</b>.<br />'.'If you didn\'t receive any e-mails, please contact our administrator and provide your token <b>'.$token.'</b>.';
-											$mysql = new mysql();
-											$mysql->query('INSERT INTO `accounts` SET 
-											`token`= \''.$token.'\', 
-											`email`= \''.$email_matches[1][0].'\', 
-											`entity_id`= \''.$entity_id.'\', 
-											`timestamp`= \''.$timestamp.'\', 
-											`ip`= \''.$_SERVER['REMOTE_ADDR'].'\', 
-											`metadata`= \''.$metadata.'\', 
-											`status`= \'initiated\'');
-											require_once(APP_BASE_DIR.'/classes/phpmailer.php');
-											$mailer = new custom_phpmailer();
-											$email_message = 'You have been approved to login to the Test IDP portal. Please follow <a href="https://projects.andy.lt/GEANT/test-idp/en/?login_token='.$token.'">THIS LINK</a> to login.';
-											$mailer::send_email($email_matches[1][0], '', $subject='Message from Test IDP portal', $email_message, 'Your message has been sent');
-										} else {
-											$message .= '<span style="color:red;">We could not find an entity id in your metadata. In order to proceed, please input a metadata that contains an entity id.</span><br />';
-											$allok = 'no';
-										}
-									} else {
-										$message .= '<span style="color:red;">We could not find any e-mails in your metadata. In order to proceed, please input a metadata that contains at least one contact e-mail address.</span><br />';
-										$allok = 'no';
-									}								
-								}
-								//echo '<pre>'; print_r($xml_array); echo '</pre>';
-							}
-						?>
-							<div id="form_login">
-								<?php if (!isset($allok) || $allok=='no') { ?>
-								<h2>Login / Register via SP metadata</h2>
-								<form method="post">
-									<p>Paste your SP metadata into the text field below.</p>
-									<textarea rows="10" style="width:100%;" name="metadata" /><?php echo $_POST['metadata']; ?></textarea>
-									<input type="submit" class="button post_menu_button_2 login" name="login" value="Login / Register" />
-								</form>
-								<?php } ?>
-								<p class="message" style="color:<?php echo $message_color; ?>;"><?php echo $message; ?></p>
-							</div>
-				<?php	}
-				}
-				echo '</section>';
-				require_once(APP_BASE_DIR.'/components/footer.php');
-				echo '</section>';
-			} else {
-			}
-		?>
-	</body>
-</html>
\ No newline at end of file
diff --git a/templates/default/styles/general.css b/templates/default/styles/general.css
deleted file mode 100644
index d0987df536fe4078df879db911421e661e8fc2a6..0000000000000000000000000000000000000000
--- a/templates/default/styles/general.css
+++ /dev/null
@@ -1,881 +0,0 @@
-* {
-	box-sizing: border-box;
-	-moz-box-sizing: border-box;
-	-webkit-box-sizing: border-box;
-}
-
-html, body {
-	margin: 0;
-	padding: 0;
-	width: 100%;
-}
-
-body {
-	background: transparent url('../media/images/main_bg.png') 0 0 repeat;
-	font-size: 15px;
-	font-family: 'Roboto', sans-serif;
-}
-
-a {
-	outline: none;
-}
-
-
-
-/* MAIN BLOCKS : START */
-
-#main_wrapper {
-	position: relative;
-	display: block;
-	width: 1200px;
-	min-height: 100vh;
-	margin: 0 auto;
-	padding: 0 0 70px 0;
-	background: #fff;
-}
-
-#main_content {
-	position: relative;
-	display: block;
-	width: 1100px;
-	margin: 0 auto;
-	background: #fff;
-}
-
-/* MAIN BLOCKS : END */
-
-
-
-/* HEADER : START */
-
-#header {
-	position: relative;
-	display: block;
-	width: 1100px;
-	height: 300px;
-	margin: 0 auto;
-	background: #fff;
-}
-
-#header center {
-	color: #aaa;
-	font-style: italic;
-}
-
-#logo {
-	position: relative;
-	display: block;
-	width: 200px;
-	height: 130px;
-	margin: 0 auto;
-}
-
-/*
-#languages {
-	position: absolute;
-	display: block;
-	top: 100px;
-	left: 200px;
-	width: 100px;
-	height: 20px;
-}
-
-#languages a {
-	position: relative;
-	display: block;
-	float: left;
-	height: 20px;
-	padding-left: 7px;
-	margin-left: 7px;
-	color: #895100;
-	border-left: 1px solid #e0c49c;
-	text-decoration: none;	
-	-webkit-transition: all 300ms ease;
-	-moz-transition: all 300ms ease;
-	-ms-transition: all 300ms ease;
-	-o-transition: all 300ms ease;
-	transition: all 300ms ease;
-}
-
-#languages a.current {
-	color: #e39500;
-	font-weight: bold;
-}
-
-#languages a:first-child {
-	padding-left: 5px;
-	margin-left: 5px;
-	border-left: none;
-}
-
-#languages a:hover {
-	color: #e39500;
-}
-*/
-
-/* HEADER : END */
-
-
-
-/* MENU : START */
-/*
-#top_menu {
-	position: relative;
-	display: block;
-	width: 1200px;
-	height: 53px;
-	margin-left: -50px;
-	background: transparent url('../media/images/menu_bg.png') 0 0 no-repeat;
-}
-
-#top_menu ul {
-	position: relative;
-	display: block;
-	width: 1200px;
-	height: 53px;
-	margin: 0;
-	padding: 0 100px;
-	list-style: none;
-}
-
-#top_menu ul li {
-	position: relative;
-	display: block;
-	height: 23px;
-	margin: 15px 0 0 0;
-	padding: 0 15px;
-	float: left;
-	border-left: 1px solid #fcb552;
-}
-
-#top_menu ul li:first-child {
-	border-left: none;
-}
-
-#top_menu ul li a {
-	position: relative;
-	display: block;
-	width: 100%;
-	height: 23px;
-	line-height: 23px;
-	margin: 0;
-	padding: 0;
-	color: #fff;
-	font-size: 15px;
-	text-decoration: none;
-	border-bottom: 1px solid transparent;
-	-webkit-transition: all 300ms ease;
-	-moz-transition: all 300ms ease;
-	-ms-transition: all 300ms ease;
-	-o-transition: all 300ms ease;
-	transition: all 300ms ease;
-}
-
-#top_menu ul li.current a {
-	border-bottom: 1px solid #fff;
-}
-
-#top_menu ul li a:hover {
-	border-bottom: 1px solid #fff;
-}
-
-#top_menu ul li.vip {
-	border-left: none;
-	text-shadow: 0 0 3px #000;
-	letter-spacing: 2px;
-	float: right;
-}
-
-#menu_button {
-	position: absolute;
-	display: none;
-	z-index: 99999;
-	top: 255px;
-	right: 30px;
-	font-size: 30px;
-	color: #e68e0c;
-	cursor: pointer;
-	-webkit-transition: all 300ms ease;
-	-moz-transition: all 300ms ease;
-	-ms-transition: all 300ms ease;
-	-o-transition: all 300ms ease;
-	transition: all 300ms ease;
-}
-
-#menu_button:hover {
-	color: #000;
-}
-*/
-/* MENU : END */
-
-/* CONTENT : START */
-
-#content {
-	position: relative;
-	display: block;
-	padding: 30px 50px 0 50px;
-	background: #fff;
-	color: #555;
-}
-
-#page_header {
-	position: relative;
-	display: block;
-	font-size: 27px;
-	color: #f29e00;
-	font-weight: 400;
-	margin: 0 0 50px 0;
-	padding: 0 10px 5px 10px;
-	border-bottom: 1px solid #dcdcdc;
-}
-
-#page_header a {
-	color: #f29e00;
-}
-
-#content h2 {
-	position: relative;
-	display: block;
-	font-size: 21px;
-	color: #f29e00;
-	font-weight: 400;
-	margin: 30px 0 20px;
-	padding: 0;
-}
-
-#content p {
-	padding-left: 10px;
-	padding-right: 10px;
-}
-
-#content a {
-	color: #f29e00;
-}
-
-/* CONTENT : END */
-
-
-
-/* FOOTER : START */
-
-#footer {
-	position: absolute;
-	display: block;
-	width: 100%;
-	height: 70px;
-	line-height: 70px;
-	bottom: 0;
-	padding: 0 50px;
-	background: #1E4361;
-}
-
-#footer, #footer * {
-	color: #fff;
-}
-
-#footer a {
-	text-decoration: none;
-}
-
-#footer a {
-	text-decoration: underline;
-}
-
-/* FOOTER : END */
-
-
-
-/* POSITIONING AND ALIGNMENT STYLES : START */
-
-.fl {
-	float: left;
-}
-
-.fr {
-	float: right;
-}
-
-.cb {
-	clear: both;
-}
-
-.tal {
-	text-align: left;
-}
-
-.tac {
-	text-align: center;
-}
-
-.tar {
-	text-align: right;
-}
-
-.taj {
-	text-align: justify;
-}
-
-.w100p {
-	width: 100%;
-}
-
-.w80p {
-	width: 80%;
-}
-
-.w60p {
-	width: 60%;
-}
-
-.w40p {
-	width: 40%;
-}
-
-.w20p {
-	width: 20%;
-}
-
-.pb20 {
-	padding-bottom: 20px;
-}
-
-.pb10 {
-	padding-bottom: 10px;
-}
-
-.pb5 {
-	padding-bottom: 5px;
-}
-
-/* POSITIONING AND ALIGNMENT STYLES : END */
-
-
-
-
-/* GENERAL MESSAGES STYLES : START */
-
-.success {
-	color: #00aa00;
-}
-
-.warning, .error {
-	color: #ff0000;
-}
-
-.notice {
-	font-style: italic;
-}
-
-.notice, .notice a {
-	color: #777777;
-}
-
-.notice a:hover {
-	text-decoration: none;
-	color: #000000;
-}
-
-/* GENERAL MESSAGES STYLES : END */
-
-
-/* FORM ELEMENTS STYLES : START */
-
-.button {
-	position: relative;
-	display: inline-block;
-	height: 40px;
-	line-height: 40px;
-	padding: 0 30px;
-	font-size: 15px;
-	color: #D3D3D3 !important;
-	border: none;
-	border-radius: 5px;
-	background: #1E4360;
-	text-align: center;
-	cursor: pointer;
-	text-decoration: none;
-	-webkit-transition: all 300ms ease;
-	-moz-transition: all 300ms ease;
-	-ms-transition: all 300ms ease;
-	-o-transition: all 300ms ease;
-	transition: all 300ms ease;
-}
-
-.button:hover {
-	background: #366182;
-	color: #fff !important; 
-}
-
-.button_green {
-	background: #008200;
-}
-
-.button_green:hover {
-	background: #00b400;
-}
-
-.button_red {
-	background: #990000;
-}
-
-.button_red:hover {
-	background: #cc0000;
-}
-
-input[type="text"], input[type="password"], input[type="email"], input[type="phone"] {
-	position: relative;
-	display: inline-block;
-	height: 25px;
-	line-height: 25px;
-	padding: 0 5px;
-	color: #333;
-	border: 1px solid #aaa;
-}
-
-/* FORM ELEMENTS STYLES : END */
-
-
-/* VARIOUS ELEMENTS STYLES : START */
-
-.info {
-	position: relative;
-	display: inline-block;
-	height: 40px;
-	line-height: 40px;
-	padding: 0 30px;
-	font-size: 15px;
-	color: #ff0000;
-	border: none;
-	/*border-radius: 5px;*/
-	/*border: 1px solid #0060ff;*/
-	text-align: center;
-}
-
-.info a {
-	color: #ff0000;
-	font-weight: 700;
-}
-
-.info_abs {
-	position: absolute;
-	display: block;
-	width: 370px;
-	top: 25px;
-	right: 0;
-	line-height: 30px;
-	text-align: justify;
-}
-
-.popup {
-	position: fixed;
-	display: none;
-	width: 100%;
-	height: 100%;
-	top: 0;
-	right: 0;
-	bottom: 0;
-	left: 0;
-	background: rgba(0, 0, 0, 0.8);
-	z-index: 99999;
-}
-
-.popup_active {
-	display: block;
-}
-
-.popup .popup_content {
-	position: relative;
-	display: block;
-	background: #fff;
-	top: 50%;
-	left: 50%;
-	padding: 50px;
-}
-
-.popup .close {
-	position: absolute;
-	display: block;
-	top: 20px;
-	right: 20px;
-	cursor: pointer;
-	font-size: 21px;
-	color: #555;
-	-webkit-transition: all 300ms ease;
-	-moz-transition: all 300ms ease;
-	-ms-transition: all 300ms ease;
-	-o-transition: all 300ms ease;
-	transition: all 300ms ease;
-}
-
-.popup .close:hover {
-	color: #aaa;
-}
-
-.popup .popup_title {
-	position: relative;
-	display: block;
-	width: 100%;
-	margin: 0 0 15px 0;
-	padding: 0 0 15px 0;
-	color: #e39500;
-	font-weight: 400;
-	border-bottom: 1px solid #dcdcdc;
-}
-
-
-.popup_500_300 {
-	width: 500px;
-	height: 300px;
-	margin-top: -150px;
-	margin-left: -250px;
-}
-
-.popup .popup_form_registration {
-	width: 500px;
-	height: 440px;
-	margin-top: -220px;
-	margin-left: -250px;
-}
-
-.popup .popup_form_login {
-	width: 500px;
-	height: 280px;
-	margin-top: -140px;
-	margin-left: -250px;
-}
-
-/* VARIOUS ELEMENTS STYLES : END */
-
-
-
-/* REGISTRATION FORM : START */
-
-#form_registration {
-	position: relative;
-	display: block;
-	color: #555;
-}
-
-#form_registration form table {
-	width: 100%;
-}
-
-#form_registration form table tbody tr td {
-	padding: 5px;
-}
-
-#form_registration input[type="text"], #form_registration input[type="password"], #form_registration input[type="email"], #form_registration input[type="phone"] {
-	width: 100%;
-}
-
-#form_registration input[type="submit"] {
-	margin-top: 10px;
-}
-
-/* REGISTRATION FORM : END */
-
-
-
-/* LOGIN FORM : START */
-
-#form_login {
-	position: relative;
-	display: block;
-	margin: 0 auto;
-	color: #555;
-	width: 1000px;
-}
-
-#form_login input[type="text"], #form_login input[type="password"], #form_login input[type="email"], #form_login input[type="phone"] {
-	width: 100%;
-}
-
-#form_login input[type="submit"] {
-	margin-top: 10px;
-}
-
-/* LOGIN FORM : END */
-
-
-
-/* PHOTO PICKER : START */
-
-#frame_photo_wrapper {
-	position: relative;
-	display: block;
-	width: 50%;
-	float: left;
-}
-
-#pet_photo {
-	border: 1px solid #ccc;
-}
-
-input#pet_photo {
-	display: none;
-}
-
-#frame_1 {
-	border: 1px solid #ccc;
-}
-
-#content form input[type="text"], #content form input[type="password"], #content form input[type="email"], #content form input[type="phone"], #content form select {
-	border: 1px solid #ccc;
-	width: 300px;
-	height: 30px;
-	line-height: 30px;
-	padding: 0 10px;
-	font-size: 13px;
-	font-family: 'Roboto', sans-serif;
-	color: #333;
-}
-
-#content form select {
-	padding: 0 5px;
-}
-
-#content form select option {
-	font-size: 13px;
-	font-family: 'Roboto', sans-serif;
-	color: #333;
-}
-
-#content form textarea {
-	border: 1px solid #ccc;
-	width: 300px;
-	height: 100px;
-	line-height: 15px;
-	padding: 10px;
-	font-size: 13px;
-	font-family: 'Roboto', sans-serif;
-	color: #333;
-}
-
-
-/*
-.pet_photo + label, .photo_picker_form input[type="submit"] {
-	position: relative;
-	display: block;
-	font-size: 20px;
-	text-align: center;
-	border: none;
-	outline: none;
-	cursor: pointer;
-	-webkit-transition-property: all;
-	-webkit-transition-duration: 0.3s;
-	-webkit-transition-timing-function: linear;
-	-webkit-transition-delay: 0s;
-	-moz-transition-property: all;
-	-moz-transition-duration: 0.3s;
-	-moz-transition-timing-function: linear;
-	-moz-transition-delay: 0s;
-	color: #fff;
-    background-color: #286335;
-}
-
-.photo_picker_form input[type="submit"] {
-	width: 100px !important;
-}
-
-.pet_photo:focus + label,
-.pet_photo.has-focus + label,
-.pet_photo + label:hover, .photo_picker_form input[type="submit"]:focus, .photo_picker_form input[type="submit"]:hover {
-    background-color: #90aa3e;
-}
-*/
-
-/* PHOTO PICKER : END */
-
-
-
-/* DATATABLES : START */
-
-.datatable thead tr {
-	text-align: left;
-}
-
-.datatable .even {
-	background: #fffaf4;
-}
-
-/* DATATABLES : END */
-
-
-
-/* RESPONSIVENESS */
-
-@media only screen and (max-width: 1220px) {
-	
-	#main_wrapper {
-		width: 100%;
-	}
-	#main_content {
-		width: 100%;
-	}
-	
-	#top_menu {
-		width: 100%;
-		margin-left: 0;
-		background: #ee8b00;
-	}
-	#top_menu ul {
-		width: 100%;
-		padding: 0 50px;
-	}
-
-}
-
-@media only screen and (max-width: 1120px) {
-	
-	#post_menu .info {
-		width: 100%;
-		float: none;
-		display: block;
-		margin-top: 20px;
-		text-align: left;
-		padding-left: 0;
-	}
-
-}
-
-@media only screen and (max-width: 1020px) {
-	
-	#post_menu {
-		position: relative;
-		display: block;
-		margin: 20px;
-		padding: 20px;
-	}
-	#post_menu .info {
-		height: auto;
-		line-height: 20px;
-	}
-	
-}
-
-@media only screen and (max-width: 1000px) {
-	
-	#header {
-		height: 250px;
-	}
-	#logo {
-		position: relative;
-		top: auto;
-		left: auto;
-		margin: 0 auto;
-		padding: 20px 0;
-	}
-	#top_banner {
-		position: relative;
-		top: auto;
-		right: auto;
-		margin: 10px auto;
-		text-align: center;
-	}
-	#top_banner .fr {
-		float: none;
-	}
-		
-	#top_menu {
-		position: absolute;
-		display: none;
-		width: 80%;
-		height: auto;
-		margin-left: 0;
-		padding-bottom: 20px;
-		background: rgba(230, 142, 12, 0.9);
-		z-index: 99999;
-	}
-
-	#top_menu ul {
-		width: 100%;
-		height: auto;
-		padding: 0;
-	}
-
-	#top_menu ul li {
-		position: relative;
-		display: block;
-		height: 50px;
-		margin: 15px 0 0 0;
-		padding: 0 15px;
-		float: none;
-		border-left: none;
-	}
-
-	#top_menu ul li:first-child {
-		border-left: none;
-	}
-
-	#top_menu ul li a {
-		height: 50px;
-		line-height: 50px;
-		font-size: 20px;
-		padding-left: 20px;
-	}
-
-	
-	#menu_button {
-		display: block;
-	}
-	
-	#footer {
-		width: 100%;
-		height: auto;
-		line-height: auto;
-	}
-
-}
-
-@media only screen and (max-width: 750px) {
-	
-	#header {
-		height: 100px;
-	}
-	#top_banner {
-		display: none;
-	}
-	#menu_button {
-		top: 30px;
-	}
-
-}
-
-@media only screen and (max-width: 550px) {
-
-	#footer_logo {
-		display: none;
-	}
-	#footer {
-		height: auto;
-	}
-	#footer span {
-		position: relative;
-		display: block;
-		width: 100%;
-		text-align: center;
-	}
-
-}
-
-@media only screen and (max-width: 400px) {
-	
-	#logo {
-		right: 30px;
-	}
-	
-	#post_menu .button {
-		float: none;
-		width: 100%;
-		height: 50px;
-		line-height: 50px;
-	}
-	#post_menu .post_menu_button_2 {
-		margin-left: 0;
-		margin-top: 20px;
-	}
-	#post_menu .info {
-		text-align: center;
-	}
-	
-}
\ No newline at end of file