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_registe r and
session_cache_l imiter, 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
misunderstandin g?
Thanks.
Brad 6 1819
I noticed that Message-ID: <L9yjd.144164$P l.30993@pd7tw1n o> 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_registe r 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("Locatio n: 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=strtolow er($_POST['username'])."-".strtolower($_ POST['password']);
if(in_array($in put,$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("Locati on: 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.c om... I noticed that Message-ID: <L9yjd.144164$P l.30993@pd7tw1n o> 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_registe r
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("Locatio n: 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=strtolow er($_POST['username'])."-".strtolower($_ POST['password']);
if(in_array($in put,$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("Locat ion: 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('locatio n: 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**********@b revell.com> wrote in message
news:L9yjd.1441 64$Pl.30993@pd7 tw1no... 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_registe r and session_cache_l imiter, 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 misunderstandin g?
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
reports that the users need, which could be in html, php, asp, jsp,
whatever.
Now I am trying to eliminate the login window entirely. In an html
request, the client (firefox, ie, etc) sends the clients hostname, IP,
a bunch of other stuff, but...
|
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 self calling script (ASP,
PHP, whatever) which will do the following:
Let's assume that my script is called FTP.ASP
1) Display an HTML login form prompting user to enter a user name and
password. Login button action (either at the button or...
|
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 is like
https://external.address.com/info.asp?<numeric code>
where <numeric code> is a number generated by the server.
This number (always different) is generated by the server only when you
open the first web page in your browser, fill in the...
|
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.
I would like the login.aspx to come up first, connect to the db, then call
up my quote form. Do I do this with a 'Show'/'Hide'?
Thanks!
|
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, that's of course.
It seems the search control is rendered first, when I stay in the
| |
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 TSWeb folder), and I'm trying to automate the login.
There is a UserName property that allows me to set the username, but I
need to automate the password too!
Looking at MSDN, there appears to be an advanced interface that allows
for...
|
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:
here:
http://curl.haxx.se/libcurl/php/examples/cookiejar.html
and here:
http://curl.haxx.se/libcurl/php/examples/ebay_login.html
|
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 time too but I hear that is
difficult and unreliable but if anyone knows a way to do that too I am
all ears.
(Visual Studio 2005, Asp.net 2.0, Visual Basic)
|
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. (like vbscript/asp/php/...??????)
I'm good at VB but never gone for vb scripting. Can somebody help me where can I start from learning VB scripting for web development?
-NEo
http://www.trisham.com
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |