-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
61 lines (54 loc) · 1.82 KB
/
login.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
<?
include "main.php";
include "head.php";
if(!$_POST[submit_user_data])
{ $resq = "SHOW TABLES FROM ".$sqlbase." LIKE 'users';";
$rc=&$db->Execute($resq);
if($rc && $rc->RecordCount())
{
$resq = "SELECT * FROM users WHERE user_priveleges=3;";
$rc=&$db->Execute($resq);
if($rc && $rc->RecordCount())
{
$myform = new HTML_Form($SELF,"POST");
$myform->addText ("user_name" , "Èìÿ ïîëüçîâàòåëÿ","");
$myform->addText ("passwd" , "Ïàðîëü","");
$myform->addSubmit("submit_user_data", "Âîéòè!");
$myform->display();
}else
{
$str = "./new_admin.php";?>
<meta http-equiv="refresh" content="0; url=<?echo $str;?>"><?
}
}
else
{
$resq = "CREATE TABLE `users` (`idx` INTEGER(10) AUTO_INCREMENT PRIMARY KEY,`user` VARCHAR(50),`passwd` VARCHAR(1),`user_priveleges` INTEGER);";
if($db->Execute($resq)!=false)
{
$str = "./new_admin.php";?>
<meta http-equiv="refresh" content="0; url=<?echo $str;?>"><?
} else echo "Error creating tables ".$db->ErrorMsg();
}
}
if($_POST[submit_user_data])
{
$resq = "SELECT * FROM users WHERE user='".$_POST[user_name]."' AND passwd='".$_POST[passwd]."';";
$rc = &$db->Execute($resq);
if($rc && $rc->RecordCount())
{?>
<meta http-equiv="Set-Cookie" CONTENT="user_name=<?echo $_POST[user_name];?>">
<meta http-equiv="Set-Cookie" CONTENT="user_passwd=<?echo $_POST[passwd];?>">
<meta http-equiv="Set-Cookie" CONTENT="user_priv=<?echo $rc->fields[user_priveleges];?>">
<meta http-equiv="refresh" CONTENT="0; url=./index.php">
<?
}
else
{
echo "Îøèáêà àâòîðèçàöèè";
$str = "./login.php";?>
<meta http-equiv="refresh" content="3; url=<?echo $str;?>"><?
}
}
include "foot.php";
?>