Memaparkan catatan dengan label Php. Papar semua catatan
Memaparkan catatan dengan label Php. Papar semua catatan

Sabtu, November 08, 2014

Hacked - UpahBuatSistemPhp.com !



Opss ! 

Rabu, Februari 12, 2014

PHP : Watermark

<?php

watermark('img.png', 'watermark.png');

function watermark($dst_im, $src_im, $im_save=NULL){
    $src_im = imagecreatefrompng($src_im);//create image from source
    $dst_im = imagecreatefrompng($dst_im);//create image from destination
    imagecopy($dst_im, $src_im, 0, 0, 0, 0, imagesx($src_im), imagesy($src_im));//merge watermark into image
    header('Content-type: image/png');//send image header to browser
    imagepng($dst_im);//send image content to browser
}
?>

Sumber : http://daif.net/script/watermark.phps

Ahad, Januari 12, 2014

PHP : Time zone Asia / Kuala Lumpur

<?php
date_default_timezone_set('Asia/Kuala_Lumpur');
echo date('Y-m-d H:i:s');
?>

Khamis, Disember 26, 2013

PHP + Gammu : Auto reply

Index.php
<?php

mysql_connect("localhost","root","");
mysql_select_db("sms");
?>
<html>
    <head>
    <title>Auto Reply</title>
<script language="javascript" src="jquery-1.7.2.min.js"></script>
<script>
$(document).ready(function(){
    autoreplay();
});

function autoreplay(){
    $.ajax({
        url : 'auto_kirim.php',
        success : function(msg) {
            $('tr.first').after(msg).fadeIn(300);
        }
    });
    setTimeout("autoreplay()",10000);
}
</script>
</head>
<body>
<table>
    <tr class="first">
        <td>Pesan</td>
        <td>Pengirim</td>
        <td>Status Kirim</td>
    </tr>
<?php

$query = mysql_query("SELECT * FROM inbox WHERE Processed='true'");
while($data = mysql_fetch_object($query)){
?><tr>
    <td><?php echo $data->Text; ?></td>
        <td><?php echo $data->SenderNumber; ?></td>
        <td><?php echo $data->Processed; ?></td></tr>
<?php
} 

?>
</body>
</html>



Autoreply.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("sms");
$query = mysql_query("SELECT * FROM inbox WHERE Processed='false'");
while($data = mysql_fetch_object($query)){

    //Disini letak Parsing Data
    //Anda bisa tambahkan  parsing Data Anda Sendiri
    $text = "Pesan Anda adalah ".$data->Text;
    //==============================================
    
    //Masukkan pesan ke Table outbox
    $q2 = mysql_query("INSERT INTO outbox(DestinationNumber, TextDecoded, CreatorID) VALUES ('".$data->SenderNumber."','".$text."','Gammu')");

    //Update Pesan Terkirim pada table inbox
    $q3 = mysql_query("UPDATE inbox SET Processed = 'true' WHERE ID = '".$data->ID."'");

    //output berupa row pada table
    ?>
    <tr>
        <td><?php echo $data->Text; ?></td>
        <td><?php echo $data->SenderNumber; ?></td>
        <td>true</td>
    </tr>
    <?php
} 
?>

Sumber :
http://onthecomputershare.blogspot.com/2012/06/software-sms-auto-reply-sms-gateway.html

Khamis, Disember 19, 2013

PHP : Cari lirik lagu

