473,569 Members | 2,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can I ensure a PAGE2.php is opened only after viewing PAGE1.php AND is opened in HTTPS?

I have a web page where certain pages have to be opened in a certain order
and should only be available when the user openes them in HTTPS.

They are all forms and the form action sends you to the next https:// page
but you can also take the S out of https:// and it opens also. That's what
I need to avoid as well as making certain they got to a certain page FROM a
certain page.

When I try:
if (isset($_SERVER['HTTPS']!='on'))
it crashes and is not even listed on php.net as a valid variable.

Many thanks
Jul 17 '05 #1
9 3658

On 19-Nov-2003, "NotGiven" <no****@nonegiv en.net> wrote:
I have a web page where certain pages have to be opened in a certain order
and should only be available when the user openes them in HTTPS.

They are all forms and the form action sends you to the next https:// page
but you can also take the S out of https:// and it opens also. That's
what
I need to avoid as well as making certain they got to a certain page FROM
a
certain page.

When I try:
if (isset($_SERVER['HTTPS']!='on'))
it crashes and is not even listed on php.net as a valid variable.


Either hide something in a field on the page that you check in the next page
(if your hidden field isn't in the $_POST array you know the user didn't
come from that page) or use sessions.

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@wil lglen.net (it's reserved for spammers)
Jul 17 '05 #2
Tom Thackrey wrote:

On 19-Nov-2003, "NotGiven" <no****@nonegiv en.net> wrote:
I have a web page where certain pages have to be opened in a certain
order and should only be available when the user openes them in HTTPS.

They are all forms and the form action sends you to the next https://
page
but you can also take the S out of https:// and it opens also. That's
what
I need to avoid as well as making certain they got to a certain page FROM
a
certain page.

When I try:
if (isset($_SERVER['HTTPS']!='on'))
it crashes and is not even listed on php.net as a valid variable.


Either hide something in a field on the page that you check in the next
page (if your hidden field isn't in the $_POST array you know the user
didn't come from that page) or use sessions.

You could do it with sessions.

on the first page: (start the sessions and all that good stuff)
$_SESSION['pageone'] = true

on page two:
if($_SESSION['pageone'] == true){
$_SESSION['pagetwo'] = true;
pagetwostuff();
}
else{
echo "Please visit page one first!";
echo "<a href="pageone"> page one</a>";
}

continue if you have page 3, etc...
if($_SESSION['pageone'] == true && $_SESSION['pagetwo'] == true)

if you have lots of pages in sequence, you may want to figure out a way to
do this with an array instead of individual arrays. ie:
pages[0] == true; // visited page one
pages[1] == true; // visited page two
pages[2] == false; // didnt visit page three/on page 3 perhaps?
pages[3] == false; // didnt visit page four

Good Luck!
-Eric Kincl
Jul 17 '05 #3
You could also look into the referer and see whether it came from
https://yourdomain.com/page1.php or not, etc etc

"Tom Thackrey" <us***********@ nospam.com> wrote in message
news:vu******** ***********@new ssvr25.news.pro digy.com...

On 19-Nov-2003, "NotGiven" <no****@nonegiv en.net> wrote:
I have a web page where certain pages have to be opened in a certain order and should only be available when the user openes them in HTTPS.

They are all forms and the form action sends you to the next https:// page but you can also take the S out of https:// and it opens also. That's
what
I need to avoid as well as making certain they got to a certain page FROM a
certain page.

When I try:
if (isset($_SERVER['HTTPS']!='on'))
it crashes and is not even listed on php.net as a valid variable.
Either hide something in a field on the page that you check in the next

page (if your hidden field isn't in the $_POST array you know the user didn't
come from that page) or use sessions.

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@wil lglen.net (it's reserved for spammers)

Jul 17 '05 #4
On Wed, 19 Nov 2003 18:01:41 -0800, Thi Nguyen wrote:
You could also look into the referer and see whether it came from
https://yourdomain.com/page1.php or not, etc etc

"Tom Thackrey" <us***********@ nospam.com> wrote in message
news:vu******** ***********@new ssvr25.news.pro digy.com...

On 19-Nov-2003, "NotGiven" <no****@nonegiv en.net> wrote:
I have a web page where certain pages have to be opened in a certain order and should only be available when the user openes them in HTTPS.
(snip)


Watch that, though... referers are sent by the browser, and can be easily
faked or omitted.
--
-- Rudy Fleminger
-- sp@mmers.and.ev il.ones.will.bo w-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Jul 17 '05 #5
> They are all forms and the form action sends you to the next https:// page
but you can also take the S out of https:// and it opens also. That's what I need to avoid as well as making certain they got to a certain page FROM a certain page.

When I try:
if (isset($_SERVER['HTTPS']!='on'))
it crashes and is not even listed on php.net as a valid variable.


Try this instead:

if (isset($_SERVER['HTTPS'])!='on')

Bye,
Jonathan
Jul 17 '05 #6
That caused page failure. I can't find anything anywhere that talks about
HTTPS being a parameter in $_SERVER

Thanks.

"Jonathan" <jo******@trico lon.com> wrote in message
news:3f******** **************@ news.xs4all.nl. ..
They are all forms and the form action sends you to the next https:// page but you can also take the S out of https:// and it opens also. That's what
I need to avoid as well as making certain they got to a certain page

FROM a
certain page.

When I try:
if (isset($_SERVER['HTTPS']!='on'))
it crashes and is not even listed on php.net as a valid variable.


Try this instead:

if (isset($_SERVER['HTTPS'])!='on')

Bye,
Jonathan

Jul 17 '05 #7
That caused page failure. I can't find anything anywhere that talks about
HTTPS being a parameter in $_SERVER

Thanks.
if (isset($_SERVER['HTTPS'])!='on')


Sorry, my mistake ;) If a var is not set then it will definately not contain
the value 'on'. So you can just use this:

if ($_SERVER['HTTPS']!='on')

Bye,
Jonathan
Jul 17 '05 #8

"Jonathan" <jo******@trico lon.com> schreef in bericht
news:3f******** **************@ news.xs4all.nl. ..

Sorry, my mistake ;) If a var is not set then it will definately not contain the value 'on'. So you can just use this:

if ($_SERVER['HTTPS']!='on')


This line will throw a warning when the key doesn't exist with the proper
error reporting level. Therefore, it's saver, and also good practice, to use
isset to check if the variable has been set:

if ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='on' )
JW

