PHP menu inbouwen,,
Ik ben bezig met een site,, maar ik moet dan een php menu inbouwen,, zoals dit:
Normale links:
> Home
> About
> Links
En als je inlogd dat de links zijn:
> Home
> About
> Links
> Control Panel
zoals dat moet ik eigenlijk hebben,, maar het lukt mij maar telkens niet om het in te bouwen :(
zou iemand my alsjeblieft kunne hellpen?
Groetjes Lars
http://www.phphulp.nl/forum/showtopic.php?cat=1&id=18389&page=
Gewijzigd op 01/01/1970 01:00:00 door Kees de braak
^^
Zet voor het menu een if-lus. Als je bent ingelogd komen die linkies erbij. En anders niet.
Voorbeeldje voor menu:
Code (php)
En die sessie moet je dus bij het inloggen starten:
.......inloggen enz.......
echo 'Je bent ingelogd.';
$_SESSION['login'] = 1;
<img border="0" src="images/index.5.gif" width="169" height="18">
<div style="margin-left: 25px; margin-right: 5px">
» <a href="home.html" target="Main"> Home</a><br>
» <a href="downloads.html" target="Main">Downloads</a><br>
» <a href="history.html" target="Main"> History </a><br>
» <a href="rules.html" target="Main"> Rules </a><br>
» <a href="faq.html" target="Main"> FAQ </a><br>
» <a href="gallery.html" target="Main"> Gallery </a><br>
» <a href="guide.html" target="Main"> Guide</a><br>
» <a href="links.html" target="Main">Links/Clansites</a><br>
» <a href="http://s12.invisionfree.com/Sanctity_MU/index.php?act=idx" target="blank"> Forum </a><br>
</p>
</div>
<!-- created by Jacksparro and XB7@ © teamssx.nl-->
</div></div>
Moet het dan dit worden???
Code (php)
??
Gewijzigd op 01/01/1970 01:00:00 door Jack
Heb je trouwens wel kennis van php of is dit gewoon een criminals?
en kzal zo ff script sturenn,, ogenblikje..
trouwens ik krijg nu een error..
www.teamssx.nl/sanctitymu/testindex.php
Gewijzigd op 01/01/1970 01:00:00 door Jack
Hmmm als ik dan toch voor je bezig ga, als je tenminst wel ff opschiet...waar kan ik je game downloaden?:D
marthijn:
Hmmm als ik dan toch voor je bezig ga, als je tenminst wel ff opschiet...waar kan ik je game downloaden?:D
nou,, nu nog nergens,, we zijn nog in een test fase... als je gedult hebt.. kmoet ff backup van vorige week downloade voor login script..
maar dit is de script van me index... een fout op regel 70 ofzo zegt ie :S
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>SanctityMu</title>
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>
<body topmargin="0" bgcolor="#000000" background="images/back.gif">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="760" bgcolor="#4A4A4C" style="border: 1 double #292929">
<tr>
<td width="100%" colspan="2"><br>
<img border="0" src="images/headerunder_blank.gif" width="760" height="43"></td>
</tr>
<tr>
<td width="570" valign="top"><div style="margin-left: 10px; margin-right: 10px">
<iframe name="Main" width="100%" height="850" border="0" frameborder="0" src="home.html">
SanctityMu can be only examined if you browser supports iframes, and yours don't probably.</iframe>
</div> </td>
<td width="190" valign="top">
<div align="right">
<table border="0" cellpadding="0" cellspacing="0" width="187">
<tr>
<td width="100%"><img border="0" src="images/rightnav.gif" width="187" height="22"><br>
<div align="right">
<div align="right"><div align="left" style="width: 145; height: 183">
<center><script language=Javascript1.2>
// verander hieronder de kleur font en grootte van het klokje
var tags_before_clock = "<font face='arial' size='1' color='#CCCCCC'><b> "
var tags_middle_clock = ""
if(navigator.appName == "Netscape") {
document.write('<layer id="clock"></layer><br>');
}
if (navigator.appVersion.indexOf("MSIE") != -1){
document.write('<span id="clock"></span>');
}
function upclock(){
var dte = new Date();
var hrs = dte.getHours();
var min = dte.getMinutes();
var sec = dte.getSeconds();
var col = ":";
var spc = " ";
var com = "";
if (hrs == 0) hrs=12;
if (min<=9) min="0"+min;
if (sec<=9) sec="0"+sec;
if(navigator.appName == "Netscape") {
document.clock.document.write(tags_before_clock+hrs+col+min+col+sec+tags_middle_clock+day+com+spc);
document.clock.document.close();
}
if (navigator.appVersion.indexOf("MSIE") != -1){
clock.innerHTML = tags_before_clock+hrs+col+min+col+sec+tags_middle_clock+com+com+spc;
}
}
setInterval("upclock()",200);
</script>
</center>
<img border="0" src="images/index.5.gif" width="169" height="18">
<div style="margin-left: 25px; margin-right: 5px">
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
<a href="home.html" target="Main"> Home</a><br>
<a href="downloads.html" target="Main">Downloads</a><br>
<a href="history.html" target="Main"> History </a><br>
<a href="rules.html" target="Main"> Rules </a><br>
<a href="faq.html" target="Main"> FAQ </a><br>
<a href="gallery.html" target="Main"> Gallery </a><br>
<a href="guide.html" target="Main"> Guide</a><br>
<a href="links.html" target="Main">Links/Clansites</a><br>
<a href="http://s12.invisionfree.com/Sanctity_MU/index.php?act=idx" target="blank"> Forum </a><br>
if($_SESSION['login'] == 1)
{
echo" » <a href="acessdenied.html" target="Main">Control Panel</a><br>";
}
?>
<a href="home.html" target="Main"> Home</a><br>
<a href="downloads.html" target="Main">Downloads</a><br>
<a href="history.html" target="Main"> History </a><br>
<a href="rules.html" target="Main"> Rules </a><br>
<a href="faq.html" target="Main"> FAQ </a><br>
<a href="gallery.html" target="Main"> Gallery </a><br>
<a href="guide.html" target="Main"> Guide</a><br>
<a href="links.html" target="Main">Links/Clansites</a><br>
<a href="http://s12.invisionfree.com/Sanctity_MU/index.php?act=idx" target="blank"> Forum </a><br>
if($_SESSION['login'] == 1)
{
echo" » <a href="acessdenied.html" target="Main">Control Panel</a><br>";
}
?>
</p>
</div>
<!-- created by Jacksparro and XB7@ © teamssx.nl-->
</div></div>
<div align="right"><div align="left" style="width: 145; height: 90"><img border="0" src="images/index.8.gif" width="169" height="18">
<div style="margin-left: 25px; margin-right: 5px">DB Server: <span class="style1">Offline</span><br>
Game Server: <span class="style1">Offline
</span></div>
</div>
</div>
</div></td>
</tr>
<tr>
<td width="100%" height="19" valign="top"><table border="0" cellpadding="5"
cellspacing="0" width="100%">
<tr>
<td width="100%"><div align="center"></div>
<FORM action="default.asp?log=in" method="post">
<p align="center"><span class="style2 style4">Nickname:</span><BR>
<input type="text" name="login" maxlength=16 style="width: 120;">
<BR>
<span class="style2 style4">Password:</span><BR>
<input type="password" name="pass" maxlength=16 style="width: 120;">
<BR>
<BR>
<input type="submit" name="submit" style="width: 100;" value="Login">
</p>
<p align="center"> <span class="style2"><a href="acessdenied.html" target="Main">Lost Password?</a></span><BR>
<span class="style2"><a href="acessdenied.html" target="Main">Register</a></span></p>
</FORM></td>
</tr>
</table></td>
</tr>
</table>
</div> </td>
</tr>
<tr>
<td width="100%" colspan="2"></td>
</tr>
</table>
<img border="0" src="images/header_blank.gif" width="760" height="203">
<p> </p>
</center>
</div>
</body>
</html>
Gewijzigd op 01/01/1970 01:00:00 door Jack
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?ph p tag zet echo-en. Anders moet je <?ph p even achter
<a href="http://s12.invisionfree.com/Sanctity_MU/index.php?act=idx" target="blank"> Forum </a><br>
zetten.
Verder moet je nog een session_start(); doen op elke pagina waar je de sessie wilt gebruiken. Die zet je gewoon direct na de <?php tag.
[code]<?php session_start();
if($_SESSION['login'] == 1)
{
echo" » <a href="acessdenied.html" target="Main">Control Panel</a><br>";
}
?>
En nou moet je op de loginpage nog die sessie laten starten.
<a href="http://s12.invisionfree.com/Sanctity_MU/index.php?act=idx" target="blank"> Forum </a><br>
zetten.
Verder moet je nog een session_start(); doen op elke pagina waar je de sessie wilt gebruiken. Die zet je gewoon direct na de <?php tag.
[code]<?php session_start();
if($_SESSION['login'] == 1)
{
echo" » <a href="acessdenied.html" target="Main">Control Panel</a><br>";
}
?>
En nou moet je op de loginpage nog die sessie laten starten.
Gewijzigd op 01/01/1970 01:00:00 door Kees de braak
<body ondragstart="return false">
<body onselectstart="return false">
<body oncontextmenu="return false">
<head>
</head>
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
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
<?php /* ------------------------- */
include("_include-config.php");
if(isset($_POST['login'],$_POST['pass'])) {
$dbres = mysql_query("SELECT `login`,`activated` FROM `[users]` WHERE `login`='{$_POST['login']}' AND `pass`=MD5('{$_POST['pass']}')");
if(($data = mysql_fetch_object($dbres)) && $data->activated == 1) {
$validate = md5(rand(0,1000));
setcookie("login",$data->login,time()+60*60*24,"/",".teamssx.nl/legendarymu");
setcookie("validate",$validate,time()+60*60*24,"/",".teamssx.nl/legendarymu");
mysql_query("REPLACE INTO `[online]`(`time`,`login`,`IP`,`validate`) values(NOW(),'{$_SERVER['REMOTE_ADDR']}','{$data->login}','$validate')");
$_SESSION['login'] = $data->login;
$_SESSION['IP'] = $_SERVER['REMOTE_ADDR'];
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`signup`) AS `signup` FROM `[users]` WHERE `login`='{$_SESSION['login']}'");
$_SESSION['data'] = mysql_fetch_object($dbres);
}
}
else if($_GET['x'] == "logout") {
mysql_query("DELETE FROM `[online]` WHERE `login`='{$_COOKIE['login']}' AND `validate`='{$_COOKIE['validate']}' AND `IP`='{$_SERVER['REMOTE_ADDR']}'");
setcookie("login",'',time()-24*60*60,"/","");
setcookie("validate",'',time()-24*60*60,"/","");
unset($_SESSION['login']);
unset($_SESSION['IP']);
unset($_SESSION['data']);
}
/* ------------------------- */ ?>
include("_include-config.php");
if(isset($_POST['login'],$_POST['pass'])) {
$dbres = mysql_query("SELECT `login`,`activated` FROM `[users]` WHERE `login`='{$_POST['login']}' AND `pass`=MD5('{$_POST['pass']}')");
if(($data = mysql_fetch_object($dbres)) && $data->activated == 1) {
$validate = md5(rand(0,1000));
setcookie("login",$data->login,time()+60*60*24,"/",".teamssx.nl/legendarymu");
setcookie("validate",$validate,time()+60*60*24,"/",".teamssx.nl/legendarymu");
mysql_query("REPLACE INTO `[online]`(`time`,`login`,`IP`,`validate`) values(NOW(),'{$_SERVER['REMOTE_ADDR']}','{$data->login}','$validate')");
$_SESSION['login'] = $data->login;
$_SESSION['IP'] = $_SERVER['REMOTE_ADDR'];
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`signup`) AS `signup` FROM `[users]` WHERE `login`='{$_SESSION['login']}'");
$_SESSION['data'] = mysql_fetch_object($dbres);
}
}
else if($_GET['x'] == "logout") {
mysql_query("DELETE FROM `[online]` WHERE `login`='{$_COOKIE['login']}' AND `validate`='{$_COOKIE['validate']}' AND `IP`='{$_SERVER['REMOTE_ADDR']}'");
setcookie("login",'',time()-24*60*60,"/","");
setcookie("validate",'',time()-24*60*60,"/","");
unset($_SESSION['login']);
unset($_SESSION['IP']);
unset($_SESSION['data']);
}
/* ------------------------- */ ?>
<html>
<head>
<title>SanctityMu</title>
<link rel="stylesheet" type="text/css" href="">
</head>
<body style="background: #000000; margin: 0px;">
<table align="center" width=100%>
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
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
<?php /* ------------------------- */
if($_GET['x'] == "logout")
print " <tr><td class=\"subTitle\"><b>Login</b></td></tr>\n <tr><td class=\"mainTxt\">Je bent nu uitgelogt\n <script language=\"javascript\">setTimeout('parent.window.location.reload()',500)</script></td></tr>\n";
else if($_GET['x'] == "lostpass") {
print " <tr><td class=\"subTitle\"><b>Lost Password</b></td></tr>\n";
if(isset($_GET['id'],$_GET['code'])) {
$dbres = mysql_query("SELECT `login` FROM `[temp]` WHERE `id`='{$_GET['id']}' AND `code`='{$_GET['code']}' AND `area`='lostpass'");
if($data = mysql_fetch_object($dbres)) {
$dbres = mysql_query("SELECT `login`,`email` FROM `[users]` WHERE `login`='{$data->login}'");
$data = mysql_fetch_object($dbres);
$newpass = rand(100000,999999);
mysql_query("UPDATE `[users]` SET `pass`=MD5('$newpass') WHERE `login`='{$data->login}'");
mysql_query("DELETE FROM `[temp]` WHERE `id`='{$_GET['id']}'");
mail($data->email,"Your new LegendaryMu password","Your old password has been reseted: $newpass","From: LegendaryMu <[email protected]>\n");
print " <tr><td class=\"mainTxt\">Your new password has been send to {$data->email}</td></tr>\n";
}
}
else if(isset($_POST['email'],$_POST['login'])) {
$dbres = mysql_query("SELECT `login`,`email` FROM `[users]` WHERE `login`='{$_POST['login']}' AND `email`='{$_POST['email']}'AND `activated`=1");
if($data = mysql_fetch_object($dbres)) {
$code = rand(100000,999999);
mysql_query("INSERT INTO `[temp]`(`login`,`code`,`area`,`time`) values('{$data->login}',$code,'lostpass',NOW())");
$id = mysql_insert_id();
mail($data->email,"LegendaryMu Password","Somebody did request us to reset your password. If u didn't than ignore this mail. If u request us to reset your password than click the link below,
http://www.teamssx.nl/legendarymu/login.php?x=lostpass&id=$id&code=$code","From: LegendaryMu <[email protected]>");
print " <tr><td class=\"mainTxt\">There has been send an mail to {$data->email} with more instructions</td></tr>\n";
}
else
print " <tr><td class=\"mainTxt\">There is no user with that nickname or E-Mail</td></tr>\n";
}
print <<<ENDHTML
<tr><td class="mainTxt" align="center"><br>
<form method="post"><table>
<tr><td width=100>Login:</td> <td><input type="text" name="login"></td></tr>
<tr><td width=100>E-Mail:<td> <td><input type="text" name="email"></td></tr>
<tr><td></td> <td align="right"><input type="submit" value="Ok" style="width: 100"></td></tr>
</form></table></td></tr>
ENDHTML;
}
else if($data) {
if($data->activated == 0)
print " <tr><td class=\"mainTxt\">Your account isn't activated</td></tr>\n";
else
print " <tr><td class=\"subTitle\"><b>Login</b></td></tr>\n <tr><td class=\"mainTxt\">You have been logged out\n <script language=\"javascript\">setTimeout('parent.window.location.reload()',500)</script>\n </td></tr>\n";
}
else {
print " <tr><td class=\"subTitle\"><b>Login</b></td></tr>\n";
if(isset($_POST['login'],$_POST['pass']))
print " <tr><td class=\"mainTxt\">Wrong nickname/password</td></tr>\n";
print <<<ENDHTML
<tr><td class="mainTxt">
<form method="post"><table align="center">
<tr><td width=100>Nickname:</td> <td><input type="text" name="login" maxlength=16 style="width: 150;"></td></tr>
<tr><td width=100>Password:</td> <td><input type="password" name="pass" maxlength=16 style="width: 150;"></td></tr>
<tr><td></td><td align="right"><input type="submit" name="submit" style="width: 100;" value="Login"></td></tr>
</table></form>
</td></tr>
<tr><td class="mainTxt" align="center"><a href="login.php?x=lostpass">Lost Password?</a></td></tr>
ENDHTML;
}
/* ------------------------- */ ?>
if($_GET['x'] == "logout")
print " <tr><td class=\"subTitle\"><b>Login</b></td></tr>\n <tr><td class=\"mainTxt\">Je bent nu uitgelogt\n <script language=\"javascript\">setTimeout('parent.window.location.reload()',500)</script></td></tr>\n";
else if($_GET['x'] == "lostpass") {
print " <tr><td class=\"subTitle\"><b>Lost Password</b></td></tr>\n";
if(isset($_GET['id'],$_GET['code'])) {
$dbres = mysql_query("SELECT `login` FROM `[temp]` WHERE `id`='{$_GET['id']}' AND `code`='{$_GET['code']}' AND `area`='lostpass'");
if($data = mysql_fetch_object($dbres)) {
$dbres = mysql_query("SELECT `login`,`email` FROM `[users]` WHERE `login`='{$data->login}'");
$data = mysql_fetch_object($dbres);
$newpass = rand(100000,999999);
mysql_query("UPDATE `[users]` SET `pass`=MD5('$newpass') WHERE `login`='{$data->login}'");
mysql_query("DELETE FROM `[temp]` WHERE `id`='{$_GET['id']}'");
mail($data->email,"Your new LegendaryMu password","Your old password has been reseted: $newpass","From: LegendaryMu <[email protected]>\n");
print " <tr><td class=\"mainTxt\">Your new password has been send to {$data->email}</td></tr>\n";
}
}
else if(isset($_POST['email'],$_POST['login'])) {
$dbres = mysql_query("SELECT `login`,`email` FROM `[users]` WHERE `login`='{$_POST['login']}' AND `email`='{$_POST['email']}'AND `activated`=1");
if($data = mysql_fetch_object($dbres)) {
$code = rand(100000,999999);
mysql_query("INSERT INTO `[temp]`(`login`,`code`,`area`,`time`) values('{$data->login}',$code,'lostpass',NOW())");
$id = mysql_insert_id();
mail($data->email,"LegendaryMu Password","Somebody did request us to reset your password. If u didn't than ignore this mail. If u request us to reset your password than click the link below,
http://www.teamssx.nl/legendarymu/login.php?x=lostpass&id=$id&code=$code","From: LegendaryMu <[email protected]>");
print " <tr><td class=\"mainTxt\">There has been send an mail to {$data->email} with more instructions</td></tr>\n";
}
else
print " <tr><td class=\"mainTxt\">There is no user with that nickname or E-Mail</td></tr>\n";
}
print <<<ENDHTML
<tr><td class="mainTxt" align="center"><br>
<form method="post"><table>
<tr><td width=100>Login:</td> <td><input type="text" name="login"></td></tr>
<tr><td width=100>E-Mail:<td> <td><input type="text" name="email"></td></tr>
<tr><td></td> <td align="right"><input type="submit" value="Ok" style="width: 100"></td></tr>
</form></table></td></tr>
ENDHTML;
}
else if($data) {
if($data->activated == 0)
print " <tr><td class=\"mainTxt\">Your account isn't activated</td></tr>\n";
else
print " <tr><td class=\"subTitle\"><b>Login</b></td></tr>\n <tr><td class=\"mainTxt\">You have been logged out\n <script language=\"javascript\">setTimeout('parent.window.location.reload()',500)</script>\n </td></tr>\n";
}
else {
print " <tr><td class=\"subTitle\"><b>Login</b></td></tr>\n";
if(isset($_POST['login'],$_POST['pass']))
print " <tr><td class=\"mainTxt\">Wrong nickname/password</td></tr>\n";
print <<<ENDHTML
<tr><td class="mainTxt">
<form method="post"><table align="center">
<tr><td width=100>Nickname:</td> <td><input type="text" name="login" maxlength=16 style="width: 150;"></td></tr>
<tr><td width=100>Password:</td> <td><input type="password" name="pass" maxlength=16 style="width: 150;"></td></tr>
<tr><td></td><td align="right"><input type="submit" name="submit" style="width: 100;" value="Login"></td></tr>
</table></form>
</td></tr>
<tr><td class="mainTxt" align="center"><a href="login.php?x=lostpass">Lost Password?</a></td></tr>
ENDHTML;
}
/* ------------------------- */ ?>
</table>
</body>
</html>
<noscript><noscript><plaintext><plaintext>
marthijn:
Bijna goed...je moet nog wel als je de linkjes die iedereen te zien krijgt binnen de
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?ph p tag zet echo-en. Anders moet je <?ph p even achter
<a href="http://s12.invisionfree.com/Sanctity_MU/index.php?act=idx" target="blank"> Forum </a><br>
zetten.
Verder moet je nog een session_start(); doen op elke pagina waar je de sessie wilt gebruiken. Die zet je gewoon direct na de <?php tag.
[code]<?php session_start();
if($_SESSION['login'] == 1)
{
echo" » <a href="acessdenied.html" target="Main">Control Panel</a><br>";
}
?>
En nou moet je op de loginpage nog die sessie laten starten. [/quote]
eeh zou jij dat kunne scripten?? bij mij word dat totaal niks..
<a href="http://s12.invisionfree.com/Sanctity_MU/index.php?act=idx" target="blank"> Forum </a><br>
zetten.
Verder moet je nog een session_start(); doen op elke pagina waar je de sessie wilt gebruiken. Die zet je gewoon direct na de <?php tag.
[code]<?php session_start();
if($_SESSION['login'] == 1)
{
echo" » <a href="acessdenied.html" target="Main">Control Panel</a><br>";
}
?>
En nou moet je op de loginpage nog die sessie laten starten. [/quote]
eeh zou jij dat kunne scripten?? bij mij word dat totaal niks..
Die moet dus de waarde een krijgen. Maar dan werken andere delen van je script niet meer.
Ik zit nu dus ff een standaart login systeem te bewerken. Ik kan je aanraden om ff een php cursusje te pakken anders kom je niet echt ver.
eheh lolxd opzich is dit toch nog wel 1 v an het belangrijkste... eerst maar login voor elkaar krijge.. kdenk toch dak in de zomervakante wat php boeke door ga leze..
Ik zal ff me best doen:P
kheb wle eens een paar criminals gemaakt maar das toch weer iets anders...
................................................
Op de index.php pagina.
» <a href="home.html" target="Main"> Home</a><br>
» <a href="downloads.html" target="Main">Downloads</a><br>
» <a href="history.html" target="Main"> History </a><br>
» <a href="rules.html" target="Main"> Rules </a><br>
» <a href="faq.html" target="Main"> FAQ </a><br>
» <a href="gallery.html" target="Main"> Gallery </a><br>
» <a href="guide.html" target="Main"> Guide</a><br>
» <a href="links.html" target="Main">Links/Clansites</a><br>
» <a href="http://s12.invisionfree.com/Sanctity_MU/index.php?act=idx" target="blank"> Forum </a><br>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
<?php session_start();
if($_SESSION['login2'] == 1)
{
echo" » <a href="acessdenied.html" target="Main">Control Panel</a><br>";
// echo" » <a href="extra link.html" target="Main">Extra link</a><br>";
// Een regel met '//' ervoor wordt een regel commentaar en komt dus niet in je script.
// Haal de '//' weg voor die tweede regel dan krijg je die link ook te zien. Zo kan je meer
// links toevoegen.
}
?>
if($_SESSION['login2'] == 1)
{
echo" » <a href="acessdenied.html" target="Main">Control Panel</a><br>";
// echo" » <a href="extra link.html" target="Main">Extra link</a><br>";
// Een regel met '//' ervoor wordt een regel commentaar en komt dus niet in je script.
// Haal de '//' weg voor die tweede regel dan krijg je die link ook te zien. Zo kan je meer
// links toevoegen.
}
?>
...............................................
En als je dit nou op home wilt laten zien, moet je
dus dit stukje script daarop ook weer zetten.
Wel opslaan als .php extensie.
Op de login pagina moet ook nog even wat verandert worden
Hopelijk werkt het dan in een keer. Maak van te voren even
een backup zodat ik niet strax je script heel misschien
heb vernageld.
..............................................
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
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
<?php /* ------------------------- */
include("_include-config.php");
if(isset($_POST['login'],$_POST['pass'])) {
$dbres = mysql_query("SELECT `login`,`activated` FROM `[users]` WHERE `login`='{$_POST['login']}' AND `pass`=MD5('{$_POST['pass']}')");
if(($data = mysql_fetch_object($dbres)) && $data->activated == 1) {
$validate = md5(rand(0,1000));
setcookie("login",$data->login,time()+60*60*24,"/",".teamssx.nl/legendarymu");
setcookie("validate",$validate,time()+60*60*24,"/",".teamssx.nl/legendarymu");
mysql_query("REPLACE INTO `[online]`(`time`,`login`,`IP`,`validate`) values(NOW(),'{$_SERVER['REMOTE_ADDR']}','{$data->login}','$validate')");
$_SESSION['login'] = $data->login;
$_SESSION['login2'] = 1;
$_SESSION['IP'] = $_SERVER['REMOTE_ADDR'];
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`signup`) AS `signup` FROM `[users]` WHERE `login`='{$_SESSION['login']}'");
$_SESSION['data'] = mysql_fetch_object($dbres);
}
}
else if($_GET['x'] == "logout") {
mysql_query("DELETE FROM `[online]` WHERE `login`='{$_COOKIE['login']}' AND `validate`='{$_COOKIE['validate']}' AND `IP`='{$_SERVER['REMOTE_ADDR']}'");
setcookie("login",'',time()-24*60*60,"/","");
setcookie("validate",'',time()-24*60*60,"/","");
unset($_SESSION['login']);
unset($_SESSION['IP']);
unset($_SESSION['data']);
}
/* ------------------------- */ ?>
include("_include-config.php");
if(isset($_POST['login'],$_POST['pass'])) {
$dbres = mysql_query("SELECT `login`,`activated` FROM `[users]` WHERE `login`='{$_POST['login']}' AND `pass`=MD5('{$_POST['pass']}')");
if(($data = mysql_fetch_object($dbres)) && $data->activated == 1) {
$validate = md5(rand(0,1000));
setcookie("login",$data->login,time()+60*60*24,"/",".teamssx.nl/legendarymu");
setcookie("validate",$validate,time()+60*60*24,"/",".teamssx.nl/legendarymu");
mysql_query("REPLACE INTO `[online]`(`time`,`login`,`IP`,`validate`) values(NOW(),'{$_SERVER['REMOTE_ADDR']}','{$data->login}','$validate')");
$_SESSION['login'] = $data->login;
$_SESSION['login2'] = 1;
$_SESSION['IP'] = $_SERVER['REMOTE_ADDR'];
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`signup`) AS `signup` FROM `[users]` WHERE `login`='{$_SESSION['login']}'");
$_SESSION['data'] = mysql_fetch_object($dbres);
}
}
else if($_GET['x'] == "logout") {
mysql_query("DELETE FROM `[online]` WHERE `login`='{$_COOKIE['login']}' AND `validate`='{$_COOKIE['validate']}' AND `IP`='{$_SERVER['REMOTE_ADDR']}'");
setcookie("login",'',time()-24*60*60,"/","");
setcookie("validate",'',time()-24*60*60,"/","");
unset($_SESSION['login']);
unset($_SESSION['IP']);
unset($_SESSION['data']);
}
/* ------------------------- */ ?>
Hiermee zou het moeten werken.
En ik ben ook geen beginner meer zie mijn status:D 100+:D
lars:
marthijn:
Bijna goed...je moet nog wel als je de linkjes die iedereen te zien krijgt binnen de
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
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
<?ph p tag zet echo-en. Anders moet je <?ph p even achter
<a href="http://s12.invisionfree.com/Sanctity_MU/index.php?act=idx" target="blank"> Forum </a><br>
zetten.
Verder moet je nog een session_start(); doen op elke pagina waar je de sessie wilt gebruiken. Die zet je gewoon direct na de <?php tag.
[code]<?php session_start();
if($_SESSION['login'] == 1)
{
echo" » <a href="acessdenied.html" target="Main">Control Panel</a><br>";
}
?>
En nou moet je op de loginpage nog die sessie laten starten. [/quote]
eeh zou jij dat kunne scripten?? bij mij word dat totaal niks..[/quote]
hij geeft nu alleen wel aan dat er in deze regel een fout zit...
echo" <a href="acessdenied.html" target="Main">Control Panel</a><br>";
foutmelding:
Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
<a href="http://s12.invisionfree.com/Sanctity_MU/index.php?act=idx" target="blank"> Forum </a><br>
zetten.
Verder moet je nog een session_start(); doen op elke pagina waar je de sessie wilt gebruiken. Die zet je gewoon direct na de <?php tag.
[code]<?php session_start();
if($_SESSION['login'] == 1)
{
echo" » <a href="acessdenied.html" target="Main">Control Panel</a><br>";
}
?>
En nou moet je op de loginpage nog die sessie laten starten. [/quote]
eeh zou jij dat kunne scripten?? bij mij word dat totaal niks..[/quote]
hij geeft nu alleen wel aan dat er in deze regel een fout zit...
echo" <a href="acessdenied.html" target="Main">Control Panel</a><br>";
foutmelding:
Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
Zie mijn vorige post compleet overzicht.
marthijn:
Zie mijn vorige post compleet overzicht.
hmm jah,, maar er blijft maar een error komen...
dit hebk bij de index..
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/teamssx/domains/teamssx.nl/public_html/sanctitymu/testindex.php:8) in /home/teamssx/domains/teamssx.nl/public_html/sanctitymu/testindex.php on line 80
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/teamssx/domains/teamssx.nl/public_html/sanctitymu/testindex.php:8) in /home/teamssx/domains/teamssx.nl/public_html/sanctitymu/testindex.php on line 80
dat heeft met die
Gewijzigd op 01/01/1970 01:00:00 door Jack