-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathadmins.php
228 lines (172 loc) · 5.55 KB
/
admins.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!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 http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Asterisk Dialer</title>
<link rel="stylesheet" href="css/styles.css" type="text/css" media="all" />
<script src='funciones.js'></script>
<script>
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, 'location=0,width=320,height=420,resizable=0,scrollbars=no');
return false;
}
</script>
</head>
<body>
<!-- Header -->
<div id="header">
<div class="shell">
<!-- Logo + Top Nav -->
<div id="top">
<h1><a href="http://asterisk-pbx.ru/wiki/works/asterisk_autodialer">Asterisk Dialer</a></h1>
<div id="top-navigation">
Welcome <strong><?php echo $_SESSION[name];?></strong>
<span>|</span>
<a href="http://asterisk-pbx.ru/wiki/works/asterisk_autodialer">Help</a>
<span>|</span>
<a href="logout.php">logout</a>
</div>
</div>
<!-- End Logo + Top Nav -->
<!-- Main Nav -->
<div id="navigation">
<ul>
<li><a href="upload.php"><span>Create New Campaign</span></a></li>
<li><a href="campaigns.php"><span>Campaigns</span></a></li>
<li><a href="start.php"><span>Start Campaign</span></a></li>
<li><a href="admins.php" class="active"><span>Administrators</span></a></li>
</ul>
</div>
<!-- End Main Nav -->
</div>
</div>
<!-- End Header -->
<!-- Container -->
<div id="container">
<!-- Small Nav -->
<div class="small-nav">
<!--<a href="#">Dashboard</a>
<span>></span>
Current Articles-->
</div>
<!-- End Small Nav -->
<br />
<!-- Main -->
<div id="main">
<div class="cl"> </div>
<!-------------------- ------->
<?php
require_once("conf.php");
$link = mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($db, $link);
// $link = mysql_connect("localhost","dialeruser","dialerpass") or die(mysql_error());
// mysql_select_db("dialerdb", $link);
$sql="SELECT user_name FROM login_admin order by user_name asc";
$res=mysql_query($sql,$link) or die (mysql_error());
$fields_num = mysql_num_fields($res);
echo" <!-- Content -->
<div id='sidebar'>
<!-- Box -->
<div class='box'>
<!-- Box Head -->
<div class='box-head'>
<h2>Administrators<span class='req'></span></h2>
</div>
<form id='contact-form' >
<!-- Form -->
<div class='form'>";
echo " <div class='table'>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>";
echo "<tr>";
for($i=0; $i<$fields_num; $i++)
{
$field = mysql_fetch_field($res);
echo "<th><b>{$field->name}</b></th>";
}
echo "<th>Control</th>";
echo "</tr>\n";
$id="test";
while($row = mysql_fetch_row($res))
{
echo "<tr>";
foreach($row as $cell)
echo "<td>$cell</td>";
echo "<td><a href='deladmin.php?desc=$cell' class='ico del'>Delete</a>";
echo '<a href=\'editadmin.php?desc='.$cell.'\' onclick="return popup(this,\'windi\')" class="ico edit">Edit</a></td>
</tr>';
}
echo "</table></div></div></div></form></div></div>";
mysql_free_result($result);
?>
<!-- Content -->
<div id="content3">
<!-- Box -->
<div class="box">
<!-- Box Head -->
<div class="box-head">
<h2>Add New Administrator<span class="req"></span></h2>>
</div>
<!-- End Box Head -->
<?php
if(isset($_POST['button'])){
$errors = array(); // declaramos un array para almacenar los errores
if($_POST['username'] == ''){
$errors1 = '<span class="error2">Insert a UserName</span>';
}else if($_POST['password'] == ''){
$errors2 = '<span class="error2">Insert a Password</span>';
}else{
// $host="localhost";
// $user="dialeruser";
// $pass="dialerpass";
// $db="dialerdb";
$username=$_POST["username"];
$password=$_POST["password"];
require_once("conf.php");
$link = mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($db, $link);
$sql1 = "INSERT INTO login_admin (user_name,user_pass) VALUES('$username',SHA('$password'))";
$result = mysql_query($sql1,$link) or die(mysql_error());
$_POST['username'] = '';
$_POST['password'] = '';
header("Location: admins.php");
}
}
?>
<form id="contact-form" action="" method="post">
<!-- Form -->
<div class="form">
<p>
<label>UserName<span></span></label><?php echo $errors1 ?>
<input type=text class='field' name=username id=username value='<?php echo $_POST['prefix']; ?>'>
</p>
<p>
<label>Password<span></span></label><?php echo $errors2 ?>
<input type=password class='field' name=password id=password value='<?php echo $_POST['cost']; ?>'>
</p>
</div>
<!-- End Form -->
<!-- Form Buttons -->
<div class="buttons">
<input name="button" type="submit" class="button" value="submit" />
</div>
<!-- End Form Buttons -->
</form>
</div>
<!-- End Box -->
<div class="cl"> </div>
</div>
<!-- Main -->
</div>
</div>
<!-- End Container -->
<?php
?>
</body>
</html>