[不指定 2010/05/30 14:13 | by 逍遥花主 ]

PS:主要是[]里的名称,在这里备个份

using System;
using System.Collections.Generic;
using System.Text;
using System.Management;
using System.Net.Sockets;
using System.Net;

namespace SystemInfo
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {

                Console.ForegroundColor = ConsoleColor.Red;

                Console.WriteLine("正在检测请稍候");

                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("===================================");
                Console.WriteLine("操作系统信息");
                Console.WriteLine("===================================");
                ManagementObjectSearcher searcher =
                    new ManagementObjectSearcher("root\\CIMV2",
                    "SELECT * FROM Win32_OperatingSystem");

                foreach (ManagementObject queryObj in searcher.Get())
                {
                    Console.WriteLine("-----------------------------------");
                    Console.WriteLine("系统名称: {0}", queryObj["Caption"]);
                    Console.WriteLine("版本: {0}", queryObj["CSDVersion"]);
                    Console.WriteLine("计算机名称: {0}", queryObj["CSName"]);
                    Console.WriteLine("单位: {0}", queryObj["Organization"]);
                    Console.WriteLine("注册用户: {0}", queryObj["RegisteredUser"]);
                    Console.WriteLine("序列号: {0}", queryObj["SerialNumber"]);
                    Console.WriteLine("系统所在分区: {0}", queryObj["SystemDrive"]);
                    Console.WriteLine("系统目录: {0}", queryObj["WindowsDirectory"]);
                    Console.WriteLine("系统System32所在目录: {0}", queryObj["SystemDirectory"]);
                    Console.WriteLine("可用内存: {0}", queryObj["TotalVisibleMemorySize"]);
                    Console.WriteLine("版本号: {0}", queryObj["Version"]);
                    Console.WriteLine("-----------------------------------");

                }

                Console.WriteLine("===================================");
                Console.WriteLine("BIOS信息");
                Console.WriteLine("===================================");
                searcher =
                    new ManagementObjectSearcher("root\\CIMV2",
                    "SELECT * FROM Win32_SystemBIOS");
                foreach (ManagementObject queryObj in searcher.Get())
                {
                    Console.WriteLine("-----------------------------------");
                    Console.WriteLine("汇总信息: {0}", queryObj["PartComponent"]);
                    Console.WriteLine("-----------------------------------");
                }

                Console.WriteLine("===================================");
                Console.WriteLine("计算机系统信息");
                Console.WriteLine("===================================");
                searcher =
                    new ManagementObjectSearcher("root\\CIMV2",
                    "SELECT * FROM Win32_ComputerSystem");

                foreach (ManagementObject queryObj in searcher.Get())
                {
                    Console.WriteLine("-----------------------------------");
                    Console.WriteLine("计算机全称: {0}", queryObj["Name"]);
                    Console.WriteLine("处理器数量: {0}", queryObj["NumberOfProcessors"]);
                    Console.WriteLine("描述: {0}", queryObj["Description"]);
                    Console.WriteLine("域: {0}", queryObj["Domain"]);
                    Console.WriteLine("系统类型: {0}", queryObj["SystemType"]);
                    Console.WriteLine("实际内存: {0}", queryObj["TotalPhysicalMemory"]);
                    Console.WriteLine("用户名: {0}", queryObj["UserName"]);
                    Console.WriteLine("-----------------------------------");
                }

                searcher =
                   new ManagementObjectSearcher("root\\CIMV2",
                   "SELECT * FROM Win32_Processor");
                Console.WriteLine("===================================");
                Console.WriteLine("CPU信息");
                Console.WriteLine("===================================");
                foreach (ManagementObject queryObj in searcher.Get())
                {
                    Console.WriteLine("-----------------------------------");
                    Console.WriteLine("编号: {0}", queryObj["DeviceID"]);
                    Console.WriteLine("CPU序列号: {0}", queryObj["ProcessorId"]);
                    Console.WriteLine("Cpu状态: {0}", queryObj["CpuStatus"]);
                    Console.WriteLine("类别: {0}", queryObj["Caption"]);
                    Console.WriteLine("名称: {0}", queryObj["Name"]);
                    Console.WriteLine("描述: {0}", queryObj["Description"]);
                    Console.WriteLine("寻址: {0}", queryObj["AddressWidth"]);
                    Console.WriteLine("数据带宽: {0}", queryObj["DataWidth"]);
                    Console.WriteLine("时钟频率: {0}", queryObj["CurrentClockSpeed"]);
                    Console.WriteLine("最高时钟频率: {0}", queryObj["MaxClockSpeed"]);
                    Console.WriteLine("版本: {0}", queryObj["Version"]);
                    Console.WriteLine("电压: {0}", queryObj["CurrentVoltage"]);
                    Console.WriteLine("二级缓容量: {0}", queryObj["L2CacheSize"]);
                    Console.WriteLine("二级缓频率: {0}", queryObj["L2CacheSpeed"]);
                    Console.WriteLine("CPU制造商: {0}", queryObj["Manufacturer"]);
                    Console.WriteLine("-----------------------------------");
                }

                searcher =
                   new ManagementObjectSearcher("root\\CIMV2",
                   "SELECT * FROM Win32_LogicalDisk");
                Console.WriteLine();
                Console.WriteLine("===================================");
                Console.WriteLine("硬盘信息");
                Console.WriteLine("===================================");
                foreach (ManagementObject queryObj in searcher.Get())
                {
                    Console.WriteLine("-----------------------------------");

                    Console.WriteLine("卷标: {0}", queryObj["VolumeName"]);
                    Console.WriteLine("序列号: {0}", queryObj["VolumeSerialNumber"]);
                    Console.WriteLine("驱动器号: {0}", queryObj["Name"]);
                    Console.WriteLine("分区大小: {0}", queryObj["Size"]);
                    Console.WriteLine("可用空间: {0}", queryObj["FreeSpace"]);
                    Console.WriteLine("文件系统: {0}", queryObj["FileSystem"]);
                    Console.WriteLine("描述: {0}", queryObj["Description"]);
                    Console.WriteLine("-----------------------------------");

                }

                Console.WriteLine();
                Console.WriteLine("===================================");
                Console.WriteLine("网卡信息");
                Console.WriteLine("===================================");
                searcher =
                    new ManagementObjectSearcher("root\\CIMV2",
                    "SELECT * FROM Win32_NetworkAdapter WHERE MACAddress = '00:0D:61:70:6B:90'");

                foreach (ManagementObject queryObj in searcher.Get())
                {
                    Console.WriteLine("-----------------------------------");
                    Console.WriteLine("名称: {0}", queryObj["Name"]);
                    Console.WriteLine("说明: {0}", queryObj["Caption"]);
                    Console.WriteLine("描述: {0}", queryObj["Description"]);
                    Console.WriteLine("MAC地址: {0}", queryObj["MACAddress"]);
                    Console.WriteLine("GUID: {0}", queryObj["GUID"]);
                    Console.WriteLine("适配器类型: {0}", queryObj["AdapterType"]);
                    Console.WriteLine("-----------------------------------");
                }

                Console.WriteLine();
                Console.WriteLine("===================================");
                Console.WriteLine("网络信息");
                Console.WriteLine("===================================");
                searcher = new ManagementObjectSearcher("root\\CIMV2",
                    "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'");


                // Every record in this collection is a network interface
                foreach (ManagementObject mo in searcher.Get())
                {
                    Console.WriteLine("-----------------------------------");
                    Console.WriteLine("主机名称:{0} ", mo["DNSHostName"]);
                    Console.WriteLine("网卡描述:{0}= ", mo["Description"]);

                    // IPAddresses, probably have more than one value
                    string[] addresses = (string[])mo["IPAddress"];
                    foreach (string ipaddress in addresses)
                    {
                        Console.WriteLine("IP地址:{0} ", ipaddress);
                    }

                    // DefaultIPGateways, probably have more than one value
                    string[] defaultgateways = (string[])mo["DefaultIPGateway"];
                    foreach (string defaultipgateway in defaultgateways)
                    {
                        Console.WriteLine("默认网关 :{0}", defaultipgateway);
                    }
                    Console.WriteLine("-----------------------------------");
                }

                Console.WriteLine();
                Console.WriteLine("检测完毕");
                Console.ReadLine();
            }
            catch (ManagementException e)
            {
               Console.WriteLine("读取数据发生错误,原因: " + e.Message);
            }
        }
    }
}

