473,800 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

authenticating a user before opening a document by clicking a hyperlink

14 New Member
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 1155
hello2008
14 New Member
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
13760
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 mostly scanned newspaper atricles which are too big to just display on a form so I need the zoom and scroll features. Im using access 2003
5
1661
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 example: invoice23.pdf invoice24.pdf The document name appears as a hyperlink in the datasheet. The document is opened (by the associated application) when the hyperlink is clicked. The problem is the database and all the documents are stored...
3
16451
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 But I am having a problem figuring out the LDAP:// The LDAP:// that I pass looks like this (i substitued generic the
4
2748
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 must log in again. This is the behavior I expected. I just discovered that if I have a browser window open (to anything) prior to opening my web app in a new browser window, it appears to share session information. I can then open and close my...
4
4163
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 any answers?? Regards,
1
2827
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 circumstance. If the user is partway through entering data into the form, clicks a hyperlink to go to another page, and then clicks the Back button to return to the edit page, the focus is again reset to the first field on the page. Under this...
1
2652
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 Sharing Options" in Word to attach a password to the document. This works as expected when users open the file with Windows Explorer. I also have an ASP web page that has a link to my file on the public drive. When I click this link, the Word...
1
3726
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 harmful to your computer and data. To protect your computer, click only those hyperlinks from trusted sources. Do you wish to continue? The Adobe application softeware appears to be display for a second and then closes. How to I get the PDF...
2
1960
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 happens when user clicks link or press browser back button. So the problem is that Opera does not support "beforeunload" event and thus it is not possible to inform user that hes about to lose his work. is there a way another then adding scripts to...
0
9555
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,...
0
10514
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, 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...
0
10287
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9099
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7588
isladogs
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...
0
6826
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();...
0
5479
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...
0
5616
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3770
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.