Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] PEAR i Auth paczka
burteck
post 20.03.2009, 13:59:01
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 20.03.2009
Skąd: Opole

Ostrzeżenie: (0%)
-----


witam ponownie

doinstalowałem paczki PEAR: AUTH i LOG i znalazłem taki przykład do logowania w którym początek jest następujący:

<?php

require_once "Auth.php";
require_once 'Log.php';
require_once 'Log/observer.php';

// Callback function to display login form
function loginFunction($username = null, $status = null, &$auth = null)
{
/*
* Change the HTML output so that it fits to your
* application.
*/
<form method="post" action="".$_SERVER['PHP_SELF']."">
Username: <input type="text" name="username"><br/>
Password: <input type="password" name="password"><br/>
<input type="submit">
</form>
}

class Auth_Log_Observer extends Log_observer {

var $messages = array();

function notify($event) {

$this->messages[] = $event;

}

}

$options = array(
'enableLogging' => true,
'cryptType' => 'md5',
'users' => array(
'guest' => md5('password'),
),
);
$a = new Auth("Array", $options, "loginFunction");

Początek jest ok - mam bibliotek w odpowiednich katalogach, widzę formularz logowania ale zaraz za nim widzę takie komentarze:

; } class Auth_Log_Observer extends Log_observer { var $messages = array(); function notify($event) { $this->messages[] = $event; } } $options = array( 'enableLogging' => true, 'cryptType' => 'md5', 'users' => array( 'guest' => md5('password'), ), ); $a = new Auth("Array", $options, "loginFunction"); $infoObserver = new Auth_Log_Observer(AUTH_LOG_INFO); $a->attachLogObserver($infoObserver); $debugObserver = new Auth_Log_Observer(AUTH_LOG_DEBUG); $a->attachLogObserver($debugObserver); $a->start(); if ($a->checkAuth()) { /* * The output of your site goes here. */ printf "Authentication Successful.
"; } printf (
Logging Output:
) .'AUTH_LOG_INFO level messages:
'; foreach ($infoObserver->messages as $event) { printf $event['priority'].': '.$event['message'].'
'; } printf '
' .'AUTH_LOG_DEBUG level messages:
'; foreach ($debugObserver->messages as $event) { printf $event['priority'].': '.$event['message'].'
'; } printf '
'; ?>

czyli jakby wyświetlał mi dane zaraz po zakończeniu formularza. Pytanie proste dlaczego?
Czy ktoś może rzucić okiem na to i pomóc mnie?
Będę wdzięczny...

burteck
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
wookieb
post 20.03.2009, 14:00:15
Post #2





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




A bbcode to nie łaska użyć?


--------------------
Go to the top of the page
+Quote Post
burteck
post 20.03.2009, 14:23:27
Post #3





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 20.03.2009
Skąd: Opole

Ostrzeżenie: (0%)
-----


a sorry za ten brak BBCode ale to mój trzeci post.
Go to the top of the page
+Quote Post
erix
post 20.03.2009, 19:06:50
Post #4





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




~burteck, użyj edytuj i wstaw bbcode, bo listing jest nieczytelny.

~wookieb - zwróciłem Ci uwagę na PW, zwrócę i publicznie, dla potomności: nie nabijaj postów, tylko użyj linka raportuj.


--------------------

ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW!
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 31.07.2025 - 10:30