Exemplo n.º 1
0
*    eLabFTW is distributed in the hope that it will be useful,                 *
*    but WITHOUT ANY WARRANTY; without even the implied                         *
*    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR                    *
*    PURPOSE.  See the GNU Affero General Public License for more details.      *
*                                                                               *
*    You should have received a copy of the GNU Affero General Public           *
*    License along with eLabFTW.  If not, see <http://www.gnu.org/licenses/>.   *
*                                                                               *
********************************************************************************/
session_start();
require_once '../inc/connect.php';
require_once '../inc/functions.php';
require_once '../inc/locale.php';
require_once '../vendor/autoload.php';
// formkey stuff
$formKey = new \Elabftw\Elabftw\FormKey();
//Array to store validation errors
$msg_arr = array();
//Validation error flag
$errflag = false;
// Check the form_key
if (!isset($_POST['form_key']) || !$formKey->validate()) {
    // form key is invalid
    $msg_arr[] = _("Your session expired. Please retry.");
    $errflag = true;
}
// Check username (sanitize and validate)
if (isset($_POST['username']) && !empty($_POST['username'])) {
    $username = filter_var($_POST['username'], FILTER_SANITIZE_STRING);
} else {
    $username = '';
Exemplo n.º 2
0
 */
/**
 * Login page
 *
 */
use Elabftw\Elabftw\Tools;
require_once 'inc/common.php';
$page_title = _('Login');
$selected_menu = null;
// Check if already logged in
if (isset($_SESSION['auth']) && $_SESSION['auth'] === 1) {
    header('Location: experiments.php');
    exit;
}
require_once 'inc/head.php';
$formKey = new \Elabftw\Elabftw\FormKey();
// if we are not in https, die saying we work only in https
if (!Tools::usingSsl()) {
    // get the url to display a link to click (without the port)
    $url = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
    $message = "eLabFTW works only in HTTPS. Please enable HTTPS on your server. Or click this link : <a href='{$url}'>{$url}</a>";
    display_message('error', $message);
    require_once 'inc/footer.php';
    exit;
}
// Check if we are banned after too much failed login attempts
$sql = "SELECT user_infos FROM banned_users WHERE time > :ban_time";
$req = $pdo->prepare($sql);
$req->execute(array(':ban_time' => date("Y-m-d H:i:s", strtotime('-' . get_config('ban_time') . ' minutes'))));
$banned_users_arr = array();
while ($banned_users = $req->fetch()) {
Exemplo n.º 3
0
*                                                                               *
********************************************************************************/
/* admin.php - for administration of the elab */
require_once 'inc/common.php';
require_once 'inc/locale.php';
require_once 'vendor/autoload.php';
$crypto = new \Elabftw\Elabftw\Crypto();
if ($_SESSION['is_admin'] != 1) {
    die(ADMIN_DIE);
}
$page_title = _('Admin panel');
$selected_menu = null;
require_once 'inc/head.php';
require_once 'inc/info_box.php';
require_once 'vendor/autoload.php';
$formKey = new \Elabftw\Elabftw\FormKey();
?>
<script src="js/tinymce/tinymce.min.js"></script>
<script src="js/raphael/raphael-min.js"></script>
<script src="js/colorwheel/colorwheel.js"></script>
<?php 
if (strlen(get_config('mail_from')) == 0) {
    $message = sprintf(_('Please finalize install : %slink to documentation%s.'), "<a href='https://github.com/elabftw/elabftw/wiki/finalizing'>", "</a>");
    display_message('error', $message);
}
// MAIN SQL FOR USERS
$sql = "SELECT * FROM users WHERE validated = :validated AND team = :team";
$user_req = $pdo->prepare($sql);
$user_req->bindValue(':validated', 0);
$user_req->bindValue(':team', $_SESSION['team_id']);
$user_req->execute();
Exemplo n.º 4
0
 * @author Nicolas CARPi <*****@*****.**>
 * @copyright 2012 Nicolas CARPi
 * @see http://www.elabftw.net Official website
 * @license AGPL-3.0
 * @package elabftw
 */
/**
 * Administration of a team
 *
 */
require_once 'inc/common.php';
// only admin can use this
if ($_SESSION['is_admin'] != 1) {
    die(_('This section is out of your reach.'));
}
$formKey = new \Elabftw\Elabftw\FormKey();
$crypto = new \Elabftw\Elabftw\CryptoWrapper();
$page_title = _('Admin panel');
$selected_menu = null;
require_once 'inc/head.php';
?>
<script src="js/tinymce/tinymce.min.js"></script>
<link href="js/colorpicker/jquery.colorpicker.css" rel="stylesheet" type="text/css" />
<?php 
// MAIN SQL FOR USERS
$sql = "SELECT * FROM users WHERE validated = :validated AND team = :team";
$user_req = $pdo->prepare($sql);
$user_req->bindValue(':validated', 0);
$user_req->bindValue(':team', $_SESSION['team_id']);
$user_req->execute();
$count = $user_req->rowCount();