[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Webmasterplein.net • Toon onderwerp - Fout in script.(Inloggen)
Pagina 1 van 1

Fout in script.(Inloggen)

BerichtGeplaatst: 13 jun 2006 20:35
door Rik
Hallo, ik zit met een probleem, ik zit nu al een paar dagen te kijken naar mijn inlogsysteem.
Hij werkt niet, maar ik kan er geen fout uit halen.
Het werkt met sessies, maar 't lijkt of de sessies niet aangemaakt worden.
Login.php wordt dus zomaar weer geinclude.
Mijn PHP op index.php, bovenaan staat nog session_start:

[code="php"]
<?php
if(isset($_GET['m'])){
$m = urldecode($_GET['m']);
print $m;
}
if(isset($_SESSION['user'])){
?>
Welkom op 't <a href="http://www.bloe.net">DreamCMS</a> Admin Control Panel.<br />
U kunt vanaf hier nieuwe pagina's maken, ze bewerken, en verwijderen.<br />
Links, in 't menu kunt u kiezen wat u wilt doen.
Als u problemen heeft met DreamCMS kunt u <a href="http://www.bloe.net">hier</a> terecht.
<?php
} else {
include('login.php');
}
?>[/code]
En dan natuurlijk ook login.php:
[code="php"]<?php
$login = $_GET['login'];
if(isset($login)){
if(($_POST['username'] == 'Bloe') AND ($_POST['password'] == '***')){
$_SESSION['user'] = $_POST['username'];
$message = urlencode('U bent met succes ingelogt!<br /><br />');
header('location: index.php?m=' . $message);
} else {
$message = urlencode('Uw wachtwoord en / of gebruikersnaam waren verkeerd, log a.u.b. opnieuw in.<br /><br />');
header('location: index.php?m=' . $message);
}
} else {
?>
<form method="post" action="login.php?login=true">
Gebruikersnaam: <input type="text" value="" name="username" /><br />
Wachtwoord: <input type="password" value="" name="password" /><br />
<input type="submit" name="submit" value="Login!" />
</form>
<?php
}
?>[/code]
Kunnen jullie er iets in ontdekken?
Alvast bedankt,

Bloe.

Re: Fout in script.(Inloggen)

BerichtGeplaatst: 13 jun 2006 20:43
door KillerSponge
Nou, zoals je al kunt zien ben je een echo vergeten af te sluiten ^^

Tip: gebruik een text-editor met php-syntaxis, zodat je dit soort fouten snel kan ontdekken. Smile

Re: Fout in script.(Inloggen)

BerichtGeplaatst: 14 jun 2006 06:06
door Rik
Ik gerbuik nergens echo ofzo, alleen 1 keer print om een variabel te schrijven.
Dat stuk tekst staat buiten PHP.
En ik gebruik al Notepad2. Smile

Re: Fout in script.(Inloggen)

BerichtGeplaatst: 15 jun 2006 09:54
door Derk
session_start(); bovenaan je script zetten Wink

Re: Fout in script.(Inloggen)

BerichtGeplaatst: 15 jun 2006 16:13
door Rik

Re: Fout in script.(Inloggen)

BerichtGeplaatst: 16 jun 2006 20:59
door Robin
Ik heb de fout gevonden:

Het ligt aan het login.php stukje:

[code="php"]
$login = $_GET['login'];
(...)
<input type="submit" name="submit" value="Login!" />
[/code]

Ten eerste, ik gebruik altijd $HTTP_POST_VARS["naam"] als ik wil weten of een button is aangeklikt, maar ik weet niet zeker of dit moet.
Ten tweede, $_GET['login'] bestaat niet, want de naam van de button is submit. Verander die in login, en het werkt.

Re: Fout in script.(Inloggen)

BerichtGeplaatst: 16 jun 2006 22:46
door Derk

Re: Fout in script.(Inloggen)

BerichtGeplaatst: 17 jun 2006 05:51
door Rik

Re: Fout in script.(Inloggen)

BerichtGeplaatst: 17 jun 2006 12:57
door Robin
Ik had Bloe's code in een bestandje gezet en uitgetest... Bij mij werkte het volgende:

[code="php"]
<?php
session_start();
if(isset($_GET['m']))
{
$m = urldecode($_GET['m']);
print $m;
}
if(isset($_SESSION['user']))
{
?>
Welkom op 't <a href="http://www.bloe.net">DreamCMS</a> Admin Control Panel.<br />
U kunt vanaf hier nieuwe pagina's maken, ze bewerken, en verwijderen.<br />
Links, in 't menu kunt u kiezen wat u wilt doen.
Als u problemen heeft met DreamCMS kunt u <a href="http://www.bloe.net">hier</a> terecht.
<?php
}
else
{
$login = $HTTP_POST_VARS['login'];
if(isset($login))
{
if(($_POST['username'] == 'Bloe') AND ($_POST['password'] == 'sjaak'))
{
$_SESSION['user'] = $_POST['username'];
$message = urlencode('U bent met succes ingelogt!<br /><br />');
header('location: test.php?m=' . $message);
}
else
{
$message = urlencode('Uw wachtwoord en / of gebruikersnaam waren verkeerd, log a.u.b. opnieuw in.<br /><br />');
header('location: test.php?m=' . $message);
}
}
else
{
?>
<form method="post" action="test.php">
Gebruikersnaam: <input type="text" value="" name="username" /><br />
Wachtwoord: <input type="password" value="" name="password" /><br />
<input type="submit" name="login" value="Login!" />
</form>
<?php
}
}
?>
[/code]

Re: Fout in script.(Inloggen)

BerichtGeplaatst: 17 jun 2006 14:06
door Rik
Dat is fijn, maar raar dat mijn script niet werkte..
Maarja, dan ga ik dit maar even ook proberen, een soort van na te maken. (Je moet wel dingen leren, hè. Razz )
Bedankt! Smile