-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathmember_user.php
150 lines (141 loc) · 4.71 KB
/
member_user.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
session_start();
require("conf.php");
$username = $_SESSION['username'];
$sql = "SELECT * FROM users WHERE user_Name = '$username'";
$result = mysqli_query($connect, $sql);
$row = mysqli_fetch_array($result);
mysqli_close($connect);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<title>SimpleAuction - Member -> User Information</title>
<!-- Include CSS -->
<link href="./css/ajax.css" rel="stylesheet" type="text/css" />
<!-- Include Scripts -->
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="./js/jquery.validate.min.js"></script>
<script type="text/javascript" src="./js/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript">
$(document).ready(function(e) {
$("#user-mem-form").validate({
rules: {
tel: {
required: true,
digits: true,
minlength: 8
},
email: {
required: true,
email: true,
}
},
messages: {
email: {
required: "Please enter a valid email address",
email: "Please enter a valid email address"
},
tel: {
required: "Please enter a phone number",
minlength: "Please enter an 8-digits phone number"
}
},
errorPlacement: function(error, element) {
if (element.is(":checkbox")) {
error.appendTo(element.next().next());
}
else {
error.appendTo(element.parent().next());
}
},
success: function(label) {
label.addClass("valid");
}
});
$("#submit_user").click(function() {
if ($("#user-mem-form").valid() == true) {
$(".loading").show(500);
$("#user-mem-form").hide(0);
$("#message_user").hide(0);
$.ajax({
type: 'POST',
url: 'ajax_member_user.php',
dataType: 'json',
data: {
user: '<? echo $row['user_Name']; ?>',
email: $("#email").val(),
realname: $("#realname").val(),
tel: $("#tel").val()
},
success: function(data) {
$(".loading").hide(500);
$("#message_user").removeClass();
if (data.error === true) {
$("#message_user").addClass("message-error");
}
else $("#message_user").addClass("message-success");
$("#message_user").text(data.msg).show(500);
$("#user-mem-form").show(500);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$(".loading").hide(500);
$("#message_user").removeClass().addClass("message-error").text("There was an AJAX error").show(500);
$("#user-mem-form").show(500);
}
});
}
return false;
});
});
</script>
</head>
<body>
<!-- START MAIN CONTAINER -->
<div class="centerBox">
<div class="container">
<h1>User Information</h1>
<div id="message_user" style="display:none">
</div>
<div class="form-container">
<form id="user-mem-form" class="common-form">
<table>
<tr>
<td class="label"><h4>Login ID</h4></td>
<td class="field"><input class="input" disabled="disabled" value="<? echo $row['user_Name']; ?>" id="username" name="username" type="text" /></td>
<td class="status"></td>
</tr>
<tr>
<td class="label"><h4>Real Name</h4></td>
<td class="field"><input class="input" value="<? echo $row['user_RealName']; ?>" id="realname" name="realname" type="text" /></td>
<td class="status"></td>
</tr>
<tr>
<td class="label"><h4>Contact Number</h4></td>
<td class="field"><input class="input" value="<? echo $row['user_Phone']; ?>" id="tel" name="tel" type="text" /></td>
<td class="status"></td>
</tr>
<tr>
<td class="label"><h4>E-mail address</h4></td>
<td class="field"><input class="input" value="<? echo $row['user_Email']; ?>" id="email" name="email" type="text" /></td>
<td class="status"></td>
</tr>
</table>
<p align="left">
<input type="image" src="./images/submit.png" value="Submit" name="submit_user" id="submit_user" />
</p>
</form>
</div>
<div class="loading" style="display:none">
Please wait<br />
<img src="images/ajax-loader.gif" title="Loader" atl="Loader" />
</div>
</div>
<br class="clear" />
<br class="clear" />
</div>
</div><!-- END MAIN CONTAINER -->
</body>
</html>