I want tht whn a user is logeed in,the user can see a page.hw it can be done in php..as:

if($valid_user==1)
 echo "You are logged in";
 else
 echo "Enter again";

In ths code I want tht whn the valid_user has value 1 the control shld be directed to a specific page rather then to show this msg.?

Kindly Guide?

Regards,

I want tht whn a user is logeed in,the user can see a page.hw it can be done in php..as:

if($valid_user==1)
 echo "You are logged in";
 else
 echo "Enter again";

In ths code I want tht whn the valid_user has value 1 the control shld be directed to a specific page rather then to show this msg.?

Kindly Guide?

Regards,

you can use header("Location:url") function to redirect after successful login.

i m using the code line

header("Location: http://localhost/school/home page1.html")

bt it is giving error:

Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\wwwroot\school\check.php:8) in C:\Inetpub\wwwroot\school\check.php on line 29

This is a very famous error in php . If you echo something , before the header function you'll get an error because the "channel" was occupied by echo.You need to put the header before any echo's or you can go in php.ini and set the output_buffering=On ( it's Off by default)

...or you can go in php.ini and set the output_buffering=On ( it's Off by default)

... or use ob_start();

- Mitko Kostov

This a code that I get from a site on the Internet, but I made what it takes to have it work.

I don't if I'm mess up somewhere, I have many errors

I'm running EasyPhp, my php ver is 5 and so Mysql.

I attach the files.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.