This is 赵峰 | 赵峰之城 | 赵峰的博客 !

使用socket代替fopen直接读取的PHP函数

网络抓取,可以伪装来源和客户端,从而躲过一些站点的检查。

» 阅读全文

PHP 中文验证码

  几个GD函数堆砌出来的玩意,只要搞定怎样把中文写到图片上就可以了,因为GD函数只接受UTF8格式编码的文字,所以在写文字前首先要进行编码转换。PHP自带的iconv和mbstring库都可以完成这项工作,但一般的虚拟主机很少支持,所以要自己写个,像这里用gb2utf8完成这项工作。当然如果你的页面就是以UTF8格式存储的,就可以省去这些额外工作。
  使用的时候直接用html语法:<img src="cncode.php">调用就可以了,在服务端做验证时取session存储的验证字符与用户提交的字符进行比较,相同则通过验证。
  注:程序用到的simkai.ttf是windows中常见的楷体,当然你也可以换成别的字体,但一定要支持中文的;gb2312.txt是gb2312和utf8的编码对照表,可以。

» 阅读全文

解决卡巴斯基key被列为黑名单问题 真正可用

06年12月5日,卡巴大范围封杀了许多使用了较长时间的非正常渠道key,导致大量卡巴用户无法更新,提示key进入黑名单。
对于一个正常的商业公司来说,这个行动是可以理解的。
现在的问题是,在卡巴斯基封key时,广大卡巴斯基用户应该如何应对?
1、换用其它杀毒软件?不习惯啊!
2、安装safe360免费3个月,那可是个大流氓,信不过!
3、买正版,没钱。


不用再找授权了,所有的都无用,进了黑名单,我有好方法!

» 阅读全文

CSS学习图书推荐 《CSS网站布局实录》和《CSS Mastery》

书名:《css网站布局实录》
作者:李超(Allan)
出版社:科学出版社希望电子出版社 

从拿到手到现在有十天了,利用坐公车的时间翻了一遍。很不错的书,虽然里面小错误很多,但瑕不掩玉,喜欢做网页的朋友可以读读。
书中的的一些细节错误的列表:
http://allan.flashempire.net/blog/?p=347#more-347

配合本书的源代码下载

另有一本《CSS Mastery:Advanced Web Standards Solutions》,英文好的可以读一下!
《CSS Mastery》下载地址

» 阅读全文

IE7简体中文正式版 下载

今天官方发布了IE7.0简体中文正式版,不过在微软中国还没有放上,应该在这两天了吧!
官方下载地址:http://download.microsoft.com/download/4/1/8/418981A4-6EF9-4DE6-BEFC-1A53E886CB62/ie7-windowsxp-x86-chs.exe

附验证方法:
1:下载完毕后,双击安装文件,如图,至验证页面时,点验证!(当然通过不了,这样做是为了让C:\Documents and Settings\All Users\Application Data\Windows Genuine Advantage\data 路径上产生一个 data.dat 文件!)不要退出安装保留此页!


2:找到路径C:\Documents and Settings\All Users\Application Data\Windows Genuine Advantage\data 打开我的电脑,复制上面路径到地址栏,回车!找到data.dat 文件,删除它!


3:这个是关键,请仔细看好,如果你是LAN上网,请拔掉你的网线,如果是ADSL上网,那就关掉ADSL猫!并确认,屏幕右下角连接已处于断开的状态!(连接图标上出现红叉) 这是关键一步,请仔细确认!


回到安装页面,再一次验证!会很顺利通过的,等上两分钟,偷着乐吧
试试吧!

» 阅读全文

完善了网站在firefox下显示不正常的问题

1、div+css 中做的页面,在IE中是居中的,在火狐是在左边。
解决办法:更改#outmain的样式,加入margin-left:auto;margin-right:auto;

2、FLASH背景透明
解决办法:在ie中实现flash背景透明很简单,加这样一个值
<param name="wmode" value="transparent">
在Mozilla,Firefox浏览器中起作用的是这个标签 <embed></embed>
那这样,在<embed>标签内加入属性 wmode="transparent" 就可以实现flash背景透明。

» 阅读全文

Mysql client 版本问题的解决办法

MYSQL 帮助:


A.2.3 Client does not support authentication protocol


MySQL 4.1 and up uses an authentication protocol based on a password hashing algorithm that is incompatible with that used by older clients. If you upgrade the server to 4.1, attempts to connect to it with an older client may fail with the following message:


shell> mysql
Client does not support authentication protocol requested
by server; consider upgrading MySQL client

To solve this problem, you should use one of the following approaches:



  • Upgrade all client programs to use a 4.1.1 or newer client library.

  • When connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password.

  • Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. This can be done using the SET PASSWORD statement and the OLD_PASSWORD() function:
    mysql> SET PASSWORD FOR
    -> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');

    Alternatively, use UPDATE and FLUSH PRIVILEGES:
    mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
    -> WHERE Host = 'some_host' AND User = 'some_user';
    mysql> FLUSH PRIVILEGES;

    Substitute the password you want to use for ``newpwd'' in the preceding examples. MySQL cannot tell you what the original password was, so you'll need to pick a new one.

  • Tell the server to use the older password hashing algorithm:

    1. Start mysqld with the --old-passwords option.

    2. Assign an old-format password to each account that has had its password updated to the longer 4.1 format. You can identify these accounts with the following query:
      mysql> SELECT Host, User, Password FROM mysql.user
      -> WHERE LENGTH(Password) > 16;

      For each account record displayed by the query, use the Host and User values and assign a password using the OLD_PASSWORD() function and either SET PASSWORD or UPDATE, as described earlier.




For additional background on password hashing and authentication, see section 5.5.9 Password Hashing in MySQL 4.1.


例子:
SET PASSWORD FOR 用户名@localhost = OLD_PASSWORD('密码');


» 阅读全文

防止英文字符撑破表格的方法

这些天组网的事太忙了,很久没更新Blog了。 
晚上写留言本时发现英文字母会挣破表格,
经多方查找,发现只要在CSS里加入:
table
{
table-layout:fixed;
word-break:break-all;
word-wrap:break-word;
}


就OK了!

» 阅读全文