『技术文摘』 | Tags:| 评论(0) | 引用(0) | 阅读(4342)


[不指定 2010/05/29 09:26 | by 逍遥花主 ]
error_reporting(255);
是列出所以提示
error_reporting(0);
是不显示所有提示
建议使用
error_reporting(7);
只显示严重错误


1 E_ERROR 致命的运行时错误
2 E_WARNING 运行时警告(非致命性错误)
4 E_PARSE 编译时解析错误
8 E_NOTICE 运行时提醒(经常是bug,也可能是有意的)
16 E_CORE_ERROR PHP启动时初始化过程中的致命错误
32 E_CORE_WARNING PHP启动时初始化过程中的警告(非致命性错)
64 E_COMPILE_ERROR 编译时致命性错
128 E_COMPILE_WARNING 编译时警告(非致命性错)
256 E_USER_ERROR 用户自定义的致命错误
512 E_USER_WARNING 用户自定义的警告(非致命性错误)
1024 E_USER_NOTICE 用户自定义的提醒(经常是bug,也可能是有意的)
2048 E_STRICT 编码标准化警告(建议如何修改以向前兼容)
4096 E_RECOVERABLE_ERROR 接近致命的运行时错误,若未被捕获则视同E_ERROR
6143 E_ALL 除E_STRICT外的所有错误(PHP6中为8191,即包含所有)
『技术文摘』 | Tags:| 评论(0) | 引用(0) | 阅读(2618)


