WHMCS产品信息无法修改写入的解决办法

网站从美国搬到香港后,这个问题困扰了我好几天,最后整得没办法了,给WHMCS官方发邮件求助,解决办法很简单,去掉MYSQL的STRICT MODE问题就迎刃而解了。
具体方法:
Open your “my.ini” file within the MySQL installation directory, and look for the text “sql-mode”.
Find:

Code:
# Set the SQL mode to strict
sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”Replace with:

Code:
# Set the SQL mode to strict
sql-mode=”NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”Or, you can run an SQL query within your database management tool, such as phpMyAdmin:

Code:
SET @@global.sql_mode= ”;

关于中文的几个编码GB2312、GBK、GB18030、GB13000

1、 GB2312
GB2312(1980年)一共收录了7445个字符,包括6763个汉字和682个其它符号。汉字区的内码范围高字节从B0-F7,低字节从A1-FE,占用的码位是72*94=6768。其中有5个空位是D7FA-D7FE。

在windows中的代码页是CP936

2、 GBK
GBK最初是由微软对GB2312的扩展,也就是CP936字码表 (Code Page 936)的扩展(原来的CP936和GB 2312-80一模一样),最初出现于Windows 95简体中文版中,由于Windows产品的流行和在大陆广泛被使用,中华人民共和国国家有关部门将其作为技术规范。注意GBK并非国家正式标准,只是国家技术监督局标准化司、电子工业部科技与质量监督司发布的“技术规范指导性文件”。虽然 GBK收录了所有Unicode 1.1及GB 13000.1-93之中的汉字,但是编码方式与Unicode 1.1及GB 13000.1-93不同。仅仅是GB 2312到GB 13000.1-93之间的过渡方案。GBK收录了21886个符号,它分为汉字区和图形符号区。汉字区包括21003个字符。

GBK作为对GB2312的扩展,在现在的windows系统中仍然使用代码页CP936表示,但是同样的936的代码页跟一开始的936的代码页只支持GB2312编码不同,现在的936代码页支持GBK的编码,GBK同时也向下兼容GB2312编码。

3、 GB18030
2000年的GB18030取代了GBK1.0的正式国家标准。该标准收录了27484个汉字,同时还收录了藏文、蒙文、维吾尔文等主要的少数民族文字。现在的PC平台必须支持GB18030,对嵌入式产品暂不作要求。所以手机、MP3一般只支持GB2312。

GB18030在windows中的代码页是CP54936。

4、 GB13000
GB13000等同于国际标准的《通用多八位编码字符集 (UCS)》 ISO10646.1,就是等同于Unicode的标准,代码页等等的都使用UTF的一套标准。

从ASCII、GB2312、GBK到GB18030,这些编码方法是向下兼容的,即同一个字符在这些方案中总是有相同的编码,后面的标准支持更多的字符。在这些编码中,英文和中文可以统一地处理。区分中文编码的方法是高字节的最高位不为0。按照程序员的称呼,GB2312、GBK到GB18030都属于双字节字符集 (DBCS)。

解密WHMCS IONCUBE LICENSE认证代码


