Selamat Datang

Assalamu'alaikum Warahmatullahi Wabarokatuh Wamaghfiratuh, Moga anda dapat mengambil manfaat dari keberadaan blog Prestasikoe ini.

blog ini sekedar kumpulan" yang tidak bisa ku ingat seluruhnya,
makanya dibuat dlm tulisan.

produk

produk

Friday, September 26, 2008

pdf-search-engine

http://www.pdf-search-engine.com

bg83

Al_Qur'an online

http://al-quran.aacpl.us/index.php?

bg83

Wednesday, September 17, 2008

karbu step



bg83

Monday, September 15, 2008

php spesific your include folder

<?php
/*
spesific your include folder
author bageer83@yahoo.co.id
20080913
using for minimalize broken include or include from other places

@$incpath=name your spesific folder
@$file=name file on your spesific folder
map folder
root
     includefile
          header.php
          foother.php
     mod
          aa.php
     incbaru
          baru.php
     this.php
     lain.php
*/

function myInclude($file,$incpath=""){
     $incpath="includefile/".$incpath."/";
     $true_inc_reff=1;
     ini_set("include_path",$incpath);
     if(file_exists($incpath.$file)&&(!ereg("http://",$incpath))){
          include($file);
     }else{
          $file=str_replace(".php","",$file);
          echo "Sorry \"".$file."\" : not exist"."<br>";
     }
     $true_inc_reff=0;
}

myInclude("header.php"); /*path of haeder.php : includefile/header.php*/
myInclude("mod/aa.php"); /*path of aa.php : includefile/mod/aa.php*/
myInclude("lain.php","../");/*path of lain.php : lain.php*/
myInclude("baru.php","../incbaru");/*path of lain.php : incbaru/baru.php*/
myInclude($_REQUEST['c'].".php",$_REQUEST['s']); /*?s=mod&c=aa : includefile/mod/aa.php*/


myInclude($_REQUEST['c'].".php",$_REQUEST['s']); /*?s=http://localhost/&c=test will failed*/
myInclude("http://localhost/index.php",""); /*will failed*/
myInclude("index.php","http://localhost/"); /*will failed*/


myInclude("foother.php"); /*path of haeder.php : includefile/header.php*/


#aa.php
/*
first time, checking refferer include
if($true_inc_reff==0){die("failed reff");}
*/
?>






bg83

Friday, September 12, 2008

hitung hari pake pg

$date="2008-09-12";
function hithari($date){
     global $dbconn;
     $sql="select TIMESTAMP '$date'-CURRENT_DATE";
     $rs=pg_query($dbconn,$sql);
     $row=pg_fetch_array($rs);
     $d=str_replace("days","",$row[0]);
     $d=str_replace("day","",$d);
     $d=trim($d);
     return $d;
}

pake php langsung gmna ya????

bg83

Thursday, September 11, 2008

rss & atom feeds icon

< link rel = "alternate" type = "application/atom+xml" title = "Prestasikoe - Atom" href = "http://bageer83.blogspot.com/feeds/posts/default" / >

< link rel = "alternate" type = "application/rss+xml" title = "Prestasikoe - RSS" href = "http://bageer83.blogspot.com/feeds/posts/default?alt=rss" / >

bg83

Tuesday, September 9, 2008

vbInformation

dim test
msgbox "content",vbInformation,"Hallo semua"


bg83

multi_user_ym.reg

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Yahoo\pager\Test]
"Plural"=dword:00000001

bg83

Monday, September 8, 2008

SEO for blogspot

<b:if cond='data:blog.pageType == &quot;index&quot;'>

<title><data:blog.title/></title>

<b:else/>

<title><data:blog.pageName/>|<data:blog.title/></title>

</b:if>

bg83

Example #1 A htmlentities() example

<?php

$str  =  "A 'quote' is <b>bold</b>" ;



// Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt;

echo  htmlentities ( $str );



// Outputs: A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt;

echo  htmlentities ( $str ,  ENT_QUOTES );

?>

from : http://id2.php.net/htmlentities
bg83

Saturday, September 6, 2008

teknik OpenWindow

function OpenWindow(theURL, width, height, left, top) { { window.open(theURL , "" ,"width="+ width +",height="+ height +",left="+ left +", top="+ top +", toolbar=no,directories=0,menubar=no,status=no,resizable=0,location=0,scrollbars=2,copyhistory=0") } }

bg83

teknik cache

<?php

Header("Cache-Control: must-revalidate");

$offset = 60 * 60 * 24 * 3;

$ExpireString = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";

Header($ExpireString);

?>



bg83

teknik breakout framing

if (parent.frames.length > 0) { parent.location.href = location.href; }

bg83

Thursday, September 4, 2008

renew imgVerify

<img src="" alt="" hspace="1" id="imgVerify">

<input name="rgnrt" type="button" id="rgnrt" value="renew" onClick="var s=document.getElementById('imgVerify').src;var re = RegExp(/i=+([\d]*)/i);if(s.match(re)){re=re.exec(s)[0];a=s.split('?')[0];n=(parseFloat(re.split('=')[1])+1);document.getElementById('imgVerify').src=(a+'?i='+n);}else{document.getElementById('imgVerify').src=(s+'?i=1');}">

document.getElementById("imgVerify").src='imgVerify.php';




bg83

Wednesday, August 27, 2008

php getTagVal for http req

function makeTagVal($tag,$val){

echo urlencode("<".$tag.">".$val."<".$tag.">");

}


function getTagVal($tag,$source){

$source=urldecode($source);

eval("\$p=split('<".$tag.">|</".$tag.">',\$source);");

return $p[1];

}
bg83

Tuesday, August 26, 2008

Create barcode with php

copas from php.net

<?php