Jul 17 '05 #9
"Janwillem Borleffs" <jw@jwscripts.c om> wrote in message news:<3f******* **************@ news.euronet.nl >...
"Jonathan" <jo******@trico lon.com> schreef in bericht
news:3f******** **************@ news.xs4all.nl. ..

Sorry, my mistake ;) If a var is not set then it will definately not

contain
the value 'on'. So you can just use this:

if ($_SERVER['HTTPS']!='on')


This line will throw a warning when the key doesn't exist with the proper
error reporting level. Therefore, it's saver, and also good practice, to use
isset to check if the variable has been set:

if ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='on' )


AFAIK, 'on' is not guaranteed. So,
$is_https = (!empty($_SERVE R['HTTPS'])); is the correct check (IMHO)

---
"Dying is an art, like everything else"---Sylvia Plath
Email: rrjanbiah-at-Y!com
Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1779
by: yabba | last post by:
2 asp pages From page1 I open a new window... page2. Does page2 know the parent page/wsindow and more inportantly can page2 somehow update the parent page? Something in the form of "<a href='page1.asp?update=true'>Update</a>" run from page 2 or perhaps something via jscript?
3
2673
by: - Steve - | last post by:
If a user where to go to http://server/page.aspx I want to force them over to https://server/page.aspx. So those that didn't catch the subtle hint there, I want to move them over to the SSL page. What's the best way to handle that? I know I can have IIS block access to a page if it's not over HTTPS, but I just want to seamlessly move them...
0
1536
by: John A Grandy | last post by:
I solved this problem once before ... but I've forgotten exactly how I solved it ... Directly beneath my web-app root-folder, I have a two sub-folders, Folder1 and Folder2. Folder1 contains Page1.aspx Folder2 contains Page2.aspx
2
1396
by: P. Prosper | last post by:
Hello all I have a small webform application with three WebForms that use session variables to maintain session data (user name) When I transfer to page 2 from page1 session state is transferred OK, but is lost when I use a command button to transfer from page2 to page3. It seem to have something to do with a timeout of some sort...
3
2289
by: schwartzenberg | last post by:
Dear friends, I have just run into a strange DB2 problem. Something i'd some of you would answer, if only shortly. My basic question is: How do i ensure 'insensitive' (ie static) cursors that are only forward readable (in DB2 for mainframe)?? It seems that the cursors i'm working on suddenly have become (after
5
1531
by: kingflux | last post by:
Hello-- When I open an existing file (NoodlePage.aspx), VisualStudio immediately changes around some lines, removes a few characters, and switches some tags. I used fc.exe to compare the before and after; even if I manually change each one back to the original, I get an 'Object reference not set to an instance of an object' error upon...
0
1150
by: viral123 | last post by:
Hi I am using asp.net application on server side. I have two web forms as page1.aspx and page2.aspx how can i make change in page2.aspx Lable by clicking on page1.aspx form button. I really need to use the objects or items from one form(page) ion another form (Page). Please Help me out.
7
7484
by: learning | last post by:
Hi! Here's my situation: I created a temporary table TEMP1 in PAGE1.PHP and inserted a few rows. Before I left PAGE1.PHP i tried "SELECT * FROM TEMP1" and echoed the rows and surely there they were. Then I jumped to PAGE2.PHP using header("Location: PAGE2.PHP") and tried "SELECT * FROM TEMP1" from there and could not echo anymore the...
1
1953
by: chuuburg | last post by:
Hi, can anyone help me with this. I have 2 pages, Page 1 is the main page while Page 2 is a flash page. When i close Page 2, I would like page 1 to be refreshed/re-retrieve from database because i need the data in the main page to be updated as data in the database will be changed when i am going through the flash pages. Page2 is opened when...
0
7701
marktang
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...
0
8130
jinu1996
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...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
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...
0
3653
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...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
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
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
940
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.