Showing posts with label learning php. Show all posts
Showing posts with label learning php. Show all posts
Tuesday, February 03, 2009
Learning Visual Basic
di
10:27 PM
Part 1: Start Here!
Join the Discussion
"The source of expertise is not in the memorization of the minute details of a subject but in the thorough understanding of the fundamental concepts on which it is based."
Dan Appleman
opinionated author
If you're new to Visual Basic, or even new to programming, this is the place! Visual Basic from the very ground up will be explained. Those of you who are more code-wise might find this article slightly boring from a technical perspective ... but Hey!, you're welcome here too!
The first thing you need to know, and I mean know, about programming is that it's not magic and you can do it. The people who have trouble learning to program are the ones who expect to have trouble. If you think it's going to be easy, it probably will be for you. So plan on having fun! It's the best way to learn.
The second thing is to realize is that the computer is really dumb! I mean stupid, idiotic, and just plain dense. That's why it has to be told each and every thing to do ... at some time. The TV and movie plots where the computer is this scheming, thinking, entity are completely wrong. If a computer doesn't have instructions to do something, it will not do anything. Your task as a programmer is to provide those instructions. The flip side of this is that if it's not doing what you intend, then it's because the instructions that it was given were wrong.
The main flaw in this is that YOU don't give the computer all of the instructions. It gets a lot of them from other programmers at other times in the form of software like the compiler (the program that turns a 'programming language' like Visual Basic into instructions that the computer can actually understand), the operating system (the program that turns things like your keystrokes into instructions that the computer can actually understand), and software objects (little packages of self contained program code that do things that a lot of people need). So to really understand the instructions that the computer received, you have to have an idea about what all the other instructions are. Welcome to programming!
Therefore ... our task in learning Visual Basic is to understand how Visual Basic combines with your instructions (and all the other stuff) to form a complete program.
Fortunately, Visual Basic takes care of virtually all of the details for you. But it's a good idea to know what's happening "under the covers". Here's a picture of what all this looks like.
By the way, this is usually called a 'Flow Chart'. A lot of people insist that you draw a flow chart of any program before you try to write it. It's a good idea, especially for people just starting out. But remember rule number 1: If it's not fun, don't do it.
Next page > The Visual Basic Programming Environment > Page 1, 2, 3
Label: hobbies, games, education
learning php,
learning VB,
Tutorial,
VB
Saturday, January 24, 2009
BELAJAR PHP
di
11:47 AM

