Showing posts with label Free PHP Tutorial. Show all posts
Showing posts with label Free PHP Tutorial. Show all posts

Multiple Upload

intro :

For women, breasts enlarge since young, most probably starting at the age of 10. However, the shape and size might be different for different individuals. It actually depends on your body figure, food that you consume daily and type of exercises you perform. Most of the women started to regret once their puberty period has over and their breasts are either too small or out of shape. So, this article will explain to you several tips for breast enlargement.
inti:
form_uploadefiles.php 
<em><FORM ENCTYPE="MULTIPART/FORM-DATA" ACTION="uploadfiles.php" METHOD="POST">
File 1: <INPUT TYPE="FILE" NAME="fupload[]"><BR>
File 2: <INPUT TYPE="FILE" NAME="fupload[]"><BR>
File 3: <INPUT TYPE="FILE" NAME="fupload[]"><BR>
File 4: <INPUT TYPE="FILE" NAME="fupload[]"><BR>
File 5: <INPUT TYPE="FILE" NAME="fupload[]"><BR>
<INPUT TYPE="SUBMIT" VALUE="Upload">
</FORM>.</em>

uploadesfiles.php
&lt;em&gt;&lt;?php
$lokasi_file = $_FILES['fupload']['tmp_name'];
$nama_file = $_FILES['fupload']['name'];
$ukuran_file = $_FILES['fupload']['size'];

echo &quot;File-file yang berhasil diupload: &lt;BR&gt;&lt;BR&gt;&quot;;

//Hitung jumlah file yang diupload
$jml_file=count($nama_file);
$i=0;

//Lakukan perulangan selama $i &lt;= jumlah file yang diupload
while ($i &lt; $jml_file)
{
if ($nama_file[$i] != &quot;&quot;){
$direktori = &quot;files/$nama_file[$i]&quot;;
move_uploaded_file($lokasi_file[$i],&quot;$direktori&quot;);
echo &quot;&lt;B&gt;$nama_file[$i]&lt;/B&gt;&lt;BR&gt;&quot;;

// Masukkan informasi file ke database
mysql_connect(&quot;localhost&quot;,&quot;root&quot;,&quot;&quot;);
mysql_select_db(&quot;pintar&quot;);
$input=&quot;INSERT INTO upload_file(nama_file,ukuran_file,deskripsi,direktori)
VALUES('$nama_file[$i]','$ukuran_file[$i]','$_POST[deskripsi]','$direktori')&quot;;
mysql_query($input);
}
$i++;
}
?&gt;

.&lt;/em&gt;

hasilnya :

Tutorial PHP Membuat ComboBox Langsung Action


ComboBox dapat dibuat langsung action, artinya ketika dipilih langsung memberikan respon tanpa harus menekan tombol submit.Misalnya pada pembuatan jump menu dan filterasi.

combolangsung.php

<?php
mysql_connect("localhost","root","pajarmaning");
mysql_select_db("dbphp");

echo "<form method=get action=$_SERVER[PHP_SELF]>";
echo "Fakultas : <select name='jurusan' onChange='this.form.submit()'>";

echo "<option value=0 selected>- Pilih Jurusan -</option>";

$sql=mysql_query("select * from jurusan");
while ($data=mysql_fetch_array($sql)){
if ($data[id_jur]==$_GET[jurusan])
echo "<option value=$data[id_jur] selected>$data[nama_jur]</option>";
else
echo "<option value=$data[id_jur]>$data[nama_jur]</option>";
}
echo "</select></form>";

if (isset($_GET[jurusan])){
echo "Program Studi : <br>";
$sql2=mysql_query("select * from prodi where id_jur='$_GET[jurusan]'");
while ($row=mysql_fetch_array($sql2)){
echo "$row[nama]<br>";
}
}
?>

Download script

Tutorial php mencegah terjadinya overwrite

Overwrite adalah hilangnya sebuah file di server dikarenakan masuknya sebuah file dengan nama yang sama masuk pada server.Ada cara praktis dimana file yang di upload pngguna , nama filenya akan di ubah secara otomatis sebelum di copy-kan keserver dengan nama yang unik.

overwrite.php

$lokasi_file = $_FILES['fupload']['tmp_name'];
$ukuran_file = $_FILES['fupload']['size'];
$nama_file = $_FILES['fupload']['name'];

// Buat nama file jadi unik
$acak           = rand(0000,9999);
$nama_file_unik = $acak.$nama_file;

$direktori      = "files/$nama_file_unik";
if (move_uploaded_file($lokasi_file,"$direktori")){
  echo "Nama File   : $nama_file_unik berhasil di upload
";
  echo "Ukuran File : $ukuran_file bytes";
 
  // Masukkan informasi file ke database
  mysql_connect("localhost","root","");
  mysql_select_db("dbphp");
  $input="INSERT INTO upload_file(nama_file,ukuran_file,deskripsi,direktori)
          VALUES('$nama_file_unik','$ukuran_file','$_POST[deskripsi]','$direktori')";
  mysql_query($input);
}
else{
  echo "File gagal diupload";
}

?>

pertama jalankan form_uplad.php kemudian klik tombol browse lalu carilah file yang sudah pernah diupload atau naamnay sudah ada di server  kemudian tekan Upload



Download Script

Tutorial PHP Menerapkan Paging ala Google

