First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
include "include/database.php";
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Process all actions to change a users password
|
||||
//
|
||||
$naction = "";
|
||||
if (array_key_exists('naction',$_POST)) $naction = $_POST['naction'];
|
||||
|
||||
switch (strtolower($naction)) {
|
||||
case "update":
|
||||
$record_num = intval($_SESSION['UserInfo']['record_num']);
|
||||
|
||||
if ($_SESSION['UserInfo']['password'] != $_POST['old_password']) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!array_key_exists('password1', $_POST) || strlen($_POST['password1']) == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!array_key_exists('password2', $_POST) || strlen($_POST['password2']) == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($_POST['password1'] != $_POST['password2']) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Update the password
|
||||
$rnum = $_SESSION['UserInfo']['record_num'];
|
||||
$password1 = $_POST['password1'];
|
||||
$query = "update users set password = '$password1' " .
|
||||
"where school_num = $base_school_num " .
|
||||
"and record_num = $rnum";
|
||||
db_query($query);
|
||||
|
||||
// $_SESSION['UserInfo']['password'] = $password1;
|
||||
|
||||
// Validate user accounts that are 'Pending'
|
||||
if ($_SESSION['UserInfo']['status'] == 'Pending') {
|
||||
$query = "update users set status = 'Active' where record_num = $rnum";
|
||||
db_query($query);
|
||||
$_SESSION['UserInfo']['status'] = 'Active';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user