473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Redirect All Links

Hi there,

I have created a website and now my client wants me to createa a form which should be mandatory and unless the user fills up the form he/she can not go to any of the URL/Link in the web site

1. When the user opens website he/she should get a form to fillup
2. If the user does not fillup the form and clicks on other links on the top (e.g. about us, contact us etc) he should again get the same form
3. If user fills up the form he/she can browse entire website

does anyone know how to do this using php

Thanks
Yogesh Khamitkar
May 25 '09 #1
3 1744
Dormilich
8,658 Expert Mod 8TB
probably the easiest way to prevent the user from accessing the site before submitting the form is not giving any links in the page (though users might get annoyed and leave your site forever). once the form was submitted you can start a session which tells PHP to print the links.
May 25 '09 #2
You can use the header() function to redirect the user who is accessing a resource he shouldn't be.

You need to do something like this:
Expand|Select|Wrap|Line Numbers
  1. if($_SESSION['has_entered_form_data'] !== TRUE)
  2. {
  3.      header("location: my_error_page.htm");
  4.      die();
  5. }
  6.  
Note however, that you must not print anything (even a whitespace) for the header function to work.

Dormilich's method is also fine, but note that people would still be able to hotlink resources and your google rating will suffer.
May 25 '09 #3
Markus
6,050 Expert 4TB
Furthermore, sessions are not permanent. I imagine having to fill out a form to view a website every time I visit it would become pretty annoying. You could counter this with cookies, but they aren't technically permanent either.
May 25 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

25
by: J.A. | last post by:
Hi, I'm new with PHP I want to create a page to redirect links, for example: http://www.php.net/link.php?link_id=2005 ....and be redirect to a URL, from my databse (MySQL), like it follow:...
7
by: Donna Hawkins | last post by:
I want to use javascript to redirect to a URL which has been passed as a variable (in php). I have searched but cannot find any solution. I think this code is a basic redirect: <script...
8
by: msnews.microsoft.com | last post by:
I want to redirect the user to a url outside of our website but I want it to preserve our application's window by opening a new window. We have a datagrid that has five hyperlink columns containing...
1
by: Andre Ranieri | last post by:
I have a quick question - I'd just like to have confirmation to be sure. I'm building an ASP.NET corporate site for my employer, some of the pages have e-commerce capability and will need to be...
5
by: Trisha | last post by:
I have a navigation user control navig.ascx that redirects to respective pages based on webcontrols.linkbutton clicks using response.redirect. I would like to control the look and feel of those...
1
by: stevebremermn | last post by:
I'm working on setting up some affiliate links on a site of mine and I haven't been able to get a redirect to work. The original affiliate link looks like this: ...
21
by: John | last post by:
Hi, I updated a site and changed the file extensions from .html to .php. Now i noticed that the google does find the old .html pages but since they're not there anymore... they can't be found....
0
by: =?Utf-8?B?U2VtU2Vt?= | last post by:
Helloz iam working in a web application for univesity. ihave diffrent kind of roles like: 1-Studetn Affairs 2-Staff imake three sperate master pages for them.: example:
4
by: DGS | last post by:
Hi guys, Not a developer, but an admin so please pardon my ignorance. I have an issue that I was hoping to get help with. What I need is for the front page of my site to capture the URL that...
6
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, We have two sites hosted on different servers and we have many pages on domain A which has many links(asp programs) to domain B. My question is if domain B server is in trouble, what is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
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,...
0
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...

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.