Skip to content

Commit 3ff2343

Browse files
committed
更新授权网站细节
1 parent 0332659 commit 3ff2343

25 files changed

Lines changed: 283 additions & 91 deletions

common/License/License.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ int CLicense::LoadIni()
245245
m_ExpireDate = iniGetInt(APP_NAME_LICENSE, KEY_NAME_EXPIRE_DATE, -1);
246246
m_Trial = iniGetInt(APP_NAME_LICENSE, KEY_NAME_TRIAL, 5);
247247

248-
iniGetString(APP_NAME_USER, KEY_NAME_ACCOUNT, m_Account, sizeof(m_Account), "A");
249-
iniGetString(APP_NAME_USER, KEY_NAME_USERNAME, m_UserName, sizeof(m_UserName), "B");
250-
iniGetString(APP_NAME_LICENSE, KEY_NAME_MAC, m_MAC, sizeof(m_MAC), "C");
248+
iniGetString(APP_NAME_USER, KEY_NAME_ACCOUNT, m_Account, sizeof(m_Account), "");
249+
iniGetString(APP_NAME_USER, KEY_NAME_USERNAME, m_UserName, sizeof(m_UserName), "");
250+
iniGetString(APP_NAME_LICENSE, KEY_NAME_MAC, m_MAC, sizeof(m_MAC), "");
251251

252252
iniFileFree();
253253

@@ -308,7 +308,7 @@ void CLicense::CreateDefault()
308308
m_nCurrentTrial = 0;
309309

310310
strncpy(m_Account, ".*", sizeof(m_Account));
311-
strncpy(m_UserName, ".*", sizeof(m_UserName));
311+
strncpy(m_UserName, "", sizeof(m_UserName));
312312
strncpy(m_MAC, ".*", sizeof(m_MAC));
313313
}
314314

@@ -359,6 +359,10 @@ int CLicense::GetErrorCodeForMachineID()
359359