“;
public function remotecheck(){
$localkeydays=10;
$whmcsurl=”http://74.54.136.212/~whmcscom/members/”;
$checkdate=date(“Ymd”);
$_SERVER$_SERVER;
$allowcheckfaildays=5;
$localkeyvalid=600;
while ($localkey) {
while ($localkeyvalid) {
$localexpiry=date(“Y”)()()date(“Ymd”,0,0,0,”m”)mktimedate;
$localmax=date(“Y”)()()date(“Ymd”,0,0,0,”m”)mktimedate;
$postfields$licensekey;
$postfields$_SERVER;
$postfields$usersip;
$postfields;
$ch=curl_init();
curl_setopt($ch);
curl_setopt($ch,1);
curl_setopt($ch,$postfields);
curl_setopt($ch,30);
curl_setopt($ch,1);
$data=curl_exec($ch);
curl_close($ch)curl_errno($ch)curl_error($ch);
$localexpiry=date(“Y”)()()date(“Ymd”,0,0,0,”m”)mktimedate;
$results=$localkeyresults;
$results;
preg_match_all(“/<(.*?)>([^<]+)<\/\1>/i”,$data,$matches);
$k$matches;
$results$matches$k$v;
$pos1=strpos($data,”“);
$licresponse=substr($data,0,$pos1);
$results$checkdate$results$results;
$data_encoded=serialize($results);
$data_encoded=base64_encode($data_encoded);
$data_encoded=strrev($data_encoded);
wordwrap($data_encoded,80,”\n”);
update_query(“tblconfiguration”);
$results;
$tempresults=$results(“|”)explode;
$tempresults;
$values=explode(“=”,$tempresult);
$configoptions$values$values;
$results$configoptions;
$tempresults=$results(“|”)()html_entity_decodeexplode;
$tempresults;
$tempresults2=explode(“;”,$tempresult);
$tempresults3=explode(“=”,$tempresult);
$temparr$tempresults3$tempresults3;
$addons$temparr;
$results$addons;
$results;
public function forceremotecheck(){
public function decodelocal(){
$_SERVER$_SERVER;
$localkey=str_replace(“\n”,”32945168″,$localkey);
$localdata=substr();
$md5hash=substr();
$localdata=strrev($localdata);
$md5hash=substr($localdata,32);
$localdata=substr($localdata,32);
$localdata=base64_decode($localdata);
$localkeyresults=unserialize($localdata);
$localkeyresults;
$results=$localkeyresults;
$validdomains=$results(“,”)explode;
$results;
echo “Local Key Validation Failed at Status Check
“;
in_array;
$results;
echo “Local Key Validation Failed at Domain Check
“;
$validips=$results(“,”)explode$results;
$validips$usersip;
$results;
echo “Local Key Validation Failed at IP Check
“;
$results;
$results;
echo “Local Key Validation Failed at Directory Check
“;
echo “Local Key MD5 Hash 2 Invalid
“;
echo “Local Key MD5 Hash Invalid
“;
while ($localkeyvalid) {
$tempresults=$results(“|”)explode;
$tempresults;
$values=explode(“=”,$tempresult);
$configoptions$values$values;
$results$configoptions;
$tempresults=$results(“|”)()html_entity_decodeexplode;
$tempresults;
$tempresults2=explode(“;”,$tempresult);
$tempresults2;
$tempresults3=explode(“=”,$tempresult);
$temparr$tempresults3$tempresults3;
$addons$temparr;
$results$addons;
$results$results;
$results;
Return ($localkeyvalid);
public function revokelocal(){
update_query(“tblconfiguration”);
public function getstatus(){
public function getbrandingremoval(){
$addon
$addon
?>

Discuz X1至今最完美的IIS7.5伪静态规则

IIS7本来是可以导入APACHE的伪静态规则的,但是后台产生的规则我用IIS导入没法正常使用,于是去网上找了一份规则,用是可以用了,但是还是存在两个问题:

1.首页门户文章没法正常显示,都是404错误

2.翻页有问题,比如一个帖子有3页,你要点两次第二页,他才会翻到第二页。

第一个问题昨天晚上我就发现了,用这句 替换掉相应位置的那一句就可以解决。
第二个问题是昨晚冕阿姨说了我才发现,当时搞鼓了一下,没结果,今天早上起来对比DZ的规则看了一下,发现了问题的所在。用这一句
替换对应的那一句就可以解决。

完整的规则如下:

<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
   
<system.webServer>
        <rewrite>
          
 <rules>
                <rule name=”Imported Rule 1″>
       
            <match url=”^topic-(.+)\.html$” ignoreCase=”false” />
    
               <conditions logicalGrouping=”MatchAll”>
                
       <add input=”{QUERY_STRING}” pattern=”^(.*)$” ignoreCase=”false”
/>
                    </conditions>
                
   <action type=”Rewrite”
url=”portal.php?mod=topic&amp;topic={R:1}&amp;{C:1}”
appendQueryString=”false” />
                </rule>
          
     <rule name=”Imported Rule 2″>
                    <match
url=”^article-([0-9]+)-([0-9]+)\.html$” ignoreCase=”false” />
          
         <conditions logicalGrouping=”MatchAll”>
                      
 <add input=”{QUERY_STRING}” pattern=”^(.*)$” ignoreCase=”false” />
 
                  </conditions>
                    <action
type=”Rewrite”
url=”portal.php?mod=view&amp;aid={R:1}&amp;page={R:2}&amp;{C:1}”
appendQueryString=”false” />
                </rule>
          
     <rule name=”Imported Rule 3″>
                    <match
url=”^forum-(\w+)-([0-9]+)\.html$” ignoreCase=”false” />
                
   <conditions logicalGrouping=”MatchAll”>
                      
 <add input=”{QUERY_STRING}” pattern=”^(.*)$” ignoreCase=”false” />
 
                  </conditions>
                    <action
type=”Rewrite”
url=”forum.php?mod=forumdisplay&amp;fid={R:1}&amp;page={R:2}&amp;{C:1}”
appendQueryString=”false” />
                </rule>
          
     <rule name=”thread”>
                    <match
url=”^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$” />
                
   <action type=”Rewrite”
url=”forum.php?mod=viewthread&amp;tid={R:1}&amp;extra=page={R:3}&amp;page={R:2}”
/>
                </rule>
                <rule
name=”Imported Rule 5″>
                    <match
url=”^group-([0-9]+)-([0-9]+)\.html$” ignoreCase=”false” />
             
      <conditions logicalGrouping=”MatchAll”>
                      
 <add input=”{QUERY_STRING}” pattern=”^(.*)$” ignoreCase=”false” />
 
                  </conditions>
                    <action
type=”Rewrite”
url=”forum.php?mod=group&amp;fid={R:1}&amp;page={R:2}&amp;{C:1}”
appendQueryString=”false” />
                </rule>
          
     <rule name=”Imported Rule 6″>
                    <match
url=”^space-(username|uid)-(.+)\.html$” ignoreCase=”false” />
          
         <conditions logicalGrouping=”MatchAll”>
                      
 <add input=”{QUERY_STRING}” pattern=”^(.*)$” ignoreCase=”false” />
 
                  </conditions>
                    <action
type=”Rewrite” url=”home.php?mod=space&amp;{R:1}={R:2}&amp;{C:1}”
appendQueryString=”false” />
                </rule>
          
     <rule name=”Imported Rule 7″>
                    <match
url=”^([a-z]+)-(.+)\.html$” ignoreCase=”false” />
                
   <conditions logicalGrouping=”MatchAll”>
                      
 <add input=”{QUERY_STRING}” pattern=”^(.*)$” ignoreCase=”false” />
 
                  </conditions>
                    <action
type=”Rewrite” url=”{R:1}.php?rewrite={R:2}&amp;{C:1}”
appendQueryString=”false” />
                </rule>
          
 </rules>
        </rewrite>
   
</system.webServer>
</configuration>

Hyper-v can’t open created VM

Windows 2008 Hyper-V worked fine.  I was able to create and run virtual machines.  I decided to upgrade to Windows 2008 R2 RTM for lab testing.  Available articles said you can leave Hyper-V installed in Windows 2008 even though there is a warning during installation of R2.  I exported a VM for importing back into W2008 R2.  Installed W2008R2.  The imported VM will not start.  Created new VM’s and they will not start.  Event log shows two errors occurring whenever an attempt is made to start a VM.  Event log follows. 

I have spent a couple of days trying to figure out what happened.  Nothing changed in the BIOS to disable VM’s and the upgrade went without error.  I sure could use some words of wisdom from someone who might know what the problem is.  Research indicates the problem is security related, but I can’t find specific information about security settings for Hyper-V in W2008 R2.  The Hyper-V folders holding files have full privileges for System and Administrator and the Virtual Machines group is assigned successfully when a VM is created.  I am working under the administrator account.  The server is a domain controller.  I also removed Hyper-V in W2008 R2 and reinstalled it, but that had no effect.

Log Name:      Microsoft-Windows-Hyper-V-Worker-Admin
Source:        Microsoft-Windows-Hyper-V-Worker
Date:          9/12/2009 2:13:15 PM
Event ID:      3040
Task Category: None
Level:         Error
Keywords:     
User:          NETWORK SERVICE
Computer:      PNS-SERVER.pronetserv.lcl
Description:
‘Symantec AV Manager’ could not initialize. (Virtual machine ID 9C99D5D2-34A1-45A5-814D-30F9145D3D6D)

Log Name:      Microsoft-Windows-Hyper-V-Worker-Admin
Source:        Microsoft-Windows-Hyper-V-Worker
Date:          9/12/2009 2:13:15 PM
Event ID:      3080
Task Category: None
Level:         Error
Keywords:     
User:          NETWORK SERVICE
Computer:      PNS-SERVER.pronetserv.lcl
Description:
‘Symantec AV Manager’ could not create or access saved state file F:\Hyper-V\Symantec AV Manager\Virtual Machines\9C99D5D2-34A1-45A5-814D-30F9145D3D6D\9C99D5D2-34A1-45A5-814D-30F9145D3D6D.vsv. (Virtual machine ID 9C99D5D2-34A1-45A5-814D-30F9145D3D6D)

    Solution:
     Hello,

    I had the same problem after Win2k8 RTM to R2 upgrade.

    In my case it was NTFS permissions problem (which actually wasn’t a problem for Hyper-V in Win2k8 RTM).

    Previously, I have changed default D: drive permissions to only allow ‘Full Access’ for Administrators and SYSTEM group to root of the D: drive.

    I solved my problem by adding ‘Authenticated Users’ group to the root of D: drive and allowed ‘List’ permission with a scope ‘This folder only’ (You should do this via Advanced permission management).
    Just in case: do NOT check ‘replace all child object permissions’, otherwise you will need to recreate all your VMs configurations from scratch.

Hyper-V File Storage and Permissions

Introduction

Hyper-V takes a different approach to virtual machine file storage than Virtual Server 2005 R2. The default locations are different, the storage approach is different, and the configuration files are different. What does this mean to the seasoned Virtual Server 2005 R2 administrator? It means that you will need to start with a fresh slate and learn how it all works. So let us dive in.

Service SIDS

To allow all of the file storage and access changes, Hyper-V leverages a new type of SID added to Windows Server 2008 called a Service SID to control access to virtual machine files. A virtual machine gets a GUID when created and a corresponding unique Service SID is created for the virtual machine using a combination of the Service SID “”NT VIRTUAL MACHINE” and the VMGUID.

Example: “NT VIRTUAL MACHINE\ C64FB013-6D92-4B9B-B106-690182B00FFA ”

If you look at the files of a virtual machine you will see the permissions show an entry for the VMGUID with security permissions assigned, this is the Service SID that is assigned to the virtual machine. Let’s refer to this service SID as the VMSID.

You can use iCACLS to set and view the permissions on files:

icacls “C:\Programdata\Microsoft\Windows\Hyper-V\Virtual Machines\ C64FB013-6D92-4B9B-B106-690182B00FFA.xml” /grant “NT VIRTUAL MACHINE\ C64FB013-6D92-4B9B-B106-690182B00FFA”:(F) /L

The figure below shows an example of a VMSID assigned permissions to a virtual hard disk.


Figure 1

If the VMSID is ever removed from the security permissions of a file that makes up the virtual machine, taking the virtual hard disk as an example, the virtual machine cannot power on.

A special group called Virtual Machines is also created to contain all the virtual machines Service SIDS registered on the Hyper-V server.

Default File Locations

Hyper-V consists of the following default file configuration locations for storing virtual machine files:

  • Default virtual hard disk storage location – C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks
  • Default virtual machine storage location – C:\ProgramData\Microsoft\Windows\Hyper-V

These can be modified using the Hyper-V Settings option in the Hyper-V Manager MMC shown below:


Figure 2

When Hyper-V is installed, these folders are created. The Virtual Hard Disks folder is initially empty but the default virtual machine storage location folder contains two subfolders:

  1. Virtual Machines – Stores the virtual machine configuration files
  2. Snapshots – Stores the snapshot files taken of a virtual machine

It is your choice to use the default locations or to specify a different path to store the virtual machine files when creating a virtual machine using the wizard. Your selection results in different actions being taken from a file security perspective.

Let us discuss the two scenarios of the default locations and specifying a different storage location.

Scenario 1: Using the default locations

If you use the default locations during the creation of a virtual machine using the New Virtual Machine wizard, the following happens.

  1. A GUID is generated and assigned to the virtual machine and a VMSID is generated for permissions use. The term VMGUID will be used to refer to the virtual machines GUID in this article.
  2. The virtual hard disk (VHD) for the virtual machine is placed in the C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks directory using the filename you specified.
  3. The VHD security permissions are modified to add the VMSID with Read and Write access to the VHD.
  4. A XML configuration file a filename consisting of the VMGUID with an XML extension is created in the C:\ProgramData\Microsoft\Windows\Hyper-V folder.
  5. A subfolder is created in the C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines directory consisting of the VMGUID as the folder name and the following permissions are assigned. This folder is used to store the saved state files (VSV and BIN).

    a.       Virtual Machines group is assigned the following special permissions that inherit to the folder and sub folders

    i.      List folder / read data
    ii.     Read attributes
    iii.    Read extended attributes
    iv.    Create files /  write data
    v.     Create folders / append data
    vi.    Read

    b.      The VMSID is assigned and given Full control special permissions for the folder only.


Figure 3

If you save the state of the virtual machine, the save state files are stored in the C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines\[VMGUID] folder.

This approach has the following advantages:

  1. You do not have to think about where you store files – the defaults are used automatically.
  2. Everything is stored in two directories.

This approach also has the following disadvantages:

  1. The virtual machine VHD, configuration files, save state files and snapshots are all stored on the system drive. This will cause the drive to run out of disk space quickly.
  2. Different virtual machines files are stored together making it harder to track the associations and troubleshoot permissions.

Scenario 2: Using a different storage location

When you use the New Virtual Machine wizard, you have the option of specifying a different location to store the virtual machine files. You enable this option by enabling the checkbox called Store the virtual machine in a different location and then provide the alternate path in the Location text box.


Figure 4

When you use an alternate storage location for your virtual machine files, permissions and files are created differently.

  1. The VMGUID is still generated and assigned to the virtual machine and a VMSID is generated for permissions use.
  2. Instead of folders being created in the default locations, a subfolder is created in the alternate location specified using the name of the virtual machine as the folder name.

    a.       So if you had specified a virtual machine name of VMTEST and an alternate location of D:\VMs, a new folder called D:\VMs\VMTEST would be created.

  3. The VMTEST folder is assigned the following special permissions

    a.       Virtual Machines group is assigned the following special permissions that inherit to the folder and sub folders.

    i.      List folder / read data
    ii.     Read attributes
    iii.    Read extended attributes
    iv.     Create files /  write data
    v.      Create folders / append data
    vi.     Read

  4. Inside the VMTEST folder, the two subfolders Virtual Machines and Snapshots are created and assigned the following permissions: The VMSID is assigned and given Full control special permissions for the folder only
  5. The VHD created by the New Virtual machine Wizard is placed in the D:\VMs\VMTEST folder and assigned the following permissions: The VMSID is given Read and Write permissions
  6. The virtual machine XML configuration file consisting of the VMGUID with an XML extension is created in the D:\VMs\VMTEST\Virtual Machines folder and assigned the following permissions: The VMSID is assigned Full Control permissions
  7. A subfolder with the name VMGUID is created in the D:\VMs\VMTEST\Virtual Machines folder and assigned the following permissions:

    a.       The subfolder inherits the Virtual Machines group permissions

    i.      List folder / read data
    ii.     Read attributes
    iii.    Read extended attributes
    iv.    Create files /  write data
    v.     Create folders / append data
    vi.    Read

    b.      The VMSID is assigned Full control special permissions for the folder only

Hyper-V looks for the configuration file in the default folder C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines, but since the configuration file is stored in the D:\VMs\VMTest\Virtual Machines folder Hyper-V needs a way to reference the configuration file from the default location. This is where symbolic links are employed. If the virtual machine is not stored in the default location, Hyper-V will create a symbolic link to the actual location of the xml configuration file.

Symbolic links are created with the MKLINK command:

mklink “C:\Programdata\Microsoft\Windows\Hyper-V\Virtual Machines\C64FB013-6D92-4B9B-B106-690182B00FFA.xml” “D:\VMTEST\Virtual Machines\C64FB013-6D92-4B9B-B106-690182B00FFA.xml”

For example, if the configuration is stored in D:\VMs\VMTest\Virtual Machines, Hyper-V will create a symbolic link in the C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines folder using the VMGUID as the name of the link. The link will have a pointer to the actual storage location.

If you create a snapshot, then Hyper-V will also create a symbolic link in the C:\ProgramData\Microsoft\Windows\Hyper-V\Snapshots folder to the snapshot version of the configuration xml file in the D:\VMs\VMTest\Snapshots folder.

This approach has the following advantages:

  1. All files for a virtual machine are stored in one folder hierarchy that is rooted with the name of the virtual machine
  2. You can place the virtual machine files on any available drive
  3. Automatic organization of the folders.

This approach has the following disadvantages:

  1. The additional symbolic links that need to be created and managed
  2. You must remember to use the different storage path when you create a new virtual machine

Conclusion

Hyper-V virtual machine file storage and permissions provides two approaches to managing the virtual machine files. Using the default folders makes it easy to create virtual machines, but places the Hyper-V server at constant risk of running out of disk space on the system volume. Using the alternate storage location eliminates the system volume disk issue and provides better organization of the virtual machines storage, but increases the complexity of the storage approach. I personally would always recommend the use of the different storage path

FTP主动模式和被动模式

FTP两种工作模式:主动模式(Active FTP)和被动模式(Passive FTP)

在主动模式下,FTP客户端随机开启一个大于1024的端口N向服务器的21号端口发起连接,然后开放N+1号端口进行监听,并向服务器发出PORT N+1命令。服务器接收到命令后,会用其本地的FTP数据端口(通常是20)来连接客户端指定的端口N+1,进行数据传输。
在被动模式下,FTP库户端随机开启一个大于1024的端口N向服务器的21号端口发起连接,同时会开启N+1号端口。然后向服务器发送PASV命令,通知服务器自己处于被动模式。服务器收到命令后,会开放一个大于1024的端口P进行监听,然后用PORT P命令通知客户端,自己的数据端口是P。客户端收到命令后,会通过N+1号端口连接服务器的端口P,然后在两个端口之间进行数据传输。
总的来说,主动模式的FTP是指服务器主动连接客户端的数据端口,被动模式的FTP是指服务器被动地等待客户端连接自己的数据端口。
被动模式的FTP通常用在处于防火墙之后的FTP客户访问外界FTp服务器的情况,因为在这种情况下,防火墙通常配置为不允许外界访问防火墙之后主机,而只允许由防火墙之后的主机发起的连接请求通过。因此,在这种情况下不能使用主动模式的FTP传输,而被动模式的FTP可以良好的工作。