Solved

trying to navigate to a page

Posted on 2012-03-17
2
253 Views
Last Modified: 2012-06-27
hi everyone
In my index.php file I have a form used for logging in which has login.php as the action

in login.php I have

<?php


require_once 'cls_user.php';

if (isset($_POST['uid']) && isset($_POST['pwd']))
{
    $user = new user;
    $user->let_uid($_POST['uid']);
    $user->let_pwd($_POST['pwd']);
    if ($user->authenticate())
    {
        //echo "authenticated!";
        header('index.php');
    }
}



?>

Open in new window


when the user class authenticates the login it starts a session variable, the idea being when   returning control back to index.php it sees the session variable has been set and acknowledges the user.

the problem is that the 'header' command isn't doing anything, I thought it would go back to index.php but instead I just get a blank screen (or just 'authenticated!' if I uncomment it)

how can I make it go back to index.php or what approach do I need to make it work
0
Comment
Question by:Natchiket
2 Comments
 
LVL 3

Accepted Solution

by:
WebF00L earned 500 total points
ID: 37733081
Try

header("Location: index.php");

Open in new window

0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 37734668
This article shows the design pattern used for PHP client authentication.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_2391-PHP-login-logout-and-easy-access-control.html

Consider adding error_reporting(E_ALL); to your scripts.  It will save you a lot of trouble because you will be able to see many things that PHP might be hiding from you in its default condition of Notice suppression.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
htacces issue 2 41
How can I do this in Pyhton? 12 74
PHP Script - Am I missing anything here? 8 38
PHP json decode 9 20
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now