php-windows Digest 29 Nov 2002 04:54:03 -0000 Issue 1462
Topics (messages 17207 through 17210):
Re: Redirect browser to another URL?
17207 by: Stephen Edmonds
17208 by: Rich Gray
Re: Getting my IP adress (not 127.0.0.1)
17209 by: erythros
Is stdout slow?
17210 by: Nicole
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
I see what you mean. I suggest making a separate page to process the form...
such as formprocess.php. When the user is sent to the page, you can access
all the variables using $_GET or $_POST arrays (depending on how your form
is sent), add the new record, and then at the bottom send the user back to
the original page. You can also send variables back with the user via a
query string, although this does have security implications
Stephen
----- Original Message -----
From: "Max Graham" <[EMAIL PROTECTED]>
To: "Rich Gray" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, November 28, 2002 3:18 PM
Subject: Re: [PHP-WIN] Redirect browser to another URL?
> The original issue was, I tried to have the single page to display any
> previous comments, and then a form to add comments. Then, once it was
> submitted, it would submit itself. The page was supposed to detect whether
> any new data had been submitted, by way of a hidden input in the form, and
> if so, would first write to the output file and then display the output
> file. It wasn't a text file in this case, it was actually an HTML snippet
I
> would get the script to grab with the include() function. What I had to
do,
> because I suspected there wasn't enough of a delay between
> writing/flushing/closing the file and including it (maybe it thought the
> include file was still locked from being written to), was split the file
> into two separate files. The first comments page shows the past comments
and
> the submission form. The form submits to a separate file that writes to
the
> include file and then displays the only displayed code in the page. In the
> header I have a refresh function, and in the body tag I have the onload
> handler set to trigger the refresh function.
>
> I just realized, though, the setTimeout may be redundant ... :P I'm still
> managing to learn slowly ... like most things I do, it's all self-taught,
> and you're right -- I haven't even touched SQL databases. My only
> familiarity with databases was with FoxPro before it became "Visual
FoxPro"
> (ominous music here). And I haven't even toyed with turning off Javascript
> ... there are services I'll turn off, but javascript ... for all its
> resemblance to C++ with bipolarism, I have been tempted to turn it off,
but
> it just somehow reminds me of that scene from the Indiana Jones movie
where
> he's trying to weigh how much sand in the bag will equal the weight of the
> statue to avoid triggering the booby traps ...
>
> ----- Original Message -----
> From: "Rich Gray" <[EMAIL PROTECTED]>
> To: "Max Graham" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Thursday, November 28, 2002 3:05 AM
> Subject: RE: [PHP-WIN] Redirect browser to another URL?
>
>
> > Hi Max
> >
> > Well it seems you are messing around with text files rather than a
> > database - this sounds like hard work :) I'm not sure I fully understand
> > your issue but are you saying you could not make the code 'refresh' the
> > comments data on the form page without a javascript redirect?
> >
> > What happens if you switch off javascript in your browser - does it
fail?
> >
> > Rich
> > -----Original Message-----
> > From: Max Graham [mailto:[EMAIL PROTECTED]]
> > Sent: 28 November 2002 05:51
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-WIN] Redirect browser to another URL?
> >
> >
> > You know, this is exactly what happened to me. I was trying to design a
> > comments page for a weblog to open in a popup. The page had a submission
> > form that would submit back to itself. 'course, I was banging my head on
> the
> > wall trying to come up with a way to get the page to detect whether it
had
> > received a form submission and write the comments to a comment file, and
> > then include the comment file with the form afterwards. I kept coming up
> > with the results of fopen(), fputs(), fflush(), and fclose() coming back
> as
> > false, which equals failed. I eventually did go to a separate page to do
> the
> > file writing, and that page finishes up with a 1-second delay using the
> > javascript setTimeout() for this command in a standalone function:
> >
> > echo "location.replace('blogcomments.php?target=".$target."');\n";
> >
> > Inelegant, but it works. I haven't had too much experience with the
header
> > function, and knowing how long it took me to bang this one out, I might
> set
> > something on fire trying it :)
> >
> > Anyone else had any fun with this issue?
> >
> >
> >
> >
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hi Max
My comment on switching off javascript was just to warn you that there are
users/browsers out there who have it switched off all the time so your
script won't work for these users... Doing it all in PHP i.e. server side
will avoid that problem.
>From what you have described I would start looking at using a database to
store the comments - it'll make your life much easier.
Rich
-----Original Message-----
From: Max Graham [mailto:[EMAIL PROTECTED]]
Sent: 28 November 2002 15:19
To: Rich Gray; [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] Redirect browser to another URL?
The original issue was, I tried to have the single page to display any
previous comments, and then a form to add comments. Then, once it was
submitted, it would submit itself. The page was supposed to detect whether
any new data had been submitted, by way of a hidden input in the form, and
if so, would first write to the output file and then display the output
file. It wasn't a text file in this case, it was actually an HTML snippet I
would get the script to grab with the include() function. What I had to do,
because I suspected there wasn't enough of a delay between
writing/flushing/closing the file and including it (maybe it thought the
include file was still locked from being written to), was split the file
into two separate files. The first comments page shows the past comments and
the submission form. The form submits to a separate file that writes to the
include file and then displays the only displayed code in the page. In the
header I have a refresh function, and in the body tag I have the onload
handler set to trigger the refresh function.
I just realized, though, the setTimeout may be redundant ... :P I'm still
managing to learn slowly ... like most things I do, it's all self-taught,
and you're right -- I haven't even touched SQL databases. My only
familiarity with databases was with FoxPro before it became "Visual FoxPro"
(ominous music here). And I haven't even toyed with turning off Javascript
... there are services I'll turn off, but javascript ... for all its
resemblance to C++ with bipolarism, I have been tempted to turn it off, but
it just somehow reminds me of that scene from the Indiana Jones movie where
he's trying to weigh how much sand in the bag will equal the weight of the
statue to avoid triggering the booby traps ...
--- End Message ---
--- Begin Message ---
here's a simple way
<?echo "$_SERVER[REMOTE_ADDR]"?>
"Steve Yates" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> "Michael Delorme" <[EMAIL PROTECTED]> wrote
> > However I only get 127.0.0.1
> > But I want the "public" dynamic adress my ISP gave me,
>
> Don't use localhost, that's always 127.0.0.1 by definition. You
didn't
> say what server you are using but if it's Apache try...
>
> getenv('SERVER_ADDR');
> or
> gethostbynamel(getenv('HTTP_HOST'));
>
> phpinfo() should tell you what environment variables are available for
your
> server.
>
> - Steve Yates
> - I have nothing against MS-DOS, stone knives, or bearskins.
>
> ~ Taglines by Taglinator - www.srtware.com ~
>
>
>
--- End Message ---
--- Begin Message ---
I have a script that grabs some 250,000+ rows, 1 field. Then prints it to
the screen.
The problem is, it takes over 10 minutes just to print. The query itself
takes under 30 seconds. So, is there a faster way to print out 5 million
characters to the web page? This seems to be the slow part. Anyone
experience this and find a solution?
Thanks!
Nicole
--- End Message ---