-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangepass.php
executable file
·47 lines (40 loc) · 1.34 KB
/
changepass.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
<?
// Start session
session_start();
// Include required functions file
require_once('includes/functions.inc.php');
require_once('includes/config.inc.php');
// Check login status... if not logged in, redirect to login screen
if (check_login_status() == false) {
redirect('login.php');
}
?>
<?php require_once('menu.php');?>
<div id="page">
<div id="page-bg">
<?php
$connection = mysql_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD)
or die ('Unable to connect!');
//select database
mysql_select_db(DB_DATABASE) or die ('Unable to select database!');
$user = $_SESSION['username'];
?>
<h2><p>Please Enter The Following Information</p></h2>
<form name="changepass" method="POST" action="#">
<h2>Enter Password: <input type='password' name='pass1'></h2>
<h2>Retype Password: <input type='password' name='pass2'></h2>
<input type='button' value='Submit' onclick="verify();" name='B1'></p></h3>
</form><br /><br />
<?php
$pass = $_POST['pass1'];
if (isset($pass))
{
$querya = "Update users SET password = md5('$pass') where username = '$user';";
$resulta = mysql_query($querya) or die ('Error in query: $querya. ' . mysql_error());
echo "<h2>Password Sucessfully Changed<h2>";
}
mysql_close($connection);
?>
<br><br>
</body>
</html>