-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbulkadduser.php
More file actions
80 lines (73 loc) · 2.4 KB
/
Copy pathbulkadduser.php
File metadata and controls
80 lines (73 loc) · 2.4 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
78
79
80
<?php
include('components/config.php');
$wrongPassword = 0;
$Success = 0;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$tmpName = $_FILES['csv']['tmp_name'];
$csv = array_map('str_getcsv', file($tmpName));
//Array Manipulation here.
foreach($csv as &$Row) {
$Row = str_getcsv($Row[0], ";");
}
$user->addBulkUsers($csv);
$Success=1;
}
include('components/sidebar.php');
?>
<script>
document.getElementById('bulkadduser.php').setAttribute("class", "current-page");
</script>
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<div class="page-title">
<div class="title_left">
<h3>User Management</h3>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Bulk Add Users</h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<?php if ($wrongPassword == 1) {echo '<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
</button>
<strong>Error</strong> Old password is incorrect
</div>';}
if ($Success == 1) {echo '<div class="alert alert-success alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
</button>
<strong>Success</strong> Data Added Successfully
</div>';}
?>
<p>User values should be in the format "username;password;role;status", one per line</p>
<br />
<form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post" enctype="multipart/form-data">
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">CSV File to import
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="file" class="form-control col-md-7 col-xs-12" name="csv">
</div>
</div>
<div class="item form-group">
<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
require 'components/footer.php';
require 'components/closing.php';
?>