-4

私はphpを初めて使用し、このコードを読み込もうとすると「HTTP-fout 500 (Internal Server Error):」が表示されるため、このコードについて助けが必要です。誰かが良いコード全体を投稿できますか。ありがとう。

      <?php
    session_start();


    if(empty($_POST['username']) || empty($_POST['password'])) {
    $notifications[] = 'Login failed! Please provide a username and password.';
   }

       if(count($notifications) == 0) {
    try {
        $dbh = new PDO('mysql:dbname=db33936_axe;host=mysql12-int.cp.hostnet.nl',   
    'u33936_mick', '123');

        $sql = "SELECT username, verified FROM users WHERE username = :username AND    
    password = :password";
        $sth = $dbh->prepare($sql);
        $sth->execute(array(
            ':username'    => $_POST['username'],
            ':password' => md5($_POST['password'])
        ));

        $result = $sth->fetch(PDO::FETCH_ASSOC);

        if($result) {
            // Set session details and redirect user to members page
            session_regenerate_id();
        $_SESSION['username']=':username';
        $_SESSION['password']=':password';

            header('Location: index.php');
        } else {
            $notifications[] = "Username or Password incorrect.";
        }
4

3 に答える 3