Hi All
Definitely a newbie with PHP, though I have messed with it a bit. I could
use some guidance here as I have spent the better part of 3 days walking the
net looking for an example.
Trying to accomplish:
When the user goes to the main page, index.html, they can enter a
username/password combo to go beyond. When the login button is pressed, the
script, login.php, is run to validate their entry and then send them along
to the first secure page, welcome.php. At the same time, if they just type
welcome.php in the address line, I would like them to be bounced back to the
index.html screen to do the login thing.
I've tried the header function, but keep getting errors about headers
already being sent. Research on this has led me to the session_register and
session_cache_limiter, but my main problem is that the header function seems
to be able to be used only once in the particular session. If I shut down
IE and start it up again, things work.
Any help out there or any reference links that may help to clear up my
misunderstanding?
Thanks.
Brad 6 1803
I noticed that Message-ID: <L9yjd.144164$Pl.30993@pd7tw1no> from Brad
Farrell contained the following: I've tried the header function, but keep getting errors about headers already being sent. Research on this has led me to the session_register and session_cache_limiter, but my main problem is that the header function seems to be able to be used only once in the particular session. If I shut down IE and start it up again, things work.
At the beginning of each page to be sent to a login page
<?php
session_start();
if($_SESSION['logged_in']==""){
header("Location: login.php");
exit;
}
Login.php
(This code is fine for one or two discrete username password
combinations. For more, you will be better off using a database)
<?php
session_start();
$_SESSION['logged_in']="";
$userpass=array("user1-pass1","user2-pass2","usern-passn");
$input=strtolower($_POST['username'])."-".strtolower($_POST['password']);
if(in_array($input,$userpass)){
$_SESSION['logged_in']=1;
}
then some data entry, error messages and so on
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
.oO(Geoff Berrow) header("Location: login.php");
The Location-header requires an absolute URL.
Micha
Thanks. That did the trick. I think I had some other issues with the
header function, but it now seems to be working just fine.
Brad
"Geoff Berrow" <bl******@ckdog.co.uk> wrote in message
news:e7********************************@4ax.com... I noticed that Message-ID: <L9yjd.144164$Pl.30993@pd7tw1no> from Brad Farrell contained the following:
I've tried the header function, but keep getting errors about headers already being sent. Research on this has led me to the session_register
andsession_cache_limiter, but my main problem is that the header function
seemsto be able to be used only once in the particular session. If I shut
downIE and start it up again, things work.
At the beginning of each page to be sent to a login page
<?php session_start(); if($_SESSION['logged_in']==""){ header("Location: login.php"); exit; }
Login.php (This code is fine for one or two discrete username password combinations. For more, you will be better off using a database)
<?php session_start(); $_SESSION['logged_in']=""; $userpass=array("user1-pass1","user2-pass2","usern-passn"); $input=strtolower($_POST['username'])."-".strtolower($_POST['password']);
if(in_array($input,$userpass)){ $_SESSION['logged_in']=1; }
then some data entry, error messages and so on
-- Geoff Berrow (put thecat out to email) It's only Usenet, no one dies. My opinions, not the committee's, mine. Simple RFDs http://www.ckdog.co.uk/rfdmaker/
I noticed that Message-ID: <bc********************************@4ax.com>
from Michael Fesser contained the following: .oO(Geoff Berrow)
header("Location: login.php");
The Location-header requires an absolute URL.
It's always worked for me. What clients do not accept this?
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
The error message means that before you issue header('location: login.php');
you have already written something out. Look for any previous echo or print
statements, or even a blank line somewhere.
--
Tony Marston http://www.tonymarston.net
"Brad Farrell" <br**********@brevell.com> wrote in message
news:L9yjd.144164$Pl.30993@pd7tw1no... Hi All
Definitely a newbie with PHP, though I have messed with it a bit. I could use some guidance here as I have spent the better part of 3 days walking the net looking for an example.
Trying to accomplish:
When the user goes to the main page, index.html, they can enter a username/password combo to go beyond. When the login button is pressed, the script, login.php, is run to validate their entry and then send them along to the first secure page, welcome.php. At the same time, if they just type welcome.php in the address line, I would like them to be bounced back to the index.html screen to do the login thing.
I've tried the header function, but keep getting errors about headers already being sent. Research on this has led me to the session_register and session_cache_limiter, but my main problem is that the header function seems to be able to be used only once in the particular session. If I shut down IE and start it up again, things work.
Any help out there or any reference links that may help to clear up my misunderstanding?
Thanks.
Brad
.oO(Geoff Berrow) I noticed that Message-ID: <bc********************************@4ax.com> from Michael Fesser contained the following:
The Location-header requires an absolute URL.
It's always worked for me. What clients do not accept this?
Doesn't matter, the full URL is required by the HTTP specification.
Micha This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ghazan Haider |
last post by:
I am posting this for the lack of a better newsgroup, and for the
knowledge of people here, and because its only partially OT.
We have a bunch of users with their computers at work. There are...
|
by: Phillip Armitage |
last post by:
I've spent the better part of two days checking out PHP, javascript and
numerous other language sites trying to find what I figure should be be an
easy web script page. Essentially what I want is a...
|
by: cgian31 |
last post by:
I need to hide the complexity from users to access an information
webpage, which is normally accessible after filling in a web
form with the correct data.
The address of the information webpage...
|
by: Pete Lux |
last post by:
I have built a web form that displays data, but I've hard coded the
username/password/database. I can create a separate .aspx for that info, but
I'd like to find out how to navigate back and forth....
|
by: sowencheung |
last post by:
Hi, all
The scenario is like this:
I have a master page, contains two user controls, one is a search
control, another is a login control.
The server-side <form> is in the master page,...
|
by: mracuraintegra |
last post by:
I'm stuck on a pretty big problem, and can't seem to find a solution,
so any help would be greatly appreciated!
I'm working with the default page generated for remote desktop web
clients (in the...
|
by: JDS |
last post by:
So, I'd like to create the following scenario:
1) Use cURL library within PHP (cURL + "Cookie Jar", et.al) to create a
virtual browser session that "logs in" to a remote site. (For example:
...
|
by: Mel |
last post by:
I am using "windows" authentication mode. I would like to store the
username and various information when the user logs on to the website.
Any ideas?
It would be a bonus to store the logout...
|
by: neo008 |
last post by:
Hi all,
I want to make a website where user can enter and see contents only by using given user ID and Password.
Can somebody suggest me what technology should I adopt for best and easy way....
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |