rechten/login probleempje
de bedoeling is dat als een admin ingelogd is deze herkend wordt als zijnde een admin met bepaalde rechten....misschien doe ik het op de verkeerde pagina en moet het pas op de hoofdpagina van het beheersysteem...
Het menu dient ook opgemaakt worden naar de rechten van de admin evenals de pagina`s....als iemand dat weet of in ieder geval duidelijk uit kan leggen, zal ik diegene erg dankbaar zijn...
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?
require_once "Auth.php";
require_once "DB.php";
function loginFunction()
{
echo("
<form name=\"form1\" method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "?login=1\">
<table height=\"100%\" align=\"center\">
<tr valign=\"middle\">
<td align=\"center\" style=\"vertical-align: middle;\">
<table bordercolor=\"white\" border=\"1\" cellpadding=\"5\" width=\"300\">
<tr class=\"overview-content\">
<td colspan=\"2\"><center>Login Mailmachine.nl</center></td>
</tr>
<tr>
<td width=\"95\">Gebruikersnaam:</td>
<td><input name=\"username\" type=\"text\" id=\"username\"></td>
</tr>
<tr>
<td width=\"95\">Wachtwoord:</td>
<td><input name=\"password\" type=\"password\" id=\"password\">
<br>
<a href=\"register.php\">Registreer hier !</a>
</td>
</tr>
<tr>
<td><div align=\"right\">
<input type=\"submit\" name=\"login\" value=\"Submit\">
</div></td>
<td><input type=\"reset\" name=\"Submit2\" value=\"Reset\"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
");
}
$params = array(
"dsn" => "mysql://mailm2:vb112*uc@localhost/mailm2",
"table" => "beheerder",
"usernamecol" => "inlognaam",
"passwordcol" => "wachtwoord"
);
$a = new Auth("DB", $params, "loginFunction", true);
$a->start();
if ($a->getAuth())
{
function maakrechtarray ($pgetal)
{
$aantal_rechten=mysql_num_rows(mysql_query("SELECT * FROM rechten"));
for ($i = $aantal_rechten;$i >= 0;$i--)
{
if($pgetal - pow(2,$i) >= 0)
{
$rechtengetal=pow(2,$i);
$rechtarray[$rechtengetal]=1;
$pgetal = $pgetal - $rechtengetal;
}
}
return $rechtarray;
}
// rechtenarray aanmaken
echo "<xmp>";
$rechtarray=maakrechtarray(9);
echo "</xmp>";
$user_id = 1; // ingelogd als superuser dus
$rechten = 9;
$select="SELECT * FROM rechten";
$result=mysql_query($select)
or die(mysql_error());
$aantalrijen=mysql_num_rows($result);
while($row=mysql_fetch_Array($result))
{
if(isset($_SESSION["rechtarray"],$row["rechten"]))
{
header("Location: /Admin/index.php");
exit();
}
}
}
else
{
echo "<a href=\"register.php\">Registreer hier !</a>\n";
}
?>
require_once "Auth.php";
require_once "DB.php";
function loginFunction()
{
echo("
<form name=\"form1\" method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "?login=1\">
<table height=\"100%\" align=\"center\">
<tr valign=\"middle\">
<td align=\"center\" style=\"vertical-align: middle;\">
<table bordercolor=\"white\" border=\"1\" cellpadding=\"5\" width=\"300\">
<tr class=\"overview-content\">
<td colspan=\"2\"><center>Login Mailmachine.nl</center></td>
</tr>
<tr>
<td width=\"95\">Gebruikersnaam:</td>
<td><input name=\"username\" type=\"text\" id=\"username\"></td>
</tr>
<tr>
<td width=\"95\">Wachtwoord:</td>
<td><input name=\"password\" type=\"password\" id=\"password\">
<br>
<a href=\"register.php\">Registreer hier !</a>
</td>
</tr>
<tr>
<td><div align=\"right\">
<input type=\"submit\" name=\"login\" value=\"Submit\">
</div></td>
<td><input type=\"reset\" name=\"Submit2\" value=\"Reset\"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
");
}
$params = array(
"dsn" => "mysql://mailm2:vb112*uc@localhost/mailm2",
"table" => "beheerder",
"usernamecol" => "inlognaam",
"passwordcol" => "wachtwoord"
);
$a = new Auth("DB", $params, "loginFunction", true);
$a->start();
if ($a->getAuth())
{
function maakrechtarray ($pgetal)
{
$aantal_rechten=mysql_num_rows(mysql_query("SELECT * FROM rechten"));
for ($i = $aantal_rechten;$i >= 0;$i--)
{
if($pgetal - pow(2,$i) >= 0)
{
$rechtengetal=pow(2,$i);
$rechtarray[$rechtengetal]=1;
$pgetal = $pgetal - $rechtengetal;
}
}
return $rechtarray;
}
// rechtenarray aanmaken
echo "<xmp>";
$rechtarray=maakrechtarray(9);
echo "</xmp>";
$user_id = 1; // ingelogd als superuser dus
$rechten = 9;
$select="SELECT * FROM rechten";
$result=mysql_query($select)
or die(mysql_error());
$aantalrijen=mysql_num_rows($result);
while($row=mysql_fetch_Array($result))
{
if(isset($_SESSION["rechtarray"],$row["rechten"]))
{
header("Location: /Admin/index.php");
exit();
}
}
}
else
{
echo "<a href=\"register.php\">Registreer hier !</a>\n";
}
?>
Dat je niet weet wat het script doet? :S
function maakrechtarray ($pgetal)
{
$aantal_rechten=mysql_num_rows(mysql_query("SELECT * FROM rechten"));
for ($i = $aantal_rechten;$i >= 0;$i--)
{
if($pgetal - pow(2,$i) >= 0)
{
$rechtengetal=pow(2,$i);
$rechtarray[$rechtengetal]=1;
$pgetal = $pgetal - $rechtengetal;
}
}
return $rechtarray;
}
// rechtenarray aanmaken
echo "<xmp>";
$rechtarray=maakrechtarray(9);
echo "</xmp>";
$user_id = 1; // ingelogd als superuser dus
$rechten = 9;
$select="SELECT * FROM rechten";
$result=mysql_query($select)
or die(mysql_error());
$aantalrijen=mysql_num_rows($result);
while($row=mysql_fetch_Array($result))
{
if(isset($_SESSION["rechtarray"],$row["rechten"]))
{
}
}
}