Repository navigation
Expand file tree
/
Copy pathLicenseInfoGenerate.php
More file actions
155 lines (135 loc) · 3.39 KB
/
Copy pathLicenseInfoGenerate.php
File metadata and controls
155 lines (135 loc) · 3.39 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
session_start();
require_once('config.php');
include_once('CheckSignin.php');
require_once('DirFileFun.php');
require_once('JSON.php');
$result = $mdb2->query(
'SELECT * FROM LicenceInfo WHERE '
." ID = "
.$mdb2->quote($_GET['ID'],"integer")
);
if (PEAR::isError($result)) {
die("{'Error':'".$result->getMessage()."'}");
}
$row = $result->fetchRow();
$product = $row[strtolower('Product')];
if(in_array($product,$_SESSION['Products'],true))
{
}
else
{
if($_SESSION['Right'] > 2)
{
}
else if($_SESSION['UserID'] == $row[strtolower('User1')])
{
}
else
{
echo "您没有下载权限";
return;
}
}
if($row[strtolower('Status')]<3)
{
header("Location:".getenv("HTTP_REFERER"));
return;
}
$content2 = strval($row[strtolower('Content2')]);
$path = "temp";
if(!file_exists($path))
{
mkdir($path);
}
$result = $mdb2->query(
'SELECT * FROM UserInfo '
.' WHERE UserID = '
.$mdb2->quote($_SESSION['UserID'],"text")
);
if (PEAR::isError($result)) {
die("{'Error':'".$result->getMessage()."'}");
}
$row2 = $result->fetchRow();
if(!empty($row2[strtolower("SessionID")]))
{
if(session_id() != $row2[strtolower("SessionID")])
{
$path3 = $path."/".$row2[strtolower("SessionID")];
my_del_dir($path3);
}
}
$result = $mdb2->query(
'UPDATE UserInfo SET SessionID = '
.$mdb2->quote(session_id(),"text")
.' WHERE UserID = '
.$mdb2->quote($_SESSION['UserID'],"text")
);
if (PEAR::isError($result)) {
die("{'Error':'".$result->getMessage()."'}");
}
$path = $path."/".session_id();
if(!file_exists($path))
{
mkdir($path);
}
$Product = $row[strtolower("Product")];
$path1 = "$path/$Product.License";
$path2 = "$path/$Product.Signature";
?><!DOCTYPE HTML><html>
<head>
<meta charset="UTF-8">
<title>授权生成</title>
</head>
<body>
<?php
if(write_ini_file(json_decode($content2,true), $path1, true))
{
$LicensePath = $path1;
echo "生成授权文件成功<br/>";
$cmd = "cscript.exe $VbsPath \"$LicensePath\"";
$ret = exec($cmd);
//echo $ret;
if("OK" == $ret)
{
echo "编码转换成功<br/>";
}
else
{
echo "编码转换失败<br/>";
return;
}
echo "<a href=$path1>下载License文件,请鼠标右键->链接另存为</a><br/>";
$PrivateKeyPath = "$PrivateKeyDir\\$Product\\$Product.PrivateKey";
$cmd = "$ExePath --License \"$LicensePath\" --PrivateKey \"$PrivateKeyPath\" ";
$ret = exec($cmd);
// 判断是否执行成功
if("OK" == $ret)
{
echo "生成签名文件成功<br/>";
echo "<a href=$path2>下载Signature文件,请鼠标右键->链接另存为</a><br/>";
// 更新下载状态
$result = $mdb2->query(
'UPDATE LicenceInfo SET Status = 4'
.' WHERE ID = '
.$mdb2->quote($_GET['ID'],"integer")
);
if (PEAR::isError($result)) {
die("{'Error':'".$result->getMessage()."'}");
}
}
else
{
echo "生成签名文件失败<br/>";
}
}
else
{
echo "生成License失败<br/>";
}
?>
<p>请将License文件和Signature文件放到与dll同目录下</p>
<p>如果你拿到的授权文件为Xxx.License和Xxx.Signature,但dll名为Xxx_x86.dll,请将两个授权名改为Xxx_x86.License和Xxx_x86.Signature。
因为有可能授权分发者对x86与x64使用相同的授权</p>
</body>
</html>