File admin/sql.php changed (mode: 100644) (index bcbc1b1..cbbf521) |
... |
... |
if ($db === FALSE) |
13 |
13 |
fatal("Internal error (db)!"); |
fatal("Internal error (db)!"); |
14 |
14 |
|
|
15 |
15 |
// create repos table |
// create repos table |
16 |
|
$sql = "CREATE TABLE repos (repo_id INT PRIMARY KEY, uid INT, itime INT)"; |
|
|
16 |
|
$sql = "CREATE TABLE repos (repo_id INTEGER PRIMARY KEY, name TEXT, uid INTEGER" |
|
17 |
|
. ", itime INTEGER" |
|
18 |
|
. ", public INTEGER)"; |
17 |
19 |
$res = sql_query($db, $sql); |
$res = sql_query($db, $sql); |
18 |
20 |
if ($res === FALSE) |
if ($res === FALSE) |
19 |
21 |
echo "WARN: Cannot create 'repo_access' table!\n"; |
echo "WARN: Cannot create 'repo_access' table!\n"; |
20 |
22 |
|
|
21 |
23 |
// create repo_access table |
// create repo_access table |
22 |
|
$sql = "CREATE TABLE repo_access (repo_id INT, uid INT, perm CHAR(1), itime INT)"; |
|
|
24 |
|
$sql = "CREATE TABLE repo_access (repo_id INTEGER, uid INTEGER, perm CHAR(1)" |
|
25 |
|
. ", itime INTEGER)"; |
23 |
26 |
$res = sql_query($db, $sql); |
$res = sql_query($db, $sql); |
24 |
27 |
if ($res === FALSE) |
if ($res === FALSE) |
25 |
28 |
echo "WARN: Cannot create 'repo_access' table!\n"; |
echo "WARN: Cannot create 'repo_access' table!\n"; |
|
... |
... |
$res = sql_query($db, $sql); |
29 |
32 |
if ($res === FALSE) |
if ($res === FALSE) |
30 |
33 |
echo "WARN: Cannot create 'state' table!\n"; |
echo "WARN: Cannot create 'state' table!\n"; |
31 |
34 |
|
|
32 |
|
$sql = "CREATE TABLE keys (key_id INT PRIMARY KEY, itime INT, uid INT, key TEXT)"; |
|
|
35 |
|
$sql = "CREATE TABLE keys (key_id INTEGER PRIMARY KEY, itime INTEGER" |
|
36 |
|
. ", uid INTEGER, key TEXT)"; |
33 |
37 |
$res = sql_query($db, $sql); |
$res = sql_query($db, $sql); |
34 |
38 |
if ($res === FALSE) |
if ($res === FALSE) |
35 |
39 |
echo "WARN: Cannot create 'keys' table!\n"; |
echo "WARN: Cannot create 'keys' table!\n"; |
36 |
40 |
|
|
37 |
|
$sql = "CREATE TABLE users (uid INT PRIMARY KEY, user TEXT, salt TEXT, pass TEXT, itime INT)"; |
|
|
41 |
|
$sql = "CREATE TABLE users (uid INT PRIMARY KEY, user TEXT, salt TEXT" |
|
42 |
|
. ", pass TEXT, email TEXT, itime INTEGER" |
|
43 |
|
. ", suspended INTEGER" |
|
44 |
|
. ", session_time INTEGER" |
|
45 |
|
. ", last_seen INTEGER)"; |
38 |
46 |
$res = sql_query($db, $sql); |
$res = sql_query($db, $sql); |
39 |
47 |
if ($res === FALSE) |
if ($res === FALSE) |
40 |
|
echo "WARN: Cannot create 'keys' table!\n"; |
|
|
48 |
|
echo "WARN: Cannot create 'users' table!\n"; |
|
49 |
|
|
|
50 |
|
$sql = "CREATE TABLE sess (sid TEXT PRIMARY KEY, uid INTEGER, expire INTEGER" |
|
51 |
|
. ", session_time INTEGER, ip TEXT)"; |
|
52 |
|
$res = sql_query($db, $sql); |
|
53 |
|
if ($res === FALSE) |
|
54 |
|
echo "WARN: Cannot create 'sess' table!\n"; |
41 |
55 |
|
|
42 |
56 |
echo "Done!\n"; |
echo "Done!\n"; |
43 |
57 |
?> |
?> |
File inc/repo.inc.php changed (mode: 100644) (index efea197..b730482) |
1 |
1 |
<?php |
<?php |
2 |
2 |
require_once($INC . "/xlog.inc.php"); |
require_once($INC . "/xlog.inc.php"); |
3 |
3 |
require_once($INC . "/db.inc.php"); |
require_once($INC . "/db.inc.php"); |
4 |
|
require_once($INC . "/state.inc.php"); |
|
|
4 |
|
require_once($INC . "/user.inc.php"); |
5 |
5 |
|
|
6 |
6 |
$repo_error = ""; |
$repo_error = ""; |
7 |
7 |
|
|
8 |
8 |
function repo_set_error($str) |
function repo_set_error($str) |
9 |
9 |
{ |
{ |
10 |
10 |
global $repo_error; |
global $repo_error; |
|
11 |
|
|
|
12 |
|
xlog("\tError: $str"); |
11 |
13 |
$repo_error = $str; |
$repo_error = $str; |
12 |
14 |
} |
} |
13 |
15 |
|
|
|
... |
... |
function repo_allow($db, $repo_id, $uid, $perms) |
56 |
58 |
return TRUE; |
return TRUE; |
57 |
59 |
} |
} |
58 |
60 |
|
|
|
61 |
|
/* |
|
62 |
|
* Add a repository |
|
63 |
|
*/ |
|
64 |
|
function repo_create($db, $uid, $name, $public) |
|
65 |
|
{ |
|
66 |
|
xlog("repo_create: name=[$name], public=$public..."); |
|
67 |
|
|
|
68 |
|
$name = htmlspecialchars($name); |
|
69 |
|
$e_name = sql_escape($db, $name); |
|
70 |
|
|
|
71 |
|
$itime = time(); |
|
72 |
|
|
|
73 |
|
$sql = "INSERT INTO repos (uid, name, itime, public)" |
|
74 |
|
. " VALUES ($uid, '$e_name', $itime, $public)"; |
|
75 |
|
$res = sql_query($db, $sql); |
|
76 |
|
if ($res === FALSE) { |
|
77 |
|
repo_set_error("Cannot insert (" . sql_error() . ")"); |
|
78 |
|
return FALSE; |
|
79 |
|
} |
|
80 |
|
sql_free_result($res); |
|
81 |
|
} |
|
82 |
|
|
|
83 |
|
/* |
|
84 |
|
* List repositories |
|
85 |
|
*/ |
|
86 |
|
function repo_list($db, $uid) |
|
87 |
|
{ |
|
88 |
|
xlog("repo_list: uid=$uid..."); |
|
89 |
|
|
|
90 |
|
$sql = "SELECT * FROM repos WHERE uid = $uid"; |
|
91 |
|
$res = sql_query($db, $sql); |
|
92 |
|
if ($res === FALSE) |
|
93 |
|
return FALSE; |
|
94 |
|
|
|
95 |
|
$ret = "<table>\n"; |
|
96 |
|
$ret .= "<tr>\n"; |
|
97 |
|
$ret .= " <th>Name</th>\n"; |
|
98 |
|
$ret .= " <th>Creation date (UTC)</th>\n"; |
|
99 |
|
$ret .= " <th>Public</th>\n"; |
|
100 |
|
$ret .= " <th>Operations</th>\n"; |
|
101 |
|
$ret .= "</tr>\n"; |
|
102 |
|
while (($row = sql_fetch_array($res))) { |
|
103 |
|
$ret .= "<tr>\n"; |
|
104 |
|
$ret .= " <td>" . $row['name'] . "</td>\n"; |
|
105 |
|
$ret .= " <td>" . date("Y-m-d H:i:s", $row['itime']) . "</td>\n"; |
|
106 |
|
$ret .= " <td>" . ($row['public'] == 1 ? "Yes" : "No") . "</td>\n"; |
|
107 |
|
$ret .= " <td>-</td>\n"; |
|
108 |
|
$ret .= "</tr>\n"; |
|
109 |
|
} |
|
110 |
|
$ret .= "</table>\n"; |
|
111 |
|
sql_free_result($res); |
|
112 |
|
|
|
113 |
|
return $ret; |
|
114 |
|
} |
59 |
115 |
?> |
?> |
File inc/sess.inc.php added (mode: 100644) (index 0000000..d5ad020) |
|
1 |
|
<?php |
|
2 |
|
require_once($INC . "/xlog.inc.php"); |
|
3 |
|
require_once($INC . "/db.inc.php"); |
|
4 |
|
|
|
5 |
|
/* |
|
6 |
|
* Add a session |
|
7 |
|
*/ |
|
8 |
|
function sess_add($db, $uid, $sid, $session_time) |
|
9 |
|
{ |
|
10 |
|
xlog("sess_add: uid=$uid, sid=$sid, session_time=$session_time."); |
|
11 |
|
|
|
12 |
|
$ip = @$_SERVER['REMOTE_ADDR']; |
|
13 |
|
$now = time(); |
|
14 |
|
|
|
15 |
|
$sql = "INSERT INTO sess (sid, uid, expire, session_time, ip)" |
|
16 |
|
. " VALUES ('$sid', $uid" |
|
17 |
|
. ", " . ($now + $session_time) . ", $session_time, '$ip')"; |
|
18 |
|
$res = sql_query($db, $sql); |
|
19 |
|
if ($res === FALSE) { |
|
20 |
|
xlog("\tCannot insert (" . sql_error() . ")!"); |
|
21 |
|
return FALSE; |
|
22 |
|
} |
|
23 |
|
sql_free_result($res); |
|
24 |
|
} |
|
25 |
|
|
|
26 |
|
/* |
|
27 |
|
* Returns if a session is still valid. Will return FALSE or uid |
|
28 |
|
*/ |
|
29 |
|
function sess_valid($db, $sid) |
|
30 |
|
{ |
|
31 |
|
xlog("sess_valid: sid=$sid..."); |
|
32 |
|
|
|
33 |
|
if (empty($sid)) |
|
34 |
|
return FALSE; |
|
35 |
|
|
|
36 |
|
$uid = FALSE; |
|
37 |
|
|
|
38 |
|
$e_sid = sql_escape($db, $sid); |
|
39 |
|
|
|
40 |
|
$sql = "SELECT uid FROM sess WHERE sid = '$e_sid'"; |
|
41 |
|
$res = sql_query($db, $sql); |
|
42 |
|
if ($res === FALSE) { |
|
43 |
|
xlog("\tCannot select (" . sql_error() . ")!"); |
|
44 |
|
return FALSE; |
|
45 |
|
} |
|
46 |
|
$row = sql_fetch_array($res); |
|
47 |
|
sql_free_result($res); |
|
48 |
|
if (isset($row['uid'])) |
|
49 |
|
$uid = $row['uid']; |
|
50 |
|
|
|
51 |
|
xlog("\tuid=$uid."); |
|
52 |
|
|
|
53 |
|
return $uid; |
|
54 |
|
} |
|
55 |
|
|
|
56 |
|
/* |
|
57 |
|
* Refresh a session |
|
58 |
|
*/ |
|
59 |
|
function sess_update($db, $sid) |
|
60 |
|
{ |
|
61 |
|
xlog("sess_update: sid=$sid..."); |
|
62 |
|
|
|
63 |
|
$e_sid = sql_escape($db, $sid); |
|
64 |
|
|
|
65 |
|
$sql = "UPDATE sess SET expire = " . time() . " + session_time" |
|
66 |
|
. " WHERE sid = '$e_sid'"; |
|
67 |
|
$res = sql_query($db, $sql); |
|
68 |
|
if ($res === FALSE) { |
|
69 |
|
xlog("\tCannot update (" . sql_error() . ")!"); |
|
70 |
|
return FALSE; |
|
71 |
|
} |
|
72 |
|
sql_free_result($res); |
|
73 |
|
|
|
74 |
|
return TRUE; |
|
75 |
|
} |
|
76 |
|
|
|
77 |
|
/* |
|
78 |
|
* Destroy session |
|
79 |
|
*/ |
|
80 |
|
function sess_destroy($db, $sid) |
|
81 |
|
{ |
|
82 |
|
xlog("sess_destroy: sid=$sid..."); |
|
83 |
|
|
|
84 |
|
$e_sid = sql_escape($db, $sid); |
|
85 |
|
|
|
86 |
|
$sql = "DELETE FROM sess WHERE sid = '$e_sid'"; |
|
87 |
|
$res = sql_query($db, $sql); |
|
88 |
|
if ($res === FALSE) { |
|
89 |
|
xlog("\tCannot delete (" . sql_error() . ")!"); |
|
90 |
|
return FALSE; |
|
91 |
|
} |
|
92 |
|
sql_free_result($res); |
|
93 |
|
|
|
94 |
|
return TRUE; |
|
95 |
|
} |
|
96 |
|
?> |
File inc/user.inc.php added (mode: 100644) (index 0000000..ab17c87) |
|
1 |
|
<?php |
|
2 |
|
require_once($INC . "/xlog.inc.php"); |
|
3 |
|
require_once($INC . "/db.inc.php"); |
|
4 |
|
require_once($INC . "/sess.inc.php"); |
|
5 |
|
|
|
6 |
|
function gg_user_set_error($str) |
|
7 |
|
{ |
|
8 |
|
global $_gg_user_error; |
|
9 |
|
|
|
10 |
|
xlog("\tError: $str"); |
|
11 |
|
$_gg_user_error = $str; |
|
12 |
|
} |
|
13 |
|
|
|
14 |
|
function gg_user_error() |
|
15 |
|
{ |
|
16 |
|
global $_gg_user_error; |
|
17 |
|
return $_gg_user_error; |
|
18 |
|
} |
|
19 |
|
|
|
20 |
|
/* |
|
21 |
|
* Add a user |
|
22 |
|
*/ |
|
23 |
|
function user_add($db, $user, $pass, $email) |
|
24 |
|
{ |
|
25 |
|
xlog("user_add: user=$user, pass=$pass, email=$email..."); |
|
26 |
|
|
|
27 |
|
$itime = time(); |
|
28 |
|
$e_salt = sha1(mt_rand() . microtime(TRUE)); |
|
29 |
|
$e_sha1pass = sha1($e_salt . "===" . $pass); |
|
30 |
|
|
|
31 |
|
$e_user = sql_escape($db, $user); |
|
32 |
|
$e_email = sql_escape($db, $email); |
|
33 |
|
|
|
34 |
|
$sql = "INSERT INTO users (user, salt, pass, email, itime)" |
|
35 |
|
. " VALUES ('$e_user', '$e_salt', '$e_sha1pass', '$e_email'" |
|
36 |
|
. ", $time)"; |
|
37 |
|
$res = sql_query($db, $sql); |
|
38 |
|
if ($res === FALSE) { |
|
39 |
|
gg_user_set_error("Cannot insert user (" . sql_error() . ")!"); |
|
40 |
|
return FALSE; |
|
41 |
|
} |
|
42 |
|
sql_free_result($res); |
|
43 |
|
|
|
44 |
|
return TRUE; |
|
45 |
|
} |
|
46 |
|
|
|
47 |
|
/* |
|
48 |
|
* Delete a user |
|
49 |
|
*/ |
|
50 |
|
function user_remove($db, $uid) |
|
51 |
|
{ |
|
52 |
|
$uid = sprintf("%u", $uid); |
|
53 |
|
|
|
54 |
|
$sql = "DELETE FROM users WHERE uid = $uid"; |
|
55 |
|
$res = sql_query($db, $sql); |
|
56 |
|
if ($res === FALSE) { |
|
57 |
|
gg_user_set_error("Cannot remove user $uid (" . sql_error() . ")!"); |
|
58 |
|
return FALSE; |
|
59 |
|
} |
|
60 |
|
sql_free_result($res); |
|
61 |
|
|
|
62 |
|
return TRUE; |
|
63 |
|
} |
|
64 |
|
|
|
65 |
|
/* |
|
66 |
|
* Returns info about a user (by uid or user fields) |
|
67 |
|
*/ |
|
68 |
|
function user_info($db, $uid, $user) |
|
69 |
|
{ |
|
70 |
|
xlog("user_info: uid=[$uid], user=[$user]..."); |
|
71 |
|
|
|
72 |
|
if ($uid > 0) { |
|
73 |
|
$add = " AND uid = " . sprintf("%u", $uid); |
|
74 |
|
} else { |
|
75 |
|
$e_user = sql_escape($db, $user); |
|
76 |
|
$add = " AND user = '$e_user'"; |
|
77 |
|
} |
|
78 |
|
|
|
79 |
|
$sql = "SELECT * FROM users WHERE suspended = 0" . $add; |
|
80 |
|
$res = sql_query($db, $sql); |
|
81 |
|
if ($res === FALSE) { |
|
82 |
|
gg_user_set_error("Cannot get info (" . sql_error() . ")!"); |
|
83 |
|
return FALSE; |
|
84 |
|
} |
|
85 |
|
$row = sql_fetch_array($res); |
|
86 |
|
sql_free_result($res); |
|
87 |
|
if (!isset($row['user'])) { |
|
88 |
|
gg_user_set_error("User not found (" . sql_error() . ")!"); |
|
89 |
|
return FALSE; |
|
90 |
|
} |
|
91 |
|
|
|
92 |
|
return $row; |
|
93 |
|
} |
|
94 |
|
|
|
95 |
|
/* |
|
96 |
|
* Test if login is OK |
|
97 |
|
*/ |
|
98 |
|
function user_login($db, $sid) |
|
99 |
|
{ |
|
100 |
|
xlog("user_login: sid=$sid..."); |
|
101 |
|
|
|
102 |
|
if (($uid = sess_valid($db, $sid))) { |
|
103 |
|
sess_update($db, $sid); |
|
104 |
|
return $uid; |
|
105 |
|
} |
|
106 |
|
|
|
107 |
|
xlog("No sid! Try with user..."); |
|
108 |
|
$user = @$_REQUEST['user']; |
|
109 |
|
$pass = @$_REQUEST['pass']; |
|
110 |
|
if (empty($user) || empty($pass)) |
|
111 |
|
return FALSE; |
|
112 |
|
|
|
113 |
|
$ui = user_info($db, 0, $user); |
|
114 |
|
if ($ui === FALSE) { |
|
115 |
|
gg_user_set_error("Invalid user or pass!"); |
|
116 |
|
return FALSE; |
|
117 |
|
} |
|
118 |
|
xlog("\tui: " . print_r($ui, TRUE)); |
|
119 |
|
|
|
120 |
|
$sha1pass = sha1($ui['salt'] . "===" . $pass); |
|
121 |
|
if (strcmp($sha1pass, $ui['pass']) != 0) { |
|
122 |
|
gg_user_set_error("Invalid user or pass!"); |
|
123 |
|
return FALSE; |
|
124 |
|
} |
|
125 |
|
|
|
126 |
|
$sid = sha1(mt_rand() . microtime(TRUE)); |
|
127 |
|
sess_add($db, $ui['uid'], $sid, $ui['session_time']); |
|
128 |
|
setcookie("sid", $sid, 0); |
|
129 |
|
|
|
130 |
|
return $ui['uid']; |
|
131 |
|
} |
|
132 |
|
|
|
133 |
|
/* |
|
134 |
|
* List users |
|
135 |
|
*/ |
|
136 |
|
function user_list($db) |
|
137 |
|
{ |
|
138 |
|
xlog("user_list..."); |
|
139 |
|
|
|
140 |
|
$sql = "SELECT * FROM users ORDER BY user"; |
|
141 |
|
$res = sql_query($db, $sql); |
|
142 |
|
if ($res === FALSE) { |
|
143 |
|
gg_user_set_error("Cannot get info (" . sql_error() . ")!"); |
|
144 |
|
return FALSE; |
|
145 |
|
} |
|
146 |
|
|
|
147 |
|
$ret = "<table>\n"; |
|
148 |
|
$ret .= "<tr>\n"; |
|
149 |
|
$ret .= " <th>Name</th>\n"; |
|
150 |
|
$ret .= " <th>E-mail</th>\n"; |
|
151 |
|
$ret .= " <th>Creation date</th>\n"; |
|
152 |
|
$ret .= " <th>Suspended?</th>\n"; |
|
153 |
|
$ret .= " <th>Session time</th>\n"; |
|
154 |
|
$ret .= " <th>Last seen</th>\n"; |
|
155 |
|
$ret .= "</tr>\n"; |
|
156 |
|
while (($row = sql_fetch_array($res))) { |
|
157 |
|
$ret .= "<tr>\n"; |
|
158 |
|
$ret .= " <td>" . $row['user'] . "</td>\n"; |
|
159 |
|
$ret .= " <td>" . $row['email'] . "</td>\n"; |
|
160 |
|
$ret .= " <td>" . date("Y-m-d H:i:s", $row['itime']) . "</td>\n"; |
|
161 |
|
$ret .= " <td>" . ($row['suspended'] == 0 ? "No" : "Yes") . "</th>\n"; |
|
162 |
|
$ret .= " <td>" . $row['session_time'] . "s</td>\n"; |
|
163 |
|
$ret .= " <td>" . date("Y-m-d H:i:s", $row['last_seen']) . "</td>\n"; |
|
164 |
|
$ret .= "</tr>\n"; |
|
165 |
|
} |
|
166 |
|
$ret .= "</table>\n"; |
|
167 |
|
sql_free_result($res); |
|
168 |
|
|
|
169 |
|
return $ret; |
|
170 |
|
} |
|
171 |
|
?> |
File root/index.php changed (mode: 100644) (index 18a639a..0363c36) |
... |
... |
$THEME = $ROOT . "/themes/default"; |
9 |
9 |
require_once("/etc/gg/config.php"); |
require_once("/etc/gg/config.php"); |
10 |
10 |
require_once($INC . "/xlog.inc.php"); |
require_once($INC . "/xlog.inc.php"); |
11 |
11 |
include_once($INC . "/db.inc.php"); |
include_once($INC . "/db.inc.php"); |
|
12 |
|
include_once($INC . "/user.inc.php"); |
12 |
13 |
include_once($INC . "/repo.inc.php"); |
include_once($INC . "/repo.inc.php"); |
13 |
14 |
|
|
|
15 |
|
xlog_set_file("/tmp/gg_web.log"); |
|
16 |
|
|
|
17 |
|
$sql_debug = $gg_db_debug; |
14 |
18 |
|
|
15 |
19 |
$op = 0; |
$op = 0; |
16 |
20 |
if (isset($_REQUEST['op'])) |
if (isset($_REQUEST['op'])) |
17 |
21 |
$op = intval($_REQUEST['op']); |
$op = intval($_REQUEST['op']); |
|
22 |
|
$doit = @intval($_REQUEST['doit']); |
|
23 |
|
$sid = @$_COOKIE['sid']; |
|
24 |
|
if (empty($sid)) |
|
25 |
|
$sid = @$_REQUEST['sid']; |
|
26 |
|
|
|
27 |
|
xlog("Start! op=$op, doit=$doit, sid=$sid..."); |
18 |
28 |
|
|
19 |
29 |
|
|
20 |
30 |
$head = ""; |
$head = ""; |
|
... |
... |
$head .= " <style type=\"text/css\">" . $css . "</style>\n"; |
29 |
39 |
$head .= "</head>\n"; |
$head .= "</head>\n"; |
30 |
40 |
$head .= "<body>\n"; |
$head .= "<body>\n"; |
31 |
41 |
|
|
32 |
|
$head .= "<h1>GG</h1>\n"; |
|
33 |
|
$head .= "<hr />\n"; |
|
34 |
42 |
|
|
|
43 |
|
// database connection |
|
44 |
|
$db = sql_open($gg_db); |
|
45 |
|
if ($db === FALSE) |
|
46 |
|
die("Cannot open database!"); |
|
47 |
|
|
|
48 |
|
// deal with login |
|
49 |
|
$uid = user_login($db, $sid); |
|
50 |
|
if (($op == 1) && ($doit == 1) && ($uid == 0)) |
|
51 |
|
$op = 0; |
|
52 |
|
|
|
53 |
|
// deal with logout |
|
54 |
|
if ($op == 9) { |
|
55 |
|
sess_destroy($db, $sid); |
|
56 |
|
$uid = ""; |
|
57 |
|
} |
35 |
58 |
|
|
36 |
59 |
// menu |
// menu |
37 |
60 |
$url = $_SERVER['PHP_SELF'] . "?a=1"; |
$url = $_SERVER['PHP_SELF'] . "?a=1"; |
38 |
61 |
$menu = ""; |
$menu = ""; |
|
62 |
|
$ui = user_info($db, $uid); |
|
63 |
|
if ($ui === FALSE) |
|
64 |
|
$u = "Not logged in"; |
|
65 |
|
else |
|
66 |
|
$u = $ui['user']; |
|
67 |
|
$menu .= "[$u]<br />\n"; |
39 |
68 |
$menu .= "[<a href=\"$url&op=1\">Login</a>]"; |
$menu .= "[<a href=\"$url&op=1\">Login</a>]"; |
40 |
69 |
$menu .= " [<a href=\"$url&op=2\">Repositories</a>]"; |
$menu .= " [<a href=\"$url&op=2\">Repositories</a>]"; |
41 |
70 |
$menu .= " [<a href=\"$url&op=3\">Admin</a>]"; |
$menu .= " [<a href=\"$url&op=3\">Admin</a>]"; |
42 |
|
$menu .= "<br />\n"; |
|
|
71 |
|
$menu .= " [<a href=\"$url&op=9\">Logout</a>]"; |
43 |
72 |
|
|
44 |
73 |
|
|
45 |
74 |
$body = ""; |
$body = ""; |
46 |
75 |
switch ($op) { |
switch ($op) { |
47 |
76 |
case 1: |
case 1: |
48 |
77 |
include($INC . "/login/login.php"); |
include($INC . "/login/login.php"); |
|
78 |
|
$body .= $_login; |
49 |
79 |
break; |
break; |
50 |
80 |
|
|
51 |
81 |
case 2: |
case 2: |
52 |
82 |
include($INC . "/repo/repo.php"); |
include($INC . "/repo/repo.php"); |
|
83 |
|
$body .= $_repo; |
53 |
84 |
break; |
break; |
54 |
85 |
|
|
55 |
86 |
case 3: |
case 3: |
56 |
87 |
include($INC . "/admin/admin.php"); |
include($INC . "/admin/admin.php"); |
|
88 |
|
$body .= $_admin; |
57 |
89 |
break; |
break; |
58 |
90 |
} |
} |
59 |
91 |
|
|
|
... |
... |
$body .= "</body>"; |
61 |
93 |
$body .= "</html>\n"; |
$body .= "</html>\n"; |
62 |
94 |
|
|
63 |
95 |
echo $head . $menu . "<br />\n" . $body; |
echo $head . $menu . "<br />\n" . $body; |
|
96 |
|
|
|
97 |
|
xlog("Done!"); |
64 |
98 |
?> |
?> |