[不指定 2010/05/05 20:47 | by 逍遥花主 ]

最近换到hawkhost,他们用的是LiteSpeed Webserver作为HTTP服务器软件,而不是Apache,以前使用的htaccess在这里不生效。在网上找了很久也没找到关于LiteSpeed服务器用htaccess的防盗链写法。咨询了他们一下,说是按Apache的写法可以使用,结果我是研究了很,终于写了个能用的,代码在下面:

引用

RewriteEngine on

RewriteCond %{HTTP_REFERER} !^http://planetidc.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://planetidc.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.planetidc.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.planetidc.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xaoyo.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xaoyo.net$ [NC]
RewriteCond %{HTTP_REFERER} !^http://xaoyo.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://xaoyo.net$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|css)$ - [F,NC]


RewriteRule .*\.(jpg|jpeg|gif|png|bmp|css)$ - [F,NC]这句还可以改一下以显示自己想显示的错误信息

引用
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|css)$ /404.shtml [R,NC,L]

『技术文摘』 | Tags: , , | 评论(0) | 引用(0) | 阅读(1446)


[不指定 2010/04/12 13:49 | by 逍遥花主 ]

      用电驴的时候,特别是中文Verycd版的,会感觉到有时搜索之后没有结果,其他的版本也有这样的问题。其实并不是电驴找不到,而是搜索后被限制了。有限制的方法当然就有破解的方法!

      老版本:要去VeryCD版电驴搜索限制,首先定位到电驴安装目录.在其中找到Config目录.然后,在Config目录下找到wordfilter.txt这个文件.老的veryCD版本的版本是wordfilter.dat这个文件.如果是wordfilter.txt这个文件,直接打开,清除所有的字符,保存退出.如果是wordfilter.dat这个文件,用记事本程序打开文件.会看到很多乱码,不用管他,清除这些乱码,保存退出,把属性改为只读。至此VeryCD版电驴搜索限制就被去掉了^-^。
      新版本:按上述方法修改后,新版VeryCD电驴会自动新建一个wordfilter.new,作用一样是限制不合法关键字。很简单再次按照上述方法修改主下就OK了。重启VeryCD看看,能找到些什么?如果你发现Config目录的上述两个文件由0Kb变回了原来的大小,那么还有个方法,把上述两个文件删除,然后建立两个同名文件夹就成了。(目前1.1.13版本VeryCD用不上这个方法以,我是WIN7系统)

      OK,搜索各种资源,大家享用吧(但不要做坏事啊!不然会打屁股的啊!)!!­

『技术文摘』 | Tags:| 评论(0) | 引用(0) | 阅读(2157)


[不指定 2010/01/30 09:54 | by 逍遥花主 ]

最近在做个小程序,一个表单由onclick控制提交到JS,再由JS提交到真正的PHP执行。结果发现,在输入框键入后直接敲"enter"键,按钮不响应,只有用鼠标点击才有效果。为了让onclick响应Enter键,在网上找了半天的代码,都没有实现这个功能,研究很久终于成功,下面把实现方法放出来:

引用

    <form id="form" name="form" method="post" action="javascript:void(0)" onkeydown="if(event.keyCode==13)getipdata('query1','query2')">
      <td width="39%" height="33"><input name="g_url" type="text" class="socss" id="ip_url" size="40" />      </td>
      <td width="34%"><input name="submit" type="submit" value="提交查询内容"  onclick="getipdata('query1','query2')"/></td>
    </form>


注意看红色的地方,"event.keyCode==13"是enter的代码,"getipdata('query1','query2')"是要提交到JS执行的。

『技术文摘』 | Tags:| 评论(0) | 引用(0) | 阅读(1089)


分页: 5/11 第一页 上页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]