Rabu, 28 Maret 2018

Nama         : Daniel Ortega K
NIM          : 5140411161


Tugas 4
Algoritma, pseucode, dan flowchart login gagal 3 kali

Algoritma
-          Sediakan my sql (xamp) dan sublime text editor (bisa menggunakan tools lain yang sejenis)
-          Pastikan kedua tools diatas telah terinstal
-          Buatlah 4 file dengan ekstensi .php menggunakan sublime, file pertama untuk form log in, file kedua untuk menu jika berhasil log in, file ketiga untuk menu jika gagal log in sebanyak 3 kali (diblokir), dan file keempat untuk session validasi.
-          Simpan file di folder htdocs yang ada pada local disk c, xampp.
-          Untuk file kedua dan ketiga, cukup diisi dengan kalimat anda berhasil login dan anda telah diblokir. (lihat pada pseucode dibawah bagian 2 dan 3)
-          Untuk file pertama, tulislah seperti pada pseucode dibawah (bagian 1)
-          Untuk file keempat, tulis seperti pseucode dibawah (bagian empat)
-          Buka browser
-          Buka file yang telah dibuat tadi (localhost/nama_file/)
-          Untuk algoritma program adalah sebagai berikut :
·         User menuliskan username dan password pada kolom yang telah disediakan
·         Karena menggunakan session, maka dapat diketahui user tersebut telah membuka website tersebut berapa kali
·         Jika gagal login, maka session akan bertambah (increment). Apabila session atau jumlah gagal sudah sama dengan lebih besar dari 3 kali, maka user akan dialihkan kehalaman blokir.
·         Namun jika log in berhasil, maka akan dialihkan ke halaman berhasil log in.




Pseucode
-          Bagian pertama (form log in)
<?php
session_start();
?>
<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        if (empty($_SESSION['jmlloginerror'])) {
            $_SESSION['jmlloginerror'] = 0;
        } else {
            echo '<h1>ANDA GAGAL Login ke-' . $_SESSION['jmlloginerror'].'</h1>';
        }
        ?>
        <form action="file_keempat.php" method="POST">
            <table>
                <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>&nbsp;</td>
                    <td>
                        <input type="submit" name="submit">
                    </td>
                </tr>               
            </table>
        </form>
    </body>
</html>

-          Bagian kedua (berhasil log in)
<h1>SELAMAT DATANG DI ADMIN</h1>

-          Bagian ketiga (blokir)
<h1>mohon maaf, anda telah diblokir akibat gagal log in lebih dari 2 kali</h1>

-          Bagian keempat (validasi session)
<?php
session_start();

$usr = $_POST['username'];
$pwd = $_POST['password'];

$dbuser = "daniel";
$dbpass = "dan1el";

if($user == $dbuser && $pass == $dbpass){
    $_SESSION['jmlloginerror']=0;
    header('location:../file_kedua.php');
} else {
    $_SESSION['jmlloginerror']++;

if($_SESSION['jmlloginerror'] < 3){
        header('location:../file_pertama.php');
    } else {
        header('location:../file_ketiga.php');
    }
}









Flowchart



Y





N



Y                                                                       N

Jumat, 08 Desember 2017

music review



Title                 : I’m with you
Singer              : Avril Lavigne
Album            : Let go (2002)
OST                 : -
Producer           : the matrix
            Another amazing sad song by Avril lavigne. This song was one of the best from all Avril’s songs. While not the best one, but still amazing. this song got the 1st position in it’s album, followed by Skater Boy on 2nd and Complicated on 3rd. Avril herself wrote this song in 2002, helped by her production team, The Matrix.
            This is a song about sadness and lonely. It tells a person that feel so alone, in a place so unfamiliar, with no one to rely on. that happen on a dark, rainy and cold night, just a terrible night to stand alone. that person (i would say She, based on the writers perception) want someone to find her. She want someone she can rely on, beacuse she feel so lost, so confuse. She want someone cares about her, that not make her feel alone. Even she doesn’t care anymore who will be that someone, any stranger that she feel she can rely, that willing to take her to a better place, a new place, and take her home, she will follow.
            A beautiful song. It makes us to realize, is it true that we’re not alone ? this time, yes maybe you feel you are not alone. But life is a cycle, when you just get to down, you will find out the truth. This song, makes us to hope, that we never lonely that so alone like her. If you, by this time feel sad, like you feel alone even when there so much people around you, like you don’t know what to do, don’t have anyone cheers you, no one see your problem, well, this 3.44 minutes song will surely entertain you.