473,386 Members | 1,733 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,386 software developers and data experts.

authenticating a user before opening a document by clicking a hyperlink

Hi,

I am new to PHP. I need to authenticate a user before clicking the link which opens an already existing PDF file.. so that no one can just click on a link provided to him/her and open the concerned PDF without providing the correct username and password first.

Can anyone help me with this authentication?
Dec 27 '07 #1
1 1144
Hi again,

The issue is resolved now.. I tried the following:
[PHP]
// Code in Index.php
<?php
session_start();

if($_SESSION)
{
// HTML code
} else
{
echo 'Please Login First!!!' ;
include("Login.php"); // takes the user to the Login page for authentication
}
?>
[/PHP]
Only when the session is active can someone see the page Index.php... and at other times if someone just tries to copy-paste this page's URL in the address bar of some other window in order to open it, the control executes the code in the else part of the page thus prohibiting anyone from seeing the page without authentication!

Thanks!!!

P.S:-
I am only a week old with PHP and am expected to be good at it pretty quickly since there are many projects at my firm lined up.. most of them implement PHP. Would like to know of any books / websites that offer PHP tutorials and sample projects so that I can learn and code in PHP the proper way right from the beginning ...

Hope someone can help.. thanks in advance!!!
Dec 29 '07 #2

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

Similar topics

4
by: Shumit Rehman | last post by:
Hi I have a table which has path names to photos I would like to view. I would like to open some/any kind of image viewer(Paint) to see the picture when I click the pathname. The pictures are...
5
by: deko | last post by:
I use hyperlinks in a subform datasheet to display locally saved documents that are associated with individual database entries. A customer entry may have a list of invoices in pdf format, for...
3
by: mrwoopey | last post by:
Hi, I am using the example "Authenticate against the Active Directory by Using Forms Authentication and Visual Basic .NET": http://support.microsoft.com/default.aspx?scid=KB;EN-US;326340 ...
4
by: Greg Burns | last post by:
I have built a web app that uses forms authentication. There isn't a "remember me" feature (i.e. the authentication cookie is not permanent). When you close the browser, and open a new one, you...
4
by: EvelynAnd Ethan | last post by:
Hi, ItemCommand event not firing from a dynamic user control ,WHERE A DATAGRID HAS BUTTON,when i click on the linkbutton first time the itemcommand event doesnt fire,second time event fires up ...
1
by: Oenone | last post by:
We have a little piece of JavaScript in one of our client's application which automatically sets the input focus to the first control on the HTML form. This works very nicely, except for in one...
1
by: Jason | last post by:
I have a document saved to a public network server. The public directory grants change access to all users on the network. To keep my Word doc protected I am using the Security feature "File...
1
by: tomlebold | last post by:
My Access 2003 applicaton is attempting to store the path and file name of a PDF file in a hyperlink column. After clicking on the hyperlink a form displays the following error: Hyperlinks can be...
2
by: koruyucu | last post by:
we'd like to make smth like google implemented in gmail: when user compose mail and then wants to leave page without actually sending it, gmail notifies user about mail was not sent. this should...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...

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.