Intro :
Anyone that plays the Pokemon Emerald game wants to know how to get to the sky pillar in Pokemon Emerald.  So, just sit back, and we will go through some things with you that are taken off the website at Kidz World, Kidzworld.com.  According to the website for game cheats at Kidz World online, the Sky Pillar is one of the coolest places to get to in the game.  It is the home of one of the strongest Pokemon in the game, consists of an ancient tower, and Kidz World can supply you with the details on how to get there.
For instance, Kidz World offers a walkthrough on how to get to the Sky Pillar in Pokemon Emerald, and the Pokemon game cheat for getting to the Sky Pillar comes complete with codes, secrets, hints, and tips straight from Cheat Street.  For more information on how you can get to the Sky Pillar in Pokemon Emerald by using this game cheat strategy, go to the official Kidz World website. 

Inti :


Paginggoogle.php
<table><tr bgcolor=999999><th>No</th><th>Nama</th><th>Alamat</th></tr>
<?php
mysql_connect("localhost","root","");
mysql_select_db("dbphp");

$batas=5;
$halaman=$_GET['halaman'];
if(empty($halaman))
{
$posisi=0;
$halaman=1;
}
else
{
$posisi = ($halaman-1) * $batas;
}

$tampil="select * from anggota limit $posisi,$batas";
$hasil=mysql_query($tampil);

$no=$posisi+1;
while ($data=mysql_fetch_array($hasil)){
echo "<tr bgcolor=cccccc><td>$no</td><td>$data[nama]</td><td>$data[alamat]</td></tr>";
$no++;
}
echo "</table><br>";

$file="paginggoogle.php";

$tampil2="select * from anggota";
$hasil2=mysql_query($tampil2);
$jmldata=mysql_num_rows($hasil2);

$jmlhalaman=ceil($jmldata/$batas);


//link ke halaman sebelumnya (previous)
if($halaman > 1)
{
$previous=$halaman-1;
echo "<A HREF=$file?halaman=1><< First</A> |
<A HREF=$file?halaman=$previous>< Previous</A> | ";
}
else
{
echo "<< First | < Previous | ";
}

$angka=($halaman > 3 ? " ... " : " ");
for($i=$halaman-2;$i<$halaman;$i++)
{
if ($i < 1)
continue;
$angka .= "<a href=$file?halaman=$i>$i</A> ";
}

$angka .= " <b>$halaman</b> ";
for($i=$halaman+1;$i<($halaman+3);$i++)
{
if ($i > $jmlhalaman)
break;
$angka .= "<a href=$file?halaman=$i>$i</A> ";
}

