Ledensysteem
gamesty - 17/07/2005 10:55
|
Onbekend |
|
Hallo,
Ik ben een site aan het maken met een ledensysteem.Wanneer ik de index wil openen krijg ik deze error:
Parse error: parse error, unexpected '}' in /vhost/usr/radiogroenzwart/index.php on line 35
Dit is het scriptje:
<title>Login</title>
<body bgcolor="#006634">
<table border="0" width="101%" bgcolor="#C0C0C0" background="../../../Documents%20and%20Settings/ik/Mijn%20documenten/Mijn%20ontvangen%20bestanden/linkerzilverstuk.jpg">
<tr>
<td>
<center><table border="1" width="99%" cellspacing="8" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF">
<tr>
<td colspan="2" height="123" bgcolor="#C0C0C0" background="header.jpg">
<p> </td>
</tr>
<tr>
<td colspan="2" bgcolor="#C0C0C0">MENULINK/MENULINK/MENULINK/MENULINK/MENULINK/MENULINK/MENULINK/MENULINK/MENU</td>
</tr>
<tr>
<td bgcolor="#C0C0C0" height="220" width="220"><img border="0" src="radio%20groenzwart%20logo.jpg" width="220" height="220"></td>
<td width="74%" rowspan="2" bgcolor="#C0C0C0">Tekst</td>
</tr>
<tr>
<td width="22%" height="24" bgcolor="#C0C0C0">
<body>
<form method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td>Username:</td></tr>
<tr><td><input type="text" name="username"></td></tr>
<tr><td>Password:</td></tr>
<tr><td><input type="password" name="password"></td></tr>
<tr><td><input type="submit" value="Login" name="Login"></td></tr>
</table>
</form>
<p>
<?php
} elseif ($controle == TRUE) {
echo "Welkom $jenickname";
} ?>
</body>
</html></td>
</tr>
</table></td>
</tr>
</table>
<title>Login</title> <body bgcolor="#006634"> <table border="0" width="101%" bgcolor="#C0C0C0" background="../../../Documents%20and%20Settings/ik/Mijn%20documenten/Mijn%20ontvangen%20bestanden/linkerzilverstuk.jpg"> <tr> <td> <center><table border="1" width="99%" cellspacing="8" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF"> <tr> <td colspan="2" height="123" bgcolor="#C0C0C0" background="header.jpg"> <p> </td> </tr> <tr> <td colspan="2" bgcolor="#C0C0C0">MENULINK/MENULINK/MENULINK/MENULINK/MENULINK/MENULINK/MENULINK/MENULINK/MENU</td> </tr> <tr> <td bgcolor="#C0C0C0" height="220" width="220"><img border="0" src="radio%20groenzwart%20logo.jpg" width="220" height="220"></td> <td width="74%" rowspan="2" bgcolor="#C0C0C0">Tekst</td> </tr> <tr> <td width="22%" height="24" bgcolor="#C0C0C0"> <body> <form method="post" action=""> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td>Username:</td></tr> <tr><td><input type="text" name="username"></td></tr> <tr><td>Password:</td></tr> <tr><td><input type="password" name="password"></td></tr> <tr><td><input type="submit" value="Login" name="Login"></td></tr> </table> </form> <p> <?php } elseif ($controle == TRUE) { echo "Welkom $jenickname"; } ?> </body> </html></td> </tr> </table></td> </tr> </table>
|
11 antwoorden
Gesponsorde links |
|
Martijn1989 - 17/07/2005 10:59 (laatste wijziging 17/07/2005 11:07)
|
PHP ver gevorderde |
|
GOED, maar niet PERFECT
<?php
if ($controle == TRUE) {
echo "Welkom $jenickname";
} ?>
<?php if ($controle == TRUE) { echo "Welkom $jenickname"; } ?>
GOED, en PERFECT
<?php
if($controle == TRUE) {
echo "Welkom ".$jenickname." op deze site";
}
?>
<?php if($controle == TRUE) { echo "Welkom ".$jenickname." op deze site"; } ?>
|
BigBug - 17/07/2005 11:01 (laatste wijziging 17/07/2005 11:02)
|
PHP expert |
|
Je begint met een elseif???
<?php
if($controle == TRUE) {
echo "Welkom ".$jenickname." op deze site";
}
?>
<?php if($controle == TRUE) { echo "Welkom ".$jenickname." op deze site"; } ?>
Zo zou ik het doen
Edit: @ Martijn, ik zou met ".$jenickname." werken. Dat is namelijk wat netter |
Martijn1989 - 17/07/2005 11:06
|
PHP ver gevorderde |
|
Ja,.. dat zag ik niet, vulde ff snel dat if () { } aan ;) ... zou ik ook doen ja ;) |
gamesty - 17/07/2005 11:36
|
Onbekend |
|
Ben nog maar een nieuwtje in php.Ik maak nog fouten:s |
gamesty - 17/07/2005 11:40
|
Onbekend |
|
Hallo,
Het werkt nu.Ik krijg geen error meer.Alleen krijg ik nu ook die melding niet van Halo, ... welkom op de site.Hoe komt dit? |
Martijn1989 - 17/07/2005 11:44
|
PHP ver gevorderde |
|
Dan klopt, if($controle == TRUE) { niet,... geef eens de verwerking van $controle |
gamesty - 17/07/2005 11:52 (laatste wijziging 17/07/2005 11:54)
|
Onbekend |
|
Wat moet ik dan wel hebben?Dat ik de controle en die melding heb?
Zo beter:
<?php
ob_start();
//Hoe lang de bezoeker mag ingelogged blijven:
$expiredate = time()+60*60*24*7; //ingesteld op 1 week
if ($logout == 1)
{ setcookie("username");
setcookie("passgecodeerd");
header("location:index.php");
exit;
}
if ($_POST["username"] && $_POST["password"])
{ // password coderen
$passgecodeerd = md5($_POST["password"]);
$username = $_POST["username"];
// variabelen in een cookie zetten
setcookie("username",$username,$expiredate);
setcookie("passgecodeerd",$passgecodeerd,$expiredate);
header("location:$_SERVER[REQUEST_URI]");
exit;
}
$controle == FALSE;
$level = 1;
$jeid = "";
include ("login.php");
$controle = password($username, $passgecodeerd);
if ($controle == TRUE)
{ $query = "SELECT * FROM members where id='$jeid'";
$resultaat = mysql_query($query) or die (mysql_error());
while ($obj = mysql_fetch_object($resultaat))
{ $nickname ="$obj->nickname";
$jeid="$obj->id";
$level="$obj->level";
}
include ('config.php');
}
if ($_POST['Login'] && $controle == TRUE)
echo "Je bent succesvol ingelogged";
elseif ($_POST['Login'] && $controle != TRUE)
echo "Fout wachtwoord en/of gebruikersnaam";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 ...>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=...">
<title>Login</title>
</head>
<body>
<?php
if ($controle != TRUE)
{ ?><form method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td>Username:</td></tr>
<tr><td><input type="text" name="username"></td></tr>
<tr><td>Password:</td></tr>
<tr><td><input type="password" name="password"></td></tr>
<tr><td><input type="submit" value="Login" name="Login"></td></tr>
</table>
</form>
<?php
if($controle == TRUE) {
echo "Welkom ".$jenickname." op deze site";
}
?>
</body>
</html>
<?php //Hoe lang de bezoeker mag ingelogged blijven: $expiredate = time()+60*60*24*7; //ingesteld op 1 week if ($logout == 1) } if ($_POST["username"] && $_POST["password"]) { // password coderen $passgecodeerd = md5($_POST["password"]); $username = $_POST["username"]; // variabelen in een cookie zetten setcookie("passgecodeerd",$passgecodeerd,$expiredate); header("location:$_SERVER[REQUEST_URI]"); } $controle == FALSE; $level = 1; $jeid = ""; include ("login.php"); $controle = password($username, $passgecodeerd); if ($controle == TRUE) { $query = "SELECT * FROM members where id='$jeid'"; { $nickname ="$obj->nickname"; $jeid="$obj->id"; $level="$obj->level"; } include ('config.php'); } if ($_POST['Login'] && $controle == TRUE) echo "Je bent succesvol ingelogged"; elseif ($_POST['Login'] && $controle != TRUE) echo "Fout wachtwoord en/of gebruikersnaam"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 ...> <html> <head> <meta http-equiv="content-type" content="text/html; charset=..."> <title>Login</title> </head> <body> <?php if ($controle != TRUE) { ?><form method="post" action=""> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td>Username:</td></tr> <tr><td><input type="text" name="username"></td></tr> <tr><td>Password:</td></tr> <tr><td><input type="password" name="password"></td></tr> <tr><td><input type="submit" value="Login" name="Login"></td></tr> </table> </form> <?php if($controle == TRUE) { echo "Welkom ".$jenickname." op deze site"; } ?> </body> </html>
|
Martijn1989 - 17/07/2005 12:08 (laatste wijziging 17/07/2005 12:11)
|
PHP ver gevorderde |
|
En zo :
<?php
ob_start();
//Hoe lang de bezoeker mag ingelogged blijven:
$expiredate = time()+60*60*24*7; //ingesteld op 1 week
if ($logout == 1)
{ setcookie("username");
setcookie("passgecodeerd");
header("location:index.php");
exit;
}
if ($_POST["username"] && $_POST["password"])
{ // password coderen
$passgecodeerd = md5($_POST["password"]);
$username = $_POST["username"];
// variabelen in een cookie zetten
setcookie("username",$username,$expiredate);
setcookie("passgecodeerd",$passgecodeerd,$expiredate);
header("location:$_SERVER[REQUEST_URI]");
exit;
}
$controle == FALSE;
$level = 1;
$jeid = "";
include ("login.php");
$controle = password($username, $passgecodeerd);
if ($controle == TRUE)
{ $query = "SELECT * FROM members where id='$jeid'";
$resultaat = mysql_query($query) or die (mysql_error());
while ($obj = mysql_fetch_object($resultaat))
{ $nickname ="$obj->nickname";
$jeid="$obj->id";
$level="$obj->level";
}
include ('config.php');
}
if ($_POST['Login'] && $controle == TRUE) {
echo "Je bent succesvol ingelogged";
} elseif ($_POST['Login'] && $controle != TRUE) {
echo "Fout wachtwoord en/of gebruikersnaam";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 ...>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=...">
<title>Login</title>
</head>
<body>
<?php
if ($controle != TRUE)
{ ?><form method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td>Username:</td></tr>
<tr><td><input type="text" name="username"></td></tr>
<tr><td>Password:</td></tr>
<tr><td><input type="password" name="password"></td></tr>
<tr><td><input type="submit" value="Login" name="Login"></td></tr>
</table>
</form>
<?php
} if($controle == TRUE) {
echo "Welkom ".$jenickname." op deze site";
}
?>
</body>
</html>
<?php //Hoe lang de bezoeker mag ingelogged blijven: $expiredate = time()+60*60*24*7; //ingesteld op 1 week if ($logout == 1) } if ($_POST["username"] && $_POST["password"]) { // password coderen $passgecodeerd = md5($_POST["password"]); $username = $_POST["username"]; // variabelen in een cookie zetten setcookie("passgecodeerd",$passgecodeerd,$expiredate); header("location:$_SERVER[REQUEST_URI]"); } $controle == FALSE; $level = 1; $jeid = ""; include ("login.php"); $controle = password($username, $passgecodeerd); if ($controle == TRUE) { $query = "SELECT * FROM members where id='$jeid'"; { $nickname ="$obj->nickname"; $jeid="$obj->id"; $level="$obj->level"; } include ('config.php'); } if ($_POST['Login'] && $controle == TRUE) { echo "Je bent succesvol ingelogged"; } elseif ($_POST['Login'] && $controle != TRUE) { echo "Fout wachtwoord en/of gebruikersnaam"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 ...> <html> <head> <meta http-equiv="content-type" content="text/html; charset=..."> <title>Login</title> </head> <body> <?php if ($controle != TRUE) { ?><form method="post" action=""> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td>Username:</td></tr> <tr><td><input type="text" name="username"></td></tr> <tr><td>Password:</td></tr> <tr><td><input type="password" name="password"></td></tr> <tr><td><input type="submit" value="Login" name="Login"></td></tr> </table> </form> <?php } if($controle == TRUE) { echo "Welkom ".$jenickname." op deze site"; } ?> </body> </html>
Je vergat op regel 42-46 -> 2× { en 2 × }
Je vergat een } op regel 66 |
Martijn1989 - 17/07/2005 12:23 (laatste wijziging 17/07/2005 12:23)
|
PHP ver gevorderde |
|
Je moet even in dit in de config zetten :
<?php
ob_start();
//Hoe lang de bezoeker mag ingelogged blijven:
$expiredate = time()+60*60*24*7; //ingesteld op 1 week
if ($logout == 1)
{ setcookie("username");
setcookie("passgecodeerd");
header("location:index.php");
exit;
}
if ($_POST["username"] && $_POST["password"])
{ // password coderen
$passgecodeerd = md5($_POST["password"]);
$username = $_POST["username"];
// variabelen in een cookie zetten
setcookie("username",$username,$expiredate);
setcookie("passgecodeerd",$passgecodeerd,$expiredate);
header("location:$_SERVER[REQUEST_URI]");
exit;
}
$controle == FALSE;
$level = 1;
$jeid = "";
include ("login.php");
$controle = password($username, $passgecodeerd);
if ($controle == TRUE)
{ $query = "SELECT * FROM members where id='$jeid'";
$resultaat = mysql_query($query) or die (mysql_error());
while ($obj = mysql_fetch_object($resultaat))
{ $nickname ="$obj->nickname";
$jeid="$obj->id";
$level="$obj->level";
}
include ('config.php');
}
if ($_POST['Login'] && $controle == TRUE) {
echo "Je bent succesvol ingelogged";
} elseif ($_POST['Login'] && $controle != TRUE) {
echo "Fout wachtwoord en/of gebruikersnaam";
}
?>
<?php //Hoe lang de bezoeker mag ingelogged blijven: $expiredate = time()+60*60*24*7; //ingesteld op 1 week if ($logout == 1) } if ($_POST["username"] && $_POST["password"]) { // password coderen $passgecodeerd = md5($_POST["password"]); $username = $_POST["username"]; // variabelen in een cookie zetten setcookie("passgecodeerd",$passgecodeerd,$expiredate); header("location:$_SERVER[REQUEST_URI]"); } $controle == FALSE; $level = 1; $jeid = ""; include ("login.php"); $controle = password($username, $passgecodeerd); if ($controle == TRUE) { $query = "SELECT * FROM members where id='$jeid'"; { $nickname ="$obj->nickname"; $jeid="$obj->id"; $level="$obj->level"; } include ('config.php'); } if ($_POST['Login'] && $controle == TRUE) { echo "Je bent succesvol ingelogged"; } elseif ($_POST['Login'] && $controle != TRUE) { echo "Fout wachtwoord en/of gebruikersnaam"; } ?>
nieuwepagina.php
<?php
include("config.php");
<?php
if ($controle != TRUE) {
echo "Meld je eerst aan!";
} else {
//pagina
}
?>
<?php include("config.php"); <?php if ($controle != TRUE) { echo "Meld je eerst aan!"; } else { //pagina } ?>
|
Gesponsorde links |
|
Dit onderwerp is gesloten. |
|