-
Notifications
You must be signed in to change notification settings - Fork 0
/
editinfo.php
125 lines (104 loc) · 3.46 KB
/
editinfo.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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
// Initialize the session
session_start();
// Check if the user is logged in, if not then redirect him to login page
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
header("location: login.php");
exit;
}
?>
<html class="gr__kplinkserver_net"><head>
<title>New Tech Information Technology Club</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<!-- you should always add your stylesheet (css) in the head tag so that it starts loading before the page html is being displayed -->
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body data-gr-c-s-loaded="true">
<!-- webpage content goes here in the body -->
<div id="page">
<div id="logo">
<h1><img src="logo.png" alt="KPLink Logo" style="width:300px;height:60px;border:0;"></h1>
</div>
<div id="nav">
<ul>
<li><a href="welcome.php">Home</a></li>
<li><a href="requests.php">Requests</a></li>
<li><a href="settings.php">Settings</a></li>
</ul>
</div>
<div id="content">
<h1>Edit Information</h1>
<?php
$con=mysqli_connect("127.0.0.1:51463","azure","6#vWHD_$","login");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$id = $_GET['id'];
$query = "SELECT * FROM users WHERE (id = $id)";
$result = mysqli_query($con,$query);
while($row=mysqli_fetch_assoc($result))
{
$ifirstname = $row['firstname'];
$ilastname = $row['lastname'];
$iphone = $row['phone'];
$iemail = $row['email'];
$icity = $row['city'];
$izipcode = $row['zipcode'];
}
if (isset($_POST['submitted']))
{
$lastname = $_POST['lastname'];
$firstname = $_POST['firstname'];
$city = $_POST['city'];
$zipcode = $_POST['zipcode'];
$email = $_POST['email'];
$phone = $_POST['phone'];
mysqli_query($con,"UPDATE users SET firstname='$firstname',lastname='$lastname',phone='$phone',email='$email',city='$city',zipcode='$zipcode' WHERE id='$id'");
header("Location:settings.php");
exit;
}
mysqli_close($con);
?>
<form id='editinfo' name='editinfo' method='post' action=''>
<table cellspacing='0' cellpadding='5' border='0'>
<tr>
<td>First Name</td>
<td><input id='firstname' name='firstname' type='text' style='display:block' value=<?php echo $ifirstname;?>></td>
</tr>
<tr>
<td>Last Name</td>
<td><input id='lastname' name='lastname' type='text' style='display:block' value=<?php echo $ilastname;?>></td>
</tr>
<tr>
<td>Phone Number</td>
<td><input id='phone' name='phone' type='text' style='display:block' value=<?php echo $iphone;?>></td>
</tr>
<tr>
<td>Email Address</td>
<td><input id='email' name='email' type='text' style='display:block' value=<?php echo $iemail;?>></td>
</tr>
<tr>
<td>City</td>
<td><input id='city' name='city' type='text' style='display:block' value=<?php echo $icity;?>></td>
</tr>
<tr>
<td>Zip Code</td>
<td><input id='zipcode' name='zipcode' type='text' style='display:block' value=<?php echo $izipcode;?>></td>
</tr>
</table>
<input id='submit' name='submit' type='submit' value='Save' style='display:block'>
<button type="reset" value="Reset">Reset</button>
<a class="btn btn-link" href="settings.php">Cancel</a>
<input id='submitted' name='submitted' type='hidden' value='true' style='display:block'/>
</form>
</div>
<div id="footer1">
<p>
<a href="logout.php" class="btn btn-danger">Sign Out of Your Account</a>
</p>
</div>
</div>
</body>
</html>