function UPCAbarcode($code) {

$lw = 2; $hi = 100;

$Lencode = array('0001101','0011001','0010011','0111101','0100011',

'0110001','0101111','0111011','0110111','0001011');

$Rencode = array('1110010','1100110','1101100','1000010','1011100',

'1001110','1010000','1000100','1001000','1110100');

$ends = '101'; $center = '01010';

/* UPC-A Must be 11 digits, we compute the checksum. */

if ( strlen($code) != 11 ) { die("UPC-A Must be 11 digits."); }

/* Compute the EAN-13 Checksum digit */

$ncode = '0'.$code;

$even = 0; $odd = 0;

for ($x=0;$x<12;$x++) {

if ($x % 2) { $odd += $ncode[$x]; } else { $even += $ncode[$x]; }

}

$code.=(10 - (($odd * 3 + $even) % 10)) % 10;

/* Create the bar encoding using a binary string */

$bars=$ends;

$bars.=$Lencode[$code[0]];

for($x=1;$x<6;$x++) {

$bars.=$Lencode[$code[$x]];

}

$bars.=$center;

for($x=6;$x<12;$x++) {

$bars.=$Rencode[$code[$x]];

}

$bars.=$ends;

/* Generate the Barcode Image */

$img = imagecreate($lw*95+30,$hi+30) or die("Cannot Initialize new GD image stream");;

$fg = imagecolorallocate($img, 0, 0, 0);

$bg = imagecolorallocate($img, 255, 255, 255);

imagefilledrectangle($img, 0, 0, $lw*95+30, $hi+30, $bg);

$shift=10;

for ($x=0;$x<strlen($bars);$x++) {

if (($x<10) || ($x>=45 && $x<50) || ($x >=85)) { $sh=10; } else { $sh=0; }

if ($bars[$x] == '1') { $color = $fg; } else { $color = $bg; }

imagefilledrectangle($img, ($x*$lw)+15,5,($x+1)*$lw+14,$hi+5+$sh,$color);

}

/* Add the Human Readable Label */

imagestring($img,4,5,$hi-5,$code[0],$fg);

for ($x=0;$x<5;$x++) {

imagestring($img,5,$lw*(13+$x*6)+15,$hi+5,$code[$x+1],$fg);

imagestring($img,5,$lw*(53+$x*6)+15,$hi+5,$code[$x+6],$fg);

}

imagestring($img,4,$lw*95+17,$hi-5,$code[11],$fg);

/* Output the Header and Content. */

header("Content-type: image/png");

imagepng($img);

}


UPCAbarcode('12345678901');


?>




bg83

Wednesday, August 13, 2008

captcha

session_start();
// The text to draw
$text = 'Testing...';
$str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$text = substr(str_shuffle($str),0,4);
$_SESSION['a']=$text;
// Set the content-type
header("Content-type: image/png");

// Create the image
$im = imagecreatetruecolor(150, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);


// Replace path by your own font path
$font = 'PAPYRUS.TTF';

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
bg83

Friday, July 18, 2008

cart20080718

Demikian class cart terbaru dari bageer83
mudah-mudahan bermanfaat
semaleman ngak tidur bwt ngulik ini class
classcart ini bisa menggunakan session
atau cookies sebagai media penyimpanannya
dibuat untuk dapat digunakan secara fleksibel
misal :pemisah data antar produk dan jumlah dapat disesuaikan
dengan applikasi yang telah anda bangun, nama data simpanan dapat juga disesuaikan
coba dulu deh
jangan lupa kirim koment ya!





<?php

session_start();

/*

cart dengan session atau cookies

penulis bageer83[Gunawan Setiawan]

20080718 4:47

jika ada koreksi silahkan hubungi bageer83@yahoo.co.id

*/

class cart{

var $p1=";";/*partisi per produk*/

var $p2=":";/*partisi produk dan jumlah*/

var $n="";/*nama paket data*/

var $t="";/*tipe paket s:session;c:cookies*/

var $rt="";/*real time data*/

var $ia=0;/*init act a()*/

/*vr() virtual data;*/

function cart($n,$t="s"){$this->n=$n;$this->t=$t;}

function a($p,$q){

$this->ia=1;

$c=$this->vr();

if($this->ck($p)==true){

$v="";$c2=split($this->p1,$c);

foreach($c2 as $c3){

$c4=split($this->p2,$c3);

$d=$v!=""?$this->p1:"";

if($c4[0]==$p){if($q>0){$v.=$d.$c4[0].$this->p2.$q;}

}else{$v.=$d.$c4[0].$this->p2.$c4[1];}

}

}elseif(($this->ck($p)==false)&&($q>0)){

$d=$c!=""?$this->p1:"";if($q>0){$v=$c.$d.$p.$this->p2.$q;}

}else{$v=$c;}

$this->rt=$v;

$this->s($v);

}

function clr(){$this->ia=1;$this->rt="";$this->s("");}

function ck($p){

$c=$this->vr();$c2=split($this->p1,$c);

foreach($c2 as $c3){$c4=split($this->p2,$c3);if($c4[0]==$p){return true;}}

return false;

}

function s($v){

if($v!=""){

if($this->t=="s"){$_SESSION[$this->n]=$v;}

elseif($this->t=="c"){setcookie($this->n,$v,time()+3600);}

}else{

if($this->t=="s"){$_SESSION[$this->n]="";}

elseif($this->t=="c"){setcookie($this->n,"",time()-3600);}

}

}

function vr(){

if($this->t=="s"){return $_SESSION[$this->n];}

else if($this->t=="c"){return $_COOKIE[$this->n];}

}

function g(){return $this->ia==1?$this->rt:$this->vr();}

}
$b=new cart("cart","c");

$b->a("p003",1);

//$b->clr();

echo $b->g();

/*

add

$b->a("p001",1);

update

$b->a("p001",2);

move

$b->a("p001",0);

clear

$b->clr();

*/

?>



bg83

Wednesday, July 9, 2008

test img


bg83

Tuesday, June 24, 2008

Ke Garut Lagih

minggu kmaren ke garut lagih
pagi di bandung
siang di garut rancabago , patrol
sore di cipanas [udah lm ngak renang]
mlm di masjid iqra
bandung 10 mlm


bg83

Other Way row over

<tr onmouseover="old_bg=this.getAttribute('bgcolor');this.setAttribute('bgcolor', '#FEFEED', 0);" onmouseout="this.setAttribute('bgcolor', old_bg, 0); " bgcolor="#ffffff">


bg83

Monday, June 16, 2008

datarow2colom


