hello, Im new be in Programmer..
I little bit confuse with the new language of PHP5, its really different with PHP4 language,..
i try to login, but i cant create, update, or delete ..-_-
any body can help me to learn more abour PHP5 please??
what actually language that should be canged by me in PHP4, to make it run in PHP5..??
becouse there are always error in my script..

Recommended Answers

All 7 Replies

What do you mean by

really different

Show us your code-snipet to see the exact problem.

PHP5 for the most part is backwards compatible with PHP4, but there are a couple key changes that might break your PHP4 script in a PHP5 environment. If you aren't already, I stronly suggest you start developing for PHP5. Many hosts these days offer a PHP5 environment, or a dual PHP4/PHP5 setup so you should be fine on that end. Using all of these new features is worth even a moderate amount of trouble you might go through finding a new host!

my script does not run well and cannt login in PHP5, but able run in PHP4
after i searc in google, it's like a problem of variable global ??
maybe you can explain me ..??

this is my script cek_login.php

<?php
include"koneksi.php";

$pass=md5($_POST[password]);



    if ( $_POST[sbg] == ' siswa '){


    $ardo=mysql_query("select * from siswa where siswa_nisn='$_POST[username]' and password='$pass'");
    }
else{
    $ardo=mysql_query("select * from guru where guru_nip='$_POST[username]' and password='$pass'");
    }

$a=mysql_num_rows($ardo);
$y=mysql_fetch_array($ardo);

if($a>0){

    session_start();
    session_register("kd");
    session_register("level");

        if($_POST[sbg]=='siswa'){

        $_SESSION[kd]=$y[siswa_nisn];
        $_SESSION[level]="siswa";

        }
        else{

        $_SESSION[kd]=$y[guru_nip];
        $_SESSION[level]="guru";

        }
    header('location:admin.php?modul=home');
}

else{

        if($_POST[sbg]=='siswa'){
        header('location:index.php?log=bukansiswa');
        }
        else{
        header('location:index.php?log=bukanguru');
        }

}


?>

You need a space between include and "koneksi.php"; to start with.

Also, there could be a problem in koneksi.php. If you're okay with showing us this code then that would help to track down your problem.

i think this problems do not come from koneksi.php
couse
i can insert, update and delete when i use this koneksi.php script..
but the problem is that, until now i cant login..

Keep in mind that $_POST works as an array, so if you want to use one of the keys, you have to write:

$_POST['password']

not $_POST[password] which lacks of quotes. The same applies to $_POST[sbg]. For this reason you are probably getting d41d8cd98f00b204e9800998ecf8427e from:

$pass=md5($_POST[password]);

Because it appears as a false or null. That should also create a Notice like this:

Notice: Use of undefined constant password - assumed 'password'

So, in development stage enable error reporting, it will help you.

Regarding the differecens between PHP4 and PHP5, check the manual: http://php.net/manual/en/migration5.php

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.