[PHP] Using 'Location' and variables
I'm sure that this is possible, but I haven't found any info/examples on it yet,.. What I have is a php script that processes data that been submitted by a FORM. That's OK,... At the end of my script, depending upon the processing, I want to GOTO another php script, that's also OK, I can simply use the function header("Location:destination.php"); However, I have a whole lot of variables that were initially submitted, and I want to take some of them with me when I go to the new destination.php. Now, I know I can just tack them on the end like a POST, but I'd prefer to NOT get them there in the URL, like a GET does,... any ideas ?? Thanks in advance, Jim. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ISP in Australia
Hi all, Just looking to see if anyone knows of any ISP in Australia, that offers PHP and MySQL for their customer usage. Any information would be greatly appreciated. Thanks, Jim. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using 'Location' and variables
Thanks for your reply John. In fact I'm using the method you describe where the same script is used to both display and process the form. However, in the area where I'm doing the processing, I want to redirect at the end of it and still be able to use some of the variables in the location I'm going to go to. Now I know I can just whack them on the end of the location header: header("Location: http://www.somehost.com/somescript.php?name=fred&age=5";); But I don't want to use this method, I'd rather something similar to GET. BTW I'm using PHP4+ Jim. "John Steele" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi Jim, > > There are several ways to accomplish this such as flat files, database records, sessions, and the like. But I prefer to simply include a file (or have the one file do both form display and processing) and then you get all your variables: > > if ($REQUEST_METHOD == 'POST') { > // either do you processing and diplay here, or > include './destination.php'; // with access to all posted vars > } > else { > // display your form > } > > Remember that header() requires a FULLY QUALIFIED DOMAIN NAME and path: > > header("Location: http://www.somehost.com/somescript.php";); > > and that it is a GET ($REQUEST_METHOD == 'GET'). The fact that some web servers will display the page anyway is no reason to depend on that. > > For PHP4+ of course you can use $_SERVER['REQUEST_METHOD'] instead. > > HTH, > John > > >I'm sure that this is possible, but I haven't found any info/examples on it > >yet,.. > > > >What I have is a php script that processes data that been submitted by a > >FORM. > > > >That's OK,... > > > >At the end of my script, depending upon the processing, I want to GOTO > >another php script, that's also OK, I can simply use the function > > > >header("Location:destination.php"); > > > >However, I have a whole lot of variables that were initially submitted, and > >I want to take some of them with me when I go to the new destination.php. > > > >Now, I know I can just tack them on the end like a POST, but I'd prefer to > >NOT get them there in the URL, like a GET does,... any ideas ?? > > > >Thanks in advance, > > > >Jim. > > -- > /* SteeleSoft Consulting John Steele - Systems Analyst/Programmer > * We also walk dogs... Dynamic Web Design PHP/MySQL/Linux/Hosting > * www.steelesoftconsulting.com [EMAIL PROTECTED] > */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using 'Location' and variables
John, I never even thought of just including the page I was wanting to redirect/switch to. I was always ending my processing portion with a header("Location : ") thingy in all of my scripts. As no output comes out during the processing stage it should all work. It seems so straight forward now, thank you. Jim. "John Steele" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi Jim, > > The header() function call you use below IS doing a GET. Maybe if you told us why you need to redirect to this new page might help. Simply doing the processing then including the new page should work fine, as long as the processing part doesn't do any output. A simple example: > > if ($REQUEST_METHOD == 'POST') { > if (!isset($name)) > echo "Please enter your name!"; // content here or > else > require 'http://www.somehost.com/somescript.php'; // $name & $age set > } > > John > > >Thanks for your reply John. > > > >In fact I'm using the method you describe where the same script is used to > >both display and process the form. > > > >However, in the area where I'm doing the processing, I want to redirect at > >the end of it and still be able to use some of the variables in the location > >I'm going to go to. Now I know I can just whack them on the end of the > >location header: > > > >header("Location: > >http://www.somehost.com/somescript.php?name=fred&age=5";); > > > >But I don't want to use this method, I'd rather something similar to GET. > > > >BTW I'm using PHP4+ > > > >Jim. > > > >"John Steele" <[EMAIL PROTECTED]> wrote in message > >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >> Hi Jim, > >> > >> There are several ways to accomplish this such as flat files, database > >records, sessions, and the like. But I prefer to simply include a file (or > >have the one file do both form display and processing) and then you get all > >your variables: > >> > >> if ($REQUEST_METHOD == 'POST') { > >> // either do you processing and diplay here, or > >> include './destination.php'; // with access to all posted vars > >> } > >> else { > >> // display your form > >> } > >> > >> Remember that header() requires a FULLY QUALIFIED DOMAIN NAME and path: > >> > >> header("Location: http://www.somehost.com/somescript.php";); > >> > >> and that it is a GET ($REQUEST_METHOD == 'GET'). The fact that some web > >servers will display the page anyway is no reason to depend on that. > >> > >> For PHP4+ of course you can use $_SERVER['REQUEST_METHOD'] instead. > >> > >> HTH, > >> John > >> > >> >I'm sure that this is possible, but I haven't found any info/examples on > >it > >> >yet,.. > >> > > >> >What I have is a php script that processes data that been submitted by a > >> >FORM. > >> > > >> >That's OK,... > >> > > >> >At the end of my script, depending upon the processing, I want to GOTO > >> >another php script, that's also OK, I can simply use the function > >> > > >> >header("Location:destination.php"); > >> > > >> >However, I have a whole lot of variables that were initially submitted, > >and > >> >I want to take some of them with me when I go to the new destination.php. > >> > > >> >Now, I know I can just tack them on the end like a POST, but I'd prefer > >to > >> >NOT get them there in the URL, like a GET does,... any ideas ?? > >> > > >> >Thanks in advance, > >> > > >> >Jim. > -- > /* SteeleSoft Consulting John Steele - Systems Analyst/Programmer > * We also walk dogs... Dynamic Web Design PHP/MySQL/Linux/Hosting > * www.steelesoftconsulting.com [EMAIL PROTECTED] > */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Uploading Files with PHP
Joe, Do you know when the file size is checked ?? I think it only gets checked after the form is posted and file uploading is finished ?? I don't know how it's possible to catch things before user uploads - now that would be neat :-) Jim. "Lerp" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi there :) Did you set a max file size in your upload form? See my form > below, notice the 'MAX_FILE_SIZE' value='102400' part within hidden field. > This should appear before the rest of the form. You can adjust this value as > you wish. > > > > > Upload > Resume: > > style='background-color: #FF; font-family: verdana; font-weight: bold; > color: #FF; font-size: 9pt;' name="submit"> > > > > Hope this helps, Joe :) > > > > "Chuck "Pup" Payne" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi, > > > > I am trying to set a small script that would let my clients upload file > with > > a Explorer or Netscape, but the problem is it would let me upload any file > > that is great than a 1MB. We get an error that the file "none" could not > be > > read. > > > > I have set the upload_tmp_dir=/tempupload is has been chmod to 777, > php.ini > > as been set to 20MB, I know that is a lot but we are engingeering company > > that work with CADD files. > > > > Any clues where to look? The PHP 4 Bible from IDG states that we have to > > under HTTP uploads, but nothing else. Is there some where on the net that > > explains better what I have to set up, turn on, or haven't done? > > > > Thanks, > > > > Chuck > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Downloading files/docs
Hi all, I've seen some posts and info elsewhere regarding downloading files - mostly stating problems with the way IE handles this function. What I'm trying to do is : 1 - offer files,.. .doc, .zip and others 2 - allow the user to click on a URL, or button 3 - have the options to Open or Save 4 - NOT have MS-Word come up within the browser window if user chooses to Open 5 - IE save the file properly Netscape seems to do all the rights things. But I want to get IE working, (as best I can). I'm using the following code-snippet within a PHP script,... browser type gets checked earlier in the script,.. Currently, to avoid IE displaying .doc files within its window, I've prevented the user from 'left-clicking' on the file's anchor with some simple JS and forcing them to do a Save-As, which seems to work for IE, but Netscape defaults to the URL for the name of the file :-( Is there a better way to achieve all of the above ?? Is it possible to stop IE from opening the .doc within its browser window ?? Any advice would be greatly appreciated. Thanks, Jim. // get the filename $filename = $dataDIR . $fileid . ".dat"; if ($browserType == "IE") { $attachment=""; } else { $attachment="attachment;"; } $attachment=""; $fn=urldecode($realname); header('Content-Disposition:'.$attachment.' filename="'.$fn.'"'); header('Content-Type: application/octet-stream'); header('Content-Description: download file from site'); header('Content-Length: '.filesize($filename) ); header('Pragma: no-cache'); header('Expires: 0'); readfile($filename); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changed localhost?
You sure Apache's still running ?? Here's a few things to check: 1. Check, that you still have the process running ? Processors dude. 2. Look at Apache's log files and see what happens after you try starting it. Errors ?? 3. Get to a prompt and type the command "netstat -na", without the quotes and look for listening ports - out of the box most daemons listen on ALL interfaces at port 80, meaning 127.0.0.1 is OK. You have had you config changed - but then you'd know that ? Proto Local Address Foreign AddressState TCP0.0.0.0:80 0.0.0.0:0 LISTENING The above means something, Apache in my case, is listening on all interfaces at port 80. 4. Does 'localhost' still resolve to 127.0.0.1 properly ? or has your cable installation conveniently changed your HOSTS file ? Check your file's contents ! Good luck. Jim. "Tv Karthick Kumar" <[EMAIL PROTECTED]> wrote in message 00a901c1bfb3$7a160840$[EMAIL PROTECTED]">news:00a901c1bfb3$7a160840$[EMAIL PROTECTED]... > Hi, > > Did you try http://localhost , instead of 127.0.0.1, or with your > machine, if you have changed any, recently. Or else just check if it > conflicts with the port(s) if you have PWS also installed on your machine. > > If you don't get any solutions, alternatively post your query to the PHP > Windows mailing list also. > > Hth, > Karthick > > > > All of a sudden Apache is nor running correctly under Windows 98. > > > > It appears that somehow localhost was changed from 127.0.0.1 to something > else. > > > > Does the fact that I now have a 24/7cable connection to the Net cause the > > problem? > > > > Thanks! > > > > Anthony Rodriguez > > ([EMAIL PROTECTED]) > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PDF creation with PDF-LIB samples?
You could try: http://www.fpdf.org/ Someone posted recently and I've quickly whacked it into my toolbox :-) Jim . "Andras Kende" <[EMAIL PROTECTED]> wrote in message 004801c1c0e3$26bf6070$b59fb841@K...">news:004801c1c0e3$26bf6070$b59fb841@K...; > Hello, > > Trying to create some pdf documents on the fly with php and mysql.. > > I search the web but not yet found any easy way to do this... > > Tried Yaps but it requires ghostscript which didnt install on a cobalt raq4 > because it it requires some more programs (glibc...etc..)... > > Anyone can give some hint where to start? > > Thanks, > > Andras Kende > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a "GoTo Page" Function?
Whack your text and input boxes in different cells of a table,.. use align (or nowadays an appropriate style setting) and that should get your things lined up :-) "Andre Dubuc" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED].; > Hugh, > > Food? What's that? > > [Btw, my wife would love you. She seems to think I spend too much time in > here . . .] > > Thanks for the help. I sort of figured I'd have to make a php page to call > the error codes, then call another for the actual database stuff. At least, > I'll be able to find my errors quicker. Later, when I understand things a bit > better, I'll clean up that mess! [I've actualy got three forms working now -- > I'm amazed!] > > Gosh, the output is ugly, though! I can't seem to line up the input boxes > with those horrible "nbsp" and since the text name before it varies . . . > sigh . . . someday I'll figure that out! > > Regards, > Andre > > > > On Tuesday 05 March 2002 23:51, you wrote: > > Andre, > > Yes, the html page with your input form effectively ends with the > > tag so any decision statements on that page past that tag would miss the > > form input. So, put any decision statements on the php page where you've > > put your database code. I'm sure someone will educate me on the above > > statements, and I'll likely deserve it. When you eventually use the > > $php_self call, you can put everything on one page above the form start. > > > > You can have as many calls on an html page as is needed to > > complete your tasks. However, I use php to do some rather complex math > > (it's complex to me at least), so I got in the habit of using php > > throughout a page without breaking out for html. For me it is more > > readable. > > > > My $00.02 on books, I bought a Sams 24 hour book on php for $25, and it got > > me off the ground. The online manuals for php and mysql have also been > > invaluable. Save your money, buy food instead. > > > > Hope this helps, > > Hugh > > - Original Message - > > From: "Andre Dubuc" <[EMAIL PROTECTED]> > > To: "hugh danaher" <[EMAIL PROTECTED]> > > Sent: Tuesday, March 05, 2002 6:35 PM > > Subject: Re: [PHP] Is there a "GoTo Page" Function? > > > > > Hi Hugh, > > > > > > Well, actually my next question you've sort of answered: "Where do I put > > > > this > > > > > code?" With all the new information coming at me, I haven't had time to > > > > think > > > > > it through -- but I gather from your response, the answer would be: 'Put > > > > it > > > > > before the database code rather than in the html page.' Am I correct? > > > > > > One other question: I gather it's OK to have multiple instances of > > > > > > > > ?> on the same html page or in the same php page? > > > > > > I realize that these are pretty fundamental questions. As soon as I can > > > scrape up eighty dollars I'll buy a book on PHP and another on HTML. In > > > > the > > > > > meantime, I would greatly appreciate it if you could clear up these basic > > > assumptions for me. > > > > > > Thanks for your help! > > > Tia, > > > Andre > > > > > > On Tuesday 05 March 2002 20:36, you wrote: > > > > Andre, > > > > My note on decision lines was in anticipation of your next > > > > question/problem > > > > > > of "How do I handle things if the user doesn't fill in his name, > > > > address, > > > > > > whatever?" My solution is check to see if the cell is filled and if > > > > not then quit the database storage and tell the person to fill in the > > > > info. > > > > I > > > > > > first check to see if the data is set and if not, send a message. This > > > > would come before wasting your time storing anything. There are many > > > > other > > > > > > methods to check user input but I learned the if (!isset($something)) > > > > die() > > > > > > method first, and to me it's the most straight forward. > > > > Hope this helps, > > > > Hugh > > > > - Original Message - > > > > From: "Andre Dubuc" <[EMAIL PROTECTED]> > > > > To: "Erik Price" <[EMAIL PROTECTED]> > > > > Cc: <[EMAIL PROTECTED]> > > > > Sent: Tuesday, March 05, 2002 4:56 PM > > > > Subject: Re: [PHP] Is there a "GoTo Page" Function? > > > > > > > > > On Tuesday 05 March 2002 19:20, you wrote: > > > > > > On Tuesday, March 5, 2002, at 07:01 PM, Andre Dubuc wrote: > > > > > > > Now that makes sense. I'm getting a better idea of how it works > > > > > > > together. I > > > > > > > figured there must be a way to control the "Submit" button's > > > > > > > > behaviour, > > > > > > > > > > > but I > > > > > > > didn't know where to look. > > > > > > > > > > > > Yep, the submit input tells the form "go do your thing", but the > > > > form > > > > > > > > already knew where to go (because you specify where to go in the > > > > > > 'action' attribute). The form also knows how to go -- whether it > > > > > > should be POST or GET. Without realizing it, you'll be learning > > > > more > > > > > > > > about the HTTP protocol itself as you start writing scripts that > > >
Re: [PHP] Is there a "GoTo Page" Function?
Not without seeing some html code. If you haven't altered any of the other font/color settings I'd have thought they'd all be the same color, black. Look up some info on 'Cascaded Style Sheets',... then it'd be as simple as and all of the text/alignment, etc,.. takes the settings of whatever is defined in "blue". Jim. "Andre Dubuc" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Thanks Jim, > > Now that looks better. > > New problem: in one of the almost identical tables I've used it in, the title > for each row is in black and not the color that the page text is set for. The > other table is correctly set. Any idea what would cause the discrepancy? > > Tia, > Andre > > > On Wednesday 06 March 2002 00:43, you wrote: > > Whack your text and input boxes in different cells of a table,.. use align > > (or nowadays an appropriate style setting) and that should get your things > > lined up :-) > > > > "Andre Dubuc" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > Hugh, > > > > > > Food? What's that? > > > > > > [Btw, my wife would love you. She seems to think I spend too much time in > > > here . . .] > > > > > > Thanks for the help. I sort of figured I'd have to make a php page to > > > call the error codes, then call another for the actual database stuff. At > > > > least, > > > > > I'll be able to find my errors quicker. Later, when I understand things a > > > > bit > > > > > better, I'll clean up that mess! [I've actualy got three forms working > > > > now -- > > > > > I'm amazed!] > > > > > > Gosh, the output is ugly, though! I can't seem to line up the input boxes > > > with those horrible "nbsp" and since the text name before it varies . . . > > > sigh . . . someday I'll figure that out! > > > > > > Regards, > > > Andre > > > > > > On Tuesday 05 March 2002 23:51, you wrote: > > > > Andre, > > > > Yes, the html page with your input form effectively ends with the > > > > > > > > > > tag so any decision statements on that page past that tag would miss > > > > the form input. So, put any decision statements on the php page where > > > > you've > > > > > > put your database code. I'm sure someone will educate me on the above > > > > statements, and I'll likely deserve it. When you eventually use the > > > > $php_self call, you can put everything on one page above the form > > > > start. > > > > > > > > You can have as many calls on an html page as is needed to > > > > complete your tasks. However, I use php to do some rather complex math > > > > (it's complex to me at least), so I got in the habit of using php > > > > throughout a page without breaking out for html. For me it is more > > > > readable. > > > > > > > > My $00.02 on books, I bought a Sams 24 hour book on php for $25, and it > > > > got > > > > > > me off the ground. The online manuals for php and mysql have also been > > > > invaluable. Save your money, buy food instead. > > > > > > > > Hope this helps, > > > > Hugh > > > > - Original Message - > > > > From: "Andre Dubuc" <[EMAIL PROTECTED]> > > > > To: "hugh danaher" <[EMAIL PROTECTED]> > > > > Sent: Tuesday, March 05, 2002 6:35 PM > > > > Subject: Re: [PHP] Is there a "GoTo Page" Function? > > > > > > > > > Hi Hugh, > > > > > > > > > > Well, actually my next question you've sort of answered: "Where do I > > > > put > > > > > > this > > > > > > > > > code?" With all the new information coming at me, I haven't had time > > > > to > > > > > > think > > > > > > > > > it through -- but I gather from your response, the answer would be: > > > > 'Put > > > > > > it > > > > > > > > > before the database code rather than in the html page.' Am I correct? > > > > > > > > > > One other question: I gather it's OK to have multiple instances of > > > > > > > > > > > > > > > > > > ?> on the same html page or in the same php page? > > > > > > > > > > I realize that these are pretty fundamental questions. As soon as I > > > > can > > > > > > > scrape up eighty dollars I'll buy a book on PHP and another on HTML. > > > > In > > > > > > the > > > > > > > > > meantime, I would greatly appreciate it if you could clear up these > > > > basic > > > > > > > assumptions for me. > > > > > > > > > > Thanks for your help! > > > > > Tia, > > > > > Andre > > > > > > > > > > On Tuesday 05 March 2002 20:36, you wrote: > > > > > > Andre, > > > > > > My note on decision lines was in anticipation of your next > > > > > > > > question/problem > > > > > > > > > > of "How do I handle things if the user doesn't fill in his name, > > > > > > > > address, > > > > > > > > > > whatever?" My solution is check to see if the cell is filled and > > > > > > if not then quit the database storage and tell the person to fill > > > > > > in > > > > the > > > > > > > > info. > > > > > > > > I > > > > > > > > > > first check to see if the data is set and if not, send a message. > > > > This > > > > > > > > would come before wasting you
Re: [PHP] image creation to file
An alternative is to put the code into makeImage.php and then call it directly from your HTML page with your whenever you want that image displayed. Jim. "Tom Rogers" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi > use ImagePNG($im,"test.png") > > Tom > > At 12:17 PM 7/03/2002, Craig Westerman wrote: > >The following creates a red rectangle png image > > > > >Header("Content-Type: image/png"); > >$im = ImageCreate(500, 75); > >$red = ImageColorAllocate($im, 255, 0, 0); > >ImageFill($im, 100, 100, $red); > >ImagePNG($im); > >?> > > > > > >This sends created image to browser > >ImagePNG($im); > > > > > >How would I save this image as test.png to file to be hard coded in static > >web pages? > > > >Thanks > > > >Craig ><> > >[EMAIL PROTECTED] > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: What permissions for uploading?
That'd depend upon who owns the directory and what user your web server is running as. If the folder, or directory is owned by the user the server is running as then the permissions should be OK. Due to your error message I'd guess they don't have write access. Permissions of 766 might be enough. Although I'd make sure that the directory is owned by the user the server is running as and then make it 700. You're in a non-Windows environment - yes ?? Jim. "Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a script that allows the user to upload a file. Right now, though, > it says permission denied when I try to upload. The permissions for the > folder I want to upload to is 755 right now. What should I change it to? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() and qmail
qmail here, working fine. I have the following set in php.ini : sendmail_path =/var/qmail/bin/qmail-inject Jim. "Jason Wong" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > On Thursday 14 March 2002 22:56, Daniel Reichenbach wrote: > > > I use qmail with PHP on a RH v 7.0 system. Works like a charm. > > > > Same here, RH 7.0 with some updates from RPM. > > > > > I compiled/installed qmail from source. Installed RH, > > > > Apache and PHP from source, too. > > > > Do you have a possibility to look at a phpinfo() page? There the > > option your php version uses for sendmail_path should be visible? > > Would be interesting to know what parameters your php version > > uses. Mine uses sendmail -t -i. > > I'm using qmail and these are the settings in php.ini: > > -- > [mail function] > ; For Win32 only. > SMTP = localhost > > ; For Win32 only. > sendmail_from = [EMAIL PROTECTED] > > ; For Unix only. You may supply arguments as well (default: 'sendmail -t -i'). > ;sendmail_path = > -- > > > In other words it's the default settings. > > RH7.1, php-4.0.6, qmail 1.03 > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > /* > Post proelium, praemium. > [After the battle, the reward.] > */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTTP_REFERER
Tom, I sort of do the same here,... think you'll find that index.html is the 'default index' for a directory when a page isn't specified on your web server and that she's going to http://www.domain.com Hope this helps. Jim. "Tom Hilton" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, I am using the $HTTP_REFERER variable to ensure that users of a website > are getting to a certain page through a link from the index.html page, and > not going straight to the page through a bookmark. > > $page=$HTTP_REFERER; > if ($page!="http://www.somedomain.com/index.html";) > { > echo "Please log in through the home page"; > echo " CONTENT='1;URL=http://www.somedomain.com/index.html'>"; > } > This is working fine for most users, but one user is telling me that even > though she is following the link from the index page, she's still getting > the error message, and are being bounced back to the index page. She is > using Internet Explorer 6.0. Are there any security or privacy settings > that might restrict use of the $HTTP_REFERER variable? Or is there a better > way to make sure users follow links to pages, rather than bookmarking and > going straight to a page? Thanks for any help you can give me. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Downloading files
Using this method,.. works OK if you choose to save the file, however if you choose to open the file you get a weird behaviour where IE says it can't find the file and a subsequent prompt to create a new one. Does anyone know why it does this and how to overcome it ? At this stage I've resorted to using some simple javascript to prevent a user clicking on a file and advising them to use right-click save-as until I come up with a more reliable method. "Scott Houseman" <[EMAIL PROTECTED]> wrote in message 003e01c1dfdf$7b3a6490$0b01a8c0@scotth">news:003e01c1dfdf$7b3a6490$0b01a8c0@scotth... > Try this: > > // Open the file to send. > $sFilePath = "/home/scott/public_html/TEST.doc"; > $iFilePointer = fopen( $sFilePath, "r" ); > // Get file content. > $sContents = fread( $iFilePointer, filesize( $sFilePath ) ); > // Close the file. > fclose( $iFilePointer ); > // Send HTTP headers. > header( "Expires: 0" ); > header( "Cache-Control: no-cache" ); > header( "Content-Type: application/save-as" ); > header( "Content-Disposition: attachment; filename=".basename( > $sFilePath ).";"); > header( "Content-Length: ".filesize( $sFilePath ) ); > // Feed file to client. > echo $sContents; > ?> > > As you give the client Content-Type: application/save-as - it will not know > what mime type the file is, > and the browser will give the user a save-as prompt. > This works in explorer - I haven't checked it in Mozilla etc - so you might > have to tweak it a bit. > > Cheers > > Scott > - Original Message - > From: "Declan Kenny" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, April 09, 2002 1:20 PM > Subject: [PHP] Downloading files > > > > Hi folks, > > > > Ok I am trying to make a download area for files (including word files). > > How do I force a download of a word document rather than have it opening > in > > IE? > > > > Declan > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php