-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
executable file
·50 lines (43 loc) · 1.81 KB
/
profile.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
<?php
require('./includes/not_logged_in_redirect.inc.php');
require_once("./includes/connection.inc.php");
require_once("./includes/cluster_utilities.inc.php");
$conn = dbConnect('write');
$sql = 'SELECT * FROM users WHERE user_id = ' . $_SESSION['user_id'];
$result = $conn->query($sql);
$user = $result->fetch_assoc();
$title = "Profile | NEO";
require_once("./includes/template_begin.inc.php");
?>
<script type="text/javascript">
function cycleChange () {
$.ajax({
url : 'update_test_cycle.php',
type : 'POST',
data : {new_cycle : parseInt($('#cycle').val())-1},
success : function(){
alert("Your test cycle was successfully changed.");
},
error : function(jqXHR, textStatus, errorThrown){
alert("There was an error.");
}
});
}
</script>
<h4><strong>Name:</strong> <?php echo ucfirst($user['first_name']) . ' ' . ucfirst($user['last_name']); ?></h4>
<h4><strong>Email:</strong> <?php echo $user['email']; ?></h4>
<h4><strong>Cluster:</strong> <?php echo getClusterName($user['cluster_id']); ?></h4>
<?php if ($user['max_cycle'] > 0) {
$current_cycle = $user['current_cycle']+1;
?>
<h4 style="display: inline-block; margin-top: 0px; margin-bottom: 0px;"><strong>Test Cycle:</strong></h4>
<select style="display: inline-block;" id="cycle" onchange="cycleChange();">
<?php for ($i = 1; $i <= $user['max_cycle'] + 1; $i++){ ?>
<option <?php if ($i == $current_cycle) echo 'selected="selected"'?> value="<?php echo $i; ?>"><?php echo $i; ?></option>
<?php } ?>
</select><br>
<?php } ?>
<button id="changePassword" class="btn btn-default" onclick="window.open('change_password.php')">Change Password</button>
<?php
require_once("./includes/template_end.inc.php");
?>