 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
imot
Joined: 25 Sep 2007 Posts: 1
|
Posted: Tue Sep 25, 2007 5:26 pm Post subject: AUTH how tu use in more admin sides? |
|
|
I am using PEAR AUTH
I cant link admin2 from admin1 because i have to login.
What is the problem?
************************************************************
* 1. hitelesit.inc included file
***********************************************************
<?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->setSessionname("valami");
$a->start();
//if (isset($_SESSION['_authsession']) && isset($_SESSION['_authsession']['registered']) && $_SESSION['_authsession']['registered'] == true)
?>
***********************************************************************************
* 1. admin1.php
***********************************************************************************
<?php
session_start();
require_once '../includes/hitelesit.inc';
if ($a->checkAuth()) {
print_r($_SESSION);
print "you are logged in in admin1";
print "<a href=admin2.php>admin2</a>";
}else{
print "not logged in admin1";
print_r($_SESSION);
}
?>
**********************************************************************************
* 2. admin2.php
**********************************************************************************
<?php
require_once '../includes/hitelesit.inc';
$_SESSION['_authsession']=session_decode($_SESSION['as']);
if ($a->checkAuth()) {
print_r($_SESSION);
print "you are logged in in admin2";
print "<a href=".$_SERVER['PHP_SELF'].">self</a>";
//$abobj->felhasznalok();
}else{
print "not logged in admin2";
print_r($_SESSION);
}
?> |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|