web page structure
Moderator: General Moderators
web page structure
How you make your web page? I am little pit confused about that. How you connect all pages? How you make them secure?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Sorry, did not explain clearly, wanted to say that someone evil man can also go into web.ee/admin/delete.php?id=1 this page and delete entry. How can i avoid it, use some sessions to control is the admin logged in ?Jcart wrote:the information in the url after ? is available in the $_GET superglobal.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Typically when logging in a user is given a session flag to indicate they have permission to access specific pages. In the simplest sense, a is_logged_in flag of some sort is given, ie.
and then on your admin/delete.php at the top of the page you'd do
Code: Select all
//semi pseudo
session_start();
if (login is valid)
{
$_SESSION['loggedin'] = true;
}Code: Select all
session_start();
if (!isset($_SESSION['loggedin']) || !$_SESSION['loggedin'])
{
//redirect to main page
header('Location: http://domain.com/');
exit();
}