I am currently writing a PHP/MySQL site which requires access to a large number of manuscript pdfs for authenticated users.
I am using session variables to store log in information for restricting access to protected pages. However, the pdfs are a bit large to put into longblob fields and have kept them in a protected folder, with their links stored in the database.
Any ideas how I can allow access to the pdf files through...
User Profile
Collapse
-
Control PDF access via PHP?
-
I've by-passed the problem by creating the output and then creating the page with the appropriate headers....
[PHP] $output = "Username,Title ,First Name,Surname,Em ail,Address 1,Address 2,Address 3,City,Region,C ountry,Postcode ,Telephone,Fax" ;
$output .= "\n";
$result = mysql_query("SE LECT * FROM tbl_usrlogin INNER JOIN tbl_userdetails ON tbl_userdetails .userID=tbl_usr login.Username" );... -
when i run the query i am getting:
error 1045: Access denied for user...
How do I get around this? (since it is a remote server, I don't have root access...)Leave a comment:
-
Ok, I've been trying to set up ssh tunneling in order to connect to the remote host through the terminal, but I haven't managed to get the syntax right. It is worth noting that I am running mySQL on my local comp, so will need a different port for this.
I've been using:
I'm not an expert on port settings, so in desperate need for some advice?Code:ssh -l user -L 3660:localhost:3660 remoteserver
...Leave a comment:
-
Performing mail merge from a mySQL database
I run a php site which contains a number of user details onto a mySQL database.
I would like to be able to use the user database stored on my site's remote server as a source for mail merge fields in word:mac on my computer - the server connection is through ssl.
So far, I have figured out that I need to do download the tables to Excel first, using a third party ODBC driver (e.g. Actual Technologies). I have got the... -
How do I make a directory through php?
Would this work?
And would it need to be done every time, or could this be used for multiple uploads?
[PHP]<?php
mkdir("/path", 0777);?>
[/PHP]Leave a comment:
-
Well, I tried that way initially, but this is what I've been getting:
Warning: move_uploaded_f ile(Uploads/a2785.ppt): failed to open stream: Permission denied in 'sitemap' on line 65
Warning: move_uploaded_f ile(): Unable to move '/tmp/phpHrtNMM' to 'Uploads/a2785.ppt' in 'sitemap' on line 65
This was my initial code:
[PHP]if (file_exists("U ploads/" . $_FILES['file']['name']))
...Leave a comment:
-
upload file onto site directory
I would like to include a function for speakers to be able to upload presentations onto our website in order to prepare for future talks. Some files can be quite large (e.g. >5-10MB), so my approach was to use ftp to do this.
There is a form where the file can be uploaded and when this is submitted, it is referred to the php ftp script - however, I seem to be getting an error stating:
ftp_login() expects parameter... -
i know - although they say this is only for SP1, the bug is still there in IE7, so the cache corrections will probably still be necessary...Leave a comment:
-
I've added the following two snippets which seem to have fixed the problem...
[PHP]header( "Pragma: private");
header( "Cache-Control: max-age=0"); [/PHP]
is that a reasonable solution?Leave a comment:
-
Yes, the file uploads without a problem in Firefox, Safari, Navigator and Opera.
I think you have located the problem - I have been using https for all the members pages. If I disable this, the pdf download works fine in IE. Is there a way around this?Leave a comment:
-
note sure whether this is what you are after, but [PHP]<?php
if($_SERVER["HTTPS"] != "on") {
$newpage = "https://" . $_SERVER["SERVER_NAM E"] . $_SERVER["REQUEST_UR I"];
header("Locatio n: $newpage");
exit();}
?>[/PHP] assuming ssl is already running on your server, you can force ssl on a page with the following code:Leave a comment:
-
I've tried both header lines without success - I still get the cannot write to cache error in IE.
I'm not sure whether the content-disposition filename seems to work, since changing tis to attachement gives me the name of the page rather than the filename with a pdf extension. My code so far is:
[PHP]<?php
if (isset($_GET['fileID']) == false) { header("Locatio n: studentsindex.p hp"); exit;}
if ($_GET['referrer']...Leave a comment:
-
Problem showing PDF file from a MySQL blob field
I'm having a problem reading a pdf from a longblob mysql field.
My code works in safari and firefox, but IE6 gives an error of (file could not be written to cache) and IE7 just gives a blank page. This is my code:
[PHP]<?php
if (isset($_GET['fileID']) == false) { header("Locatio n: studentsindex.p hp"); exit;}
if ($_GET['referrer'] == "papers") { $table = "tbl_pastpapers "; } else... -
have you tried checking whether the session is set?
[PHP]if (!isset($_SESSI ON)) {
session_start() ;[/PHP]
Also, why are you spelling it SEESION instead of SESSION?Leave a comment:
-
the best way to do this is to use AJAX - there is a similar post in the forums relating to this. I have used this successfully for a number of drop down boxes for exactly the same situation.
you need an html page, a js page and the php page.
in your html drop box one you will need an onchange function linking it to the javascript file.
in the javascript, you should include the xmlhttp request to the php page...Leave a comment:
-
i've done something similar - the action page is quite simple.
I have set the value of the checkbox equal to the email address that I want it sent to, which is pulled from mySQL and placed in the field like this:
[PHP]echo "<input name=\"email[ ]\" type=\"checkbox \" value=\""; echo $row_rs_other['emailAddress']; echo"\" />";[/PHP]
Once you submit...Leave a comment:
-
yes, that's along the lines of what I'm looking for - wasn't quite sure about the exact syntax with counter divisions, but adapting this has worked. thanks.Leave a comment:
-
sorry, maybe I wasn't clear enough -
yes, I could use a table, but what I'm not sure is how to do the looping structure in order to go down vertically ie
Item 1 - Item 4 - Item 7
Item 2 - Item 5 - Item 8
Item 3 - Item 6 - Item 9
Presumably you need some sort of auto-increment counter to decide where to draw <tr> and <td>? Or create two divs and assign recordsets to $col1 $col2...Leave a comment:
-
displaying single column data in multiple columns
This might seem like a problem with a simple solution, but I'm not entirely sure how to approach it.
I would like to generate a user contact list from a table of user details on a database. However, for the master page (which only needs to display the name), I was wondering if there is any way that the user names could be displayed in multiple rows rather than one continuous vertical stream (I would rather avoid recordset paging)....
No activity results to display
Show More
Leave a comment: