Submitted by gouki on 2012, January 17, 8:59 AM
号码小助手,会自动将号码分析成:AAAB,AABB,ABAB之类的方式。
调用方式:http://ixyz.sinaapp.com/api/phone?h=13912341234,13912123344,13912345678&type=json
默认返回值是json,可支持json,xml,text三种返回形式
号码最多一次传10个
PHPCODE:
esult = file_get_contents('http://ixyz.sinaapp.com/api/phone?h=13912341234,13912123344,13912345678&type=json');
返回值是:
json格式返回:
{"phones":{"13912341234":["ABCD","ABCDABCD"],"13912123344":["ABCD","ABCDABCD","AABB","ABCD","ABAB"],"13912345678":["ABCD","ABCDABCD","AABB","ABCD","ABAB","ABCD"]},"copyright":"Written by walkerlee, api support by gouki","error":"sorry,phone doesn't match"}
xml格式返回:
XML/HTML代码【xml返回的格式结果与json的有一点点不太一样】
- <?xml version='1.0' encoding='UTF-8'?>
- <root>
- <result>
- <phones>
- <phone number="13912341234">
- <ABCD>ABCD</ABCD>
- <ABCDABCD>ABCDABCD</ABCDABCD>
- </phone>
- <phone number="13912123344">
- <ABCD>ABCD</ABCD>
- <AABB>AABB</AABB>
- <ABAB>ABAB</ABAB>
- </phone>
- <phone number="13912345678">
- <ABCD>ABCD</ABCD>
- </phone>
- </phones>
- <copyright><![CDATA[Written by walkerlee, api support by gouki]]></copyright>
- </result>
- </root>
----------
目前支持的类型有:XML/HTML代码
- Array
- (
- [0] => AABB
- [1] => ABCD
- [2] => AAAB
- [3] => ABAB
- [4] => ABCABC
- [5] => ABCDABCD
- [6] => ABBB
- [7] => ABCCBA
- [8] => ABBA
- [9] => AAAA
- [10] => AAAAA
- [11] => AAAAAA
- [12] => AAAAAAA
- [13] => AAAAAAAA
- [14] => ABCDCBA
- [15] => ABCDDCBA
- [16] => ABCBA
- )
---------
以上类型可以根据需要随便加,如果你觉得有哪些规则不错,你可以告诉我(这个正则是自动生成的,因此只要告诉规则就OK了)
嗯,这个程序的核心函数是walkerlee写的,我只是稍稍的封装处理了一下
Tags: sae, php, yii4sae
PHP | 评论:0
| 阅读:14937
Submitted by gouki on 2012, January 16, 4:57 PM
这是一张来自微博的图片,我用微软的OCR解析了一下,可能不太正确,我也不深究了,想仔细看就点击小图看大图吧?
解析后的正文:
Baby | 评论:0
| 阅读:15704
Submitted by gouki on 2012, January 14, 2:09 PM
众所周知,我们在插入数据库的时候,都是:insert into table (xxx) values('0');这种方式。
嗯,如果xxx是char或者varchar,并不会出错,但如果xxx是int型或者日期型,则可能会出错,也可能不出错,这是由您的配置决定的。
您可以看这里:
1.修改my.ini
XML/HTML代码
- ctrl+f 查找 sql-mode
-
- 将它值改为 "ANSI"
- sql-mode="ANSI";
- 重启数据库,就ok了.
2.动态修改数据库模式
XML/HTML代码
- 在启动数据库后,使用sql语句 SET sql_mode='ansi' ,
就ok了
--------------------------------------------------
第2个方法没用过.... T.T
手册地址在这.
http://doc.mysql.cn/mysql5/refman-5.1-zh.html-chapter/database-administration.html#server-sql-mode
sql-mode 是服务器模式
值的不同,mysql处理sql语句的方式也不同.
当值为ansi时,
mysql将更改sql语句的语法和行为,使其更符合标准SQL。
说白了,就是会修改错误.容错性高.
这样你给datetime项 和 int项 插入 空字符串,
mysql会将datetime的空字符改为 0000-00-00 00:00,
将int的空字符串改为0 .
其他值的作用.自己看手册.
-------上面这一段内容来自:http://ymx.iteye.com/blog/829046
是因为fireguns在询问的时候才想起要查这玩意,所以我就问了一下google
然后,firegus找到的资料是:
XML/HTML代码
- # Set the SQL mode to strict
- sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”
-
- 改为:
-
- # Set the SQL mode to strict
- sql-mode=”NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”
手册上说的SQLMODE是指:
Tags: mysql, insert, int, datetime
DataBase | 评论:0
| 阅读:21628
Submitted by gouki on 2012, January 13, 2:49 PM
在用httpfox抓包的时候,发现如标题发生的情况:"Content" tab issues NS_ERROR_DOCUMENT_NOT_CACHED on all POST/GET,
查询了一下,果然在官方的issue中发现了解决方案。再对比了一下我的设置,原来,我将一些Cache都关闭了,怪不得呢。
What steps will reproduce the problem?
1. Get the Firefox 3 Nightly build (tested with Gecko/2008051006)
2. Run any POST or GET request
3.
What is the expected output?
What do you see instead?
expected the "Content" tab to display the responseXML/responseText, it displays "Error loading content (NS_ERROR_DOCUMENT_NOT_CACHED)" What version of the product are you using?
On what operating system?
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9pre) Gecko/2008051006 Minefield/3.0pre
Please provide any additional information below. hopwe this is an easy fix :)
very sad to have found it to replace bulky Firebug to find out it doesnt work :(.
------
回复如下:
please check the following firefox preferences: (this can be done with the "about:config" url)
1) browser.cache.disk.enable make sure this is set to "true" (default: true)
2) browser.cache.memory.enable make sure this is set to "true" (default: true)
3) network.http.use-cache make sure this is set to "true" (default: true)
4) browser.cache.disk_cache_ssl setting this to "true" should help getting the content of https requests. it is deactivated by default for security reasons. (default: false) (see http://kb.mozillazine.org/Browser.cache.disk_cache_ssl)
----
OK,问题解决。
http://code.google.com/p/httpfox/issues/detail?id=20
Tags: firefox, httpfox
Software | 评论:0
| 阅读:20779
Submitted by gouki on 2012, January 12, 9:28 AM
看到本文的时候,其实我还是很蛋定的,大约早在3年多前就看到有人这么做过了,当时还给我发了一大堆这样的代码。
其实还有例子,那就是当初在liba网的时候,有一段时间突然发现MYSQL超慢。bobby查询了所有的数据库查询,发现了类似本文的例子,那时候其实很惊讶,/*!xxxx*/这样的代码不是被注释了吗?又能用来干嘛 ?
所以,今天看到这一篇博客的时候,还是忍不住贴出来,因为这已经真的不算是秘密的秘密了。
来源:http://hi.baidu.com/isbx/blog/item/795dcc112b85f40eb8127b4d.html
作者:meao
昨天在检测一个外国PHP网站时
在id=255后加’出现forbidden
于是我and 1=1正常 and 1=2出错
说明肯定有注入
接着我order by猜出字段
然后union select 1,2,3,4 //悲剧的又出现了forbidden
肯定是做了过滤了
后来构造了语句id=-255+union+/*!select*/+1,2,3,4
原理:
MySQL Server supports some variants of C-style comments. These enable you to write code that includes MySQL extensions, but is still portable, by using comments of the following form:
/*! MySQL-specific code */
In this case, MySQL Server parses and executes the code within the comment as it would any other SQL statement, but other SQL servers will ignore the extensions. For example, MySQL Server recognizes the STRAIGHT_JOIN keyword in the following statement, but other servers will not:
SELECT /*! STRAIGHT_JOIN */ col1 FROM table1,table2 WHERE …
If you add a version number after the “!” character, the syntax within the comment is executed only if the MySQL version is greater than or equal to the specified version number. The TEMPORARY keyword in the following comment is executed only by servers from MySQL 3.23.02 or higher:
CREATE /*!32302 TEMPORARY */ TABLE t (a INT);
The comment syntax just described applies to how the mysqld server parses SQL statements. The mysql client program also performs some parsing of statements before sending them to the server. (It does this to determine statement boundaries within a multiple-statement input line.)
Tags: select, mysql
DataBase | 评论:0
| 阅读:17146