again author try to pay debt. : d. debt hits tutorial that discuss redirect yard complexly. before aim discussion kernel, author will give what explanation and how does example case from redirect yard complexly this.
mybe there some people ever try searching at google hit article he looks for, but when get article, web only permit user that egistrasi that can accessing article. so, step furthermore that done by user register self to be member in website, in form the yard location differs from article that looked for. but after registration process finished, and process loggings success, user automatically at redirect to yard he goes to previous. this little example from redirect complex. another example, when does user that will try to will downloaded a file on page certain at a website, user compelled to logging beforehand, but after logging direct user meredirect automatically aim yard downloads. : d. in tutorial this, author will try to answer that various problem. bye . . bye. .:D
prepare first of all the database:
create database simple_cms ;
use simple_cms ;
create table user( id int(5) PRIMARY KEY auto_increment, username varchar(20), password varchar(50));
create table article (id int(5) PRIMARY KEY auto_increment, penulis varchar(20), judul varchar(200), isi text);
insert into user values ('','admin',md5('admin'));
insert into article values('','Loka Dwiartara','Kegantengan Abadi','Kegantengan abadi terpancar dari kekerenan sejati. Aura kegantengan selalu terpancar dari kerennya seseorang. :D. Kadang banyak yang berpikir keindahan secara fisik itu melebihi dari segalanya. Kita tahu bahwa b_scorpio itu tidak ganteng, tapi setidaknya tolong hargai dia :D'), ( '','Loka Dwiartara','PHP is powerfull easy language ... ', 'Kekerenan php dalam menangani pengembangan sistem informasi berbasis website patut di acungi 4 jempol kaki dan tangan, kehebatannya melebihi b_scorpio yang tidak pandai menggaet i#a, wanita yang dia suka. ;D~~~, peace ... damai ... ') ;
Selanjutnya, config.php :
<?php
$host = "localhost";
$username = "root";
$password = "";
$database = "simple_cms" ;
$connect = mysql_connect($host, $username, $password);
mysql_select_db( $database , $connect) or die ("MySQL is error!!");
?>
Kemudian, halaman login.php :
<html>
<head><title>Login Page ...!</title></head>
<body>
<form action=cek.php method=POST>
<table border=0 bcolor=#DFDFDF><tr><td>username</td><td><input type=text name=username></td></tr>
<tr><td>password</td><td><input type=password name=password></td></tr>
<tr><td></td><td><input type=submit name=submit value=submit></td></tr>
</table>
</form>
</body>
</html>
Selanjutnya, file cek.php, disinilah redirect kompleks halaman berada :
<?php
session_start();
require_once "config.php";
if (ISSET($_POST['username']) && ISSET($_POST['password']) )
{
$username = $_POST['username'];
$password = md5($_POST['password']);
$session_halaman = $_SESSION['halaman'];
$cekuser = "select username, password from user where username = '$username' and password = '$password'";
$query_cekuser = mysql_query($cekuser);
$exist = mysql_num_rows($query_cekuser);
if ($exist >= 1)
{
$_SESSION['user'] = session_id();
header("location: index.php?view=page&id=$session_halaman");
}
else
{
header("location: login.php");
}
}
?>
Dan halaman index.php, untuk menampilkan artikelnya :
<?php
session_start();
require_once "config.php";
if (!ISSET($_REQUEST['id']) )
{
$list_article = "select * from article";
$query_list_article = mysql_query($list_article);
echo "<h3>Article Today</h3>";
if (ISSET($_SESSION['user']))
{
echo "</p><b>Welcome back User</b>. Do you want <a href=logout.php>logout</a> ? :D~~ </p>";
}
while ($showlist = mysql_fetch_array($query_list_article))
{
$id = $showlist['id'];
$penulis = $showlist['penulis'];
$judul = $showlist['judul'];
$isi = $showlist['isi'];
$panjangartikel = strlen($isi);
$isi_dipotong = substr($isi, 0, 60);
$isi_fix = substr($isi, 0, strrpos($isi_dipotong, " "));
$isi_fix .= "...";
echo "<b>$judul</b><br>
Oleh : $penulis<br>
<p>$isi_fix <a href=index.php?view=page&id=$id>selengkapnya</a></p>
<hr width=45% align=left>";
}
}
else if (ISSET($_REQUEST['view']) && ISSET($_REQUEST['id']) )
{
$id = $_REQUEST['id'] ;
if (!ISSET($_SESSION['user']))
{
$_SESSION['halaman'] = $id ;
echo "Login dulu dong <a href=login.php>di sini</a>";
}
else
{
$list_article = "select * from article where id = '$id' ";
$query_list_article = mysql_query($list_article);
while ($showlist = mysql_fetch_array($query_list_article))
{
$id = $showlist['id'];
$penulis = $showlist['penulis'];
$judul = $showlist['judul'];
$isi = $showlist['isi'];
echo "<h3>Article Today</h3>";
echo "<b>$judul</b><br>
Oleh : $penulis<br>
<p>$isi</p>
<hr width=100% align=left>";
}
echo "<a href=index.php?view=page>Kembali...</a>";
}
}
?>
Terakhir adalah, file logout.php :
<?php
session_start();
unset($_SESSION['user']);
session_destroy();
header("location: index.php");
?>
Hmmm.. panjang juga scriptnya. :D~ Penulis coba jelaskan beberapa baris yang penting saja. Lihat ke halaman index.php, di situ terdapat baris seperti ini :
....
else if (ISSET($_REQUEST['view']) && ISSET($_REQUEST['id']) )
{
$id = $_REQUEST['id'] ;
if (!ISSET($_SESSION['user']))
{
$_SESSION['halaman'] = $id ;
echo "Login dulu dong <a href=login.php>di sini</a>";
}
...
else if (ISSET($_REQUEST['view']) && ISSET($_REQUEST['id']) )
Ini berarti, jika user mengklik salah satu artikel di halaman index,
if (!ISSET($_SESSION['user']))
dan jika user belum login,
$_SESSION['halaman'] = $id ;
maka, rekam halaman yang akan dibuka, simpan halaman tersebut ke dalam variable session.
echo "Login dulu dong <a href=login.php>di sini</a>";
Persilahkan user untuk login dulu.
Nah selanjutnya, jika user telah login maka artikel langsung di perlihatkan seluruhnya, seperti pada baris ini
....
else
{
$list_article = "select * from article where id = '$id' ";
$query_list_article = mysql_query($list_article);
while ($showlist = mysql_fetch_array($query_list_article))
{
$id = $showlist['id'];
$penulis = $showlist['penulis'];
$judul = $showlist['judul'];
$isi = $showlist['isi'];
echo "<h3>Article Today</h3>";
echo "<b>$judul</b><br>
Oleh : $penulis<br>
<p>$isi</p>
<hr width=100% align=left>";
....
Kemudian untuk script cek.php
if (ISSET($_POST['username']) && ISSET($_POST['password']) )
Jika user telah mengisi password dan username,
....
$cekuser = "select username, password from user where username = '$username' and password = '$password'";
maka buat sebuah query yang akan menyeleksi apakah username dan passwordnya ada.
...
$query_cekuser = mysql_query($cekuser);
Jalankan querynya ...
$exist = mysql_num_rows($query_cekuser);
Apakah username dan password yang dimasukkan tersebut ada dalam database?
if ($exist >= 1)
{
Jika ada,
$_SESSION['user'] = session_id();
maka buat session baru untuk user
header("location: index.php?view=page&id=$session_halaman");
Redirectkan si user ke halaman yang dia tuju sebelumnya ... Ya, disinilah letak dari redirect kompleksnya. :D. Cukup manfaatkan saja session yang ada untuk meredirect user ke halaman yang dituju.
}
else
{
header("location: login.php");
jika username dan password salah, persilahkan user untuk login ulang.
}
}
Untuk screenshoot demonya seperti ini :
Ini adalah halaman pertama kali
Ketika salah satu link akan diklik, maka user diperintahkan untuk login terlebih dahulu
Setelah login berhasil maka user secara otomatis langsung di redirect ke halaman tujuan yang awal.
Yup, penulis kira sudah cukup jelas untuk redirect kompleks. Jika ada yang ditanyakan silahkan kirim email ke alkemail@gmail.com. Selamat mencoba.
Script tersebut dapat di download di sini
http://networkandgame.890m.com/ilmuwebsite/article/redir-complex-by-alk.zip
Greetz : b_scorpio, abuzahra, peterpanz, kandar, phii_, syahrilrohman, ivan, dr.emi, safril, najwa. Special for jojo. :). Hi, Jo! Have a nice day.
Sumber dari situs Ilmu Website dalam kategori php kuliah dengan judul Redirect Halaman Kompleks
Label: hobbies, games, education
configuration on php,
free,
free photoshop,
free software,
free tutorial php,
learning php,
redirect halaman php,
setting php
Subscribe to:
Posts (Atom)