JeroenHulshof
Gebruiker
- Lid geworden
- 13 dec 2012
- Berichten
- 43
Hallo,
Ik heb een klein probleem. Ik heb het login systeem van php-login.net geinstalleerd op mijn webpagina. Als ik dan inlog op de index.php pagina, dan blijf ik ook op de index.php pagina, maar wel ingelogd. Nu wil ik zelf een nieuwe pagina aanmaken, maar ik heb echter geen idee hoe. Ik vind het al knap dat het installeren is gelukt haha.
Hopelijk weten jullie dit?
Dit is de code als je wilt inloggen
En dit is de code als je bent ingelogd:
Ik denk zelf dat het iets te maken heeft met <a href="index.php?logout">Logout</a>. Ookal kan ik de logout pagina niet vinden in het mapje.
Hopelijk kunnen jullie mij helpen
Jeroen
Ik heb een klein probleem. Ik heb het login systeem van php-login.net geinstalleerd op mijn webpagina. Als ik dan inlog op de index.php pagina, dan blijf ik ook op de index.php pagina, maar wel ingelogd. Nu wil ik zelf een nieuwe pagina aanmaken, maar ik heb echter geen idee hoe. Ik vind het al knap dat het installeren is gelukt haha.
Hopelijk weten jullie dit?
Dit is de code als je wilt inloggen
Code:
<?php
/**
* A simple, clean and secure PHP Login Script
*
* MINIMAL VERSION
* (check the website / github / facebook for other versions)
*
* A simple PHP Login Script.
* Uses PHP SESSIONS, modern password-hashing and salting
* and gives the basic functions a proper login system needs.
*
* Please remember: this is just the minimal version of the login script, so if you need a more
* advanced version, have a look on the github repo. there are / will be better versions, including
* more functions and/or much more complex code / file structure. buzzwords: MVC, dependency injected,
* one shared database connection, PDO, prepared statements, PSR-0/1/2 and documented in phpDocumentor style
*
* @package php-login
* @author Panique
* @link https://github.com/panique/php-login/
* @license http://opensource.org/licenses/MIT MIT License
*/
// checking for minimum PHP version
if (version_compare(PHP_VERSION, '5.3.7', '<')) {
exit("Sorry, Simple PHP Login does not run on a PHP version smaller than 5.3.7 !");
} else if (version_compare(PHP_VERSION, '5.5.0', '<')) {
// if you are using PHP 5.3 or PHP 5.4 you have to include the password_api_compatibility_library.php
// (this library adds the PHP 5.5 password hashing functions to older versions of PHP)
require_once("libraries/password_compatibility_library.php");
}
// include the configs / constants for the database connection
require_once("config/db.php");
// load the login class
require_once("classes/Login.php");
// create a login object. when this object is created, it will do all login/logout stuff automatically
// so this single line handles the entire login process. in consequence, you can simply ...
$login = new Login();
// ... ask if we are logged in here:
if ($login->isUserLoggedIn() == true) {
// the user is logged in. you can do whatever you want here.
// for demonstration purposes, we simply show the "you are logged in" view.
include("views/logged_in.php");
} else {
// the user is not logged in. you can do whatever you want here.
// for demonstration purposes, we simply show the "you are not logged in" view.
include("views/not_logged_in.php");
}
?>
En dit is de code als je bent ingelogd:
Code:
<div>
<!-- if you need user information, just put them into the $_SESSION variable and output them here -->
Hey, <?php echo $_SESSION['user_name']; ?>.
<br>Je bent ingelogd! Vanaf hier kun je verdere stappen ondernemen!
</div>
<div>
<!-- because people were asking: "index.php?logout" is just my simplified form of "index.php?logout=true" -->
<a href="index.php?logout">Logout</a>
</div>
Ik denk zelf dat het iets te maken heeft met <a href="index.php?logout">Logout</a>. Ookal kan ik de logout pagina niet vinden in het mapje.
Hopelijk kunnen jullie mij helpen
Jeroen