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
|
<?php require_once( realpath(dirname(__FILE__)) . '/../common/config.php'); require_once( realpath(dirname(__FILE__)) . '/function_is_login.php'); if (is_login()) { header("Location: main.php"); exit; }
if (!SysCmsUser::exists()) { $user = new SysCmsUser(array('name'=>'Sky', 'login_name'=>'skyadmin', 'password'=>'0d78b065f67f10fbdcd2e648bc02f0eb', 'role'=>'superadmin', 'status'=>1)); $user->save() or die('Create user failure.'); $user = new SysCmsUser(array('name'=>'Admin', 'login_name'=>'admin', 'password'=>'2e6e5a2b38ba905790605c9b101497bc', 'role'=>'admin', 'status'=>1)); $user->save() or die('Create user failure.'); }
$is_postback = isset($_POST['loginname'], $_POST['password']); if ($is_postback) { $login_name = trim($_POST['loginname']); $password = trim($_POST['password']); //$autologin = $_POST['autologin']; $user = SysCmsUser::first(array('conditions' => array('login_name = ? AND password = ? AND actived = ?', $login_name, md5($password), 1))); if ($user === NULL) { // user not found. unset($_SESSION['webadmin']); } else { $_SESSION['webadmin'] = $user->attributes(); header("Location: main.php"); exit; } } ?> <!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" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <title>Content Management System (CMS) - Powered by One Solution Limited</title> <style type="text/css"> <!-- body { padding:0px; margin-top: 50px; background-color:#666666; font-family: Arial; font-size: 12px; color: #666666; text-decoration: none; } #error_notification { border: 1px #A25965 solid; height: auto; padding: 4px; background: #F8F0F1; text-align: center; -moz-border-radius: 5px; } --> </style> </head>
<body> <table width="500" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#FFFFFF"><img alt="" src="images/login_topf.jpg" width="500" height="15" /></td> </tr> <tr> <td align="center" valign="middle" bgcolor="#FFFFFF"><img alt="" src="images/logo.jpg" width="435" height="150" /></td> </tr> <tr> <td bgcolor="#FFFFFF"><img alt="" src="images/login_line.jpg" width="500" height="15" /></td> </tr> <tr> <td align="center" valign="middle" bgcolor="#FFFFFF"><?php if ($is_postback) { ?> <div id="error_notification">The submitted login info is incorrect.</div> <?php } ?> <form name="login" method="post" action="login.php"> <table border="0" cellspacing="0" cellpadding="3"> <tr> <td align="right">Login ID</td> <td align="left">: </td> <td align="left"><input id="name" type="text" name="loginname" style="width:200px;" /></td> </tr> <tr> <td align="right">Password</td> <td align="left">: </td> <td align="left"><input type="password" name="password" style="width:200px;" /></td> </tr> <tr> <td align="right"> </td> <td align="left"> </td> <td align="left"><input type="checkbox" name="autologin" value="1" /> Keep me signed in </td> </tr> <tr> <td colspan="2" align="center"></td> <td colspan="2" align="left"><input id="submit" type="submit" name="submit" value=" Login " /></td> </tr> </table> </form></td> </tr> <tr> <td bgcolor="#FFFFFF"><img alt="" src="images/login_line.jpg" width="500" height="15" /></td> </tr> <tr> <td align="right" bgcolor="#FFFFFF"> </td> </tr> <tr> <td><img alt="" src="images/login_footerf.jpg" width="500" height="15" /></td> </tr> </table> </body> </html>
|