-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuseraccountfunctions.php
More file actions
77 lines (72 loc) · 2.22 KB
/
useraccountfunctions.php
File metadata and controls
77 lines (72 loc) · 2.22 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
session_start(); //POST update method for updating data from the accountmanagment form in accountmanagment.php
if(isset($_POST['Update']))
{
$data_missing = array();
if(!empty($_POST['First_Name']))
{
$f_name = trim($_POST['First_Name']);
}
if(!empty($_POST['Last_Name']))
{
$l_name = trim($_POST['Last_Name']);
}
if(!empty($_POST['Email']))
{
$email = trim($_POST['Email']);
}
if(!empty($_POST['Phone_Number']))
{
$phone = trim($_POST['Phone_Number']);
}
if(!empty($_POST['Address']))
{
$address = trim($_POST['Address']);
}
if(!empty($_POST['City']))
{
$city = trim($_POST['City']);
}
if(!empty($_POST['State']))
{
$state = trim($_POST['State']);
}
if(!empty($_POST['Zip']))
{
$zip = trim($_POST['Zip']);
}
if(!empty($_POST['userpassword']))
{
$password = trim($_POST['userpassword']);
}
if(!empty($_POST['IDcheck']))
{
$IDcheck= trim(($_POST['IDcheck']));
}
}
require_once('mysqli_connect.php');
$query="Update users
SET
First_Name ='".$f_name."',
Last_Name ='".$l_name."',
Email ='".$email."',
Phone_Number ='".$phone."',
Address ='".$address."',
City ='".$city."',
State ='".$state."',
Zip ='".$zip."',
userpassword =PASSWORD('".$password."') WHERE student_id='".$_SESSION["myusername"]."'";
$stmt=mysqli_prepare($dbc, $query);
mysqli_stmt_execute($stmt);
$affected_rows = mysqli_stmt_affected_rows($stmt);
if(mysql_affected_rows() == 0)
{
mysqli_stmt_close($stmt);
}
// print_r ($_SESSION);
?>
<html>
</body>
<meta http-equiv="refresh" content="0; url=accountmanagement.php" />
</body>
</html>