Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Tuesday, March 26, 2013

Simple Search Engine

http://pctechtips.org/a-simple-php-search-engine-tutorial/
http://onlamp.com/pub/a/php/2002/10/24/simplesearchengine.html?page=3

xss and sql injection prevention

//filtering input for xss and sql injection
$input = strip_tags( $input );
$input = mysql_real_escape_string( $input );
$input = trim( $input );

Thursday, July 14, 2011

in_array strange behavior

use in_array in php?
better check this out because I had mess my script because this strange behavior.
http://www.php.net/manual/en/function.in-array.php#102681

Sunday, February 20, 2011

3 method to open url from php

Method 1:  Curl
//Check for curl before doing anything
if(function_exists(“curl_init”)){
//Initialize curl
$curl_feed = curl_init(“http://netw0rk.blogspot.com/”);
//Curl Options
curl_setopt($curl_feed, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_feed, CURLOPT_HEADER, 0);
//Store our data
$data = curl_exec($curl_feed);
//Close curl
curl_close($curl_feed);
}
Method 2:  fopen
//Initialize fopen
$fopen_feed = @fopen(“http://netw0rk.blogspot.com/”, “r”);
//Make sure fopen was successfull
if ($fopen_feed) {
//Store our data
$data = “”;
while (!feof($fopen_feed)) {
$data .= fread($fopen_feed, 8192);
}
}
//Close fopen
fclose($fopen_feed);
Method 3:  fsockopen
//Initialize fsockopen
$fsockopen_feed = @fsockopen(“http://netw0rk.blogspot.com/”, 80, $errno, $errstr, 30);
if ($fsockopen_feed){
//Create our headers for the request
$headers = “GET http://netw0rk.blogspot.com/  HTTP/1.1\r\n”;
$headers .= “Host:  netw0rk.blogspot.com”\r\n”;
$headers .= “Connection: Close\r\n\r\n”;
fwrite($fsockopen_feed, $headers);
//Store our data
$data = “”;
while (!feof($fsockopen_feed)){
$data .= fgets($fp, 128);
}
//Close fsockopen
fclose($fsockopen_feed);
// Strip the header information
$data = explode(“\\r\\”, $data);
$data = $data[1];
}

Wednesday, March 17, 2010

wordpress sqlite

Sudah bisa buat wordpress jalan dengan backend database sqlite, tinggal test bisa jalan pake nginx apa enggak?