360360
do
361361
{
362+
if (strlen(m_MAC) <= 0)
363+
{
364+
break;
365+
}
362366
// 检查机器码
363367
regex pattern(m_MAC);
364368
if (!regex_search(m_RealMAC, pattern))
@@ -408,6 +412,10 @@ int CLicense::GetErrorCodeByAccount(const char* account)
408412

409413
do
410414
{
415+
if (strlen(m_Account) <= 0)
416+
{
417+
break;
418+
}
411419
regex pattern(m_Account);
412420
if (!regex_search(account, pattern))
413421
{
@@ -429,13 +437,6 @@ int CLicense::GetErrorCodeByNameThenAccount(const char* name, const char* accoun
429437
do
430438
{
431439
// 汉字使用正则太复杂,还是改用查找
432-
//regex pattern(m_UserName);
433-
//if (!regex_search(name, pattern))
434-
//{
435-
// m_ErrorCode = -9;
436-
// sprintf(m_ErrorInfo, ERROR_CODE_9, name);
437-
// break;
438-
//}
439440
if (strlen(m_UserName) <= 0)
440441
{
441442
break;

common/www/ConvertCode.vbs

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
'/*===========================================================
2+
' * Intro 把要转换的多个文件/文件夹拖到该文件上即可
3+
' * FileName ConvertCode.vbs
4+
' * Author Florian
5+
' * Version v1.0
6+
' * WEB http://www.cnblogs.com/fanzhidongyzby
7+
8+
' * LastModify 2014-06-11 00:39:58
9+
' *==========================================================*/
10+
11+
'-------------------------------------------------
12+
'设置编码:默认 utf-8 --> gb2312
13+
'-------------------------------------------------
14+
15+
SrcCode="utf-8"
16+
DestCode="gb2312"
17+
18+
'-------------------------------------------------
19+
'解析参数
20+
'-------------------------------------------------
21+
' 由于使用了WSH.Echo直接执行会弹框,所以要通过cscript.exe来执行
22+
23+
Set fs = CreateObject("scripting.filesystemobject")
24+
Set objArgs = WScript.Arguments
25+
If objArgs.Count>0 Then
26+
For I = 0 To objArgs.Count - 1
27+
FileUrl = objArgs(I)
28+
Call ConvertDir(FileUrl)
29+
Next
30+
Else
31+
'MsgBox "没有文件/文件夹被拖入!"
32+
WSH.Echo "NO"
33+
wscript.quit
34+
End If
35+
'MsgBox "转换成功!"
36+
WSH.Echo "OK"
37+
38+
'-------------------------------------------------
39+
'函数名称:ConvertDir
40+
'作用:将任意目录内的文件进行编码转换
41+
'-------------------------------------------------
42+
43+
Function ConvertDir(DirUrl)
44+
If fs.FileExists(DirUrl) Then
45+
Call ConvertFile(DirUrl)
46+
Else
47+
Call SearchDir(DirUrl)
48+
End If
49+
End Function
50+
51+
52+
'-------------------------------------------------
53+
'函数名称:SearchDir
54+
'作用:递归查找目录内的文件,进行编码转换
55+
'-------------------------------------------------
56+
57+
Function SearchDir(path)
58+
Set folder = fs.getfolder(path)
59+
Set subfolders = folder.subfolders
60+
Set Files = folder.Files
61+
For Each i In Files
62+
Call ConvertFile(i.path)
63+
Next
64+
For Each j In subfolders
65+
Call SearchDir(j.path)
66+
Next
67+
End Function
68+
69+
'-------------------------------------------------
70+
'函数名称:ConvertFile
71+
'作用:将一个文件进行编码转换
72+
'-------------------------------------------------
73+
74+
Function ConvertFile(FileUrl)
75+
Call WriteToFile(FileUrl, ReadFile(FileUrl, SrcCode), DestCode)
76+
End Function
77+
78+
'-------------------------------------------------
79+
'函数名称:ReadFile
80+
'作用:利用AdoDb.Stream对象来读取各种格式的文本文件
81+
'-------------------------------------------------
82+
83+
Function ReadFile(FileUrl, CharSet)
84+
Dim Str
85+
Set stm = CreateObject("Adodb.Stream")
86+
stm.Type = 2
87+
stm.mode = 3
88+
stm.charset = CharSet
89+
stm.Open
90+
stm.loadfromfile FileUrl
91+
Str = stm.readtext
92+
stm.Close
93+
Set stm = Nothing
94+
ReadFile = Str
95+
End Function
96+
97+
'-------------------------------------------------
98+
'函数名称:WriteToFile
99+
'作用:利用AdoDb.Stream对象来写入各种格式的文本文件
100+
'-------------------------------------------------
101+
102+
Function WriteToFile (FileUrl, Str, CharSet)
103+
Set stm = CreateObject("Adodb.Stream")
104+
stm.Type = 2
105+
stm.mode = 3
106+
stm.charset = CharSet
107+
stm.Open
108+
stm.WriteText Str
109+
stm.SaveToFile FileUrl, 2
110+
stm.flush
111+
stm.Close
112+
Set stm = Nothing
113+
End Function

common/www/DirFileFun.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3-
// 由于客户端C读UTF-8麻烦,所以这个地方文件要保存为ASCII,这样写的文件就是ASCII了
3+
// 由于客户端C读UTF-8麻烦,所以这个地方文件要保存为ASCII,这样写的文件就是ASCII了
44
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
55
function write_ini_file($assoc_arr, $path, $has_sections=FALSE) {
66
$content = "";
@@ -44,7 +44,7 @@ function write_ini_file($assoc_arr, $path, $has_sections=FALSE) {
4444
}
4545

4646
/*
47-
自定义的删除函数,可以删除文件和递归删除文件夹
47+
自定义的删除函数,可以删除文件和递归删除文件夹
4848
*/
4949
function my_del_dir($path)
5050
{
@@ -58,11 +58,11 @@ function my_del_dir($path)
5858
my_del_dir($path.'/'.$file);
5959
}
6060
}
61-
@rmdir($path); //这种方法不用判断文件夹是否为空, 因为不管开始时文件夹是否为空,到达这里的时候,都是空的
61+
@rmdir($path); //这种方法不用判断文件夹是否为空, 因为不管开始时文件夹是否为空,到达这里的时候,都是空的
6262
}
6363
else
6464
{
65-
@unlink($path); //这两个地方最好还是要用@屏蔽一下warning错误,看着闹心
65+
@unlink($path); //这两个地方最好还是要用@屏蔽一下warning错误,看着闹心
6666
}
6767
}
6868

common/www/Home.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,25 @@
1212
当前用户:<?php echo @$_SESSION['UserID']; ?> 当前IP: <?php echo $_SERVER['REMOTE_ADDR']; ?> <a href="Logout.php">退出</a> <a href="aboutus.php" target="_blank">关于我们</a>
1313
<hr/>
1414
<h1>用户信息</h1>
15-
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2FUserInfoView.php" target="_blank">查看个人信息</a>
15+
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2FUserInfoView.php" target="_blank">查看/修改个人信息,修改密码</a>
1616
<hr/>
1717
<h1>产品信息</h1>
18-
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2FProductInfoListView.php" target="_blank">查看产品列表</a>
18+
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2FProductInfoListView.php" target="_blank">查看产品列表,下载与本授权系统配套的DLL</a>
1919
<hr/>
2020
<h1>授权信息</h1>
21-
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2FLicenseInfoListView.php" target="_blank">查看授权列表</a>
21+
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2FLicenseInfoListView.php" target="_blank">查看授权列表,添加授权</a>
2222
<?php if(@$_SESSION['Right'] >= 2) {?>
2323
<hr/>
24-
<h1>管理</h1>
24+
<h1>审核管理</h1>
2525
<a href="LicenseInfoListView2.php" target="_blank">审核用户</a>
26-
<hr/>
2726
<?php }?>
2827
<?php if(@$_SESSION['Right'] == 99) {?>
2928
<hr/>
30-
<h1>管理</h1>
29+
<h1>管理员专区</h1>
3130
<a href="LicenseInfoListView99.php" target="_blank">审核用户</a>
3231
<a href="User2ListView.php" target="_blank">查看审核人员列表</a>
3332
<a href="Signup.php" target="_blank">注册用户</a>
3433
<a href="SwitchUserID.php" target="_blank">切换用户ID</a>
35-
<hr/>
3634
<?php }?>
3735
</body>
3836
</html>

common/www/License.exe

2.26 MB
Binary file not shown.

common/www/LicenseInfoAction.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@
1111
$query = 'DELETE FROM LicenceInfo '
1212
.' WHERE ID = '
1313
.$mdb2->quote($_GET['ID'],"integer")
14-
.' AND User1 = '
15-
.$mdb2->quote($_SESSION['UserID'],"text")
16-
;
14+
.' AND Status <4 ';
15+
16+
// 只能删除自己的吗?管理员可以更新所有的
17+
if($_SESSION['Right'] <= 2)
18+
{
19+
$query = $query.' AND User1 = '.$mdb2->quote($_SESSION['UserID'],"text");
20+
}
1721

1822
$result = $mdb2->query($query);
1923

@@ -107,10 +111,14 @@ function stripslashes_deep($value){
107111
.$mdb2->quote($_POST['Remark'],"text")
108112
.' , Status = 1'
109113
.' WHERE ID = '
110-
.$mdb2->quote($_GET['ID'],"integer")
111-
.' AND User1 = '
112-
.$mdb2->quote($_SESSION['UserID'],"text");
114+
.$mdb2->quote($_GET['ID'],"integer");
113115

116+
// 只能更新自己的吗?管理员可以更新所有的
117+
if($_SESSION['Right'] <= 2)
118+
{
119+
$query = $query.' AND User1 = '.$mdb2->quote($_SESSION['UserID'],"text");
120+
}
121+
114122
$result = $mdb2->query($query);
115123
if (PEAR::isError($result)) {
116124
die("{'Error':'".$result->getMessage()."'}");

common/www/LicenseInfoGenerate.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@
101101
{
102102
$LicensePath = $path1;
103103
echo "生成授权文件成功<br/>";
104+
105+
$cmd = "cscript.exe $VbsPath \"$LicensePath\"";
106+
$ret = exec($cmd);
107+
//echo $ret;
108+
if("OK" == $ret)
109+
{
110+
echo "编码转换成功<br/>";
111+
}
112+
else
113+
{
114+
echo "编码转换失败<br/>";
115+
return;
116+
}
117+
104118
echo "<a href=$path1>下载License文件,请鼠标右键->链接另存为</a><br/>";
105119

106120
$PrivateKeyPath = "$PrivateKeyDir\\$Product\\$Product.PrivateKey";
@@ -133,6 +147,8 @@
133147
echo "生成License失败<br/>";
134148
}
135149

150+
151+
136152
?>
137153
<p>请将License文件和Signature文件放到与dll同目录下</p>
138154
</body>

common/www/LicenseInfoListView.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
$result = $mdb2->query(
88
'SELECT * FROM LicenceInfo WHERE User1 = '
9-
.$mdb2->quote($_SESSION['UserID'],"text"));
9+
.$mdb2->quote($_SESSION['UserID'],"text")
10+
." ORDER BY ID DESC"
11+
);
1012
if (PEAR::isError($result)) {
1113
die("{'Error':'".$result->getMessage()."'}");
1214
}

common/www/LicenseInfoListView2.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
{
2828
$query = $query." AND User2 = ".$mdb2->quote($_POST['User2'],"text");
2929
}
30+
$query = $query." ORDER BY ID DESC";
3031

3132
$result = $mdb2->query($query);
3233

common/www/LicenseInfoListView99.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
{
3333
$query = $query." AND User1 = ".$mdb2->quote($_SESSION['UserID'],"text");
3434
}
35+
$query = $query." ORDER BY ID DESC";
3536

3637
// 如果是审核员是可以看到自己能审核的
3738

0 commit comments

Comments
 (0)