mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 10:54:52 +00:00
Add ability to turn on extension access (cookie)
This commit is contained in:
20
post.php
20
post.php
@@ -216,6 +216,9 @@ if(isset($_POST['edit_profile'])){
|
||||
$existing_file_name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['existing_file_name'])));
|
||||
$logout = FALSE;
|
||||
|
||||
var_dump($_POST);
|
||||
exit();
|
||||
|
||||
//Check to see if a file is attached
|
||||
if($_FILES['file']['tmp_name'] != ''){
|
||||
|
||||
@@ -275,6 +278,23 @@ if(isset($_POST['edit_profile'])){
|
||||
$logout = TRUE;
|
||||
}
|
||||
|
||||
// Enable extension access, only if it isn't already setup (user doesn't have cookie)
|
||||
if(isset($_POST['extension']) && $_POST['extension'] == 'Yes'){
|
||||
if(!isset($_COOKIE['user_extension_key'])){
|
||||
$extension_key = keygen();
|
||||
mysqli_query($mysqli, "UPDATE users SET user_extension_key = '$extension_key' WHERE user_id = $user_id");
|
||||
|
||||
$extended_log_description .= ", extension access enabled";
|
||||
$logout = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Disable extension access
|
||||
if(!isset($_POST['extension'])){
|
||||
mysqli_query($mysqli, "UPDATE users SET user_extension_key = '' WHERE user_id = $user_id");
|
||||
$extended_log_description .= ", extension access disabled";
|
||||
}
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'User Preferences', log_action = 'Modify', log_description = '$session_name modified their preferences$extended_log_description', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_created_at = NOW(), log_user_id = $session_user_id, company_id = $session_company_id");
|
||||
|
||||
|
||||
@@ -72,6 +72,14 @@ $sql_recent_logs = mysqli_query($mysqli,"SELECT * FROM logs
|
||||
<label>Avatar</label>
|
||||
<input type="file" class="form-control-file" accept="image/*;capture=camera" name="file">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" name="extension" id="extension" value="Yes" <?php if(isset($_COOKIE['user_extension_key'])) {echo "checked";} ?>>
|
||||
<label class="form-check-label" for="extension">Extension access enabled?</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" name="edit_profile" class="btn btn-primary mt-3"><i class="fa fa-fw fa-check"></i> Save</button>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user