Пример #1
0
<?php 
include "header.php";
include "sidebar.php";
?>
<div id="center">
<?php 
// $level from sidebar.php after user check
if (isset($_GET['do']) and $level == 'admin') {
    echo '<center>';
    switch ($_GET['do']) {
        case 'resetpass':
            // case for password reset
            $h = new Head();
            if (isset($_POST['resetpass'])) {
                if ($_POST['password1'] == $_POST['password2']) {
                    if ($h->resetPass($_POST['user'], $_POST['password1']) == "done") {
                        echo 'Password for ', $_POST['user'], ' changed';
                    } else {
                        echo 'some error occured';
                    }
                } else {
                    echo "Passwords dont match";
                }
            } else {
                echo '<form method ="POST" name="resetform" >Reset Password for<br><select name="user" >';
                foreach ($h->getList() as $head) {
                    echo '<option>', $head['username'], '</option>';
                }
                echo '</select><br>Password<br><input type="password" name="password1" /><br>Confirm<br><input type="password" name="password2" /><br><input type="button"  name ="reset" value="Reset" onclick="checkPassword(\'resetform\')"/><input type="hidden" name="resetpass" value="resetpass" /></form>';
            }
            break;