Exemplo n.º 1
0
            if ($_POST["password"] == $_POST["confirmpassword"]) {
                $strinsert = "insert into users(username,password,firstname,lastname,salutation,\r\n\t\t\t\t\t\temail,office,permission,active) values('" . $unm . "','" . $pwd . "','" . $fnm . "','" . $lnm . "','" . $sal . "','" . $eml . "','" . $office . "',b'" . $user . "',b'" . $active . "')";
                echo $strinsert;
                $cnt = ExecuteNonQuery($strinsert);
                if ($cnt == 1) {
                    redirect_to("viewfaculties.php?msg=Record inserted successfully.&flag=1");
                } else {
                    redirect_to("viewfaculties.php?msg=Error in inserting record..Please try later.&flag=2");
                }
            } else {
                $message = "There was 1 error in the form.";
                single_errormessage('Password and Confirm password does not match');
            }
        } else {
            $message = "There was 1 error in the form.";
            single_errormessage('Username already exists into the database');
        }
    } else {
        if (count($errors) == 1) {
            $message = "There was 1 error in the form.";
        } else {
            $message = "There were " . count($errors) . " errors in the form.";
        }
    }
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Add Faculty</title>
            echo $cntrec;
            if ($cntrec > 0) {
                $query = "update users set password='******' where id=" . $_SESSION["a_userid"];
                $ctrec = ExecuteNonQuery($query);
                if ($ctrec == 1) {
                    //		redirect_to("changepassword.php?msg=Password successfully.&flag=1");
                    redirect_to("logout.php");
                } else {
                    redirect_to("changepassword.php?msg=Error in updating password..Please try later.&flag=2");
                }
            } else {
                $message = "password is incorrect...Please try later.";
            }
        } else {
            $message = "There was 1 error in the form.";
            single_errormessage('Password and Confirm password does not match');
        }
    } else {
        if (count($errors) == 1) {
            $message = "There was 1 error in the form.";
        } else {
            $message = "There were " . count($errors) . " errors in the form.";
        }
    }
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="css/style.css" rel="stylesheet" type="text/css">