-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathadmin.php
94 lines (86 loc) · 2.84 KB
/
admin.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
<?php
include('dict_functions.php');
include('dict_config.php');
if (isset($_POST['submit']) && isset($_POST['user']) && isset($_POST['pass']) ){
$user = $_POST['user'];
$pass = $_POST['pass'];
$word = $_POST['word'];
$meanings = $_POST['meanings'];
if($user!= '----' || md5($pass)!= '---'){
echo '<h2>Xin lỗi, tính năng này chưa hoàn thành!</h2>';
echo 'Trở về <a href="/dict/">trang từ điển</a>.';
exit;
}
}
$action = $_GET['action'];
$dict = $_GET['dict'];
$id = isset($_GET['id'])?$_GET['id']:-1;
$title = array('add'=>'Thêm', 'edit'=>'Sửa');
$ok = preg_match("/^(edit|add)$/",$action) && preg_match("/^[vienfrderu]{2}_[vienfrderu]{2}$/",$dict);
$_vi = preg_match("/vi_\w{2}/",$dict)? 'f_vi' : 'f_novi';
$word = '';
$meanings = '';
if($ok && $id>0){
$db = mysql_connect($dbhost,$dbuser,$dbpass) or die('Could not connect: ' . mysql_error());
mysql_select_db($dbname) or die('Could not select database');
$query = "SET NAMES 'UTF8'";
mysql_query($query,$db);
$query = 'SELECT * FROM '.$dict." WHERE d_id='$id'";
//echo $query;
$res = mysql_query($query,$db);
if($res){
$row = mysql_fetch_assoc($res);
$word = $row['d_word'];
$meanings = $row['d_meanings'];
} else {
echo "ERROR: ";
exit;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html dir="ltr">
<head>
<title>VnOSS - Webdict</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="dict.css" />
<script type="text/JavaScript" src="xvnkb.js"></script>
<script type="text/JavaScript" src="dict.js"></script>
</head>
<body>
<center>
<h1>VnOSS webdict :: <?php echo $title[$action];?></h1>
<H2><?php echo $DICT[$dict];?></h2>
<form name="fdict" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<?php include('chim-radio.html');?>
<fieldset class="fs">
<legend>Từ</legend>
<input id="<?php echo $_vi;?>" type="text" name="word" value="<?php echo $word;?>"
class="inputWord" maxlength="64">
</fieldset>
<br />
<fieldset class="fs">
<legend>Nghĩa</legend>
<textarea class="textMeanings" name="meanings"><?php echo $meanings;?></textarea>
</fieldset>
<br />
<fieldset class="fs">
<legend>Xác thực</legend>
Tên <input type="text" name="user" value="" class="inputUser" maxlength="36">
Mật mã <input id="f_pass" type="password" name="pass" value="" class="inputPass" maxlength="36">
</fieldset>
<br />
<input type="hidden" name="dict" value="<?php echo $dict;?>">
<input type="submit" name="submit" value="<?php echo $title[$action];?>">
</form>
<hr noshade size=1 width="50%">
<a href="/dict/">Trang từ điển</a>
</center>
<script type="text/javascript">
DISPLAY_ID = [ "chim_off", "chim_vni", "chim_telex", "chim_viqr" ];
NOOP = ["f_pass","f_novi"];
SPELLCHECK_ID="";
VKSetMethod(0);
</script>
</body>
</html>