This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Host Database | |
# | |
# localhost is used to configure the loopback interface | |
# when the system is booting. Do not change this entry. | |
## | |
127.0.0.1 localhost | |
255.255.255.255 broadcasthost | |
::1 localhost | |
fe80::1%lo0 localhost |
In August 2007 a hacker found a way to expose the PHP source code on facebook.com. He retrieved two files and then emailed them to me, and I wrote about the issue:
http://techcrunch.com/2007/08/11/facebook-source-code-leaked/
It became a big deal:
http://www.techmeme.com/070812/p1#a070812p1
The two files are index.php (the homepage) and search.php (the search page)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* File : Rest.inc.php | |
* Author : Arun Kumar Sekar | |
*/ | |
class REST { | |
public $_allow = array(); | |
public $_content_type = "application/json"; | |
public $_request = array(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This is the API, 2 possibilities: show the app list or show a specific app by id. | |
// This would normally be pulled from a database but for demo purposes, I will be hardcoding the return values. | |
function get_app_by_id($id) | |
{ | |
$app_info = array(); | |
// normally this info would be pulled from a database. | |
// build JSON array. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server | |
{ | |
listen 80; | |
#listen [::]:80; | |
server_name m.v5mp.com; | |
index index.html index.htm index.php default.html default.htm default.php; | |
root /home/wwwroot/m.v5mp.com; | |
include none.conf; | |
#error_page 404 /404.html; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//模拟一个订单数组 | |
$arr = array( | |
0 => array( | |
"o_id"=>"1", | |
"name"=>"田景文", | |
"tel"=>"18677216692", | |
"order_date"=>"1412146800" //10-1 | |
), | |
1 => array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* 二维数组按指定的键值排序 | |
* $array 数组 | |
* $key排序键值 | |
* $type排序方式 | |
*/ | |
function array_sort($arr, $keys, $type = 'desc') { | |
$keysvalue = $new_array = array(); | |
foreach ($arr as $k => $v) { | |
$keysvalue[$k] = $v[$keys]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach($array as $key => $value){ | |
if($value == 5)break; | |
} | |
// 这是一种。 | |
// 如果是嵌套的循环,用continue加数字也可以实现 | |
foreach($array as $key => $value){ | |
foreach($value as $key2 => $value2){ |
Why rewrite URLs? Check Wikipedia
Make sure AllowOverride is on for your directory, or put in httpd.conf
# Apache (.htaccess or httpd.conf)
RewriteEngine On