<html>
<head>
<title>SongLyric Searcher by 1.13.19.Hacker</title>
<link type="text/css" rel="stylesheet" href="http://1-13-19-hacker.eu.pn/Resources/css/style.css" />
</head>
<body>
<center><h1>SongLyric Searcher</h1>by <a href="http://www.facebook.com/1.13.19.Hacker" target="_blank">1.13.19.Hacker</a><form method="POST" action="" id="lirik_lagu" name="lirik_lagu" class="form-wrapper"><br />
<table border="0"><tr><td>Artist</td><td><input type="text" name="artis" value="<?php if(isset($_POST['artis'])){ echo htmlentities($_POST['artis']); } else { echo '';} ?>" /></td></tr>
<tr><td>Song Title</td><td><input type="text" name="judul" value="<?php if(isset($_POST['judul'])){ echo htmlentities($_POST['judul']); } else { echo '';} ?>" /></td></tr>
<tr><td colspan="2"><input type="submit" name="submit" id="submit" value="Search" /></td></tr></table></form><br />
<?php
function get_string_between($string, $start, $end){
    $string = " ".$string;
    $ini = strpos($string,$start);
    if ($ini == 0) return "";
    $ini += strlen($start);
    $len = strpos($string,$end,$ini) - $ini;
    return substr($string,$ini,$len);
}

if($_POST['submit']=="Search"){
    if(isset($_POST['artis']) && !empty($_POST['artis']) && isset($_POST['judul']) && !empty($_POST['judul'])){
        $source = file_get_contents("http://www.songlyrics.com/".str_replace(" ", "-",$_POST['artis'])."/".str_replace(" ", "-",$_POST['judul'])."-lyrics/");
        if (!empty($source)) {
            $output = get_string_between($source, '<p id="songLyricsDiv" ondragstart="return false;" onselectstart="return false;" oncontextmenu="return false;" class="songLyricsV14">','</p>');
            //$output = str_replace("<br />","",$output);
            if(strpos($output, 'Sorry, we have no') !== FALSE){$output = "<script>alert('Lyric not found!')</script>";}
            echo ($output);
        }
        else{
            echo "<script>alert('Unable to grab data')</script>";
        }
    }
    else{
        echo "<script>alert('Please fill all textbox!')</script>";
    }
}
?></center>
</body></html> 
12-12-2013 05:49 AM 
* sumber : Aku pun lupa mana aku copy..haha..tuih

Rabu, Disember 18, 2013

PHP : Round 2 decimal floating point

<?php
echo(round(4.96754,2) . "<br>");
echo(round(7.045,2) . "<br>");
echo(round(7.055,2));
?>

Isnin, Disember 16, 2013

FIX PHP : Warning: Cannot modify header information - headers already sent

<?php
  ob_start();

  // sumbat dan goreng kod kat dalam ni 

 ob_end_flush();
?> 
* Dengan sedikit hack (pakai dengan cara ni).. kita boleh abaikan masalah warning @ notice tersebut. Masalah ni biasanya berpunya daripada whitespace antara tag <?php dan ?> ...tapi kalau kod dah cecah lebih daripada 2K baris. Tak sanggup dah nak baca beb..huhu.. pakai cara ni mudah. Letak je ob_start(); kat atas fail kemudian ob_end_flush(); kat baris paling bawah dalam fail..semoga mujarab \m/

Selasa, Disember 10, 2013

PHP+JavaScript : Echo Alert box

<?php
echo '<script type="text/javascript">alert("Data: ' . $var . '");</script>';
?>

Isnin, Disember 02, 2013

PHP : Redirect location (header)

<?php 
header("Refresh: 3: url=http://0x2013.com"); 
echo '<h1>Anda akan ke laman saya dalam 3 saat</h1>';
?>

Ahad, November 24, 2013

LAMPP : Permision denied "/op/lampp/htdoc" - FIXED!

Bila pasang XAMPP dalam linux, semua web files akan sumbat dalam folder htdocs. Tapi masalahnya. Asyik kena recursive chmod je folder website (htdocs) dan sangat leceh bila nak buat kerja (sangat busy beb!). Jadi, cara mudah.. kita letakkan bawah user dan group komputer kita sendiri. Tak faham? Ok. Contoh lah web saya tu dalam folder "pinktube" (bukan redtube ok?), dan saya nak buat index.php dalam tu.
$ touch /opt/lampp/htdocs/pinktube/index.php
touch: cannot touch ‘/opt/lampp/htdocs/pinktube/index.php’: Permission denied
Nampak tak masalah kat atas? Bayangkan ada banyak fail dan folder. Nak chmod 755 -R pun rasa malas klau ada banyak folder lain dan kena kerap kali buat macamni. Tu belum masuk lagi kes orang yang tak tahu guna recursive chmod. Mesti kojol kalau dia chmod fail satu per satu..kah..kah..

