I have a problem with Pear AUTH
[email protected] (Tamás Horváth)
| Newsgroups | php.pear.doc |
|---|---|
| Message-ID | <[email protected]> |
I have a problem with Pear AUTH, please help me!
I have two admin pages (admin1.php admin2.php)
after i logged in admin1.php succesful, i cant
visit admin2.php from admin1.php, because
i have to log in again.
what is the problem?
according to the following PHP codes:
0:AUTH hitelesit.inc
------------------------------------------------------------------------------------------------------------------------
<?php
require_once "class_ab.inc";
$abobj = new AB();
$dsn=$abobj->ab_csatlakozas();
require_once("Auth/Auth.php");
function handle_pear_error($e) {
die($e->getMessage() . ' ' .
print_r($e->getUserInfo(), true));
}
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
'handle_pear_error');
$parameterek = array(
"dsn" => $dsn,
"table" => "t_felhasznalok",
"usernamecol" => "fel_usernev",
"passwordcol" => "fel_jelszo",
"db_fields"=>"*",
"cryptType" => "md5"
);
function belepes_form() {
echo '<form method="post" ACTION="' .
$_SERVER['PHP_SELF'] . '?login=1">
<table class="tablazat">
<tr>
<td>
Felhasználó
</td>
<td>
<input type="text" name="username" />
</td>
</tr>
<tr>
<td>
Jelszó
</td>
<td>
<input type="password" name="password" />
</td>
</tr>
<tr>
<td>
<input type="submit" value="Belépés" />
</td>
</tr>
</table>
</form><br />
';
}//function belepes_form()
$a = new Auth("DB", $parameterek,"belepes_form");
$a->start();
?>
1:admin1.php
------------------------------------------------------------------------------------------------------------------------
<?php
include '../includes/hitelesit.inc';
if ($a->getAuth()) {
print "ok admin1";
print "<a href='admin2.php'>admin2</a> ";
}else
print "you are not in admin1";
?>
2:admin2.php
---------------------------------------------------------------------------------------------------------------------------
<?php
include '../includes/hitelesit.inc';
if ($a->checkAuth()) {
print_r($_SESSION);
print "you are in admin2";
print "<a href=".$_SERVER['PHP_SELF'].">self</a>";
//$abobj->felhasznalok();
}else{
print "not in 2";
print_r($_SESSION);
}
?>
___________________________________________________________
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html