-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew_admin.php
More file actions
47 lines (43 loc) · 1.37 KB
/
new_admin.php
File metadata and controls
47 lines (43 loc) · 1.37 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
<?
include "main.php";
include "head.php";
$resq = "SELECT * FROM users WHERE user_priveleges=3;";
$rc = &$db->Execute($resq);
if($rc && $rc->RecordCount())
{
$str = "./login.php";
?><meta http-equiv="refresh" content="0; url=<?echo $str;?>"><?
}
else
{
if(!$_POST[submit_user_data])
{
echo "Ââîä àäìèíèñòðàòîðà ñèñòåìû";
$myform = new HTML_Form($SELF,"POST");
$myform->addHidden("cmd","new","");
$myform->addText ("user_name" , "Èìÿ ïîëüçîâàòåëÿ","administrator");
$myform->addPassword ("passwd" , "Ïàðîëü","");
$myform->addSelect ("priveleges" , "Ïðàâà", $priveleges,"3");
$myform->addSubmit("submit_user_data", "Îòïðàâèòü");
$myform->display();
}
if($_POST[submit_user_data] && $_POST[cmd]="new")
{
if($_POST["passwd"]!=$_POST["passwd2"] || $_POST["passwd"]=='' || $_POST["user_name"==''])
{echo "Íå âñå äàííûå èëè ïàðîëü è ïîäòâåðæäåíèå íå ñîâïàäàþò";
$str = "./new_admin.php";
?><meta http-equiv="refresh" content="3; url=<?echo $str;?>"><?
}
else
{$resq = "INSERT INTO users (user,passwd,user_priveleges) VALUES ('".$_POST[user_name]."','".$_POST[passwd]."',".$_POST[priveleges].");";
if($db->Execute($resq)!=false)
{
$str = "./login.php";
?><meta http-equiv="refresh" content="0; url=<?echo $str;?>"><?
}else
echo "Error inserting ".$db->ErrorMsg();
}
}
}
include "foot.php";
?>