Penyelesaian Mudah :
===================
1. Kita kenal pasti user dan group:
$ who am i
Contoh output:
syasha      pts/1        2023-14-54 01:44 (:0)
* amik output yang depan sekali untuk kenal pasti user dan group , sebagai contoh diatas ialah "syasha"

2. Set direktori /op/lampp/htdocs/ tersebut dengan permision dari output user dan group di atas
$ sudo chown -R username:username /opt/lampp/htdocs
Klu ikot contoh aku, username tu perlulah ganti dengan syasha..bergantung pada komputer korang la.

3. Edit fail httpd.conf
$ sudo nano /opt/lampp/etc/httpd.conf
Cari maklumat bawah bahagian <IfModule unixd_module>
User deamon
Group deamon
Ganti deamon tu dengan user dan group anda sendiri. Simpan dan restart lampp anda. Ok selesai.. try la buat fail atau folder, dah takde masalah lagi.

Selamat mencuba!

Jumaat, November 15, 2013

PHP : Saiz imej berdasarkan kadaran ( Proportional resizing image )

<?php
function scale_image($foto, $maxdim){
$thumb_width = $maxdim;
list($fullsize_width, $fullsize_height) = getimagesize($foto);
$thumb_height = @floor($fullsize_height/($fullsize_width/$thumb_width));
if($fullsize_width > $thumb_width){ $width = $thumb_width; $height = $thumb_height; } else { $width = $fullsize_width; $height = $fullsize_height; }

return '<img src="' . $foto . '" width="' . $width . '" height="' . $height . '" />';
}

echo scale_image('image.jpg', '500');
?>

Jumaat, Oktober 11, 2013

PHP : MySQL database size

<html><head><title>mysql database size</title></head><body>  
<h1>mysql database size</h1>  
<?php  
function file_size_info($filesize) {  
 $bytes = array('KB', 'KB', 'MB', 'GB', 'TB'); # values are always displayed  
if ($filesize < 1024) $filesize = 1; # in at least kilobytes.  
for ($i = 0; $filesize > 1024; $i++) $filesize /= 1024;  
 $file_size_info['size'] = ceil($filesize);  
 $file_size_info['type'] = $bytes[$i];  
 return $file_size_info;  
}  
$db_server = 'put your server here';  
$db_user = 'put your mysql user here';  
$db_pwd = 'put your password here';  
$db_name = 'put your db name here';  
$db_link = @mysql_connect($db_server, $db_user, $db_pwd)  
 or exit('Could not connect: ' . mysql_error());  
$db = @mysql_select_db($db_name, $db_link)  
 or exit('Could not select database: ' . mysql_error());  
// Calculate DB size by adding table size + index size:  
$rows = mysql_query("SHOW TABLE STATUS");  
$dbsize = 0;  
while ($row = mysql_fetch_array($rows)) {  
 $dbsize += $row['Data_length'] + $row['Index_length'];  
}  
print "database size is: $dbsize bytes<br />";  
print 'or<br />';  
$dbsize = file_size_info($dbsize);  
print "database size is: {$dbsize['size']} {$dbsize['type']}";  
?>  
</body></html>

Selasa, Oktober 08, 2013

PHP - Gravatar API Function

<?php
function show_my_gravatar($email, $size, $default, $rating)
{
  $params = '?gravatar_id='.md5($email).'&default='.$default.'&size='.$size.'&rating='.$rating;
  $output = '<img src="http://www.gravatar.com/avatar.php'.$params.'" width="'.$size.'px" height="'.$size.'px" />';
  echo $output;
}
?>

Selasa, Ogos 27, 2013

Bagaimana serangan "SQL injection" dilakukan ?

