Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Community Forums
 Community Discussions (All other subjects)
 pdf file within a psp file

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
cadfhs Posted - 24 May 2008 : 11:07:25
Hi
Is there anyone out there who can solve this for me?
I would like to put pdf files inside files with a psp extension. The reason is that I want to restrict access to the pdf's to members of the society but don't want them to have to enter a password for every pdf. My server don't support .htpasswd so I can not use that, but have code for a password that uses php script.
cheers
Neil<
4   L A T E S T    R E P L I E S    (Newest First)
cadfhs Posted - 26 May 2008 : 11:04:41
Thanks Shaggy
I will have a think about this and see what I can do.
Cheers
Neil<
Shaggy Posted - 26 May 2008 : 05:33:39
This would be the basics of it, making the assumption that you're using the Snitz variables. You'll need to create a database connection in this file (you can't include inc_header.asp or any other files that use response.write but you will need to include inc_func_common.asp for the chkstring function) and you'd need to drop the filename of each PDF into a table in that database (FILES, below).
dim objStream,intPdf,strPdf
if MemberId>0 then
	intPdf=request.querystring("pdf")
	if len(intPdf)>0 and isnumeric(intPdf) then
		intPdf=clng(intPdf)
		set objRs=objConn.execute("SELECT FILENAME FROM FILES WHERE FILE_ID="&intPdf)
		if not objRs.eof then
			strPdf=chkstring(objRs("FILENAME"),"urlpath")
			server.scripttimeout=300
			set objStream=server.createObject("ADODB.Stream")
			objStream.open
			objStream.type=1
			objStream.loadfromfile server.mappath("/pdfs/"&strPdf)
			response.addheader "content-disposition","attachment;filename="&strPdf
			response.charset="UTF-8"
			response.contenttype="application/x-pdf"
			response.binarywrite objStream.read
			objStream.close:set objStream=nothing
		end if
		objRs.close:set objRs=nothing
	end if
end if
<
cadfhs Posted - 26 May 2008 : 05:21:44
Shaggy, cheers for this, but I am at a lost how to do it.

Currently the links to these pdf's are on a web page which has a password on it, but I am not 100% happy that this is secure.<
Shaggy Posted - 26 May 2008 : 04:41:05
psp?

Quickest & easiest way to do what you want is to stream the files through an ASP file that checks whether or not the visitor is logged in before serving the file.

<

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000 Version 3.4.07