|
@@ -1,7 +1,7 @@
|
|
|
<?php
|
|
|
require "connectionDb.php";
|
|
|
|
|
|
- if (isset($_POST['edit']) && $_POST['role']!='super' && $_POST['username']!='super' && $_POST['email']!='super' ) {
|
|
|
+ if (isset($_POST['add']) && $_POST['role']!='super' && $_POST['username']!='super' && $_POST['email']!='super' ) {
|
|
|
|
|
|
|
|
|
$role = $_POST['role'];
|
|
@@ -9,11 +9,12 @@
|
|
|
$username = $_POST['username'];
|
|
|
$email = $_POST['email'];
|
|
|
$password = $_POST['password'];
|
|
|
+ $passcode = generate_password();
|
|
|
$pumplist = $_POST['pumplist'];
|
|
|
$pumpliststr = implode(",", $pumplist);
|
|
|
|
|
|
|
|
|
- $sql ="INSERT INTO user SET created_at=strftime('%Y-%m-%d %H:%M:%f000000+06:30', 'now', 'localtime'),updated_at=strftime('%Y-%m-%d %H:%M:%f000000+06:30', 'now', 'localtime'), name='$username', email='$email', password='$password',role='$role',pump_list='$pumpliststr' WHERE id='$id'";
|
|
|
+ $sql ="INSERT INTO user SET created_at=strftime('%Y-%m-%d %H:%M:%f000000+06:30', 'now', 'localtime'),updated_at=strftime('%Y-%m-%d %H:%M:%f000000+06:30', 'now', 'localtime'), name='$username', email='$email', password='$password',role='$role',pump_list='$pumpliststr',pass_code='$passcode' WHERE id='$id'";
|
|
|
|
|
|
$db->exec($sql);
|
|
|
|
|
@@ -121,7 +122,7 @@ input[type=checkbox]:checked:after {
|
|
|
|
|
|
<div class="form-group">
|
|
|
<div class="col-sm-offset-2 col-sm-10">
|
|
|
- <input type="submit" name="edit" value="Submit" class="btn btn-success">
|
|
|
+ <input type="submit" name="add" value="Submit" class="btn btn-success">
|
|
|
<input type="button" value="Cancel" class="btn btn-danger" onclick="document.getElementById('editVForm').style.display = 'none';">
|
|
|
</div>
|
|
|
</div>
|