Isnin, Ogos 19, 2013

PHP : Scan port

<?php
$target = "72.14.207.99"; // your target
$ports = array(21, 25, 79, 80); // http://www.iss.net/security_center/advice/Exploits/Ports/default.htm
$timeout = 1; // ...timeout

function portScan($host, $port, $timeout=30) {
$fp = @fsockopen($host, $port, $errno, $errstr, $timeout);
if ($fp) {
return True;
} else {
return False;
}
}

ob_start();
foreach($ports as $port) {
$scan=portScan($target, $port, $timeout);
if($scan[0]) {
echo "Success $target:$port<br />";
} else {
echo "Fail $target:$port<br />";
}
ob_flush(); // Used to send data right after instead of waiting for entire scan
flush(); // See last comment.
}
?>

PHP : Decryption - stripslashes(gzinflate(base64_decode())

<?php
//name  : stripslashes(gzinflate(base64_decode DECRYPTER

echo '<p align="center">eval(stripslashes(gzinflate(base64_decode DECRYPTER<br><hr>

<p align="center">coded by dika_xb ||
hacker-newbie.org  || hujan.asap@gmail.com<br>
<hr>
<p align="center"> how to use ? <p>
this script :<br> < ?php<br>
eval(stripslashes(gzinflate(base64_decode("<b>SCRIPT HERE</b>"))));
<BR>?>  <br>

put <b>SCRIPT HERE</b> to text box and decrypt <br>';
   set_time_limit(100);    
 
  $isi = $_POST['data'];
        if(isset($isi)){
  




  $isi = str_replace('?>',"",$isi);
$isi = str_replace('<?php eval(("',"",$isi);

$isi = str_replace('"',"",$isi);
$isi = str_replace(')))); ?><?',"",$isi);

$isi = str_replace(')',"",$isi);
$isi = str_replace(';',"",$isi);;
    

  
     

   

   function dec($isi)
   {
         $isi = stripslashes(gzinflate(base64_decode($isi)));

    $isi = str_replace('?><?php eval(stripslashes(gzinflate(base64_decode("',"",$isi);
$isi = str_replace('")))); ?><?',"",$isi);

$cari = ';';
$find = strpos($isi,$cari);

if($find === false) {dec($isi);}
else 
{
    $isi = str_replace("</textarea>","</textarea>",$isi);
   echo "<form action='' method='post'> <textarea rows='8' cols='150' name=data>$isi </textarea><br><br><input type='submit' value='decrtipt'>";
     
}




        
return($isi);
   }
   $i=0;

   $isi = dec($isi);
 


        }
        else
        {
            echo '<form action="" method="post"> 
<textarea name="data" rows="8" cols="150"></textarea> <br>
<input type="submit" value="decrtipt">';
        }
        
     
?>

PHP : Muat-naik fail dari URL

<?php 
$PHP_SELF = $_SERVER['PHP_SELF']; 

if ($_GET[xfer]) { 
if ($_POST[from] == "") { 
print "You forgot to enter a url."; 
} else { 
copy("$_POST[from]", "$_POST[to]"); 
$size = round((filesize($_POST[to])/1000000), 3); 
print "transfer complete.<br> 
<a><a href=\"$_POST[from]\">$_POST[from]</a><br> 
<a><a href=\"$_POST[to]\">$_POST[to]</a> : $size MB"; 
} 
} else { 
print "<form action=\"$PHP_SELF?xfer=true\" method=post> 
from(http://): <input name='from' value=''><br> 
to(filename): <input name='to'><br> 
<input type=submit value=\"transload\">"; 
} 
?>

Ahad, Ogos 18, 2013

PHP : Switch Case

<?php

$day = 'Saturday';

switch ($day) {
case 'Saturday':
case 'Sunday':
echo 'It\'s a weekend.';
break;

default:
echo 'Not a weekend.';
break;
}

?>

Handling Exception & Catch (Throws Code)


Selasa, Ogos 06, 2013

PHP : Bing! Domain Scanner (CLI dan UI)

<?php
/*
name: bing subdomain scanner
author: RieqyNS13
using: php bing.php domain.com
*/
$args = $_SERVER['argv'];
$url = $args[1];
scan($url);
function curl($url){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $exec = curl_exec($ch);
    curl_close($ch);
    return $exec;
}
function scan($url){
    $i=1;
    $jum=0;
    $reg = '@^(https?\://)?(www\.)?([a-z0-9]([a-z0-9]|(\-[a-z0-9]))*\.)+[a-z]+$@i';
    if(preg_match($reg, $url)){
        while(1){
            $curl = curl("http://www.bing.com/search?q=domain:".$url."&first=".$i);
            $data = preg_match_all('#\<div class\="sb_meta"\>\<cite\>(.*?)\</cite\>#is', $curl, $m) ? $m[1] : null;
            if($data==null){
                $count=0;
                goto a;
            }
            foreach($data as $dat){
                $dat_ = preg_match("|/|i", $dat) ? strstr($dat, "/", 1) : $dat ;
                $urls[$i][] = $dat_;
            }
            $count = count($urls[$i]);
            $urls_ = array_unique($urls[$i]);
            sort($urls_);
            foreach($urls_ as $url_){
                echo $url_."\n";
                $jum++;
            }
            $i=$i+10;
            a:
            if($count<10 || $data==null){
                echo "\nJumlah subdomain terdeteksi: ".$jum;
                exit;
            }    
        }
    }else{
        echo "URL tidak valid";
        exit;
    }
}
?>


<?php
//bacoked by rieqy
ini_set("output_buffering", "Off");
set_time_limit(0);
//:dead
if(isset($_POST['submit'])){
    if(!empty($_POST['domain'])){
        $domain = trim($_POST['domain']);
    }else $domain = null;
    
}else $domain = null;
?>
<html>
<head>
<title>Bing Subdomain Scanner by RieqyNS13</title>
<meta name="author" content="RieqyNS13">
<meta name="description" content="Bing Subdomain Scanner by RieqyNS13">
</head>
<body>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method=POST>
<label for="subdomain">Masukkan domain</label>&nbsp<input type="text" value="<?php echo $domain; ?>" name="domain" style="width:200px" placeholder="e.g. http://gay.com or gay.com"><input type="submit" name="submit" value="Scan"><br>
<textarea placeholder="subdomain akan ditampilkan di sini" rows="20" cols="35" readonly>
<?php
if(isset($domain) && !empty($domain)){
    scan($domain);
}
function curl($url){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $exec = curl_exec($ch);
    curl_close($ch);
    return $exec;
}
function scan($url){
    $i=1;
    $jum=0;
    $reg = '@^(https?\://)?(www\.)?([a-z0-9]([a-z0-9]|(\-[a-z0-9]))*\.)+[a-z]+$@i';
    if(preg_match($reg, $url)){
        while(1){
            $curl = curl("http://www.bing.com/search?q=domain:".$url."&first=".$i);
            $data = preg_match_all('#\<div class\="sb_meta"\>\<cite\>(.*?)\</cite\>#is', $curl, $m) ? $m[1] : null;
            if($data==null){
                $count=0;
                goto a;
            }
            foreach($data as $dat){
                $dat_ = preg_match("|/|i", $dat) ? strstr($dat, "/", 1) : $dat ;
                $urls[$i][] = $dat_;
            }
            $count = count($urls[$i]);
            $urls_ = array_unique($urls[$i]);
            sort($urls_);
            foreach($urls_ as $url_){
                echo $url_."\n";
                ob_flush();flush();
                $jum++;
            }
            $i=$i+10;
            a:
            if($count<10 || $data==null){
                echo "\nJumlah subdomain terdeteksi: ".$jum;
                ob_flush();flush();
                exit;
            }    
        }
    }else{
        echo "URL tidak valid";
        ob_flush();flush();
        exit;
    }
}
?>
</textarea>
</form>
</body>
</html>