$angka .= ($halaman+2<$jmlhalaman ? " ...
<a href=$file?halaman=$jmlhalaman>$jmlhalaman</A> " : " ");

echo "$angka";

//link kehalaman berikutnya (Next)
if($halaman < $jmlhalaman)
{
$next=$halaman+1;
echo " | <A HREF=$file?halaman=$next>Next ></A> |
<A HREF=$file?halaman=$jmlhalaman>Last >></A> ";
}
else
{
echo " | Next > | Last >>";
}
echo "<p>Total anggota : <b>$jmldata</b> orang</p>";

?>

Download script

Menampilkan data secara selang seling

 Intro:
If you would like to know how to delete an Internet address from the address bar of your computer, you can certainly do that easily. I delete Internet addresses from my address bar by selecting the address in the address bar window and then pressing the delete key. This will clear your Internet address bar window of any Internet addresses that might be showing in the window. Then you can put any other Internet address that you please in the window and press enter to go to the website page of your choice. Another way to delete an Internet address from the address bar of your computer is to align your cursor with the last letter of the address and then press the backspace key until the address is erased from right to left.

If you would like to delete all Internet addresses that are showing within the browser history, say, after you are finished using your computer and ready to power down, then you can clear the history of the Internet Explorer browser of all Internet addresses showing pages that you have visited during your computer session. These are the three ways to delete an Internet address from the address bar of your computer.

Inti:

selangseling.php
<style type="text/css">
table {
border: 1px solid #000000;
}
th {
background-color: #FF9900;
color : #FFFFFF;
}
tr:hover{
background-color: #CCCCCC;
}
</style>

<?php
$warna1 = "#A6D000"; // baris genap berwarna hijau tua
$warna2 = "#D5F35B"; // baris ganjil berwarna hijau muda
$warna = $warna1; // warna default

mysql_connect("localhost","root","");
mysql_select_db('dbphp');
$sql = mysql_query("select * from anggota");

echo "<table cellpadding=4><tr><th>No</th><th>Nama</th><th>Alamat</th></tr>";

$no=1;
while($data=mysql_fetch_array($sql)){
if($warna == $warna1){
$warna = $warna2;
}
else {
$warna = $warna1;
}
echo "<tr bgcolor=$warna><td>$no</td><td>$data[nama]</td><td>$data[alamat]</td></tr>";
$no++;
}
echo "</table>";
?>

Download script.

Mengatasi pilihan combobox yang sama


<script language="JavaScript1.2">

function validate_pil(data) {
var pil1=data.pil1;
var pil2=data.pil2;
var pil3=data.pil3;
if (pil1.value==pil2.value) {
if (pil1.value!=0) {
alert ("Pilihan 1 tidak boleh sama dengan Pilihan 2");
pil2.value=0; }
}
if (pil1.value==pil3.value) {
if (pil1.value!=0) {
alert ("Pilihan 1 tidak boleh sama dengan Pilihan 3");
pil3.value=0; }
}
if (pil2.value==pil3.value) {
if (pil2.value!=0) {
alert ("Pilihan 2 tidak boleh sama dengan Pilihan 3");
pil3.value=0; }
}
}
</script>

<link href="style.css" rel="stylesheet" type="text/css">

<form method=get action=update.php>

<?php
mysql_connect("localhost","root","");
mysql_select_db("dbphp");

//fungsi untuk combobox pilihan

function combo($var, $data) {
echo "<select name='$var' onChange='validate_pil(this.form)'>";
echo "<option value=0 selected>- Pilih Prodi -</option>";
$sql=mysql_query("select * from prodi");
while ($data=mysql_fetch_array($sql)){
echo "<option value=$data[id]>$data[nama]</option>";
}
echo "</select>";
}

echo "Pilihan 1 : ";
combo("pil1",$data1);

echo "<br><br>Pilihan 2 : ";
combo("pil2",$data2);

echo "<br><br>Pilihan 3 : ";
combo("pil3",$data3);

?>
</form>


download script

Membatasi tipe file yang boleh diupload


Uploadtipe.php
<?php
//baca variable tipe, local , nama dan ukuran file
$tipe_file = $_FILES['fupload']['type'];
$lokasi_file = $_FILES['fupload']['tmp_name'];
$nama_file = $_FILES['fupload']['name'];
$ukuran_file = $_FILES['fupload']['size'];


// Jika tipe file bukan gif, jpg (jpeg) dan png
if ($tipe_file != "image/gif" AND
$tipe_file != "image/jpeg" AND
$tipe_file != "image/pjpeg" AND
$tipe_file != "image/png"){
echo "Upload Gagal !!! <br>
Tipe file <b>$nama_file</b> : $tipe_file <br>
Tipe file yang boleh di upload: gif, jpg dan png.";
}
else{
$direktori = "files/$nama_file";
$url = "http://localhost/files";

move_uploaded_file($lokasi_file,"$direktori");
echo "Nama File : <b>$nama_file</b> berhasil di upload <br>";
echo "Tipe Filenya : <b>$tipe_file</b><br><br>";
echo "<img src=$url/$nama_file>";

// Masukkan informasi file ke database
mysql_connect("localhost","root","");
mysql_select_db("dbphp");
$input="INSERT INTO upload_file(nama_file,ukuran_file,deskripsi,direktori)
VALUES('$nama_file','$ukuran_file','$_POST[deskripsi]','$direktori')";
mysql_query($input);
}
?>


download scrip

Menerapkan paging pada searching

 Intro :
It is extremely easy to learn how to get a Yahoo password. First of all, Yahoo is one network that offers homepages and free email accounts to people that affords them the opportunity to obtain a password that goes along with their email account. Another way to obtain a Yahoo password is to establish your Internet service with an Internet service provider, such as A T & T, where they offer the Yahoo browser and software to their Internet customers. Upon establishing your service and setting up your Internet account, you will have the chance to choose your own username, which will usually be your email account, along with a password, that is personally chosen by you, to your new Internet account. Of course, at the same time, this gives you a Yahoo email account, as well.

Follow these simple instructions to set up a free email account. First of all, access the Yahoo.com Internet homepage. Then access the selection that says "email." After accessing the email selection, you will be prompted to put in a username and password if you have one. If you need to establish your account, choose the selection that says "register for an email account." After that, you will be prompted on the instructions of just how to establish your new user ID and password. Once established, you have the opportunity to change your password anytime you wish to for your security.

Inti :

Skrip pagingsearch.php

//form searching
<form method=get action=pagingsearch.php>
Isikan Nama : <input type=text name="nama">
<input type=submit name=oke value=Cari>
</form>

<?php
mysql_connect("localhost","root","");
mysql_select_db("dbphp");
//langkah 1
$oke=$_GET['oke'];
if ($oke=='Cari'){

$batas=5;
$halaman=$_GET['halaman'];

if(empty($halaman)){
$posisi=0;
$halaman=1;
}
else{
$posisi = ($halaman-1) * $batas;
}

//langkah 2
$nama=$_GET['nama'];

$tampil="select * from anggota where nama like '%$nama%' limit $posisi,$batas";
$hasil=mysql_query($tampil);
$jumlah=mysql_num_rows($hasil);

if ($jumlah > 0){
echo "<table >
<tr bgcolor=999999><th>No</th><th>Nama</th><th>Alamat</th></tr>";
$no=$posisi+1;
while ($data=mysql_fetch_array($hasil)){
echo "<tr bgcolor=cccccc><td>$no</td><td>$data[nama]</td><td>$data[alamat]</td></tr>";
$no++;
}
echo "</table>";

//langkah 3
echo "<br>Halaman : ";

$file="paging_2.php";

$tampil2="select * from anggota where nama like '%$nama%'";
$hasil2=mysql_query($tampil2);
$jmldata=mysql_num_rows($hasil2);

$jmlhalaman=ceil($jmldata/$batas);

for($i=1;$i<=$jmlhalaman;$i++)
if ($i != $halaman)
{
echo " <a href=$file?halaman=$i&nama=$nama&oke=$oke>$i</A> | ";
}
else
{
echo " <b>$i</b> | ";
}
echo "<p>Ditemukan <b>$jmldata</b> orang yang bernama <b>$nama</b></p>";

}
else{
echo "Tidak ditemukan data yang bernama <b>$nama</b>";
}
}
?>

Download sript

Menampilkan tanggal saat ini dengan ComboBox

Intro :Would you like to know how to install Windows 2000 Professional? If so, you are in luck because the people at Microsoft have the instructions laid out for you step by step. You can install Windows 2000 Professional by going to the appropriate URL at MicroSoft and following the directions. Below is the URL and some tips from the MicroSoft website:

* First, of course, you should have the MicroSoft Windows 2000 Professional disks to begin the installation.
* Second, if you need to create boot disks, there is an instructional process at the site at this URL to help you do just that. The article number is 19706.
* The URL that is available to step you through the MicroSoft Windows 2000 Professional setup is located at http://support.microsoft.com/kb/304868.
* Follow the 16 steps that MicroSoft has available for the Windows 2000 Professional setup, and you will succeed in a solid installation of the Windows 2000 Professional Software/Operating System.

For the full 16 steps for how to install Windows 2000 Professional, visit the above URL to begin the setup process. Be sure to follow the directions to a "T."

Inti:
<form method=get action=tanggal.php>

<?php
$nama_bln=array(1=> "Januari", "Februari", "Maret", "April", "Mei",
"Juni", "Juli", "Agustus", "September",
"Oktober", "November", "Desember");

echo "Tanggal saat ini : ";
//Tanggal saat ini

$tanggal=date("d");
echo "<select name=tgl>";
for ($i=1; $i<=31; $i++){
if ($tanggal==$i)
echo "<option value=$i selected>$tanggal</option>";
else
echo "<option value=$i>$i</option>";
}
echo "</select>";

//Bulan saat ini

$bulan=date("m");
echo " <select name=bln>";
for ($i=1; $i<=$bulan; $i++){
if ($bulan==$i)
echo "<option value=$i selected>$nama_bln[$i]</option>";
else
echo "<option value=$i>$nama_bln[$i]</option>";
}
echo "</select>";
//Tahun saat ini

$sekarang=date("Y");
echo " <select name=tahun>";
for ($i=2000;$i<=$sekarang;$i++){
if ($sekarang==$i)
echo "<option value=$i selected>$sekarang</option>";
else
echo "<option value=$i>$i</option>";
}
echo "</select></form>";
?>

</form>

Download scrip

Membuat tanggal dengan ComboBox

Intro :I have quite a few single friends who are working professionals with busy lives. They depend heavily on their cell phones as a lifeline to their social lives. As a result, I have been asked the same question many times over and over again. Between Android and the iPhone, which is better to access my online dating profile, social networking sites and generally is the best smart phone OS?

Well, there really is so simple answer to that question. It all comes down to personal preference at the moment because they both similarly can handle all your smart phone needs. You can make calls, text, access social networking sites and utilize your online dating profile on either the Android or iPhone without a problem. On the other hand, both the iPhone and the Android seem to have security issues that need to be addressed as well. In my opinion though, I think it’s a little too premature to tell which OS will prevail in the smart phone arena. Maybe both can survive and co-exist with each other as competitors, which of course brings competition and with competition breeds innovation while keeping costs low. This is the scenario I see for the future with at least two or maybe even three major players in the market.

Inti:
Salah satu cara yang usability untuk memilih tanggal adalah menggunakan ComboBox karena user dapat langsung memilih berdasarkan pilihan yang sudah disediakan didalam ComboBox.Dengan cara tersebut user dapat terhindar dari kesalahan penulisan format tanggal apabila diinputkan dalm ebntuk TextBox biasa.

Scrip tanggal.php

<form method=get action=update.php>

<?php
$nama_bln=array(1=> "Januari", "Februari", "Maret", "April", "Mei",
                    "Juni", "Juli", "Agustus", "September",
                    "Oktober", "November", "Desember");

echo "<select name=tanggal>
      <option value=0 selected>Tgl</option>";
      for ($tgl=1; $tgl<=31; $tgl++){
        echo "<option value=$tgl>$tgl</option>";
      }
      echo "</select> "; 
     
echo "<select name=bulan>
      <option value=0 selected>Bulan</option>";
      for ($bln=1; $bln<=12; $bln++){
        echo "<option value=$bln>$nama_bln[$bln]</option>";
      }  
      echo "</select> ";
     
$thn_skrg=date("Y");
echo "<select name=tahun>
      <option value=0 selected>Tahun</option>";
      for ($thn=2000;$thn<=$thn_skrg;$thn++){
        echo "<option value=$thn>$thn</option>";
      }
      echo "</select>";
?>

</form>

Jalankan :

Menampilkan data vertikal horisontal

Intro:Security is the key issue that these two companies need to address before they do become then next best thing since sliced bread and revolutionize the computing and smart phone industries. Yes, I did say computing industry because these phones are in fact a small handled computer. Android is an open source mobile OS platform that's running on top of Linux kernel and the iPhone’s OS is based on the Mac OS X (Based on FreeBSD) running on the UNIX kernel. This means they both can be hacked, cracked, personal information can be stolen and the phone can be infected by newly emerging viruses and malicious code especially made for smart phones. Can these issues be addressed? Well, they should be being addressed as we speak because ultimately, security is king and users will follow the safest OS available. I know I would.





<?php
$kolom = 3; // Tentukan banyaknya kolom
$no = 1; // Untuk penomoran

mysql_connect("localhost","root","");
mysql_select_db("dbphp");

$sql = mysql_query("SELECT nama FROM anggota");
$jml_baris = mysql_num_rows($sql);

$sisa_bagi = $jml_baris % $kolom;
if ($sisa_bagi == 0)
$no_kolom = $jml_baris / $kolom;
else
$no_kolom = ceil($jml_baris/$kolom)-1;

echo "<table bgcolor=#cccccc border=1 bordercolor=#000000 ><tr >";
$ulang1 = 0;
for($i = 0; $i < $kolom; $i++){
if($sisa_bagi > 0){
$jumbaris = $no_kolom + 1;
$ulang2 = $i * $jumbaris;
$ulang1 = $jumbaris * ($i + 1);
}
else{
$ulang2 = $ulang1;
$ulang1 = ($no_kolom*($i+1))+($jml_baris % $kolom);
}
$sisa_bagi--; // decrease sisa bagi

// Tampilkan per kolom
echo "<td valign=top>";
for($j = $ulang2; $j < $ulang1; $j++){
$data = mysql_fetch_array($sql);
$no = $j+1;
echo "$no. $data[nama] <br>";
}
echo "</td>";
}
echo "</tr></table>";
?>

Download Script

Membatasi Ukuran File yang diupload

Intro:So, with that said, maybe neither the iPhone nor Android will prevail in the smart phone wars in the long run. Although Blackberry has been dramatically loosing market share since the iPhone and Android’s introduction into the market, maybe Blackberry’s eye for security will help make a comeback for their lagging sales and falling market share. Blackberry’s OS has been proprietary since the start and with their new OS6 touted as being the safest smart phone OS available to date; maybe there still is a chance for blackberry to make a comeback. That is of course if in deed Blackberry OS6 is the safest smart phone OS available. Although, through my research, I have found that blackberry is also vulnerable to most security issues that plague Android and iPhone.


Dalam urusan upload file, biasanya ukuran file telah dibatasi oleh server .Kita juga bias mengeceknya pada file php.ini atau melalui phpinfo.php pada bagian post_max_size.

Script upload_max.php

<?php
$lokasi_file = $_FILES['fupload']['tmp_name'];
$nama_file = $_FILES['fupload']['name'];
$ukuran_file = $_FILES['fupload']['size'];

// Jika ukuran file > ukuran maksimal file
if ($ukuran_file > $_POST[ukuran_maks_file]){
echo "Upload Gagal !!! <br>
Ukuran file <b>$nama_file</b> : $ukuran_file bytes<br>
Ukuran file tidak boleh > 1000000 bytes (1 Mb) <br>";
}
else{
$direktori_file = "files/$nama_file";

move_uploaded_file($lokasi_file,"$direktori_file");
echo "Nama File : <b>$nama_file</b> berhasil di upload <br>";
echo "Ukuran File : <b>$ukuran_file</b> bytes";

// Masukkan informasi file ke database
mysql_connect("localhost","root","");
mysql_select_db("dbphp");
$input="INSERT INTO upload_file(nama_file,ukuran_file,deskripsi,direktori)
VALUES('$nama_file','$ukuran_file','$deskripsi','$direktori')";
mysql_query($input);
}
?>

Pertama tama jalankan form_upload yanmg telah di rubah actionnya menjadi upload_max.php.Akan muncul pesan error jika file yang di upload lebih dari 1MB.



Aplikasi Download File

Intro :So, with that said, maybe neither the iPhone nor Android will prevail in the smart phone wars in the long run. Although Blackberry has been dramatically loosing market share since the iPhone and Android’s introduction into the market, maybe Blackberry’s eye for security will help make a comeback for their lagging sales and falling market share. Blackberry’s OS has been proprietary since the start and with their new OS6 touted as being the safest smart phone OS available to date; maybe there still is a chance for blackberry to make a comeback. That is of course if in deed Blackberry OS6 is the safest smart phone OS available. Although, through my research, I have found that blackberry is also vulnerable to most security issues that plague Android and iPhone.

For now Android seems to be aggressively taking iPhone's market share but for the long haul, security is the key and the future of the smart phone market. If there are no significant changes in security soon, I might just have to down grade to my old dumb cell phone. I’m still saving that sucker just in case.


Kebaslikan dari Upload adalah Download File yang pada intinya merupakan proses pengambilan file deserver ke computer local.Adapun inti dari aplikasi download file ini hanyalah menyediakan link-link terhadap fie yang akan didownload.

Download.php

<?php
mysql_connect("localhost","root","");
mysql_select_db("dbphp");

$tampil="SELECT * FROM upload_file ORDER BY id_upload DESC";
$hasil=mysql_query($tampil);

while ($data=mysql_fetch_array($hasil)){
  echo "Nama File   : <b>$data[nama_file]</b> <br>";
  echo "Ukuran File : $data[ukuran_file] bytes <br>";
  echo "Deskripsi   : $data[deskripsi] <br>";
  echo "<a href='$data[direktori]'>Download File</a> <hr>";
}
?>

Sekarang jalankan, hsilnya :

Menerapkan Paging

Intro :Sure, Lion and iCloud are big news, but, for the millions of iPhone users out there, the real news at the center of the Apple's WWDC conference was iOS 5, equipped with cutting-edge (though, in some cases, strangely familiar) notifications, messaging, and cable-free connectivity. These goodies—and hundreds of other (unspecified) features—now available in developer release, won't appear until the fall, perhaps at the same time as a new iPhone. It seems like just about all the competition–Android, Windows Phone 7, and BlackBerry—will be releasing new versions between now and then, too.

Using Apple's release as the baseline, I've pulled out 13 of the most exciting new features of iOS 5. The iPhone—and iOS 5—will face three popular challengers this fall. Each of these contenders will be a bit sprier by the iOS 5 debut: Microsoft will deliver Windows Phone 7 Mango in Q4; Blackberry OS 7 also ought to be available; and Android 2.3 Gingerbread will be ubiquitous, with Android 3.1 Ice Cream served up for the holidays. How will iOS stack up?


1.Tentukan limit/batas, kemudian cek pada halaman dan posisi berapa pada saat skrip dijalankan
2.Sesuaikan perintah SQL dengan limit/batas dan posisi
3.Hitung total data halaman serta tampilkan link untuk navigasi halaman.
Skrip paging.php

<table>
      <tr bgcolor="#999999"><th bgcolor="#CCCCCC">No</th><th>Nama</th><th>Alamat</th></tr>
<?php
mysql_connect("localhost","root","pajarmaning");
mysql_select_db("dbphp");

//Langkah 1: Tentukan batas,cek halaman & posisi data
$batas   = 5;
$halaman = $_GET['halaman'];
if(empty($halaman)){
    $posisi=0;
    $halaman=1;
}
else{
    $posisi = ($halaman-1) * $batas;
}

//Langkah 2: Sesuaikan perintah SQL
$tampil="select * from anggota limit $posisi,$batas";
$hasil=mysql_query($tampil);

$no=$posisi+1; // Agar angka (penomoran) mengikuti paging
while ($data=mysql_fetch_array($hasil)){
  echo "<tr bgcolor=CCCCCC><td>$no</td><td>$data[nama]</td><td>$data[alamat]</td></tr>";
  $no++;
}
echo "</table>";

//Langkah 3: Hitung total data dan halaman serta link 1,2,3 ...
echo "<br>Halaman : ";
$file="paging_1.php";

$tampil2="select * from anggota";
$hasil2=mysql_query($tampil2);
$jmldata=mysql_num_rows($hasil2);
$jmlhalaman=ceil($jmldata/$batas);

for($i=1;$i<=$jmlhalaman;$i++)
if ($i != $halaman)
{
    echo " <a href=$_SERVER[PHP_SELF]?halaman=$i>$i</A> | ";
}
else
{
    echo " <b>$i</b> | ";
}
echo "<p>Total anggota : <b>$jmldata</b> orang</p>";
?>



Sekarang jalankan, hasilnya :




Menampilkan Data Multi Kolom Horisontal 2

Intro:The first and most obvious difference between the two tablets is their size. The BlackBerry PlayBook is a 7 inch device with dimensions of 193 x 130 x 10mm and a weight of 400g, while the iPad 2 is a 10.1 inch tablet with dimensions of 241 x 186 x 9mm, with the top-spec 3G model weighing a heavier 610g.

Apple have always had a strong eye for design and the iPad 2 is arguably their crowning hour - it's incredibly sleek, looking especially "sci-fi" with its new white bezel. Whereas the iPad 2 has a physical home button on the bottom of its bezel, the BlackBerry PlayBook has no buttons on its front side, making for a very slick and smooth front face, even if the black boxy design of RIM's unit is a little uninspired overall. The tiny power button on the PlayBook is a chore to find though.


Trik ini aalah unutk menampilkan data dengan pengurutan
<?php
$kolom = 3; // Tentukan banyaknya kolom
$no = 1; // Untuk penomoran

mysql_connect("localhost","root","");
mysql_select_db("dbphp");

$sql = mysql_query("SELECT nama FROM anggota");
$jml_baris = mysql_num_rows($sql);

echo "<table>";
for($i = 0; $i < $jml_baris; $i++) {
$data = mysql_fetch_array($sql);

// % adalah operator modulus (sisa bagi)
if($i % $kolom == 0) {
echo "<tr bgcolor=cccccc>";
}
echo "<td>$no</td>";
echo "<td>$data[nama]</td>";

if(($i % $kolom) == ($kolom - 1) OR ($i + 1) == $jml_baris) {
echo "</tr> ";
}
$no++;
}
echo "</table> ";
?>

Hasilnya:



Upload File

RIM have been billing their BlackBerry PlayBook tablet as an iPad killer ever since they first revealed it way back in September 2010. With a greater focus on enterprise usage than the iPad 2, its smaller 7 inch form factor makes it a very different proposition from that of Apple's slate offering.

With the BlackBerry PlayBook tablet hitting UK stores today, we thought it would be helpful to pit the two tablets against each other in a tech-showdown.

There can be only one slate at the top of the tablet pile; does the PlayBook have what it takes to knock the iPad off its lofty perch? With pricing and storage relatively balanced across each device, we focus here on breaking down the key tablet features to see which tablet is worthy of your cash.

Size and Design

The first and most obvious difference between the two tablets is their size. The BlackBerry PlayBook is a 7 inch device with dimensions of 193 x 130 x 10mm and a weight of 400g, while the iPad 2 is a 10.1 inch tablet with dimensions of 241 x 186 x 9mm, with the top-spec 3G model weighing a heavier 610g.

Apple have always had a strong eye for design and the iPad 2 is arguably their crowning hour - it's incredibly sleek, looking especially "sci-fi" with its new white bezel. Whereas the iPad 2 has a physical home button on the bottom of its bezel, the BlackBerry PlayBook has no buttons on its front side, making for a very slick and smooth front face, even if the black boxy design of RIM's unit is a little uninspired overall. The tiny power button on the PlayBook is a chore to find though.

Winner - Tie

While we prefer the look of the iPad 2, there's much to like about the portability of the PlayBook. This one comes down to personal preference then; a larger screen that's visually more engaging, or a smaller tablet that's easier to carry around with you.

blackberry-playbook-pic-ap-image-1-473575300.jpg

Processor

The second generation iPad joins the dual-core tablet fray with its inclusion of an Apple A5 1Ghz dual-core chip. Though we've seen games like Infinity Blade exploit the new power available with the A5 chip, the original iPad was so zippy that it's an incremental update at best.

Likewise, the PlayBook uses a 1 GHz Cortex-A9 dual-core processor, which again results in a very slick, lag-free user experience.

Winner - Tie
Intro:Not much in this one. With both platforms relatively closed, you're unlikely to be able to push the tablets beyond their limitations, meaning that both processors are more than sufficient for running apps and the video formats open to them.

Operating System

RIM chose to adopt the relatively-niche QNX operating system for the BlackBerry PlayBook. Much like using a BlackBerry phone, QNX focusses on multi-tasking and gesture-based controls for quick navigation. It's a clean and simple interface with lots of room for customisation as well as a smart notifications bar.

With the forthcoming iOS 5 update fixing the notification problems that Apple's mobile devices usually inflict upon their users, iOS is now pretty much the perfect UI for a tablet device. A large, easily browsed grid system with room for App folders, what it lacks in customisation options it gains in simplicity, elegance and instinctive controls.

Inti:
Buat folder untuk menampung file-file yang diupload misalnya folder images.Dan yang perlu diperhatikan folder tersebut sebaiknya diletakan di folder tempat di simpannya skrip-skrip apliksi upload.
Skrip form_upload.php

<form enctype="multipart/form-data" method="post" action="upload1.php">
File yang diupload : <input type="file" name="fupload"><br>
Deskripsi File : <br><textarea name="deskripsi" rows="8" cols="40"></textarea><br>
<input type=submit value=Upload>
</form>
Skrip upload1.php
<?php
$lokasi_file = $_FILES['fupload']['tmp_name'];
$nama_file = $_FILES['fupload']['name'];
$ukuran_file = $_FILES['fupload']['size'];

$direktori = "images/$nama_file";
if (move_uploaded_file($lokasi_file,"$direktori")){
echo "Nama File : <b>$nama_file</b> berhasil di upload <br>";
echo "Ukuran File : <b>$ukuran_file</b> bytes";

// Masukkan informasi file ke database
mysql_connect("localhost","root","");
mysql_select_db("pintar");
$input="INSERT INTO upload_file(nama_file,ukuran_file,deskripsi,direktori)
VALUES('$nama_file','$ukuran_file','$_POST[deskripsi]','$direktori')";
mysql_query($input);
}
else{
echo "File gagal diupload";
}

?>

Keterangan skrip
1.yang perlu diperhatikan ketika mengirimkan file adalah method dari from harus POST dan tambahan entype=”multipart/form-data”.

2.move_upload_file(file_sumber.file_tujuan) adalah salah satu fungsi untuk mengupload file.Ada juga fungsi copy(file_sumber,file_tujuan) dan fungsinys sama, yaitu untuk mengupload file/copy file.
Jalnkan skrip form_upload.php kemudian klik tombol browse, lalu carilah file yang kan di upload.




Apabila berhasil tampil halaman seperti ini:

Menampilkan Data tanpa Paging

RIM have been billing their BlackBerry PlayBook tablet as an iPad killer ever since they first revealed it way back in September 2010. With a greater focus on enterprise usage than the iPad 2, its smaller 7 inch form factor makes it a very different proposition from that of Apple's slate offering.

With the BlackBerry PlayBook tablet hitting UK stores today, we thought it would be helpful to pit the two tablets against each other in a tech-showdown.

There can be only one slate at the top of the tablet pile; does the PlayBook have what it takes to knock the iPad off its lofty perch? With pricing and storage relatively balanced across each device, we focus here on breaking down the key tablet features to see which tablet is worthy of your cash.

Size and Design

The first and most obvious difference between the two tablets is their size. The BlackBerry PlayBook is a 7 inch device with dimensions of 193 x 130 x 10mm and a weight of 400g, while the iPad 2 is a 10.1 inch tablet with dimensions of 241 x 186 x 9mm, with the top-spec 3G model weighing a heavier 610g.

Apple have always had a strong eye for design and the iPad 2 is arguably their crowning hour - it's incredibly sleek, looking especially "sci-fi" with its new white bezel. Whereas the iPad 2 has a physical home button on the bottom of its bezel, the BlackBerry PlayBook has no buttons on its front side, making for a very slick and smooth front face, even if the black boxy design of RIM's unit is a little uninspired overall. The tiny power button on the PlayBook is a chore to find though.

Winner - Tie

While we prefer the look of the iPad 2, there's much to like about the portability of the PlayBook. This one comes down to personal preference then; a larger screen that's visually more engaging, or a smaller tablet that's easier to carry around with you.

blackberry-playbook-pic-ap-image-1-473575300.jpg

Processor

The second generation iPad joins the dual-core tablet fray with its inclusion of an Apple A5 1Ghz dual-core chip. Though we've seen games like Infinity Blade exploit the new power available with the A5 chip, the original iPad was so zippy that it's an incremental update at best.

Likewise, the PlayBook uses a 1 GHz Cortex-A9 dual-core processor, which again results in a very slick, lag-free user experience.

Winner - Tie

Not much in this one. With both platforms relatively closed, you're unlikely to be able to push the tablets beyond their limitations, meaning that both processors are more than sufficient for running apps and the video formats open to them.

Operating System

RIM chose to adopt the relatively-niche QNX operating system for the BlackBerry PlayBook. Much like using a BlackBerry phone, QNX focusses on multi-tasking and gesture-based controls for quick navigation. It's a clean and simple interface with lots of room for customisation as well as a smart notifications bar.

With the forthcoming iOS 5 update fixing the notification problems that Apple's mobile devices usually inflict upon their users, iOS is now pretty much the perfect UI for a tablet device. A large, easily browsed grid system with room for App folders, what it lacks in customisation options it gains in simplicity, elegance and instinctive controls.

Inti:


Paging juga dikenal dengan sebutan pagination(paginate, previous-next, tampilan per halaman , page navigator, halaman 1..2..3, dst.Apapun namanya intinya paging merupakan suatu teknik untuk membatasi data yang akan ditampilkan dalam suatu halaman.
Biasanya paging digunakan untuk menampilkan data yang banyak dan hamper disetiap aplikasi web si paging selalu ada.

<table>
<tr><th>No</th><th>Nama</th><th>Alamat</th></tr>

<?php
mysql_connect("localhost","root","root");
mysql_select_db("pintar");

$tampil="select * from anggota";
$hasil=mysql_query($tampil);

$no=1;
while ($data=mysql_fetch_array($hasil)){
echo "<tr><td>$no</td><td>$data[nama]</td><td>$data[alamat]</td></tr>";
$no++;
}
echo "</table>";
?>


Sekarang coba di jalankan skrip nonpaging.php, maka hasilnya adalah sebagai berikut



Menampilkan Database dalam Combobox

Intro:Another prominent equity research firm has ratcheted down its expectations for the tablet market, thanks to weaker-than-expected sales of slates other than Apple's iPad.

JP Morgan said build plans for tablets other than the iPad have slowed, with a prediscounted stockpile of 73 million units versus the firm's March 9 tally of 81 million slates.

"Our research indicates that tablet build plans in the aggregate have declined approximately 10 percent since early March," JP Morgan analyst Mark Moskowitz wrote in a report issued June 1. "Beyond Apple's iPad, there has not been another high-volume tablet offering to hit the market."

Moskowitz added that the driver of the prediscounted build decline is the weak volume showing in the market from the non-Apple tablet hopefuls.

Apple has sold more than 20 million iPads since the launch of the seminal slate in April 2010. However, the much-hyped, and Android 3.0 "Honeycomb"-based Motorola Xoom tablet, Samsung Galaxy Tab, Asustek Eee Pad Transformer and RIM's PlayBook have sold only in a modest capacity, the analyst wrote

Inti:
ComboBox merupakan salah satu komponen form yang berfungsi unutk menampilkan beberapa pilihan, di mana hanya satu pilihan yang boleh dipilih .
Skrip combobox

<select name=jurusan>
<option value=0 selected>- Pilih Jurusan -</option>

<?php
mysql_connect("localhost","root","");
mysql_select_db("dbphp");
$sql=mysql_query("select * from jurusan");
while ($data=mysql_fetch_array($sql)){
  echo "<option value=$data[id_jur]>$data[nama_jur]</option>";
}
?>

</select></form
Hasilnya



Menmapilkan Data Multi Kolom Horisontal [1]

Intro:Officially, the Xoom sold 250,000 units in under two months, while the PlayBook is believed to have sold 250,000 units in one month.

However, Moskowitz said there had been some indications that the Eee Pad Transformer tablet was selling out in the retail channel in April and May, but his research indicated the slate had not even made it to many of the targeted retail outlets prior to the supposed sell-outs.

One reason for the slower-than-expected sales, he cited, is that first generation of non-iPad tablets don't offer compelling price or enough features to drive incremental purchasers within vendors' projections.

Moreover, JP Morgan expects there to be limited build activity because tablet vendors are waiting to see how the back-to-school reception is, as well as waiting to launch 4G LTE tablets.

Ultimately, the firm puts consensus estimates for tablet shipments at around 50 million to 55 million units for 2011.

JP Morgan is hardly the first firm to adjust tablet estimates after Android Honeycomb tablets and the PlayBook failed to follow the iPad in setting the tablet world afire.

Inti:Menmapilkan Data Multi Kolom Horisontal [1]

Kalau biasanya kita menmapilkan data secara vertical, maka pada kasus tertentu ada kalanya data sebaiknya ditampilkan secar a horizontal.

Skrip gallery.php

<?php
$kolom = 3; // Tentukan banyaknya kolom

mysql_connect("localhost","root","pajarmaning");
mysql_select_db("dbphp");

$sql = mysql_query("select * from galeri");
echo "<table border=1><tr>";
$i = 0;
while ($data = mysql_fetch_array($sql)){
// Tampilkan data ke kolom kanan selama $i >= kolom
if ($i >= $kolom){
echo "</tr><tr>";
$i = 0;
}
$i++;
echo "<td align=center><br>
<a href='#'><img src='$data[gambar]' border=0><br>
$data[judul]</a><br><br></td>";
}
echo "</tr></table>";
?>