User Authentication using PHP4 and Apache

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
idnoble
Forum Commoner
Posts: 28
Joined: Wed Mar 31, 2004 4:09 am

User Authentication using PHP4 and Apache

Post by idnoble »

Hello,
I'm trying to restrict access to some parts of my site, I have created authentiaction levels using PHP and Mysql, but its still possible for users to circumvent the system, by typing the URL, I want people who does this to redirected to another page. Any one knows how to do this?
Thanks in advance
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

use cookies with session ;-)

Code: Select all

/// example

<?
    // Check if the cookies are set
    // This removes some notices (undefined index)
    if (isset($_COOKIE['USERNAME']) && isset($_COOKIE['PASSWORD']))
    {
        // Get values from superglobal variables
        $USERNAME = $_COOKIE['USERNAME'];
        $PASSWORD = $_COOKIE['PASSWORD'];

$security = new auth();
        $check = $security->docheck($USERNAME, $PASSWORD);
    }
    else
    {
        $check = false;
    }
                                                                                                                             
        if ($check == false)
        {
do something here....
// include that on the pages which you want to protect
Post Reply