Skip to content

Instantly share code, notes, and snippets.

@ewwink
Last active December 13, 2015 22:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ewwink/4984272 to your computer and use it in GitHub Desktop.
Save ewwink/4984272 to your computer and use it in GitHub Desktop.
Simple Login / Authentication Integration eXtplorer with your PHP Application. eXtplorer is A PHP and JavaScript- based File Manager
<?php
require_once('eXtplorer/libraries/standalone.php');
// check if session ["credentials_extplorer"] present if not redirect to "login.php"
if(!isset($_SESSION["credentials_extplorer"]["username"])){
include("login.php");
session_destroy();
exit;
}
?>
<?php
//error_reporting(E_ALL);
define( '_VALID_EXT', 1 );
define( '_VALID_MOS', 1 );
require_once('functions.php');
echo "Your App successfully interegrated with eXtplorer - A PHP- and JavaScript- based File Manager";
?>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login - LAMPV Manager</title>
<script type="text/javascript" src="eXtplorereXtplorereXtplorereXtplorer/scripts/extjs3/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="eXtplorereXtplorereXtplorer/scripts/extjs3/ext-all.js"></script>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="eXtplorereXtplorer/scripts/extjs3/resources/css/ext-all.css" />
<link rel="stylesheet" href="eXtplorer/scripts/extjs3/resources/css/xtheme-blue.css" />
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
<body>
<div id="adminForm"></div>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
Ext.onReady(function () {
var simple = new Ext.FormPanel({
xtype: "form",
renderTo: "adminForm",
title: "Login to LAMPV Manager",
id: "simpleform",
labelWidth: 125, // label settings here cascade unless overridden
url: "eXtplorer/index.php",
frame: true,
keys: {
key: Ext.EventObject.ENTER,
fn: function () {
if(simple.getForm().isValid()) {
Ext.get("statusBar").update("Please wait...");
Ext.getCmp("simpleform").getForm().submit({
reset: false,
success: function (form, action) {
location.reload()
},
failure: function (form, action) {
if(!action.result) return;
Ext.Msg.alert('Error(s)', action.result.error, function () {
this.findField('password').setValue('');
this.findField('password').focus();
}, form);
Ext.get('statusBar').update(action.result.error);
},
scope: Ext.getCmp("simpleform").getForm(),
params: {
option: "com_extplorer",
action: "login",
type: "extplorer"
}
});
}
else {
return false;
}
}
},
items: [{
xtype: "textfield",
fieldLabel: "Username",
name: "username",
width: 175,
allowBlank: false
}, {
xtype: "textfield",
fieldLabel: "Password",
name: "password",
inputType: "password",
width: 175,
allowBlank: false
},
new Ext.form.ComboBox({
fieldLabel: "Language",
store: new Ext.data.SimpleStore({
fields: ['language', 'langname'],
data: [
['english', 'English']
]
}),
displayField: "langname",
valueField: "language",
value: "english",
hiddenName: "lang",
disableKeyFilter: true,
editable: false,
triggerAction: "all",
mode: "local",
allowBlank: false,
selectOnFocus: true
}), {
xtype: "displayfield",
id: "statusBar"
}],
buttons: [{
text: "Login",
type: "submit",
handler: function () {
Ext.get("statusBar").update("Please wait...");
Ext.getCmp("simpleform").getForm().submit({
reset: false,
success: function (form, action) {
location.reload()
},
failure: function (form, action) {
if(!action.result) return;
Ext.Msg.alert('Error(s)', action.result.error, function () {
this.findField('password').setValue('');
this.findField('password').focus();
}, form);
Ext.get('statusBar').update(action.result.error);
},
scope: Ext.getCmp("simpleform").getForm(),
params: {
option: "com_extplorer",
action: "login",
type: "extplorer"
}
});
}
}, {
text: 'Reset',
handler: function () {
simple.getForm().reset();
}
}]
}
);
Ext.get('formContainer').center();
Ext.get('formContainer').setTop(100);
simple.getForm().findField('username').focus();
Ext.EventManager.onWindowResize(function () {
Ext.get('formContainer').center();
Ext.get('formContainer').setTop(100);
});
});
/*]]>*/
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment