-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
73 lines (60 loc) · 1.78 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<html>
<head>
<meta charset="utf-8" />
</head>
<?php
require "phplib/genlibraries.php";
//checkIfSessionUser(basename($_SERVER['PHP_SELF']));
// Check if PHP session exists.
$r = checkLoggedIn();
// Recover guest user
if ($_REQUEST['id']){
if(! checkUserLoginExists($_REQUEST['id'])){
unset($_REQUEST['id']);
}
$r = loadUser($_REQUEST['id'],false);
}
// TEMPORAL IF !!!!!!!!!!!!!!!!!!!!1
if ($_REQUEST['guai_user']){
$login = $_REQUEST["guai_user"];
$user = $GLOBALS['usersCol']->findOne(array('_id' => $login));
if (!$user['_id'] || $user['Status'] == 0 || $user['Type'] !="0") {
redirect("../home/redirect.php");
}
$auxlastlog = $user['lastLogin'];
$user['lastLogin'] = moment();
updateUser($user);
setUser($user,$auxlastlog);
redirect("../home/redirect.php");
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Create guest
if (!$_REQUEST['id']){
// Read requested tool, if any
$tool = array();
$sd = "";
if ($_REQUEST['from']){
$tool = getTool_fromId($_REQUEST['from'],1);
if (!isset($tool['_id'])){
$_SESSION['userData']['Warning'][]="Cannot load '".$_REQUEST['from']."'. Tool not found";
redirect("../home/redirect.php");
}
/*
if (isset($tool['sampleData'])){
$sd = $tool['sampleData'];
}else{
$sd = $tool['_id'];
}
//$sd = ( isset($_REQUEST['sd'])?$_REQUEST['sd']:"");
*/
}
// Get access creating an a anonymous guest account
$r = createUserAnonymous($sd);
if (!$r)
exit('Login error: cannot create anonymous VRE user');
// Redirect to WS with a welcome modal
if ($_REQUEST['from']){
redirect("../workspace/?from=".$_REQUEST['from']);
}
}
redirect("../home/redirect.php");