# phpMyAdmin SQL Dump
# version 2.5.4
# http://www.phpmyadmin.net
#
# Host: localhost
# Generation Time: Jun 16, 2008 at 08:58 AM
# Server version: 5.0.26
# PHP Version: 5.1.6
#
# Database : `test1`
#

# --------------------------------------------------------


#
# Table structure for table `testproduk`
#


CREATE TABLE `testproduk` (
`pid` varchar(255) NOT NULL,
`item` varchar(255) NOT NULL,
`desc` varchar(255) NOT NULL,
`price` varchar(255) NOT NULL,
PRIMARY KEY (`pid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


#
# Dumping data for table `testproduk`
#


INSERT INTO `testproduk` (`pid`, `item`, `desc`, `price`) VALUES ('p001', 'item1', 'desc1', '1'),
('p002', 'item2', 'desc2', '2'),
('p003', 'item3', 'desc3', '3'),
('p004', 'item4', 'desc4', '4'),
('p005', 'item5', 'desc5', '5'),
('p006', 'item6', 'desc6', '1'),
('p007', 'item7', 'desc7', '2'),
('p008', 'item8', 'desc8', '3'),
('p009', 'item9', 'desc9', '4'),
('p010', 'item10', 'desc10', '5'),
('p011', 'item11', 'desc11', '1'),
('p012', 'item12', 'desc12', '2'),
('p013', 'item13', 'desc13', '3'),
('p014', 'item14', 'desc14', '4'),
('p015', 'item15', 'desc15', '5'),
('p016', 'item16', 'desc16', '1'),
('p017', 'item17', 'desc17', '2'),
('p018', 'item18', 'desc18', '3'),
('p019', 'item19', 'desc19', '4'),
('p020', 'item20', 'desc20', '5'),
('p021', 'item21', 'desc21', '1'),
('p022', 'item22', 'desc22', '2'),
('p023', 'item23', 'desc23', '3'),
('p024', 'item24', 'desc24', '4'),
('p025', 'item25', 'desc25', '5'),
('p026', 'item26', 'desc26', '1'),
('p027', 'item27', 'desc27', '2'),
('p028', 'item28', 'desc28', '3'),
('p029', 'item29', 'desc29', '4'),
('p030', 'item30', 'desc30', '5');





<?php
$myconn=mysql_connect("localhost","root","root");
mysql_select_db("test1");


$sql = 'SELECT `pid` , `item` , `desc` , `price` '
. ' FROM `testproduk` LIMIT 0, 30';
$rs = mysql_query($sql);


$slice = 3;
$doslice= true;
$part = ceil(mysql_num_rows($rs)/$slice);
$width = floor(100/$slice)."%";
?>
<style type="text/css">
<!--
.trheader {
background-color: #00BBF9;
font-weight:bold;
color:#333333;
}
.trdata {
background-color: #EAEAEA;
}
-->
</style>
<strong>PRICE LIST</strong>
<table width="100%" border="0" cellspacing="0" cellpadding="3" style="border:2px solid #cfcfcf;font:8pt tahoma;">
<tr>
<td width="<?=$width;?>" valign="top" align="center">
<?php
$i=0;
$lo=0;
while($row=mysql_fetch_array($rs)){$i++;$lo++;
if($lo==1){
?>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" style="border:1px solid #cfcfcf;font:8pt tahoma;">
<tr class="trheader">
<td width="20">No</td>
<td>Pid</td>
<td>Desc</td>
<td>Price</td>
</tr>
<?php
}
?>
<tr class="trdata">
<td><strong><?=$i;?>.</strong></td>
<td><?=$row['pid'];?></td>
<td><?=$row['desc'];?></td>
<td><?=$row['price'];?></td>
</tr>
<?php if($lo==$part&&$doslice==true){
echo '</table>';
echo '</td>';
echo '<td width="'.$width.'" valign="top" align="center">';
$lo=0;
}
?>
<?php
}
?>
</table>
</td>
</tr>
</table>
<br />
<br />
<table width="300" border="0" align="center" cellpadding="3" cellspacing="0" bgcolor="#F4F4F4" style="border:2px solid #cfcfcf;font:8pt tahoma;color:#333333;">
<tr>
<td style="text-align:justify;"><strong><u>Triks Data Row 2 Columns or more</u></strong><br />
good for print price list in 2 or more column <br />
<br />
bagus digunakan untuk memprint price list yang membutuhkan beberapa kolom dalam menampilkan data yang sama, kelebihannya adalah anda hanya perlu menjalankan query 1 kali saja untuk menampilkan data harga dari database. <br />
jika anda menggunakan applikasi web developer dengan WISYWIG akan mudah sekali dalam merubah dan atau menambahkan colom baru. <br />
Trik ini tentu bisa juga digunakan untuk menampilkan tabel lain. <br />
<br />
Selamat Mencoba<br />
<br />
<div style="font-family:Georgia;font-style:italic;font-weight:bold;text-align:right;"><a href="mailto:bageer83@yahoo.co.id?subject=Triks Data Row 2 Columns" style="




bg83

Saturday, June 14, 2008

The Beauty of Mathematics

The Beauty of Mathematics

1 x 8 + 1 = 9
12 x 8 + 2 = 98
123 x 8 + 3 = 987
1234 x 8 + 4 = 9876
12345 x 8 + 5 = 98765
123456 x 8 + 6 = 987654
1234567 x 8 + 7 = 9876543
12345678 x 8 + 8 = 98765432
123456789 x 8 + 9 = 987654321

1 x 9 + 2 = 11
12 x 9 + 3 = 111
123 x 9 + 4 = 1111
1234 x 9 + 5 = 11111
12345 x 9 + 6 = 111111
123456 x 9 + 7 = 1111111
1234567 x 9 + 8 = 11111111
12345678 x 9 + 9 = 111111111
123456789 x 9 +10= 1111111111

9 x 9 + 7 = 88
98 x 9 + 6 = 888
987 x 9 + 5 = 8888
9876 x 9 + 4 = 88888
98765 x 9 + 3 = 888888
987654 x 9 + 2 = 8888888
9876543 x 9 + 1 = 88888888
98765432 x 9 + 0 = 888888888

Brilliant, isn't it?

And look at this symmetry:

1 x 1 = 1
11 x 11 = 121
111 x 111 = 12321
1111 x 1111 = 1234321
11111 x 11111 = 123454321
111111 x 111111 = 12345654321
1111111 x 1111111 = 1234567654321
11111111 x 11111111 = 123456787654321
111111111 x 111111111 = 12345678987654321



Now, take a look at this...


101%



From a strictly mathematical viewpoint:



What Equals 100%?
What does it mean to give MORE than 100%?

Ever wonder about those people who say they are giving more than 100%?

We have all been in situations where someone wants you to
GIVE OVER 100%.

How about ACHIEVING 101%?


What equals 100% in life?


Here's a little mathematical formula that might help
answer these questions:


If:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Is represented as:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26.


If:


H-A-R-D-W-O- R- K

8+1+18+4+23+ 15+18+11 = 98%


And:

K-N-O-W-L-E- D-G-E

11+14+15+23+ 12+5+4+7+ 5 = 96%


But:

A-T-T-I-T-U- D-E

1+20+20+9+20+ 21+4+5 = 100%

THEN, look how far the love of God will take you:

L-O-V-E-O-F- G-O-D

12+15+22+5+15+ 6+7+15+4 = 101%

Therefore, one can conclude with mathematical certainty that:

While Hard Work and Knowledge will get you close, and Attitude will
get you there, It's the Love of God that will put you over the top!

Have a nice day & God bless!!
dr milis alumniku
bg83

go success

bukankah kau pernah merasakan kesuksesan,
bukankah kau juga telah melewati masa-masa sulit,
bukankah kau pernah merasakan beratnya bangkit,
bukankah semua itu indah untuk dijalani,
bukankah hambar rasanya jika semua itu belum pernah dijalani, tak ada ilmu amal bahkan tak ada pengalaman yang dapat diceritakan pada orang terdekat,

kita hanya butuh ingatan,
bagaimana kesuksesan dapat diraih,
kita hanya butuh ingatan,
bagaimana kesulitan dapat dilalui,
kita hanya butuh ingatan,
bagaimana bangkit dapat dicapai,

satu hal lagi
kita butuh ingatan,
kalimat apa yang ingin diucapkan sebagai doa pada Allah

mengingat diri kita saat menjalani semua ini bisa sebagai motivasi diri,
disamping motivasi yang datang dari orang terdekat kita.

semoga bermanfaat
bg20080614

Saturday, May 31, 2008

baru dwa tulisan

bulan ini baru dwa tulisan

tgl 12 pada datang ke bdg
tgl 13 dirumah aje, gwe kerja da blom ijin
tgl 14 main ke kawah putih, a paradise of the world
tgl 15 pulang kejokja ya...., naik tut tut
tgl 17 paket chip
tgl 19 chipnya nyampe tuh ngak ku buka
tgl 28 balik ke smd ya..
tgl 31 hari tanpa tembakau
see you
iwmu
bg83

Wednesday, May 28, 2008

back to samarinda

hei i,
sore ini jd khan balik ke samarinda
hati" di perjalanan ya!

bg83

cobalagi kirim cv

coba lagi kirim cv a....h
mudah mudahan ktrima
syukur Alhamdulillah klo bisa ktrima

trima ya.. ya...

mkasih bwt bang dendi atas informasinya

bg83

Monday, April 28, 2008

Php Httpredirects

<?php

//http://www.digiways.com/articles/php/httpredirects/

class CDWHttpFile

{

/* $strLocation - URL of the last web page retreived (could be different

from what was requiested in case of HTTP redirect.) */

var $strLocation;

var $aHeaderLines; // headers of last web page

var $strFile; // last web page retreived

/* $bResult - contains true if last web page was

retrieved successfully, false otherwise. */

var $bResult;

/* ReadHttpFile - the function that does all the work.

$strUrl - URL of the page we want to get.

$iHttpRedirectMaxRecursiveCalls - maximum number of

times following HTTP redirection. */

function ReadHttpFile($strUrl, $iHttpRedirectMaxRecursiveCalls = 20)

{

// parsing the url getting web server name/IP, path and port.

$url = parse_url($strUrl);

// setting path to "/" if not present in $strUrl

if (isset($url["path"]) == false) $url["path"] = "/";

// setting port to default HTTP server port 80

if (isset($url["port"]) == false) $url["port"] = 80;

// connecting to the server

$fp = fsockopen ($url["host"], $url["port"], $errno, $errstr, 30);


// reseting class data

$this->bResult = false;

unset($this->strFile);

unset($this->aHeaderLines);

$this->strLocation = $strUrl;


/* Return if the socket was not open $this->bResult is set to false. */

if (!$fp)

return;

else

{

// composing HTTP request

$strQuery = "GET ".$url["path"];

if (isset($url["query"]) == true) $strQuery .= "?".$url["query"];

$strQuery .= " HTTP/1.0\r\n\r\n";

// sending the request to the server

fputs($fp, $strQuery);

/* $bHeader is set to true while we receive the HTTP header

and after the empty line (end of HTTP header) it's set to false. */

$bHeader = true;

// continuing untill there's no more text to read from the socket

while (!feof($fp))

{

/* reading a line of text from the socket

not more than 8192 symbols. */

$strLine = fgets($fp, 8192);

// removing trailing \n and \r characters.

$strLine = ereg_replace("[\r\n]", "", $strLine);

if ($bHeader == false)

$this->strFile .= $strLine."\n";

else

$this->aHeaderLines[] = trim($strLine);

if (strlen($strLine) == 0) $bHeader = false;

}

fclose ($fp);

}


/* Processing all HTTP header lines and checking for

HTTP redirect directive 'Location:'. */

for ($i = 0; $i < count($this->aHeaderLines); $i++)

if (strcasecmp(substr($this->aHeaderLines[$i], 0, 9), "Location:") == 0)

{

$url = trim(substr($this->aHeaderLines[$i], 9));

// $url now is the URL of the web page we are relocated to

// If $url is the same page we are requesting, just continue

if ($url != $strUrl)

{

/* If the maximum number of redirects is reached,

just return. $this->bResult is set to false. */

if ($iHttpRedirectMaxRecursiveCalls == 0) return;

/* Calling the function recursively with the new URL

and the maximum number of redirections reduced by one. */

return $this->ReadHttpFile(

$url,

$iHttpRedirectMaxRecursiveCalls-1);

}

}


/* We should get here if there was no HTTP redirect directive found.

Setting $this->bResult to true. Web page was retreived successfully. */

$this->bResult = true;



/* If magic_quotes_runtime is enabled in php.ini, then all the quotes

in the received text will be prefixed with slashes. */

if (ini_get("magic_quotes_runtime"))

{

$this->strFile = stripslashes($this->strFile);

for ($i = 0; $i < count($this->aHeaderLines); $i++)

$this->aHeaderLines[$i] = stripslashes($this->aHeaderLines[$i]);

}

}


/* Just to make it easier to use this class, adding contructor

which accepts URL as a parameter and calls ReadHttpFile functions. */

function CDWHttpFile($strUrl = "")

{

if (strlen($strUrl) > 0)

$this->ReadHttpFile($strUrl);

}

};


$httpFile = new CDWHttpFile("http://localhost");

if ($httpFile->bResult == true)

{

echo "URL: $httpFile->strLocation <br>";

foreach($httpFile->aHeaderLines as $strHeaderLine)

echo "Header line: ".htmlspecialchars($strHeaderLine)."<br>";

//echo "Contents: <hr>".htmlspecialchars($httpFile->strFile)."<hr>";

preg_split("/<body>/ || /<\/body><\/html>/",$httpFile->strFile,3);

//echo htmlspecialchars($a[0]);

}


?>




bg83

Php HttpRequest

Ni Aq kasi HttpRequest pake php

biar gampang klo ada crosing data antar server

Scrip ini udah di coba di labnya bageer83

Selamat Mencoba








<?php

error_reporting(E_ALL);

set_time_limit(10);

class HttpRequest

{

var $sHostAdd;

var $sUri;

var $iPort;

var $sPostData;

var $sRequestHeader;

var $sResponse;



function HttpRequest($sUrl)

{

$sPatternUrlPart = '/http:\/\/([a-z-\.0-9]+)(:(\d+)){0,1}(.*)/i';

$arMatchUrlPart = array();

preg_match($sPatternUrlPart, $sUrl, $arMatchUrlPart);



$this->sHostAdd = gethostbyname($arMatchUrlPart[1]);

if (empty($arMatchUrlPart[4]))

{

$this->sUri = '/';

}

else

{

$this->sUri = $arMatchUrlPart[4];

}

if (empty($arMatchUrlPart[3]))

{

$this->iPort = 80;

}

else

{

$this->iPort = $arMatchUrlPart[3];

}



$this->addRequestHeader('Host: '.$arMatchUrlPart[1]);

$this->addRequestHeader('Connection: Close');

}



function addRequestHeader($sHeader)

{

$this->sRequestHeader .= trim($sHeader)."\r\n";

}



function addData($var,$data){

$this->sPostData .= "&"."$var"."=".urlencode("$data");

}



function getData(){

return $this->sPostData;

}



function sendRequest($sMethod = 'GET', $sPostData = '')

{

$sPostData.=$this->getData();

//echo $sPostData;



if ($sMethod == 'GET'){

$sRequest = $sMethod." ".$this->sUri."?".$sPostData." HTTP/1.1\r\n";

}else{

$sRequest = $sMethod." ".$this->sUri." HTTP/1.1\r\n";

}



//$sRequest = $this->sUri." HTTP/1.1\r\n";



$sRequest .= $this->sRequestHeader;

if ($sMethod == 'POST')

{

$sRequest .= "Content-Type: application/x-www-form-urlencoded\r\n";

$sRequest .= "Content-Length: ".strlen($sPostData)."\r\n";

$sRequest .= "\r\n";

$sRequest .= $sPostData."\r\n";

}

$sRequest .= "\r\n";



$sockHttp = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);

if (!$sockHttp)

{

die('socket_create() failed!');

}



$resSockHttp = socket_connect($sockHttp, $this->sHostAdd, $this->iPort);

if (!$resSockHttp)

{

die('socket_connect() failed!');

}



socket_write($sockHttp, $sRequest, strlen($sRequest));



$this->sResponse = '';

while ($sRead = socket_read($sockHttp, 1024))/*4096*/

{

$this->sResponse .= $sRead;

}

socket_close($sockHttp);

}



function getResponse()

{

return $this->sResponse ;

}



function getResponseBody()

{

$sPatternSeperate = '/\r\n\r\n/';

$arMatchResponsePart = preg_split($sPatternSeperate, $this->sResponse,2);

//return $arMatchResponsePart[0];/*header information*/

//return $arMatchResponsePart[1];/*isi data*/

$arMatchResponsePart = preg_split("/\r\n/",$arMatchResponsePart[1],2);/*dibatas 2 partisi*/

$response=substr_replace($arMatchResponsePart[1],"",-5,1);/*menghilangkan end response 0*/

return $response;

}

}

$HttpRequest=new HttpRequest("http://localhost/lab/phpsocket/dataonserver.php");

//$HttpRequest->addRequestHeader("Content-Type: text/html; charset=utf-8");

//$HttpRequest->addRequestHeader("Accept: text/plain");



$HttpRequest->addData("act","smsout");

$HttpRequest->addData("mess","test `~!@#$%^&*()_+|{}:\"<>?-=\[];',./");



$HttpRequest->sendRequest("GET","");

//$HttpRequest->sendRequest("POST","act=".urlencode("testdari send"));



//echo $HttpRequest->getResponse();

echo $HttpRequest->getResponseBody();


bg83

Friday, April 25, 2008

urlencode

bingung knapa posting lewat url kadang gagal,
dalam beberapa character memang suka error

awalnya bikin char convert, ribet juga
udah lama, hasilnya jg blm tentu sesuai keinginan

cari" mendingan pake url encoder
ngak terlalu sulit tinggal masukin stringnya
semuanya beres......


bg83

semalem ngejava

smalem ngejava,
lumayan juga ada yang yangkut,
sekarang tinggal ngantuknya,
soalnya ngak tidur pisan.
ya... apa boleh buat
klo mau bisa kudu mau ngorbanin sesuatu

malem teh ngulik java networking
hasilnya bisa bikin Rhttp hasil korek"
dari contoh ha..

barusan aq dpt url yg bagus :

http://www.ibiblio.org/java/books/jnp/javanetexamples/index.html


bg83

Thursday, April 24, 2008

fireftp client

Jangan bingung nyari app ftp client
bisa jadi fireftp bisa menjadi solusi
ini merupakan add on bwt mozilla firefox

kunjungi :
https://addons.mozilla.org/en-US/firefox/addon/684
http://fireftp.mozdev.org/
langsung install ke firefox kamyu

userfriendly pisan, ngak terlalu rumit
cobadeh...

bg83

Wednesday, April 23, 2008

quick_sms 01.02

<script language="javascript" src="module/quick_sms/jquery-1.2.2.js"></script>

<div id="_quick_sms" style="position: absolute;left: 393px; top: 64px; display:none;">

<form id="form_quick_sms" name="form_quick_sms" action="">

<table border="0" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF" id="t_quick_sms" style="border:thin solid #999999;">

<tr>

<td colspan="3" bgcolor="#CCCCCC"><strong>Quick SMS Vonix v.01.02 </strong></td>

</tr>

<tr>

<td valign="top"><strong>Mid</strong></td>

<td valign="top"><strong>:</strong></td>

<td><input name="mid" type="text" id="mid" readonly="true"/></td>

</tr>

<tr>

<td valign="top"><strong>Nama</strong></td>

<td valign="top"><strong>:</strong></td>

<td><input name="nama" type="text" id="nama" readonly="true"/></td>

</tr>

<tr>

<td valign="top"><strong>Nohp</strong></td>

<td valign="top"><strong>:</strong></td>

<td><input name="nohp" type="text" id="nohp" /></td>

</tr>

<tr>

<td valign="top"><strong>Pesan</strong></td>

<td valign="top"><strong>:</strong></td>

<td><textarea name="mess" id="mess"></textarea>

<br />

<input name="charlength" type="text" id="charlength" value="0" size="1" readonly="true"/>

<input name="countsms" type="text" id="countsms" value="0" size="1" readonly="true"/>

<input name="clear" type="button" id="clear" value="Clear" /></td>

</tr>

<tr>

<td valign="top">&nbsp;</td>

<td valign="top">&nbsp;</td>

<td><input name="kirim" type="button" id="kirim" value="Kirim" />

<input name="cancel" type="button" id="cancel" value="Cancel" /></td>

</tr>

</table>

</form>

</div>

<script language="javascript">

quick_sms={

show:function(){$("#_quick_sms").show();},

hide:function(){$("#_quick_sms").hide();},

make:function(mid,nama,nohp){

this.show();

$("#form_quick_sms #mid").val(mid);

$("#form_quick_sms #nama").val(nama);

$("#form_quick_sms #nohp").val(nohp);

this.clearmess();

},

kirim:function(){

nohp=this.validhp();

mess=this.validmess();

if(this.getcharlength()>0){

/*metode for smscc2*/

//$.post("../process.php",{act:"smsout",idin:"0",nohp:nohp,mess:mess},function(msg){alert("Data Saved: "+msg);});



/*metode for other app*/

$.post("module/quick_sms/relay_quick_sms.php",{act:"smsout",idin:"0",nohp:nohp,mess:mess},function(msg){alert("Data Saved: "+msg);});

}else{

alert("data yang dikirim belum memadai");

}

},

replacinghp:function(nohp,f,r){

l=nohp.length;

lf=f.length;

out=r+nohp.substring(lf,l);

//alert(out);

return out;

},

validhp:function(){

nohp = $("#form_quick_sms #nohp").val();

if(nohp.substring(0,2)=="08"){

//alert(1);

return quick_sms.replacinghp(nohp,"08","08");

}else if(nohp.substring(0,2)=="02"){

//alert(2);

return quick_sms.replacinghp(nohp,"02","02");

}else if(nohp.substring(0,2)=="62"){

//alert(3);

return quick_sms.replacinghp(nohp,"62","0");

}else if(nohp.substring(0,3)=="+62"){

//alert(4);

return quick_sms.replacinghp(nohp,"+62","0");

}

},

validmess:function(){

return this.getmess();

},

updateview:function(){

$("#form_quick_sms #charlength").val(this.getcharlength());

$("#form_quick_sms #countsms").val(this.getcountsms());

},

getcharlength:function(){return this.getmess().length;},

getcountsms:function(){

l=this.getcharlength();

if(l<=0){

return 0;

}else if((l>0)&&(l<=160)){

return 1;

}else if((l>160)&&(l<=320)){

return 2;

}else if(l>320){

alert("melebihi batas maksimum character");

/*cut maximum*/

this.setmess(this.getmess().substring(0,320));

this.updateview();

return 2;

}

},

getmess:function(){return $("#form_quick_sms #mess").val();},

setmess:function(val){$("#form_quick_sms #mess").val(val);},

clearmess:function(){quick_sms.setmess(""); quick_sms.updateview();}

}

$("#form_quick_sms #kirim").click(

function(){

quick_sms.kirim();

}

);

$("#form_quick_sms #mess").keyup(

function(event){

if(event.keyCode==13){

quick_sms.setmess(quick_sms.getmess().substring(0,quick_sms.getcharlength()-1));

}

quick_sms.updateview();

}

);

$("#form_quick_sms #clear").click(function(){quick_sms.clearmess();});

$("#form_quick_sms #cancel").click(function(){quick_sms.hide();});

</script>

<input type="button" name="Button" value="89063" onClick="quick_sms.make('89063','Gunawan','085221005500');" style="display:none;">

relay_quick_sms.php
<?php

$act=$_POST['act'];

$idin=$_POST['idin'];

$nohp=$_POST['nohp'];

$mess=$_POST['mess'];

function convertCharsForHttp($msg) {

$result = $msg;

$result = str_replace("%","%25",$result);

$result = str_replace(" ","%20",$result);

$result = str_replace("!","%21",$result);

$result = str_replace("\"","%22",$result);

$result = str_replace("#","%23",$result);

$result = str_replace("$","%24",$result);

$result = str_replace("&","%26",$result);

$result = str_replace("'","%27",$result);

$result = str_replace("(","%28",$result);

$result = str_replace(")","%29",$result);

$result = str_replace("*","%2A",$result);

$result = str_replace("+","%2B",$result);

$result = str_replace(",","%2C",$result);

$result = str_replace("-","%2D",$result);

$result = str_replace(".","%2E",$result);

$result = str_replace("/","%2F",$result);

$result = str_replace(":","%3A",$result);

$result = str_replace("-","%3B",$result);

$result = str_replace("<","%3C",$result);

$result = str_replace("=","%3D",$result);

$result = str_replace(">","%3E",$result);

$result = str_replace("@","%40",$result);

$result = str_replace("_","%5F",$result);

return $result;

}

$mess=convertCharsForHttp($mess);

//echo "http://$ip:$port/addtrans?tujuan=$receiver&mess=$mess&id_chip=$id_chip&id_server=$id_server&id_app=$id_app&cara_kirim=$cara_kirim&id_ref=$id&id_trans=1";

//echo "java RelayToHttp \"http://$ip:$port/addtrans?tujuan=$receiver&mess=$mess&id_chip=$id_chip&id_server=$id_server&id_app=$id_app&cara_kirim=$cara_kirim&id_ref=$id&id_trans=1\"";

//echo exec("java RelayToHttp \"http://$ip:$port/addtrans?tujuan=$receiver&mess=$mess&id_chip=$id_chip&id_server=$id_server&id_app=$id_app&cara_kirim=$cara_kirim&id_ref=$id&id_trans=1\"");

//echo "java RelayToHttp \"http://192.168.1.23/smscc2/process.php?act=$act&idin=$idin&nohp=$nohp&mess=$mess\"";

//echo "\n";

echo exec("java RelayToHttp \"http://192.168.1.23/smscc2/process.php?act=$act&idin=$idin&nohp=$nohp&mess=$mess\"");


?>



bg83

quick_sms 01.01

quick_sms={

set:function(mid,nama,nohp){

//alert('set');

quick_sms.makeform();

document.from_quick_sms.mid.value=mid;

document.from_quick_sms.nama.value=nama;

document.from_quick_sms.nohp.value=nohp;

},

convertCharsForHttp:function (msg) {

result = msg;

result = result.replace("%","%25");

result = result.replace(" ","%20");

result = result.replace("!","%21");

result = result.replace("\"","%22");

result = result.replace("#","%23");

result = result.replace("$","%24");

result = result.replace("&","%26");

result = result.replace("'","%27");

result = result.replace("(","%28");

result = result.replace(")","%29");

result = result.replace("*","%2A");

result = result.replace("+","%2B");

result = result.replace(",","%2C");

result = result.replace("-","%2D");

result = result.replace(".","%2E");

result = result.replace("/","%2F");

result = result.replace(":","%3A");

result = result.replace("-","%3B");

result = result.replace("<","%3C");

result = result.replace("=","%3D");

result = result.replace(">","%3E");

result = result.replace("@","%40");

result = result.replace("_","%5F");

return result;

},

clearmess:function(){

//alert("clear");

document.from_quick_sms.mess.value="";

quick_sms.hitchar();

},

messkeyup:function(event){

if(event.keyCode==13){

mess=document.from_quick_sms.mess.value;

l=mess.length;

document.from_quick_sms.mess.value=mess.substring(0,(l-1));

return;

}

quick_sms.hitchar();

},

hitchar:function(){

mess=document.from_quick_sms.mess.value;

l=mess.length;

document.from_quick_sms.charlength.value=l;

limit=320;

if(l>limit){

alert("maaf pesan anda melebihi batas maksimum");

document.from_quick_sms.mess.value=mess.substring(0,limit);

mess=document.from_quick_sms.mess.value;

l=mess.length;

document.from_quick_sms.charlength.value=l;

}

if((l>0)&&(l<=160)) {csms=1;}else if((l>160)&&(l<=320)) {csms=2;}else{csms=0;}

document.from_quick_sms.countsms.value=csms;

},

kirim:function(){

mess=document.from_quick_sms.mess.value;

//nohp="6285221005500";

nohp=document.from_quick_sms.nohp.value;

nohp=quick_sms.validhp(nohp);

mess=quick_sms.convertCharsForHttp(mess);

if(mess!=""){

alert('http://192.168.1.23/smscc2/process.php?act=smsout&idin=0&nohp='+nohp+'&mess='+mess);

}else{

alert('anda belum menuliskan pesan yang akan dikirimkan');

}

},

replacinghp:function(nohp,f,r){

l=nohp.length;

lf=f.length;

out=r+nohp.substring(lf,l);

//alert(out);

return out;



},

validhp:function(nohp){

if(nohp.substring(0,2)=="08"){

//alert(1);

return quick_sms.replacinghp(nohp,"08","08");

}else if(nohp.substring(0,2)=="02"){

//alert(2);

return quick_sms.replacinghp(nohp,"02","02");

}else if(nohp.substring(0,2)=="62"){

//alert(3);

return quick_sms.replacinghp(nohp,"62","0");

}else if(nohp.substring(0,3)=="+62"){

//alert(4);

return quick_sms.replacinghp(nohp,"+62","0");

}

},

cancel:function(){

/*

document.from_quick_sms.mid.value="";

document.from_quick_sms.nama.value="";

document.from_quick_sms.nohp.value="";

quick_sms.clearmess();

*/

document.getElementById("quick_sms").innerHTML="";

},

makeform:function(){

out='<form action="" method="post" name="from_quick_sms" id="from_quick_sms">'+

'<table border="0">'+

'<tr>'+

'<td colspan="3">'+

'Quick Sms'+

'<input name="charlength" type="text" id="charlength" size="1" value="0">'+

'<input name="countsms" type="text" id="countsms" size="1" value="0">'+

'<input type="button" name="Button" value="clear" onClick="quick_sms.clearmess();">'+

'</td>'+

'</tr>'+

'<tr>'+

'<td>Mid</td>'+

'<td>:</td>'+

'<td><input name="mid" type="text" id="mid"></td>'+

'</tr>'+

'<tr>'+

'<td>Nama</td>'+

'<td>:</td>'+

'<td><input name="nama" type="text" id="nama"></td>'+

'</tr>'+

'<tr>'+

'<td>NoHp </td>'+

'<td>:</td>'+

'<td><input name="nohp" type="text" id="nohp"></td>'+

'</tr>'+

'<tr>'+

'<td>Pesan</td>'+

'<td>:</td>'+

'<td><textarea name="mess" id="mess" onKeyUp="quick_sms.messkeyup(event);"></textarea></td>'+

'</tr>'+

'<tr>'+

'<td>&nbsp;</td>'+

'<td>&nbsp;</td>'+

'<td><input type="button" name="Submit2" value="kirim" onClick="quick_sms.kirim();"> '+

'<input type="button" name="Submit3" value="Cancel" onClick="quick_sms.cancel();">'+

'</td>'+

'</tr>'+

'</table>'+

'</form>';

document.getElementById("quick_sms").innerHTML=out;

}

}

document.getElementById("quick_sms").innerHTML="";

var a=10;


htmlnya


<style type="text/css">

<!--

#quick_sms {

border: 1px solid #0000FF;

width: 300px;

z-index: 100;

margin-left: 300px;

position: absolute;

left: -21px;

top: 12px;

background-color: #FFFFFF;

}

-->

</style>


<div id="quick_sms">

<form action="" method="post" name="from_quick_sms" id="from_quick_sms">

<table border="0">

<tr>

<td colspan="3">

Quick Sms

<input name="charlength" type="text" id="charlength" size="1" value="0">

<input name="countsms" type="text" id="countsms" size="1" value="0">

<input type="button" name="Button" value="clear" onClick="quick_sms.clearmess();">

</td>

</tr>

<tr>

<td>Mid</td>

<td>:</td>

<td><input name="mid" type="text" id="mid"></td>

</tr>

<tr>

<td>Nama</td>

<td>:</td>

<td><input name="nama" type="text" id="nama"></td>

</tr>

<tr>

<td>NoHp </td>

<td>:</td>

<td><input name="nohp" type="text" id="nohp"></td>

</tr>

<tr>

<td>Pesan</td>

<td>:</td>

<td><textarea name="mess" id="mess" onKeyUp="quick_sms.messkeyup(event);"></textarea></td>

</tr>

<tr>

<td>&nbsp;</td>

<td>&nbsp;</td>

<td><input type="button" name="Submit2" value="kirim" onClick="quick_sms.kirim();">

<input type="button" name="Submit3" value="Cancel" onClick="quick_sms.cancel();">

</td>

</tr>

</table>

</form>

</div>

<input type="submit" name="Submit" value="set quick sms" onClick="setquick_sms('89063','Gunawan','+6285221005500');">

<script language="javascript">

function bageerjs(file){

var js = document.createElement("script");

js.src=file;

document.getElementsByTagName("head")[0].appendChild(js);

}

function setquick_sms(mid,nama,nohp){

if (typeof quick_sms == "undefined") {

alert('blm ada');

bageerjs('testload.js');

quick_sms.set(mid,nama,nohp);

}else{

alert("sudah ada");

}

quick_sms.set(mid,nama,nohp);

}

</script>

compare jquery metode post

saya akan bahas tentang pemilihan cara untuk memposting data menggunakan ajax yang ada di jquery.
ada beberapa metode diantaranya:

metode 1 dengan script demikian:
$.ajax({
type: "POST",
url: "relay_quick_sms.php",
data: "act=smsout&idin=0&nohp="+nohp+"&mess="+mess,
success: function(msg){alert( "Data Saved: " + msg );}
});

metode 2 dengan script demikian:
$.post("relay_quick_sms.php",
{act:"smsout",idin:"0",nohp:nohp,mess:mess},
function(msg){alert("Data Saved: "+msg);}
);

pilih mana ya?,
ni hasil lab bageer83

type metode 1 metode 2
char & tdk di encode diencode dl

jika mau post ajax dengan aman lebih baik gunakan metode 2,
karena data yang akan dikirim diencode dl sama jquerynya.
sedangkan jika menggunakan metode 1, kita akan mendapatkan masalah pada pengiriman data berkarakter spesial,
mungkin hasil lab saya ini bisa saja berubah seiring perkembangan versinya,
saat ini saya menggunakan jquery-1.2.2.js.

yang punya hasil lab, bisa sharing disini okey
selamat mencoba
moga bermanfaat.

bg83

Tuesday, April 22, 2008

loading js file

function bageerjs(file){
var js = document.createElement("script");
js.src=file;
document.getElementsByTagName("head")[0].appendChild(js);
}
document.getElementById("loadjs").onclick=function(){
//alert('aa');
bageerjs('testload.js');
}

bg83

no enter key





bg83

Javascript Char Codes (Key Codes)

Javascript Char Codes (Key Codes)












































































































































































































































































































































































































































































Key Pressed Javascript Key Code
backspace 8
tab 9
enter 13
shift 16
ctrl 17
alt 18
pause/break 19
caps lock 20
escape 27
page up 33
page down 34
end 35
home 36
left arrow 37
up arrow 38
right arrow 39
down arrow 40
insert 45
delete 46
0 48
1 49
2 50
3 51
4 52
5 53
6 54
7 55
8 56
9 57
a 65
b 66
c 67
d 68
e 69
f 70
g 71
h 72
i 73
j 74
k 75
l 76
m 77
n 78
o 79
p 80
q 81
r 82
s 83
t 84
u 85
v 86
w 87
x 88
y 89
z 90
left window key 91
right window key 92
select key 93
numpad 0 96
numpad 1 97
numpad 2 98
numpad 3 99
numpad 4 100
numpad 5 101
numpad 6 102
numpad 7 103
numpad 8 104
numpad 9 105
multiply 106
add 107
subtract 109
decimal point 110
divide 111
f1 112
f2 113
f3 114
f4 115
f5 116
f6 117
f7 118
f8 119
f9 120
f10 121
f11 122
f12 123
num lock 144
scroll lock 145
semi-colon 186
equal sign 187
comma 188
dash 189
period 190
forward slash 191
grave accent 192
open bracket 219
back slash 220
close braket 221
single quote 222




bg83

Monday, April 14, 2008

test

test

Permisi

Ngikut nge blog ah...