|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: php-general-digest-help
lists.php.netDate: Thu May 09 2002 - 15:00:44 CDT
php-general Digest 9 May 2002 20:00:44 -0000 Issue 1335
Topics (messages 96780 through 96862):
Re: session thingies
96780 by: Pafo
96782 by: Pafo
Re: Rating results after relevance. Difficult problem
96781 by: David Robley
96784 by: andy
96788 by: David Robley
96789 by: Lauri Vain
96790 by: Sven Herrmann
96795 by: andy
Re: how to generate static html pages from dynamic php pages
96783 by: John Holmes
96787 by: Lauri Vain
96797 by: Ford, Mike [LSS]
96798 by: Rasmus Lerdorf
96805 by: Michael Kimsal
96810 by: Nicole Lallande
96811 by: Jon Haworth
96812 by: Jon Haworth
96818 by: Joel Boonstra
96822 by: Rasmus Lerdorf
96842 by: Joel Boonstra
Error in current documentation or PHP bug?
96785 by: Indira Virk
Re: Browser windows close
96786 by: Lauri Vain
Re: session _save dir
96791 by: Ford, Mike [LSS]
SOLVED [PHP] var-vars question
96792 by: heinisch.creaction.de
Re: reindexing an array after unset()
96793 by: Ford, Mike [LSS]
Re: Self Destruct code
96794 by: Terry Carney
96799 by: heinisch.creaction.de
96802 by: John Holmes
Re: accessing php pages w/o .php extension on unix and wind ows
96796 by: Ford, Mike [LSS]
Re: Genus who came up with "Self Destruct Code" & "Copy Protection"
96800 by: Jay Blanchard
96813 by: Udo Giacomozzi
96814 by: Udo Giacomozzi
96835 by: Brian McGarvie
PHP --> HTML
96801 by: Maris Kalnins
96804 by: John Holmes
96806 by: Dan Hardiker
96832 by: George Nicolae
96837 by: Miguel Cruz
96850 by: Matt Williams
Re: =php decal please=
96803 by: Steve Bradwell
problems with <form></form>
96807 by: Hawk
96808 by: Tommy Claasens - Q Data KZN
error-catching
96809 by: Gert Mellak
96819 by: Matthew Ward
96825 by: Gert Mellak
96827 by: Nookie
96828 by: Gert Mellak
96834 by: Danny Shepherd
96851 by: J Smith
96852 by: Gert Mellak
96853 by: Andreas Indahl
96855 by: Herbert Mraz
96861 by: Miguel Cruz
Apache rewrite engine and $REQUEST_URI
96815 by: PeterV
multiple select form elements question
96816 by: ravi
96817 by: Rasmus Lerdorf
96824 by: Pushkar Pradhan
96833 by: ravi
Internationalization?
96820 by: J. Anderson Scarbrough
96836 by: Miguel Cruz
virtual host problem
96821 by: Dennis Gearon
96823 by: John Holmes
Re: passing variables between php pages
96826 by: Paras Mukadam
96839 by: Miguel Cruz
Re: Uploaded File Is Moved Successfully, But Really Isn't There
96829 by: Dr. Shim
Re: how to send spaces in the url
96830 by: Pushkar Pradhan
96844 by: Kevin Stone
96860 by: Matthew Walker
Re: destroy_session
96831 by: Norman Zhang
Re: yes and no buttons and posting
96838 by: Miguel Cruz
A pen pal system with Photo upload feature
96840 by: Thomas Edison Jr.
96843 by: Jason Soza
96849 by: Bogdan Stancescu
96857 by: Tyler Longren
Re: script to script
96841 by: Miguel Cruz
Re: date comparison again
96845 by: Miguel Cruz
96846 by: Scott St. John
register_globals in php4
96847 by: Patrick Hsieh
96848 by: Miguel Cruz
include text from a html-file online
96854 by: Andreas Indahl
96856 by: Gert Mellak
Nitpicking - PHP 4.2.0 for windows says version is 4.1.2
96858 by: Garth Dahlstrom
gobbling replace
96859 by: Josh & Valerie McCormack
fsockopen, and remaining data in buffer
96862 by: Demitrious S. Kelly
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
that dident look that hard,, how about to delete a single session and not
all sessions,,
cause in .asp u cant delete a single session...
in asp u use a command called session.abandon to destroy all the sessions,,
whats the php name for this.. ?
----- Original Message -----
From: "Austin Marshall" <amars
pdq.net>
To: "Pafo" <pafo
pafo.net>
Cc: <php-general
lists.php.net>
Sent: Thursday, May 09, 2002 1:59 AM
Subject: Re: session thingies
> Pafo wrote:
> > i dont understand how to use sessions with php...
> >
> > i got 4 pages and i want to set a session on page 1 that can be reed
from
> > page 2-3-4 and i want to set anotherone at page 3 that can be reed at
> > 1-2-4...
> >
> > please, som example code,,
> >
> > thx in advance
> >
> >
>
> FILE 1:
>
> <?php
> session_start();
> $_SESSION['foo']="banana";
> ?>
>
> File 2:
> <?php
> session_start();
> echo $_SESSION['foo'];
> ?>
>
> It's not hard.
>
attached mail follows:
hmm,, dosent work for me,, it just dosent show anything when i use the lines
below...
----- Original Message -----
From: "Austin Marshall" <amars
pdq.net>
To: "Pafo" <pafo
pafo.net>
Cc: <php-general
lists.php.net>
Sent: Thursday, May 09, 2002 1:59 AM
Subject: Re: session thingies
> Pafo wrote:
> > i dont understand how to use sessions with php...
> >
> > i got 4 pages and i want to set a session on page 1 that can be reed
from
> > page 2-3-4 and i want to set anotherone at page 3 that can be reed at
> > 1-2-4...
> >
> > please, som example code,,
> >
> > thx in advance
> >
> >
>
> FILE 1:
>
> <?php
> session_start();
> $_SESSION['foo']="banana";
> ?>
>
> File 2:
> <?php
> session_start();
> echo $_SESSION['foo'];
> ?>
>
> It's not hard.
>
attached mail follows:
In article <20020509065440.5713.qmail
pb1.pair.com>, news.letters
gmx.de
says...
> wow! Sven's idea works just great! Didn't try it on the 2000 user db though.
> But I looks much clearer than creating temp tables and doing all the math on
> 1000 users in php.
>
> So I was just wondering if there is a better way to get rid of the 0 results
> than I have found.
> First I did try to add
> where results != 0
> but the db does not know about the results row
> Then I did put the whole if statement ( if (news.text_short like '%test%',
> 50, 0) + if (user.name
> > like '%woodoo%', 50, 0)
> into the where clause and this works. Just not that elegant.
> Minor prob, but maybe someone knows a better way.
>
>
> Thanx for the great help!
>
> Andy
This is mysql? Try NOT ISNULL to exclude null values.
-- David Robley Temporary Kiwi!Quod subigo farinam
attached mail follows:
NOT ISNULL?
Like where rating NOT ISNULL?
does not work though. The thing is that this values are not NULL, they are 0
so maybe I did get you wrong. We do create an extra value called result (... AS result) this is sometimes 0. I tryed: WHERE result != 0, but mysql does not know about result.
Andy
"David Robley" <robleyd
paradise.net.nz> schrieb im Newsbeitrag
news:MPG.1744fa7cc4625a3098971b
news.php.net...
> In article <20020509065440.5713.qmail
pb1.pair.com>, news.letters
gmx.de
> says...
> > wow! Sven's idea works just great! Didn't try it on the 2000 user db
though.
> > But I looks much clearer than creating temp tables and doing all the
math on
> > 1000 users in php.
> >
> > So I was just wondering if there is a better way to get rid of the 0
results
> > than I have found.
> > First I did try to add
> > where results != 0
> > but the db does not know about the results row
> > Then I did put the whole if statement ( if (news.text_short like
'%test%',
> > 50, 0) + if (user.name
> > > like '%woodoo%', 50, 0)
> > into the where clause and this works. Just not that elegant.
> > Minor prob, but maybe someone knows a better way.
> >
> >
> > Thanx for the great help!
> >
> > Andy
>
> This is mysql? Try NOT ISNULL to exclude null values.
>
> --
> David Robley
> Temporary Kiwi!
>
> Quod subigo farinam
attached mail follows:
In article <20020509090248.87014.qmail
pb1.pair.com>, news.letters
gmx.de
says...
> NOT ISNULL?
>
> Like where rating NOT ISNULL?
>
> does not work though. The thing is that this values are not NULL, they are 0
>
> so maybe I did get you wrong. We do create an extra value called result (...
> AS result)
> this is sometimes 0. I tryed: WHERE result != 0, but mysql does not know
> about result.
>
> Andy
>
>
You might check that result is not a reserved word.
-- David Robley Temporary Kiwi!Quod subigo farinam
attached mail follows:
Andy and all,
> wow! Sven's idea works just great!
Yes, isn't it great?!!
You can actually extend it even further and even implement boolean expressions.
I remember a great article somewhere (let me see whether I can dig it up from somewhere).
Ok, here it is: http://www.evolt.org/article/Boolean_Fulltext_Searching_with_PHP_and_MyS QL/18/15665/index.html
I have used a really similar approach by many sites and it has worked great so far. There are downsides to it compared to "SELECT id,name FROM art WHERE content LIKE '%string%'" (speed), but the advantages surely beat the living crap out of this (unless you get three billion-zillion-gazillion hits per day).
Enjoy!
Thanks, Lauri
-- Tharapita Creations [server-client web applications] lauri.vaintharapita.com http://www.tharapita.com/ Mobile: +372 53 410 610
attached mail follows:
> First I did try to add > where results != 0 > but the db does not know about the results row
simply use select news.id, if (news.text_short like '%test%', 50, 0) + if (user.name like '%woodoo%', 50, 0) as rating from news, user where user.id = news.creator HAVING rating > 0 order by rating DESC;
Sven
attached mail follows:
gorgeous!
Works great.
Andy
"Sven Herrmann" <woodoo
woodoomagic.de> schrieb im Newsbeitrag
news:20020509100219.28654.qmail
pb1.pair.com...
> > First I did try to add
> > where results != 0
> > but the db does not know about the results row
>
> simply use
> select news.id, if (news.text_short like '%test%', 50, 0) + if (user.name
> like '%woodoo%', 50, 0) as rating from news, user where user.id =
> news.creator HAVING rating > 0 order by rating DESC;
>
>
> Sven
>
>
attached mail follows:
> This is cool, but I would be really hesitant to make my 404 page serve > up actual real content, even if it's only the first time the link is > hit. For the sake of search engines that might ignore links that return > a 404 error (regardless of the content at that page), I would want to > make sure my content returns a valid HTTP status code, so that search > engines know that the content is okay to index.
It wouldn't be a 404 error, though. The 404 page would be an interceptor. It would say, okay, you're looking for products/1234/index.html, but it doesn't exist. Let me create it for you, and redirect you back to it. So the search engine or user is none the wiser and they get products/1234/index.html no matter what. Now, if the product really doesn't exist, then you throw them a 404 error, so they know.
---John Holmes...
attached mail follows:
Nicole,
> As to the second concept -- you can do this using > apache rewrite rules
Yes, apache rewrite rules are probably the best way to go about!
> Anyone remember this article?
Sure. Check out the following links:
Search Engine Friendly URLs with PHP and Apache http://www.evolt.org/article/Search_Engine_Friendly_URLs_with_PHP_and_Ap ache/17/15049/index.html
Search Engine Friendly URLs (Part II) http://www.evolt.org/article/Search_Engine_Friendly_URLs_Part_II/17/1717 1/index.html
Thanks, Lauri
-- Tharapita Creations [server-client web applications] lauri.vaintharapita.com http://www.tharapita.com/ Mobile: +372 53 410 610
attached mail follows:
> -----Original Message-----
> From: michael kimsal [mailto:michael
tapinternet.com]
> Sent: 09 May 2002 03:39
>
> Whoops - sorry. If the Fusebox code is operating under a 404
> error page
> assumption that could be made to work. We use PATH_INFO, which is
> limited to Apache, and works well under Linux (and presumably other
> Unix) filesystems.
... and Windows. I'm using PATH_INFO very successfully on a Windows NT/Apache/PHP setup.
attached mail follows:
> > What I'm talking about is a user goes to a nonexistent page, > > www.domain.com/products/1234 and should get a 404 error. Instead, your > > 404 page looks in the database for product 1234 and sees if it exists. > > If it does, it writes the file products/1234/index.html with the data > > from the database. Now, when the next person follows your link to > > www.domain.com/products/1234, they get your html page, instead of > > hitting PHP and the database, thus saving you some resources... > > This is cool, but I would be really hesitant to make my 404 page serve > up actual real content, even if it's only the first time the link is > hit. For the sake of search engines that might ignore links that return > a 404 error (regardless of the content at that page), I would want to > make sure my content returns a valid HTTP status code, so that search > engines know that the content is okay to index.
You are missing a key concept here. You can set the return status directly from PHP, so if in your 404 handler you determine that you can serve up a real page with content, you simply send a 200 instead of a 404. There is absolutely no way for the search engine to know that it actually hit a 404 and the page was created on the fly and served up.
I have built several sites that had absolutely no files, just a single 404 handler that determined what should be created. When content was added to the database the appropriate files in the filesystem were then deleted and the next request for that particular file ould hit the 404 handler which would regenerate the static file.
This approach is great for applications that have a whole lot of data that doesn't change very often. One example I helped out with was a weather site. Weather reports came in every 4 hours. The entire database of hundreds of thousands of locations was thus updated every 4 hours. Now, only a tiny fraction of these locations were actually being checked by people hitting the web site, but many of these were hit *a lot*.
So, previously the people who had built this would generate hundreds of thousands of static files every 4 hours even though most of these files would never actually be requested. By using the 404 trick, every 4 hours I deleted all the static weather files. The 404 handler would take a request, generate the static file for that request and serve it up as a 200. The next request for that same location would obviously not hit the 404 handler and it was served up statically.
If you were to have done this using your PATH_INFO approach, you would have been hitting the database to generate the data on every single request for the same location even though you know that the data will not change for 4 hours. On really busy sites this can kill you. And in thie case the database was busy enough importing the next batch of weather reports that it didn't need these extra hits.
-Rasmus
attached mail follows:
Ford, Mike [LSS] wrote:
>>-----Original Message-----
>>From: michael kimsal [mailto:michael
tapinternet.com]
>>Sent: 09 May 2002 03:39
>>
>>Whoops - sorry. If the Fusebox code is operating under a 404
>>error page
>>assumption that could be made to work. We use PATH_INFO, which is
>>limited to Apache, and works well under Linux (and presumably other
>>Unix) filesystems.
>>
>>
>
>... and Windows. I'm using PATH_INFO very successfully on a Windows NT/Apache/PHP setup.
>
>
We've never been able to get a URL of
http://www.domain.com/index.php/blah/foo/ho/ho/ho
to work under any Windows setup without resorting to 404 handling hacks. Are you saying you do that?
attached mail follows:
Rasmus and John,
Could you point me to some more literature about this 404/200 method you are discussing - sounds pretty cool. Pretty much all Iknow about 404 is how to set the page in the httpd.conf file -- from your discussions it sounds as though you have written a php script for that 404 page -
Thanks,
Nicole
Rasmus Lerdorf wrote:
>>>What I'm talking about is a user goes to a nonexistent page, >>>www.domain.com/products/1234 and should get a 404 error. Instead, your >>>404 page looks in the database for product 1234 and sees if it exists. >>>If it does, it writes the file products/1234/index.html with the data >>>from the database. Now, when the next person follows your link to >>>www.domain.com/products/1234, they get your html page, instead of >>>hitting PHP and the database, thus saving you some resources... >>> >>This is cool, but I would be really hesitant to make my 404 page serve >>up actual real content, even if it's only the first time the link is >>hit. For the sake of search engines that might ignore links that return >>a 404 error (regardless of the content at that page), I would want to >>make sure my content returns a valid HTTP status code, so that search >>engines know that the content is okay to index. >> > >You are missing a key concept here. You can set the return status >directly from PHP, so if in your 404 handler you determine that you can >serve up a real page with content, you simply send a 200 instead of a 404. >There is absolutely no way for the search engine to know that it actually >hit a 404 and the page was created on the fly and served up. > >I have built several sites that had absolutely no files, just a single 404 >handler that determined what should be created. When content was added to >the database the appropriate files in the filesystem were then deleted and >the next request for that particular file ould hit the 404 handler which >would regenerate the static file. > >This approach is great for applications that have a whole lot of data that >doesn't change very often. One example I helped out with was a weather >site. Weather reports came in every 4 hours. The entire database of >hundreds of thousands of locations was thus updated every 4 hours. Now, >only a tiny fraction of these locations were actually being checked by >people hitting the web site, but many of these were hit *a lot*. > >So, previously the people who had built this would generate hundreds of >thousands of static files every 4 hours even though most of these files >would never actually be requested. By using the 404 trick, every 4 hours >I deleted all the static weather files. The 404 handler would take a >request, generate the static file for that request and serve it up as a >200. The next request for that same location would obviously not hit the >404 handler and it was served up statically. > >If you were to have done this using your PATH_INFO approach, you would >have been hitting the database to generate the data on every single >request for the same location even though you know that the data will not >change for 4 hours. On really busy sites this can kill you. And in thie >case the database was busy enough importing the next batch of weather >reports that it didn't need these extra hits. > >-Rasmus > > >
-- ######################## Nicole Lallande nicolenmlconsulting.com 760.753.6766 ########################
attached mail follows:
Hi Michael,
> We've never been able to get a URL of > > http://www.domain.com/index.php/blah/foo/ho/ho/ho > > to work under any Windows setup without resorting to 404 handling hacks. > Are you saying you do that?
With mod_rewrite, yes, it works fine.
There's a great article at alistapart: http://www.alistapart.com/stories/succeed/
Cheers Jon
attached mail follows:
Hi Michael,
> Thanks. However 'mod_rewrite' only works with Apache - we were/are > looking for a way to work transparently using IIS or Apache on > both windows and unix. Another brit claims to have it working and I've > asked for more specifics. :)
Hm. If it's Mike you're talking about, I suggest you reread his post...
> I'm using PATH_INFO very successfully on a Windows NT/Apache/PHP setup.
Note the word "Apache" :-)
IIS sucks supernovas through a capillary. Don't bother with it.
Cheers Jon
attached mail follows:
Rasmus,
I was unaware that PHP could override the status codes sent by Apache. I knew that PHP could send *additional* status code headers, but I was under the assumption that the order of operations was:
request -> notfound -> Apache sends 404 header -> 404 page -> PHP sends more HTTP headers
If the PHP-sent HTTP headers trump the Apache ones, or if I'm just confused, well, then this is all well and good.
> If you were to have done this using your PATH_INFO approach, you would > have been hitting the database to generate the data on every single > request for the same location even though you know that the data will not > change for 4 hours. On really busy sites this can kill you. And in thie > case the database was busy enough importing the next batch of weather > reports that it didn't need these extra hits.
This isn't necessarily true -- I use the exact same method you do. Each request for a given URL checks for the existance of a previously-generated file. If the file exists, it simply uses that, without hitting the database at all. Otherwise, the database is hit once, and the static page is generated and used.
So, if I begin with a completely empty file cache, only the pages that receive traffic will be generated, and then only once. My cache is generated dynamically, based completely on what pages receive hits.
I don't have any schedule setup like you do to remove the previously-generated files, but if I did, it would work just the same as your site does.
So, I suppose we're talking about the same things, just with two different methods. I prefer mine, since I don't have to worry about sending the right HTTP headers, but that's just me.
Joel
-- [ joel boonstra | jboonstragospelcom.net ]
attached mail follows:
To actually set the status, and yes it does override the Apache one, you can use something like this:
header('Status: 404 Not Found');
This will send a 404 from any old PHP script, for example.
> So, if I begin with a completely empty file cache, only the pages that > receive traffic will be generated, and then only once. My cache is > generated dynamically, based completely on what pages receive hits. > > I don't have any schedule setup like you do to remove the > previously-generated files, but if I did, it would work just the same as > your site does. > > So, I suppose we're talking about the same things, just with two > different methods. I prefer mine, since I don't have to worry about > sending the right HTTP headers, but that's just me.
Not quite. In your case you have extra dynamic logic and an extra stat since you have to run PHP code on every request to determine whether to serve up the static data or not.
The beauty behind the ErrorDocument 404 approach is that absolutely no dynamic code needs to be run once the static file has been generated.
It works like this:
Request comes in for /foo/bar.html
Apache looks for the file /var/www/doc_root/foo/bar.html and doesn't find it thus triggering a 404 error.
In your httpd.conf you have this:
ErrorDocument 404 /script.php
Therefore, instead of Apache sending a 404 to the client, it runs script.php.
In script.php you look at $REQUEST_URI and pick out the /foo/bar.html and use that to determine what data to fetch from the database. In my weather reports example, this might be a country code and a city name or something similar. Once you have fetched this information from the db you write it to /var/www/doc_root/foo/bar.html and you also serve it up directly for this request, remembering to do a Header('Status: 200 OK') before sending the data.
Now, the next request for /foo/bar.html will again cause Apache to look for /var/www/doc_root/foo/bar.html and hocus-pokus-shazzam, the file exists and is served up statically without any extra code needing to be executed.
-Rasmus
attached mail follows:
Rasmus,
I see what you're saying. You're right, I do have some PHP overhead that you don't. I guess I feel that, even for very high-traffic sites, PHP should be able to deal with it, as long as the coder (me) doesn't do anything too stupid. I only have one minor point -- I realize that this borders on nitpicking, but I'm stubborn, and I wanted to point it out anyway.
You said:
<snip> > ErrorDocument 404 /script.php > > Therefore, instead of Apache sending a 404 to the client, it runs > script.php. </snip>
Apache still does send a 404 to the client, even if you have a custom ErrorDocument defined. You can verify this by telnetting directly to a server that has a PHP error document defined, requesting a bad URL, and examining the headers you get back.
However, as you also pointed out, if you make your 'script.php' output this:
header("HTTP/1.1 200 OK");
then that seems to be sent instead of the 404 status code. This can also be verified by examing raw HTTP headers you receive.
I just wanted to point out that Apache still sends a 404; it's up to the ErrorDocument to override that status code if you want it to be something different.
Thanks for the enlightenment!
-- [ joel boonstra | jboonstragospelcom.net ]
attached mail follows:
Hi.
This is regarding section 'Strings' under the section 'Types' in the manual.
Under 'String Conversion' it says:
When the first expression is a string, the type of the variable will depend on the second expression.
$foo = "10.0 pigs " + 1; // $foo is integer (11) $foo = "10.0 pigs " + 1.0; // $foo is float (11)
For more information on this conversion, see the Unix manual page for strtod(3).
If you would like to test any of the examples in this section, you can cut and paste the examples and insert the following line to see for yourself what's going on:
echo "\$foo==$foo; type is " . gettype ($foo) . "<br>\n";
I tried the above example:
<?php $foo = "10.0 pigs " + 1; if (is_float($foo)) { echo "Value: (float)$foo<BR>"; } else if (is_int($foo)) { echo "Value: (int)$foo<BR>"; } echo "\$foo==$foo; type is " . gettype ($foo) . "<br>\n"; ?>
The output is:
Value: (float)11 $foo==11; type is double
According to the documentation $foo should be of type 'integer'.
Is this an error in the documentation or a PHP bug?
I have PHP 4.2.0 installed as a static module in Apache 1.3.19 in HP-UX 11.0.
Regards, Indira.
attached mail follows:
Chris,
> ah cool thanks chaps
Also, a note that you cannot close all windows (or it will at least ask for confirmation from the user). That goes for windows that you haven't opened yourself.
Thanks, Lauri
-- Tharapita Creations [server-client web applications] lauri.vaintharapita.com http://www.tharapita.com/ Mobile: +372 53 410 610
attached mail follows:
> -----Original Message-----
> From: Kirk Babb [mailto:kbcd
worldnet.att.net]
> Sent: 08 May 2002 16:26
>
> Can I set php so that it looks in its home directory, or is
> this something I
> have to live with forever? I'm curious, though, since there
> is no php.ini
> in winnt at the moment, how is php working?
By using all the built-in defaults.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford
lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
attached mail follows:
I donīt know why the original mail took so much time, but in the meantime the problem is solved. The problem was, that the vars were not "global" in the classīs function. So the returned values wouldnīt be visible inside. I just made the var another option in the calling command, and everything works fine. Oliver At 07.05.2002 18:46, you wrote: >Hi folks, >Linux, PHP3 > >I have the following problem: >I have an object, which creates a form, wherein there are selects, which >names accord to values in the database. > >But I didnīt get it to have a variable var, Iīm sure itīs just a small >thing, but I cannot see it >Any suggestions ? >TIA Oliver > >echo '<form name="g94" action="'.$to_go.'" method="get">'; >// Already tried post, no difference >echo '<table border="1" width="100%" cellpadding="1" cellspacing="1">'; > while($da=$MKA -> getDbAns()) // This gives back an array named $da > while there are answers > { > > $xwert=$da[1]; > >// $da[1] contains "abc" the var $xwert will be "abc" > >// now Iīd like to see the value of $abc but thereīs nothing in > > echo '<tr><td> '.$$xwert.'</td><td>'; > >// set the new select named "abc" > echo '<select name="'.$da[1].'">'; > >// forget the rest, just for understanding what while does > for($i=0; $i < 11 ; $i++) > { > if(isset($$da[1])) // just for testing > { > echo "<option selected >".$i."</option>"; > } > else > { > echo "<option>".$i."</option>"; > } > } // end for > echo '</select>'; > echo '</td>'; > echo '<td>'.$da[1].'</td>'; > echo '<td>'.$da[2].'</td>'; > echo '<td align="right">'.$da[3].' EUR</td>'; > echo '</tr>'; > } // end while > echo '</table>'; > echo '<br><br><input type="submit" value="CalC !">'; > echo "</form>"; > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
> -----Original Message-----
> From: Erik Price [mailto:pricee
hhbrown.com]
> Sent: 08 May 2002 20:23
>
> After using unset() on an array element to remove it, what is
> the best
> way to reindex the array so that I have a nice sequential
> order of 0, 1,
> 2, 3... again? (Otherwise, unset($array[2]) will leave me
> with an array
> that looks like 0, 1, 3...).
I'd try
$arr = array_values($arr);
Reads nicely, anyway!
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford
lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
attached mail follows:
On Tue, 7 May 2002, SP wrote:
> Although the database server would be located on your server, the > username and password would be visible in the code so they could use > phpmyadmin and get the whole database - structure and data.
They certainly could but then they would have had to be planning to rip him off all along. Not something I'd care to ponder for too long. :-)
Regards,
Terry.
tcarney
selterra.com
----------------------------------------------------------
Public PGP Key: http://www.selterra.com/pgpkey/tcarney.asc
attached mail follows:
At 08.05.2002 08:55, you wrote: >Fellow PHP'ers > >Firstly, thank you for the responses, seems to be a subject that most >people have touched, yet, unfortunately, it seems that there are no fool >proof tried and tested method out there. >Much of the advise given are perfectly acceptible and make plenty of >sence, yet, even if you keep the code on your own server and demo the app, >they still might insist on payment AFTER you have given the complete >product ( I can also understand this, when I buy something, I would also >like to have the product before I give the money). In my case, I CANNOT >keep any part of the app on my own servers as the app is intended to run >on an intranet with no outside connections, so I am basically spoofed with >anything to do with keeping part on my own servers or creating a backdoor. >In previous cases I have built myself an inconspicuous page between the >rest that simply runs eval() on the posted var, allowing me to break >things if needed, but even that will not work if the client puts >.htpassword on his site ( most of the stuff I do is intended for company >only use and not for the general public, so most sites are heavily >password protected). >Even building time locks into the code can prove to be pointless as it >doesn't take a genius to read through the code to see where you are >"disabling" it. So, that leaves the contract as my only and last resort... >Firstly, my problem with contracts being my safety net: I am not a lawyer, >don't want to be, and don't have the time to go to court. Secondly, >lawsuits can be dragged out over several years depending on the amount and >parties involved, and the problem is, some clients know this and >deliberately try to exploit this.
If youīre trying to make your living as freelancer, selfemployed, you need knowledge of "how business works" or you will mostly get sucked. Look at all the geniuses who had a good idea, but didnīt have knowledge of law and order. Most of them were eaten by bigger companies, or live on the street now. You wouldnīt start programming if you donīt know how (- OK, some try it ;) ).
>So, from all the responses to this thread, I can see that all of us are in >the same boat, granted, not all clients have this attitude, and most are >recurring clients that understand how business works, however, most of us >are not in the priveleged position to pic and choose jobs, which leaves me >to believe that we ( the PHP coders of the world) need some protection. >Now this can start a Holy War, with people arguing that the only real >solution is encryption of code in order to hide cripling code or other >means to protect yourself, and hence, there goes the whole Open Source >idea ( which, believe me, I am NOT trying to do ), but on the other hand, >encrypted code for paid products to clients aren't supposed to become part >of the world wide php code library. >Which brings me to the question, shouldn't we start a project that >addresses this problem? I am aware of the dangers of having a "free" Zend >encoder; what will prevent people from encrypting everything they do, and >hence cause the PHP community to suffer from this ( possibly?), but I >believe that this community has been here long enough and we have enough >dedicated open source people who knows what it's all about to sustain it >even if there were such dangers lurking. > >I think this needs much more thought and much more input from others. >Again, I am not trying to shoot down the suggestions about having a sound >legal contract and regular billing etc, I am just playing devil's advocate >and looking at the worst case for the "smaller" developers that are left >to the wolves. I shudder to think how many people have been conned out of >their hard work and how much damage that can cause small businesses >depending on any and all means of income. Personally I think that PHP will >become an even more popular language if people know they have some built >in assurance; in the end it all comes down to money doesn't it >? We all have to eat right? > >Thanks alot for hearing me out, lokking forward to your responses This would bring you nothing, except of wasting time. Half year you have finished your program, any other has the ultimate weapon against your program. This only lengthten the time someone needs to "crack" your scripts. If you want to make your programs unreadable, change to C/C++, then you distribute binaries which couldnīt be as easy reassembled. Php is already popular, since it is available for windows. Donīt you read the list ;-)
Again, if you sell a product, make sure that you have all papers you need for a smooth job. If you donīt have knowledge about L&O, buy a book, contact the commercial chamber, an attorney. Do the same as you would do when you start to learn a new programming language. Itīs also worth for you "normal" life. Business is a jungle, an only the best will survive! Oliver
attached mail follows:
> You wouldnīt start programming if you donīt know how (- OK, some try it ;) > ).
HA! If that were true we wouldn't need this list and have to answer the same questions...over and over... ;)
In a perfect world...
---John Holmes...
attached mail follows:
> -----Original Message-----
> From: brett [mailto:brett
jnewman.com]
> Sent: 08 May 2002 18:48
>
> For a reason I have yet to find, I can access php files on my
> linux server
> running apache without adding the extension. On my notebook
> at home, I have
> apache and php setup, but can not access php files without adding the
> extension. I know this probably has something to do with
> apache, but have not
> found out how and what makes this happen. Does anyone have
> any clues for me to
> take a look at to determine why linux allows this and windows
> does not.
Could be several things. Most likely are:
* Content negotiation * AliasMatch * URL rewriting
Haven't used all of these myself, but this might provide you with some pointers of where to look.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford
lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
attached mail follows:
[snip] Iīve problems reading sources from 2 weeks ago without my documentation. Would you work yourself trough 30 to 100 or more php scripts, includes, classes without any comment or structure? I donīt believe (this is something for "hackers"). [/snip]
Well, if we're talking PHP here, the first pass breaks lines at semi-colons. Not all lines end in semi-colons though, but this would get you awfully close in a hurry. No comments and carriage returns in the code would just slow someone down a little.
Jay
attached mail follows:
dfreeman
outbackqld.net.au (David Freeman) wrote in
news:003a01c1f6eb$949f4d60$030a0a0a
skink:
> I guess that depends on how you want to do things. Keep in mind that
> your great <whatever project> probably has free equivalents. Why will
> someone pay for yours when they can download an equivalent one for free?
I was talking in general. The BBS was simply an example to make things clearer. I am *not* developing a BB system! If you want you can think of a immaginary tool that makes a website load twice as fast, need the half web space and makes the website look nicer, of course at lower CPU load than ever ;-) I hope you understand what I mean. The fact that PHP itself is free does not necessarily mean that all applications written with it must be free too.
Udo
Posted by ELKNews 1.0.4-B Empower your News Reader! http://www.atozedsoftware.com
attached mail follows:
heinisch
creaction.de wrote in
news:4.3.1.2.20020509001344.00b7dcf0
pop.compuserve.com:
> For the german readers of the list, if they didnīt know already,
> our laws have changed ! There must be a documentation of
> the program and itīs behaviour BEFORE you sign the contract.
> Thatīs a basic and necessary part of the contract !!
Do you know if this does apply to germany only or to other european
countries (ie. Italy) too?
Udo
Posted by ELKNews 1.0.4-B Empower your News Reader! http://www.atozedsoftware.com
attached mail follows:
good leagal pointers for UK-based web developers...
www.weblaw.co.uk
(also has french/german/italian counterparts)
attached mail follows:
Hi!
The question is..
I have a php page (for example image gallery with multiple pages) that works fine! How can I make all possible html files to put this image gallery on server where isnt php support?
Thanks
attached mail follows:
Use output buffering and write all of the static HTML files.
www.php.net/fopen www.php.net/ob_start
etc...
---John Holmes...
> -----Original Message-----
> From: Maris Kalnins [mailto:proximus
btv.lv]
> Sent: Thursday, May 09, 2002 5:08 AM
> To: php-general
lists.php.net
> Subject: [PHP] PHP --> HTML
>
> Hi!
>
> The question is..
>
> I have a php page (for example image gallery with multiple pages) that
> works
> fine!
> How can I make all possible html files to put this image gallery on
server
> where isnt php support?
>
> Thanks
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
You could also use some form of spider to go through your website. These are usually aimed at downloading a website to your local machine, or for mass caching. This should have the effect your after with minimum fuss and no rewriting of the .php scripts (or need to write another tool). > Use output buffering and write all of the static HTML files. > www.php.net/fopen > www.php.net/ob_start > etc... > ---John Holmes... >> >> Hi! >> >> The question is.. >> >> I have a php page (for example image gallery with multiple pages) that >> works >> fine! >> How can I make all possible html files to put this image gallery on server >> where isnt php support?
-- Dan Hardiker [dhardikerstaff.firstcreative.net] ADAM Software & Systems Engineer
attached mail follows:
try to get the whole site with a program (I don't remember now a good one) witch download a whole site to hdd.
--Best regards, George Nicolae IT Manager ___________________ PaginiWeb.com - Professional Web Design www.PaginiWeb.com
"Maris Kalnins" <proximus
btv.lv> wrote in message news:20020509120940.12551.qmail
pb1.pair.com... > Hi! > > The question is.. > > I have a php page (for example image gallery with multiple pages) that works > fine! > How can I make all possible html files to put this image gallery on server > where isnt php support? > > Thanks > >
attached mail follows:
On Thu, 9 May 2002, Maris Kalnins wrote: > I have a php page (for example image gallery with multiple pages) that > works fine! How can I make all possible html files to put this image > gallery on server where isnt php support?
The easiest way is with wget (http://wget.sunsite.dk/)
miguel
attached mail follows:
On Thursday 09 May 2002 1:23 pm, Dan Hardiker wrote:
> You could also use some form of spider to go through your website. These > are usually aimed at downloading a website to your local machine, or for > mass caching. > This should have the effect your after with minimum fuss and no rewriting > of the .php scripts (or need to write another tool).
do a google for HTTRACK, very impressed with the sites we've had to cache locally
matt
attached mail follows:
Sweet idea, I'm in.
-----Original Message-----
From: Jay Blanchard [mailto:jay.blanchard
niicommunications.com]
Sent: Wednesday, May 08, 2002 4:38 PM
To: php-general
lists.php.net
Subject: RE: [PHP] =php decal please=
[snip] How do I get a php decal for the rear window of my truck? [/snip]
Get some adhesive backed paper for your ink jet printer. Save the logo from the site. Modify it in your favorite picture editor. Print it to the adhesive backed paper. Cut it out. Stick it on.
I couldn't see any decals listed on their web site.
Jay
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I don't really know how to title the problem, but I hope someone will check this anyway.. the problem is that I have a table with several contents, and I have a form on every row, the problem is that the form is to big, so the tab le looks ugly, I tried with everything I could come up with, and I'm already using css. The normal height of the <td> is about 10 px, but when I have the form in it it is about 30 px, and as you can imagine, it isn't looking nice at all :) Just wondering if anyone else had this problem, and if you have any solution for it.
Håkan
attached mail follows:
Hi, Putting the form tags outside the <tr>'s will not grow the table cells But this is a workaround I have found Dont know if it is correct in HTML 4.1 standards
Try This <table> <form><tr><td> </td></tr></form> </table> Thanks Tommy
-----Original Message-----
From: Hawk [mailto:hw2k
barrysworld.com]
Sent: Thu, 09 May 2002 15:25
To: php-general
lists.php.net
Subject: [PHP] problems with <form></form>
I don't really know how to title the problem, but I hope someone will check this anyway.. the problem is that I have a table with several contents, and I have a form on every row, the problem is that the form is to big, so the tab le looks ugly, I tried with everything I could come up with, and I'm already using css. The normal height of the <td> is about 10 px, but when I have the form in it it is about 30 px, and as you can imagine, it isn't looking nice at all :) Just wondering if anyone else had this problem, and if you have any solution for it.
Håkan
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi!
When I open a database connection and i. e. the db-server is down, I get a very long, long error message telling me that the server is down.
What I want to do is just echo a text, i. e. "DB-Server down" and leave out the error message.
Does anyone have an idea how to manage this?
I'd be grateful for any information!
TIA,
Gert.
gert
mellak.com
http://mellak.com
attached mail follows:
Simply use an if() statement to determine whether you are able to connect to the database, and if not, display a message to say that its down, for example:
<?php $db_connect = mysql_connect($db_server, $db_user, $db_pass); if(! $db_connect) { print("Could not connect to the database server, it may be down."); } else { $db_open = mysql_select_db($db_name, $db_connect); if(! $db_open) { print("Could not open the specified database."); } }
?>
"Gert Mellak" <gert
mellak.com> wrote in message
news:20020509140013.98456.qmail
pb1.pair.com...
> Hi!
>
> When I open a database connection and i. e. the db-server is down,
> I get a very long, long error message telling me that the server is down.
>
> What I want to do is just echo a text, i. e. "DB-Server down" and leave
out
> the error message.
>
> Does anyone have an idea how to manage this?
>
> I'd be grateful for any information!
>
> TIA,
>
> Gert.
> gert
mellak.com
> http://mellak.com
>
>
>
attached mail follows:
really that easy? thank you...
gert.
Matthew Ward <email
inspirationstudios.co.uk> schrieb in im Newsbeitrag:
20020509151943.52621.qmail
pb1.pair.com...
> Simply use an if() statement to determine whether you are able to connect
to
> the database, and if not, display a message to say that its down, for
> example:
>
> <?php
> $db_connect = mysql_connect($db_server, $db_user, $db_pass);
> if(! $db_connect) {
> print("Could not connect to the database server, it may be down.");
> } else {
> $db_open = mysql_select_db($db_name, $db_connect);
> if(! $db_open) {
> print("Could not open the specified database.");
> }
> }
>
> ?>
>
> "Gert Mellak" <gert
mellak.com> wrote in message
> news:20020509140013.98456.qmail
pb1.pair.com...
> > Hi!
> >
> > When I open a database connection and i. e. the db-server is down,
> > I get a very long, long error message telling me that the server is
down.
> >
> > What I want to do is just echo a text, i. e. "DB-Server down" and leave
> out
> > the error message.
> >
> > Does anyone have an idea how to manage this?
> >
> > I'd be grateful for any information!
> >
> > TIA,
> >
> > Gert.
> > gert
mellak.com
> > http://mellak.com
> >
> >
> >
>
>
attached mail follows:
On Thursday 09 May 2002 18:05, Gert Mellak wrote: > really that easy? thank you... > > gert.
or use die function
$db_connect = mysql_connect($db_server, $db_user, $db_pass) or die('Couldn't connect to database');
$db_open = mysql_select_db($db_name, $db_connect) or die('Couldn't select database');
Greetings, Szymon Kosok http://www.best-scripts.tk
attached mail follows:
> $db_connect = mysql_connect($db_server, $db_user, $db_pass) or die('Couldn't > connect to database'); > > $db_open = mysql_select_db($db_name, $db_connect) or die('Couldn't select > database');
well, I tried this out and if the mysql-server is down, I get the "Warning: Unable to connect to mysql-server"-stuff.
The only way I've found was to connect by
mysql_connect - but that's not
the fine style, yeah?
Gert.
attached mail follows:
That's what the
operator is there for - there's nothing wrong with using
it, though it's considered bad form to use it without implementing your own
error checking as the code would be near impossible to debug.
Danny.
----- Original Message -----
From: "Gert Mellak" <gert
mellak.com>
To: <php-general
lists.php.net>
Sent: Thursday, May 09, 2002 5:18 PM
Subject: Re: [PHP] Re: error-catching
> > $db_connect = mysql_connect($db_server, $db_user, $db_pass) or
> die('Couldn't
> > connect to database');
> >
> > $db_open = mysql_select_db($db_name, $db_connect) or die('Couldn't
select
> > database');
>
> well, I tried this out and if the mysql-server is down, I get the
> "Warning: Unable to connect to mysql-server"-stuff.
>
> The only way I've found was to connect by
mysql_connect - but that's not
> the fine style, yeah?
>
> Gert.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
You can write your own error handlers using set_error_handler(). Then, depending on the error code, you can decide whether you should display the error message, email it to you, log it, whatever.
http://www.php.net/manual/en/function.set-error-handler.php
If you just want to hide the error message, there's nothing wrong with using
.
J
Gert Mellak wrote:
>> $db_connect = mysql_connect($db_server, $db_user, $db_pass) or
> die('Couldn't
>> connect to database');
>>
>> $db_open = mysql_select_db($db_name, $db_connect) or die('Couldn't select
>> database');
>
> well, I tried this out and if the mysql-server is down, I get the
> "Warning: Unable to connect to mysql-server"-stuff.
>
> The only way I've found was to connect by
mysql_connect - but that's not
> the fine style, yeah?
>
> Gert.
attached mail follows:
J Smith <dark_panda
hushmail.com> schrieb in im Newsbeitrag:
20020509180836.99473.qmail
pb1.pair.com...
>
> You can write your own error handlers using set_error_handler(). Then,
> depending on the error code, you can decide whether you should display the
> error message, email it to you, log it, whatever.
>
> http://www.php.net/manual/en/function.set-error-handler.php
thank you very much! this seems to be what I was looking for!
>
> If you just want to hide the error message, there's nothing wrong with
using
>
.
ok, it's a new point of view... I've always thought that this is bad programming style!
Thank you for your hints!
Gert.
attached mail follows:
use or die ("DB-server down"); at the end of you line.
"Gert Mellak" <gert
mellak.com> wrote in message
news:20020509140013.98456.qmail
pb1.pair.com...
> Hi!
>
> When I open a database connection and i. e. the db-server is down,
> I get a very long, long error message telling me that the server is down.
>
> What I want to do is just echo a text, i. e. "DB-Server down" and leave
out
> the error message.
>
> Does anyone have an idea how to manage this?
>
> I'd be grateful for any information!
>
> TIA,
>
> Gert.
> gert
mellak.com
> http://mellak.com
>
>
>
attached mail follows:
Gert,
to prevent PHP to output any error messages, you can prefix the expression
with
, i.e.
$db =
mysql_connect( $host, $user, $password) or die ('Sorry, server is
down!');
Greetings, Herb
----- Original Message -----
From: "Gert Mellak" <gert
mellak.com>
To: <php-general
lists.php.net>
Sent: Thursday, May 09, 2002 4:00 PM
Subject: [PHP] error-catching
> Hi! > > When I open a database connection and i. e. the db-server is down, > I get a very long, long error message telling me that the server is down. > > What I want to do is just echo a text, i. e. "DB-Server down" and leave out > the error message. > > Does anyone have an idea how to manage this?
attached mail follows:
On Thu, 9 May 2002, Gert Mellak wrote:
>> If you just want to hide the error message, there's nothing wrong with
>> using
.
>
> ok, it's a new point of view... I've always thought that this is bad
> programming style!
It's bad if you're using it to hide errors rather than fixing them.
If you have another reliable way of catching the same errors, then it's fine.
miguel
attached mail follows:
Hi, I'm using apache rewrite and I need to get the URL that I see in the browser. When using $REQUEST_URI I get the page where the rewrite is being redirected to. How can I get my hands on the actual URL that I see in the browser?
Thanks for any hints. I haven't coded for a while and am a bit out of it... Peter
attached mail follows:
hello,
i am a PHP newbie and i am stumped by the problem below and would appreciate any thoughts:
if i am submitting my HTML form to a PHP script, i am asked to do something like the below, for multiple selection elements:
HTML file:
<form action="test.php" method="post"> <select name="testvar[]" multiple> <option>opt1</option> <option>opt2</option> <option>opt3</option> <option>opt4</option> <option>opt5</option> </select> <br> <input type="submit"> </form>
then, in my test.php i am supposed to be able to access these form elements using the $_POST global. that works for non- -multiple choice elements, but for multiple choice elements such as the above the values are repeated!
for example, if i chose "opt1" and "opt2" above, and in the PHP script i access it as below:
$_POST['testvar']
then the array that is returned by the above access has 4 elements not 2!
count($_POST['testvar']) => 4 $_POST['testvar'] => ('opt1', 'opt2', 'opt1', 'opt2')
sometimes things get even worse with the value of a hidden element being added to one of these arrays!
could it be the browser messing up on encountering the '[]'? i have tested on mozilla-1.0rc1 and netscape-4.7. i am running apache2 with php4 on freeBSD 4.3.
any ideas?
thanks,
--ravi
attached mail follows:
Unless you really know what you are doing, I would suggest not using Apache2 yet. Apache2+PHP is really not fully baked at this point.
Downgrade to the stable Apache1 and this will work as you expect.
-Rasmus
On Thu, 9 May 2002, ravi wrote:
> > hello, > > i am a PHP newbie and i am stumped by the problem below and > would appreciate any thoughts: > > if i am submitting my HTML form to a PHP script, i am asked to do > something like the below, for multiple selection elements: > > HTML file: > > <form action="test.php" method="post"> > <select name="testvar[]" multiple> > <option>opt1</option> > <option>opt2</option> > <option>opt3</option> > <option>opt4</option> > <option>opt5</option> > </select> > <br> > <input type="submit"> > </form> > > then, in my test.php i am supposed to be able to access these > form elements using the $_POST global. that works for non- > -multiple choice elements, but for multiple choice elements such > as the above the values are repeated! > > for example, if i chose "opt1" and "opt2" above, and in the PHP > script i access it as below: > > $_POST['testvar'] > > then the array that is returned by the above access has 4 elements > not 2! > > count($_POST['testvar']) => 4 > $_POST['testvar'] => ('opt1', 'opt2', 'opt1', 'opt2') > > sometimes things get even worse with the value of a hidden > element being added to one of these arrays! > > could it be the browser messing up on encountering the '[]'? i have > tested on mozilla-1.0rc1 and netscape-4.7. i am running apache2 > with php4 on freeBSD 4.3. > > any ideas? > > thanks, > > --ravi > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
Ravi, I am doing exactly the same kind of form processing and getting the desired results (apache 1.3.22!). > Unless you really know what you are doing, I would suggest not using > Apache2 yet. Apache2+PHP is really not fully baked at this point. > > Downgrade to the stable Apache1 and this will work as you expect. > > -Rasmus > > On Thu, 9 May 2002, ravi wrote: > > > > > hello, > > > > i am a PHP newbie and i am stumped by the problem below and > > would appreciate any thoughts: > > > > if i am submitting my HTML form to a PHP script, i am asked to do > > something like the below, for multiple selection elements: > > > > HTML file: > > > > <form action="test.php" method="post"> > > <select name="testvar[]" multiple> > > <option>opt1</option> > > <option>opt2</option> > > <option>opt3</option> > > <option>opt4</option> > > <option>opt5</option> > > </select> > > <br> > > <input type="submit"> > > </form> > > > > then, in my test.php i am supposed to be able to access these > > form elements using the $_POST global. that works for non- > > -multiple choice elements, but for multiple choice elements such > > as the above the values are repeated! > > > > for example, if i chose "opt1" and "opt2" above, and in the PHP > > script i access it as below: > > > > $_POST['testvar'] > > > > then the array that is returned by the above access has 4 elements > > not 2! > > > > count($_POST['testvar']) => 4 > > $_POST['testvar'] => ('opt1', 'opt2', 'opt1', 'opt2') > > > > sometimes things get even worse with the value of a hidden > > element being added to one of these arrays! > > > > could it be the browser messing up on encountering the '[]'? i have > > tested on mozilla-1.0rc1 and netscape-4.7. i am running apache2 > > with php4 on freeBSD 4.3. > > > > any ideas? > > > > thanks, > > > > --ravi > > > > > > > > -- > > 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 >
-Pushkar S. Pradhan
attached mail follows:
pushkar, rasmus,
thanks for your responses. the problem was indeed apache2/php badness. i moved to apache 1.3.x and its working like a charm.
--ravi
attached mail follows:
I'm trying to find some good resources on what PHP can and/or can not do with regards to internationalization and multilanguage support. Any ideas?
Thanks.
_________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com
attached mail follows:
On Thu, 9 May 2002, J. Anderson Scarbrough wrote: > I'm trying to find some good resources on what PHP can and/or can not do > with regards to internationalization and multilanguage support. Any ideas?
The gettext section of the manual is a good place to start. There's really not much you can't do. It's more a matter of working out how much is worth the effort.
miguel
attached mail follows:
I have a site on a host that gives me everything I need, mod_rewrite, lots of stuff. I am JUST NOW on it. I have a problem though. I can't get php to include anything out of the document root. When I use ftp or telnet, the directories show up as /var/www/html for doc root and /var/www/rsrcs/..... for the directories I want to store includes, etc. in. That's all fine, I tried using those directory names and php could not open the files. Doesn't say whether they exist or not.
FIRST QUESTION: are those errors in the apache log, or just the php error file?
To learn more, I put the phpinfo(); function in my document root, and lo and behold, I get this long a gnarly virtual path: /home/virtual/site26/fst/var/www/html/ as my document root. So I try: /home/virtual/site26/fst/var/www/rsrcs/.... for my includes, and still can't get to it.
SECOND QUESTION: are there any virtual host gurus who can tell me how to get Apache/PHP to include files from outside of the document root on virtual hosted systems?
PLEASE CC ME, I'm on DIGEST. Thank you VERY much IN ADVANCE!
--If You want to buy computer parts, see the reviews at: http://www.cnet.com/ **OR EVEN BETTER COMPILATIONS**!! http://sysopt.earthweb.com/userreviews/products/
attached mail follows:
> To learn more, I put the phpinfo(); function in my document root, and > lo and behold, I get this long a gnarly virtual path: > /home/virtual/site26/fst/var/www/html/ > as my document root. So I try: > /home/virtual/site26/fst/var/www/rsrcs/.... for my includes, and still > can't get to it.
You've probably got an ensim system, don't you? The host for falkware.com is like that and it's a pain. Through ssh, the path to the file is /var/www/html/etc..., but like you, we have to use the whole "hidden" path /home/virtual/site26/fst/var/www/rsrcs/... That should work for you. What kind of error are you getting when you use the entire path?
> SECOND QUESTION: are there any virtual host gurus who can tell me how to > get Apache/PHP to include files from outside of the document root on > virtual hosted systems?
You can use an absolute path, with /home/virtual ... or use a relative path from the script you're in ../../includes/ etc..
---John Holmes...
attached mail follows:
> > I'm new to this as well, but have learned defining globals is not good > > practice. Avoid this if possible. Write your scripts so that you do not > > need to do this. > > You're probably confusing this with "register_globals" which is a setting in > php.ini and is indeed a bad idea. > > But why is this so bad ? If I have only one website on a machine and no-one other than myself uses this machine, why is it bad? Kindly explain.
regards, Paras.
attached mail follows:
On Wed, 8 May 2002, baldey_uk wrote: > If i want to pass variables from one php page to another do i have to use > the POST or GET html methods or is there a simplier way? What i am wanting > to do is take input from a html form, pass those as variables to a php page > (which i have done), do a couple of if or else operations and then pass > those same variables onto different php pages. Thanks for any help in > advance!
That's what sessions are for.
miguel
attached mail follows:
I tried using abolute paths, it still said that it couldn't find the directory. Do I have to put forward slashes in my abolute paths? Yes, I am using Windows.
---------------
"Jason Wong" <php-general
gremlins.com.hk> wrote in message
news:php.general-96769
news.php.net...
On Thursday 09 May 2002 14:15, Dr. Shim wrote:
Try using absolute paths.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* The amount of time between slipping on the peel and landing on the pavement is precisely 1 bananosecond. */
attached mail follows:
Thanks to all who responded. I think I should have mentioned that I am trying to send these vars. in the url to a javascript pg. thus won't have access to php on the other side (i.e. I want to keep it this way for speed). So as Kyle suggested to replace the " " is the only way? This is fine but isn't there something standard for this? > What you could do is think of some random sequence of characters, say > |-| and use that for a space. > > Then, on the receiving script, just remember to use > str_replace("|-|"," ",$HTTP_SERVER_VARS["QUERY_STRING"]) > > > If you don't have access to the receiving script, then you'll need to > use "%20". > > > -Kyle > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
-Pushkar S. Pradhan
attached mail follows:
LOL! A standard!? In Javascript!? You must be joking. :-)
Nope. But it's not difficult. You simply have to access the url string with 'document.location.href', parse out the values individually and replace the space placeholders. Can't remember what the exact javascript function would be.. I think it's 'string.replace' or something like that. I'm certain a quick search.will reveal exactly what you need. -Kevin
----- Original Message -----
From: "Pushkar Pradhan" <pushkar
ERC.MsState.Edu>
To: "Kyle Gibson" <admin
plaguenet.com>
Cc: <php-general
lists.php.net>
Sent: Thursday, May 09, 2002 10:24 AM
Subject: Re: [PHP] Re: how to send spaces in the url
> Thanks to all who responded. > I think I should have mentioned that I am trying to send these vars. in > the url to a javascript pg. thus won't have access to php on the other > side (i.e. I want to keep it this way for speed). > So as Kyle suggested to replace the " " is the only way? This is fine but > isn't there something standard for this? > > What you could do is think of some random sequence of characters, say > > |-| and use that for a space. > > > > Then, on the receiving script, just remember to use > > str_replace("|-|"," ",$HTTP_SERVER_VARS["QUERY_STRING"]) > > > > > > If you don't have access to the receiving script, then you'll need to > > use "%20". > > > > > > -Kyle > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -Pushkar S. Pradhan > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
Might I suggest using PHP's urlencode() to encode the string, and Javascript's function unescape()?
Matthew Walker Senior Software Engineer ePliant Marketing
-----Original Message-----
From: Kevin Stone [mailto:kevin
helpelf.com]
Sent: Thursday, May 09, 2002 11:37 AM
To: php-general
lists.php.net
Subject: Re: [PHP] Re: how to send spaces in the url
LOL! A standard!? In Javascript!? You must be joking. :-)
Nope. But it's not difficult. You simply have to access the url string with 'document.location.href', parse out the values individually and replace the space placeholders. Can't remember what the exact javascript function would be.. I think it's 'string.replace' or something like that. I'm certain a quick search.will reveal exactly what you need. -Kevin
----- Original Message -----
From: "Pushkar Pradhan" <pushkar
ERC.MsState.Edu>
To: "Kyle Gibson" <admin
plaguenet.com>
Cc: <php-general
lists.php.net>
Sent: Thursday, May 09, 2002 10:24 AM
Subject: Re: [PHP] Re: how to send spaces in the url
> Thanks to all who responded. > I think I should have mentioned that I am trying to send these vars. in > the url to a javascript pg. thus won't have access to php on the other > side (i.e. I want to keep it this way for speed). > So as Kyle suggested to replace the " " is the only way? This is fine but > isn't there something standard for this? > > What you could do is think of some random sequence of characters, say > > |-| and use that for a space. > > > > Then, on the receiving script, just remember to use > > str_replace("|-|"," ",$HTTP_SERVER_VARS["QUERY_STRING"]) > > > > > > If you don't have access to the receiving script, then you'll need to > > use "%20". > > > > > > -Kyle > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -Pushkar S. Pradhan > > > -- > 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--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
attached mail follows:
I thought session_unset() === $_SESSION=array();
The problem is when I hit the back button the web browser will ask me to resend the data. If I choose yes, the old data redisplays again. How do I make it a real logout?
Regards, Norman
"Kirk Babb" <kbcd
worldnet.att.net> wrote in message
news:20020509025708.74298.qmail
pb1.pair.com...
If you used $_SESSION, how about
$_SESSION=array();
It's in the manual
http://www.php.net/manual/en/ref.session.php
attached mail follows:
On Thu, 9 May 2002, baldey_uk wrote: > Hello again, i am trying to do as said below but have a problem. Is there > anyway to say 'go to this page in PHP' without using headers as i would like > to use relative URL's and not abolsute ones. Also is this fine that the code > here is all on the same page or do i have to have the form posting to a php > page and then do the swtich case from there?
If you don't mind having the buttons on separate lines (or you will use a table to put them on the same line), then just use two different forms:
<form action="yespage.html"> <input type="submit" name="x" value="Yes"> </form>
<form action="nopage.html"> <input type="submit" name="x" value="No"> </form>
miguel
attached mail follows:
Hi,
I've already built in a penpal system. Now i want to add a feature which allows user to upload his/her image. When other user's search for penpals, the photos should appear next to the record's details.
Can anyone guide me towards such a script/tutorial?
I'm using mySQL as my backend, on an Apache Web Server on Linux.
Thanks, T. Edison jr.
=====
Rahul S. Johari (Director)
******************************************
Abraxas Technologies Inc.
Homepage : http://www.abraxastech.com
Email : abraxastech
yahoo.com
Tel : 91-4546512/4522124
*******************************************
__________________________________________________ Do You Yahoo!? Yahoo! Shopping - Mother's Day is May 12th! http://shopping.yahoo.com
attached mail follows:
Couldn't you just add a column to your MySQL table where the image name would be stored, then when you display your query results in your script, just put something like:
echo "<img src=\"path/to/your/images/$imagename\">";
Seems easy enough.
Jason Soza
----- Original Message -----
From: "Thomas Edison Jr." <thomasedisonjr
yahoo.com>
Date: Thursday, May 9, 2002 9:23 am
Subject: [PHP] A pen pal system with Photo upload feature
> Hi,
>
> I've already built in a penpal system. Now i want to
> add a feature which allows user to upload his/her
> image. When other user's search for penpals, the
> photos should appear next to the record's details.
>
> Can anyone guide me towards such a script/tutorial?
>
> I'm using mySQL as my backend, on an Apache Web Server
> on Linux.
>
> Thanks,
> T. Edison jr.
>
>
>
> =====
> Rahul S. Johari (Director)
> ******************************************
> Abraxas Technologies Inc.
> Homepage : http://www.abraxastech.com
> Email : abraxastech
yahoo.com
> Tel : 91-4546512/4522124
> *******************************************
attached mail follows:
You may also use blobs to store the images in the database. That may induce some major slowdown for large numbers of images. I would suggest going with a directory structure on the filesystem, managing the structure from PHP and allowing no more that 100 images per directory.
For example: ---------------------- <? // Globals $image_path="/var/www/html/pal/external_images"; $count_limit=100;
// main $dir=0; while (is_dir($image_path.$dir)) { $dir++; } if ($dir) { // Going back to the last existing directory $dir--; } else { // We don't even have the first directory, so we'll create it mkdir($image_path."0"); } $im=0; while(is_file($image_path.$dir.$im)) { $im++; } // We started counting from 0 if ($im>($count_limit-1)) { $dir++; mkdir($image_path.$dir); $im=0; } // Ok, got the final image path - let's store it $image_path.=$dir.$im;
// The file upload field is expected to be "image" if (is_uploaded_file($_POST["image"]) { copy($_POST["image"],$image_path) } mysql_run_query("insert into entries set image_path=\"$dir$im\""); ?> ----------------------
This is obviously just the skeleton of the upload page, but I hope it's explicit enough to start things going...
Bogdan
Jason Soza wrote:
>Couldn't you just add a column to your MySQL table where the image name >would be stored, then when you display your query results in your >script, just put something like: > >echo "<img src=\"path/to/your/images/$imagename\">"; > >Seems easy enough. > >Jason Soza >
attached mail follows:
This might help you: http://www.phpbuilder.com/columns/william19990908.php3?page=1
Tyler Longren
Captain Jack Communications
tyler
captainjack.com
www.captainjack.com
----- Original Message -----
From: "Thomas Edison Jr." <thomasedisonjr
yahoo.com>
To: <php-general
lists.php.net>
Sent: Thursday, May 09, 2002 12:23 PM
Subject: [PHP] A pen pal system with Photo upload feature
> Hi,
>
> I've already built in a penpal system. Now i want to
> add a feature which allows user to upload his/her
> image. When other user's search for penpals, the
> photos should appear next to the record's details.
>
> Can anyone guide me towards such a script/tutorial?
>
> I'm using mySQL as my backend, on an Apache Web Server
> on Linux.
>
> Thanks,
> T. Edison jr.
>
>
>
> =====
> Rahul S. Johari (Director)
> ******************************************
> Abraxas Technologies Inc.
> Homepage : http://www.abraxastech.com
> Email : abraxastech
yahoo.com
> Tel : 91-4546512/4522124
> *******************************************
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Mother's Day is May 12th!
> http://shopping.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Keep in mind that HTTP_REFERER can be faked with very little effort, so don't rely on this as an absolute security measure.
miguel
On Wed, 8 May 2002, Jas wrote:
> That worked very well, I appriciate you giving me an example to go from.
> Jas
>
> "Kevin Stone" <kevin
helpelf.com> wrote in message
> news:000c01c1f6c6$fe370260$6601a8c0
kevin...
> > Well let's say your form is at "http://www.yourdomain.com/form.html". And
> > your confirmation script is at
> > "http://www.yourdomain.com/http/confirm.php". Looking for the entire
> exact
> > URL may prove unreliable if you make any changes to your website. Looking
> > for a partial domain will ensure security and you won't be nagged with
> > errors resulting from changes. So the security portion of your script
> might
> > be as simple as this. Becuase you're looking for the domain at the
> > beginning of the referral string it is completely unspoofable.
> >
> > <?
> > // Hard code the domain into the script.
> > $domain_a = 'http://www.yourdomain.com';
> >
> > //Ensure the domain is at the beginning of the referral string.
> > $length = strlen($domain_a);
> > $domain_b = substr($HTTP_REFERER, 0, $length);
> >
> > if ($domain_a != $domain_b){
> > echo "INVALID ENTRY";
> > exit;
> > }
> > ?>
> >
> > Good luck!
> > -Kevin
> >
> > ----- Original Message -----
> > From: "Jas" <jlgerfen
hotmail.com>
> > To: <php-general
lists.php.net>
> > Sent: Wednesday, May 08, 2002 11:57 AM
> > Subject: Re: [PHP] script to script
> >
> >
> > > Could you give me an example of this?
> > > thanks again,
> > > jas
> > >
> > > "Kevin Stone" <kevin
helpelf.com> wrote in message
> > > news:006601c1f6b8$8a00ad00$6601a8c0
kevin...
> > > > The variable $HTTP_REFERER stores the last URL visited by the browser.
> > > It
> > > > is set by the browser its self so contents may vary. But you can
> > hardcode
> > > > the URL into your script then perform a soft comparison between the
> two.
> > > If
> > > > there are too many differences then you simply deny the request. Hope
> > > this
> > > > helps.
> > > >
> > > > -Kevin
> > > >
> > > > ----- Original Message -----
> > > > From: "Jas" <jlgerfen
hotmail.com>
> > > > To: <php-general
lists.php.net>
> > > > Sent: Wednesday, May 08, 2002 11:38 AM
> > > > Subject: [PHP] script to script
> > > >
> > > >
> > > > > I have a form that links from a form on an html page then to a
> confirm
> > > > page,
> > > > > I have error validation on each page however on the final page I
> would
> > > > like
> > > > > to have it verify where the data is coming from... i.e. I would like
> > to
> > > > make
> > > > > sure it is coming from the confirm page on the same server. If
> anyone
> > > has
> > > > > an idea of how to accomplish this that would be great. Thanks in
> > > advance,
> > > > > jas
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > 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
> > >
> > >
> >
> >
>
>
>
>
attached mail follows:
On Wed, 8 May 2002, Scott St. John wrote: > Sorry to be so thick this morning, but I have a unix time stamp in my MS > Sql server that is the date, plus 60 days to expire a password. I want to > take today's date and compare to the two to see: > 1)How many days until the password expires > 2)If the password already expired then force a password change. > > I am missing something I am sure because I am not getting the answer I am > looking for with this code: > > $expirePass = strtotime("now"); <-todays date > $myPassword = ("1026047985"); <-from the MS Sql field > > $itexpires = ($expirePass - $myPassword);
$daysleft = intval(($mypassword - now()) / 86400));
miguel
attached mail follows:
Thank you Miguel! I was missing the /86400 and it works much better now :)
On Thu, 9 May 2002, Miguel Cruz wrote:
> On Wed, 8 May 2002, Scott St. John wrote: > > Sorry to be so thick this morning, but I have a unix time stamp in my MS > > Sql server that is the date, plus 60 days to expire a password. I want to > > take today's date and compare to the two to see: > > 1)How many days until the password expires > > 2)If the password already expired then force a password change. > > > > I am missing something I am sure because I am not getting the answer I am > > looking for with this code: > > > > $expirePass = strtotime("now"); <-todays date > > $myPassword = ("1026047985"); <-from the MS Sql field > > > > $itexpires = ($expirePass - $myPassword); > > $daysleft = intval(($mypassword - now()) / 86400)); > > miguel >
--
attached mail follows:
Hello list,
php4.1 recommends to set register_globals=off in php.ini to make php more strict. My question is, if I turn off register_globals, what will happen if any malicious user just try to modify the variable values in the url? Say,
http://www.domain.com/xxx.php?id=3&sex=female
Does it work if user just change the value in the URL directly and send the url directly to web server?
How can we avoid the malicious attack by directly http GET/POST with modified parameter values to make possible system error or compromise?
-- Patrick Hsieh <pahudpahud.net> GPG public key http://pahud.net/pubkeys/pahudatpahud.gpg
attached mail follows:
On Fri, 10 May 2002, Patrick Hsieh wrote: > php4.1 recommends to set register_globals=off in php.ini to make php > more strict. My question is, if I turn off register_globals, what will > happen if any malicious user just try to modify the variable values in > the url? Say, > > http://www.domain.com/xxx.php?id=3&sex=female > > Does it work if user just change the value in the URL directly and send > the url directly to web server? > > How can we avoid the malicious attack by directly http GET/POST with > modified parameter values to make possible system error or compromise?
If register_globals is off, then you'll get $_GET['id'] = 3 and $_GET['sex'] = female. It's then up to you to make sure those are okay. But at least $id and $sex won't get set until you explicitly set them in your code.
miguel
attached mail follows:
I want to include text from a html-file that is online at another website. To be more precise: I want to include my seti-stats from http://setiathome.ssl.berkeley.edu/ on my own homepage. Can I do this with PHP?
Sincerely Andreas Indahl
attached mail follows:
Andreas Indahl <andreas
koga.nu> schrieb in im Newsbeitrag:
20020509181648.4920.qmail
pb1.pair.com...
> I want to include text from a html-file that is online at another website.
> To be more precise: I want to include my seti-stats from
> http://setiathome.ssl.berkeley.edu/ on my own homepage. Can I do this with
> PHP?
certainly... just use the fopen-function and use the URL as the filename. You handle it the same way as a normal text-file.
Here's the link to the php-function:
http://www.php.net/manual/en/function.fopen.php
Greetings,
Gert.
==================================== I'm still confused - but on a much higher level...
attached mail follows:
('binary' encoding is not supported, stored as-is) Anyone notice this... when you do a <? phpinfo(); ?>
you get "PHP Version 4.1.2", while my apache window says "Apache/1.3.20 (Win32) PHP/4.2.0 running..."
-G
attached mail follows:
I'm doing a str_replace (same thing happens with ereg and preg) and when the pattern is found it's erasing everything after it and doing a strange replace, too.
I'm using a seven column CSV (new_data.csv) where the first [0] column is first name and the second [1] is last name. This is what I'm trying to search for, and replace with with some characters on either side. So it will find John Smith and replace it with 123 John Smith 456.
Here's the file I"m trying to do the replaces in (text.txt): 1 This is a test of the templating program. <br> 2 Here's hoping it's working. <br> 3 <br> 4 <br> 5 6 John Smith <br> 7 8 Peter Lem <br> 9 10 Shawn Adams <br>
Here's the program: 1 <? 2 $row = 1; 3 $fp = fopen("new_data.csv", "r"); 4 while ($data = fgetcsv ($fp, 1000, ",")) { 5 $num = count ($data); 6 $row++; 7 for ($c=0; $c < $num; $c++) { 8 $text = fopen("text.txt", "r"); 9 $merged = fopen("merged_text.html", "w"); 10 $filecontents = fread($text,filesize("text.txt")); 11 $fullname = $data[0] . ' ' . $data[1]; 12 $newfullname = "123 " . $fullname . " 456"; 13 $new_filecontents = str_replace($fullname, $newfullname, $filecontents); 14 fwrite($merged,$new_filecontents); 15 fclose ($merged); 16 fclose ($text); 17 copy("merged_text.html", "text.txt"); 18 } 19 } 20 fclose ($fp); 21 ?>
by the way, I know it's horribly ugly to open and close the file in the loop like that, but when it was outside the loop no changes were saved.
Here's the ouput (merged_text.html): 1 This is a test of the templating program. <br> 2 Here's hoping it's working. <br> 3 <br> 4 <br> 5 6 123 123 123 123 123 123 John Smith 456 456 456 456 4
Thanks for your help!
Josh
attached mail follows:
Hello Guys!
I'm having troubles with not knowing the amount of data which is waiting to be received in the buffer for a specific socket I can use fsockopen, establish a connection, and write to the socket, I can read from the socket just fine as well. The trouble I'm running into is illustrated in this example
Eg: Open a socket to an ftp site (port 21). I can expect a banner from
EG: the ftp server, but this is not always the case. if there is a
EG: banner it is usually only one line, but this is not always the case.
EG: I can then fputs($fp, 'user anonymous'.chr(10)); After that fputs I
EG: can expect one line to be in the buffer. I then fputs($fp, 'pass
EG: anonymsou
email.com'.chr(10)); There can then be anything from 0 to
EG: (lots) of bytes in the buffer, spanning multiple lines.
I want to be able to pull all of the waiting information out of the socket, process it, and then proceed - not knowing the amount of data to expect. A while( $data=fgets($fp, 9999) ) works, but either a) hangs when there is no more data to receive, or b) times the socket out when a socket timeout on the file pointer is used, or c) is VERY unreliable when the socket is set to non-blocking mode. I've tried using $var=socket_get_status($fp), but then $var['unread_bytes'] is always 0 or null... Am I missing something?
The development server is running slackware 8, kernel 2.4.18, apache-1.3.24, and php 4.2
I'll send sample code if asked, Thanks in advance for the help!
------------------------------------------------------------------------ -
-- Demitrious S. Kelly
-- Eagle Networks
------------------------------------------------------------------------ -
------------------------------------------------------------------------ -
-- Demitrious S. Kelly
-- Eagle Networks
------------------------------------------------------------------------ -
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]