-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusers_add.php
124 lines (106 loc) · 4.38 KB
/
users_add.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
<?php include ('inc_php_funtions.php'); ?>
<?php
//if (isset($_POST['HEADING']))
if($_POST) {
if(isset($_POST['STATUS']) && $_POST['STATUS'] == '1')
{
$STATUS = 1;
}
else {
$STATUS = 0;
}
$PNAME = normalize_str($_POST['PNAME']);
$PCAT = normalize_str($_POST['PCAT']);
$EMAIL = normalize_str($_POST['EMAIL']);
$FRMUSERID = normalize_str($_POST['FRMUSERID']);
$PASSWORD = normalize_str($_POST['PASSWORD']);
$USERCAT = normalize_str($_POST['USERCAT']);
$PWDHASH = md5($PASSWORD);
$sql="INSERT INTO `admin` (PNAME, PCAT, EMAIL, FRMUSERID, PWDHASH, USERCAT, STATUS)
VALUES ('$PNAME', '$PCAT', '$EMAIL', '$FRMUSERID', '$PWDHASH', '$USERCAT', '$STATUS')";
if(!mysqli_query($link, $sql)){
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
/*echo ("<script>location='comp-pg_edit.php?id=$MXID&preID=$preID&page=$page&added=y'</script>");*/
}
?>
<div class="alert alert-success" role="alert">
<strong>Success!</strong> Product Successfully Added!
</div>
<div id="form-content">
<form method="post" id="product_add" name="productAdd" autocomplete="off">
<div class="modal-body">
<div class="container">
<div class="row sml-padding">
<div class="col-lg-3"><label class="control-label">Person Name <span class="text-danger">*</span></label></div>
<div class="col-lg-9">
<input name="PNAME" class="form-control" type="text" required>
</div>
</div>
<div class="row sml-padding">
<div class="col-lg-3"><label class="control-label">Designation on System <span class="text-danger">*</span></label></div>
<div class="col-lg-9">
<input name="PCAT" class="form-control" type="text" required>
</div>
</div>
<div class="row sml-padding">
<div class="col-lg-3"><label class="control-label">Email Address <span class="text-danger">*</span><small><br><em>(for recoving password or alerts)</em></small></label></div>
<div class="col-lg-9">
<input name="EMAIL" class="form-control" type="email" required>
</div>
</div>
<div class="row sml-padding">
<div class="col-lg-3"><label class="control-label">User ID <span class="text-danger">*</span></label></div>
<div class="col-lg-9">
<input name="FRMUSERID" class="form-control" type="text" autocomplete="off" required>
</div>
</div>
<div class="row sml-padding">
<div class="col-lg-3"><label class="control-label">Password <span class="text-danger">*</span></label></div>
<div class="col-lg-9">
<input name="PASSWORD" class="form-control" type="password" autocomplete="off" required>
<input name="USERCAT" type="hidden" value="1">
</div>
</div>
<div class="row sml-padding">
<div class="col-lg-3"><label class="control-label">Status</label></div>
<div class="col-lg-9"><label><input type="checkbox" name="STATUS" value="1" checked="checked" /> Active</label></div>
</div>
</div>
</div>
<div class="modal-footer">
<input type="reset" class="btn btn-default pull-left" value="Clear">
<input type="submit" class="btn btn-primary" name="ProductAddSbmt" value="Submit">
</div>
</form>
</div>
<script type="text/javascript">
/*autohide alert*/
$(document).ready(function () {
window.setTimeout(function() {
$(".alert").fadeTo(1500, 0).slideUp(500, function(){
$(this).remove();
});
}, 6000);
});
/*autohide alert*/
$(document).ready(function() {
// submit form using $.ajax() method
$('#product_add').submit(function(e){
e.preventDefault(); // Prevent Default Submission
$.ajax({
url: 'users_add.php',
type: 'POST',
data: $(this).serialize() // it will serialize the form data
})
.done(function(data){
$('#form-content').fadeOut('slow', function(){
$('#form-content').fadeIn('slow').html(data);
});
})
.fail(function(){
alert('Ajax Submit Failed ...');
});
});
});
</script>