Re: [PHP] Re: I suck at regular expressions!
Not quite. I have the same problem. At 11:36 PM 11/14/2001, Johan Holst Nielsen wrote: >Richard S. Crawford wrote: > > > I am trying to get the title of an html file... you know, the string > > between the < title > and < /title > tags... > > > > Here is the function I've got so far: > > > > function fileTitle($fileName) { > > $myFile = fopen($fileName, "r"); > > $myText=""; > > while (!feof($myFile)) { > > $myText .= fgets($myFile,255); > > } > > fclose($myFile); > > if (eregi("(.+)",$myText,$theTitle)) return > > $theTitle[0]; > > else return "(No Title)"; > > } > >Try: >function getTitle($filename) { >$fp = fopen($filename, "r"); > $filecontent = fread($fp, filesize($filename)); > if(eregi("(.+)", $content, $title_arr)) { > return >addslashes(htmlspecialchars(trim(strip_tags($title_arr[1]; > } > else { > return "(No Title)"; > } >} > > >Regards, >Johan > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] Sliante, Richard S. Crawford http://www.mossroot.com mailto:[EMAIL PROTECTED] AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford "It is only with the heart that we see rightly; what is essential is invisible to the eye." --Antoine de Saint Exupéry "Push the button, Max!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: how can I get the post content in php
Hello Johan the program just can let me get the post string like my example I want post the xml file content to a php file, then I want get the post string that it's xml content. hehe, thanks for your help -- Yorgo Sun Project Manager Technology Dept. Tom.com Email:[EMAIL PROTECTED] Mobile:13701243390 Phone:65283399-121 TomQ ID:yorgo http://www.ruisoft.com "Johan Holst Nielsen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > $HTTP_SERVER_VARS['QUERY_STRING'] --> it just can read the content by GET > > method. > > > > I want POST content > > Ah okay. Try this: > > $post_query = ""; > $keys_arr = array_keys($HTTP_POST_VARS); > $keys_size = sizeof($key_arr); > for($i=0; $i<$keys_size; $i++) { > if($i == 0) { > $post_query .= $keys_arr[$i]."=".$HTTP_POST_VARS[$keys_arr[$i]]; > } > else { > $post_query .= "&".$keys_arr[$i]."=".$HTTP_POST_VARS[$keys_arr[$i]]; > } > } > > Regards, > Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] I have tried ...
For the record, I have tried: I have read: http://www.php.net/manual/en/function.session-register.php > This is my problem: > http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/test_session.php > > Type something. > Press submit. > Change your text and re-submit. > > $name doesn't re-save itself. This is my code: > http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/test_session.phps > > Suggestions? > It can't be that complicated can it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: I suck at regular expressions!
Richard S. Crawford wrote: > Not quite. I have the same problem. I tried at test on my localhost. Following works for me: $string = "Sometime i dont wanna know"; if(eregi("(.+)", $string, $arr)) { echo "Title: ".$arr[1]; } else { echo "unknown title"; } This works for me? Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: how can I get the post content in php
>the program just can let me get the post string like my example > I want post the xml file content to a php file, then I want get the post > string that it's xml content. > > hehe, thanks for your help Did you solve your problem? I dont think i understand you, but i tries to give a little summary what I think you mean. 1. A page make a post request with XML data to a PHP file. 2. The PHP file get the post request, and get the XML data. 3. An then what? Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: how can I get the post content in php
I think you understand my problem. I will use a client program to POST the XML data to a php file on the server base HTTP in php file will get the post request, the question is, how can i get the xml data in post request -- Yorgo Sun Project Manager Technology Dept. Tom.com Email:[EMAIL PROTECTED] Mobile:13701243390 Phone:65283399-121 TomQ ID:yorgo http://www.ruisoft.com "Johan Holst Nielsen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >the program just can let me get the post string like my example > > I want post the xml file content to a php file, then I want get the post > > string that it's xml content. > > > > hehe, thanks for your help > > Did you solve your problem? > I dont think i understand you, but i tries to give a little summary what I > think you mean. > > 1. A page make a post request with XML data to a PHP file. > 2. The PHP file get the post request, and get the XML data. > 3. An then what? > > Regards, > Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] And ...
And ... if this helps: http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/phpinfo.php Jtjohnston wrote: > For the record, I have tried: > > //$temp = $name; > session_name("TESTpostcard"); > session_start(); > > $temp = $name; > session_register("name"); > $name = $temp; > > > I have read: http://www.php.net/manual/en/function.session-register.php > > This is my problem: > > http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/test_session.php > > > > Type something. > > Press submit. > > Change your text and re-submit. > > > > $name doesn't re-save itself. This is my code: > > http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/test_session.phps > > > > Suggestions? > > It can't be that complicated can it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Session
The problem lies with the fact that you have a variable 'name' that gets posted in the form as well as a session variable 'name' that is passed to the script when it is executed again. As far as I remember the session variable supercedes the posted variable, so the session variable would overwrite the value of the posted variable every time. You need to register the session variable with another name and then toggle between the two variables in you script. Also, a session variable need only be registered once: if (!session_is_registered("name")) { session_register("name"); } Rudolf Visagie Principal Software Developer Digital Healthcare Solutions Tel. +27(0)11 266 6946 Fax. +27(0)11 266 5080 Cell: +27(0)82 895 1598 E-mail: [EMAIL PROTECTED] -Original Message- From: jtjohnston [mailto:[EMAIL PROTECTED]] Sent: 15 November 2001 09:08 To: [EMAIL PROTECTED] Subject: [PHP] Session Hi, I have read: http://www.php.net/manual/en/function.session-register.php Could I ask you a question about how to set a session $vars in a ? It seems to be quite a mystery/controversy!! This is my problem: http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/test_session.php Type something. Press submit. Change your text and re-submit. $name doesn't re-save itself. This is my code: http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/test_session.php s Would you have any suggestions? It can't be that complicated can it? J.T-Johnston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: how can I get the post content in php
> I think you understand my problem. > > I will use a client program to POST the XML data to a php file on the > server base HTTP > in php file will get the post request, > > the question is, how can i get the xml data in post request Hmm, I dont think I understand? Where do you want to do with the XML? Cant you just make a echo() in a xml document? please explain? ... ... ... ... ... Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: how can I get the post content in php
XML file is text file. If I open the file with php like call $fp, that is a long string with some special char. post method can send a long string to the server. how php can receive that long string is my problem. if can do that, php can parser the xml file send form remote computer. I want php parser the SOAP message -- Yorgo Sun Project Manager Technology Dept. Tom.com Email:[EMAIL PROTECTED] Mobile:13701243390 Phone:65283399-121 TomQ ID:yorgo http://www.ruisoft.com "Johan Holst Nielsen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I think you understand my problem. > > > > I will use a client program to POST the XML data to a php file on the > > server base HTTP > > in php file will get the post request, > > > > the question is, how can i get the xml data in post request > > Hmm, I dont think I understand? Where do you want to do with the XML? Cant > you just make a echo() in a xml document? please explain? > > ... > ... > > echo $xmldatavar; > ?> > ... > ... > ... > > Regards, > Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] multiple include
Hi all, I would like to do something like that : #ifndef _SYS_TYPES_H #include #endif Is it possible in php ? Thx poz
Re: [PHP] how can I get the post content in php
$HTTP_RAW_POST_DATA (problems with 4.0.6 because in it some changes had been made). If the content type is known by PHP then this var is empty, otherwise you have the data in it. Works perfect with 4.0.0. I think that since 4.0.7 there is a ini option about that Regards, On Thursday 15 November 2001 02:36 am, you wrote: > I mean post content string not a lot of variables > > etc: > > aaa.html post a=1&b=2 to bbb.php > > I want use php to read the string a=1&b=2 not $a and $b > > thanks -- Andrey Hristov Web Developer Icygen Corporation BUILDING SOLUTIONS http://www.icygen.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: how can I get the post content in php
I think I saw on this list that there's a $HTTP_RAW_POST_DATA (or similar) varibale. Sorry the net is slow like hell at work, I can't search for more info. But I think if you search for "raw" on the general mailing list's archive you will find it. Arpi > XML file is text file. If I open the file with php like call $fp, > that is a long string with some special char. > post method can send a long string to the server. > how php can receive that long string is my problem. > > if can do that, php can parser the xml file send form remote > computer. I want php parser the SOAP message > -- > Yorgo Sun > Project Manager > Technology Dept. Tom.com > Email:[EMAIL PROTECTED] Mobile:13701243390 Phone:65283399-121 TomQ > ID:yorgo http://www.ruisoft.com > "Johan Holst Nielsen" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > I think you understand my problem. > > > > > > I will use a client program to POST the XML data to a php file > > > on the server base HTTP > > > in php file will get the post request, > > > > > > the question is, how can i get the xml data in post request > > > > Hmm, I dont think I understand? Where do you want to do with the > > XML? Cant you just make a echo() in a xml document? please > > explain? > > ... > > ... > > > > > echo $xmldatavar; > > ?> > > ... > > ... > > ... > > > > Regards, > > Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] how can I get the post content in php
thinks I finded it by review the soure code. try it's empty. then think have and other way. so got your explain. I just try the older version or waitting the php4.1.0 -- Yorgo Sun Project Manager Technology Dept. Tom.com Email:[EMAIL PROTECTED] Mobile:13701243390 Phone:65283399-121 TomQ ID:yorgo http://www.ruisoft.com "Andrey Hristov" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > $HTTP_RAW_POST_DATA > > (problems with 4.0.6 because in it some changes had been made). If the > content type is known by PHP then this var is empty, otherwise you have the > data in it. Works perfect with 4.0.0. I think that since 4.0.7 there is a ini > option about that > > Regards, > > > On Thursday 15 November 2001 02:36 am, you wrote: > > I mean post content string not a lot of variables > > > > etc: > > > > aaa.html post a=1&b=2 to bbb.php > > > > I want use php to read the string a=1&b=2 not $a and $b > > > > thanks > > -- > Andrey Hristov > Web Developer > Icygen Corporation > BUILDING SOLUTIONS > http://www.icygen.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: I suck at regular expressions!
try that! New Document '; if (preg_match('/(.+?)<\/title>/is', $mem, $matches)) { echo "title is:$matches[1]"; } ?> "Richard S. Crawford" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am trying to get the title of an html file... you know, the string between the < title > and < /title > tags... Here is the function I've got so far: function fileTitle($fileName) { $myFile = fopen($fileName, "r"); $myText=""; while (!feof($myFile)) { $myText .= fgets($myFile,255); } fclose($myFile); if (eregi("(.+)",$myText,$theTitle)) return $theTitle[0]; else return "(No Title)"; } The trouble is, it always returns "(No Title)", regardless of whether the file has a title defined in the header or not. I suspect I'm doing something fundamentally wrong. Can anyone set me straight? Sliante, Richard S. Crawford http://www.mossroot.com mailto:[EMAIL PROTECTED] AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford "It is only with the heart that we see rightly; what is essential is invisible to the eye." --Antoine de Saint Exupéry "Push the button, Max!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] pls help: add new extension to PHP (rpm) on RedHat
Hello, I'm using PHP 4.0.4pl1-9 on RedHat 7.1. The software was installed using rpm. I'd like to add the mhash extension without re-installing the entire PHP package from source. So i try following steps: - install mhash from source - obtain PHP source directory, then cd ext/mhash phpize ./configure --with-mhash make make install (found /usr/lib/php4/mhash.so ready) - uncomment the line with mhash.so in /etc/php.ini However, when i tried the sample in PHP manual, it failed to call mhash() with following error messages: PHP Warning: Invalid library (maybe not a PHP library) 'mhash.so' in Unknown on line 0 Did i use the wrong procedure ? I'm new to PHP and sorry for the newbie faq. Thanks in advance. ST Wong -- S.T. Wong | Email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Serious problem with Cookies..
I started an affiliate program to sell my scripts, and it uses cookies for tracking.. I didnt know it at the time, but as soon as the web browser's closed, the cookie info is gone. g! I need it to stay there *permanently*! =) Here's the code I have no for both setting and retrieving.. retrieving: $refid = $HTTP_COOKIE_VARS["refid"]; setting: setcookie ("refid", $id); Am I just missing something I didnt see on php.net? =) -- >From PHPGalaxy.com, earn up to $10 per order selling our PHP Scripts and Software on your Site. http://www.phpgalaxy.com/aff/ Also, get a fast free POP3 email account, you @php.la at http://www.phpgalaxy.com/search/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Serious problem with Cookies..
you must set the cookie's expiry time! of-the manual: setcookie ("TestCookie", "Test Value"); setcookie ("TestCookie", $value,time()+3600); /* expire in 1 hour */ setcookie ("TestCookie", $value,time()+3600, "/~rasmus/", ".utoronto.ca", 1); "Phpgalaxy.Com" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I started an affiliate program to sell my scripts, and it uses cookies > for tracking.. I didnt know it at the time, but as soon as the web > browser's closed, the cookie info is gone. g! I need it to stay > there *permanently*! =) Here's the code I have no for both setting and > retrieving.. > > retrieving: $refid = $HTTP_COOKIE_VARS["refid"]; > setting: setcookie ("refid", $id); > > Am I just missing something I didnt see on php.net? =) > > > -- > From PHPGalaxy.com, earn up to $10 per order selling our PHP Scripts > and Software on your Site. http://www.phpgalaxy.com/aff/ > > Also, get a fast free POP3 email account, you @php.la at > http://www.phpgalaxy.com/search/ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Serious problem with Cookies..
yeah I saw that bit on there, but I was led to believe tha by leaving it out, it would make the cookie permanent...I see thats not true =) so what would I do to make this permanent? or would I just set it for the highest time-limit possible? =) _lallous wrote: > you must set the cookie's expiry time! > > of-the manual: > setcookie ("TestCookie", "Test Value"); > setcookie ("TestCookie", $value,time()+3600); /* expire in 1 hour */ > setcookie ("TestCookie", $value,time()+3600, "/~rasmus/", ".utoronto.ca", > 1); > > "Phpgalaxy.Com" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I started an affiliate program to sell my scripts, and it uses cookies > > for tracking.. I didnt know it at the time, but as soon as the web > > browser's closed, the cookie info is gone. g! I need it to stay > > there *permanently*! =) Here's the code I have no for both setting and > > retrieving.. > > > > retrieving: $refid = $HTTP_COOKIE_VARS["refid"]; > > setting: setcookie ("refid", $id); > > > > Am I just missing something I didnt see on php.net? =) > > > > > > -- > > From PHPGalaxy.com, earn up to $10 per order selling our PHP Scripts > > and Software on your Site. http://www.phpgalaxy.com/aff/ > > > > Also, get a fast free POP3 email account, you @php.la at > > http://www.phpgalaxy.com/search/ > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- >From PHPGalaxy.com, earn up to $10 per order selling our PHP Scripts and Software on your Site. http://www.phpgalaxy.com/aff/ Also, get a fast free POP3 email account, you @php.la at http://www.phpgalaxy.com/search/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] NO CARGA PAGINA PHP
Supongo que es PHP 4: Chequea el httpd.conf por: AddType application/x-httpd-php .php3 AddType application/x-httpd-php .php AddType application/x-httpd-php .php4 Espero que este sea el problema. Mensaje citado por: Daniel Geldres Castro <[EMAIL PROTECTED]>: > Tengo un pequeño problema con mi servidor SuSe 7.0 > Tengo instalado el apache y corriendo los demonios, tengo instlado los > rpm > del mod_php, postgres y mysql pero cuando desde mi navegador deseo > visualizar alguna pagina con la extension php esta se descarga sola, no > me > visualiza nada. > > Que error debo de haber cometido si aparentemnte todo estaba bien. > > === > Saludos, > Daniel Geldres Castro > mail: [EMAIL PROTECTED] > Telf Trab.: 511-447-7600 > Telf Casa.: 511-251-3584 > ICQ 72211218 > MSN [EMAIL PROTECTED] > Yahoo ID danielgeldres > === > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: > [EMAIL PROTECTED] > > Saludos, Ing. Ricardo Núñez Webmaster de la DST Universidad Simón Bolívar E-Mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Serious problem with Cookies..
Den 01-11-15 13.20, skrev "PHPGalaxy.com" <[EMAIL PROTECTED]>: > yeah I saw that bit on there, but I was led to believe tha by leaving it out, > it would make the cookie permanent...I see thats not true =) so what would I > do to make this permanent? or would I just set it for the highest time-limit > possible? =) If you set it like this: There is not a good way to set a permanent cookie, the user can always delete them if he wants to. Thanks. /Magnus Hammar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Serious problem with Cookies..
well yeah, thats always true..but this's at least as good as it gets =) ya suppose there's any limit on how many years I can set it for? hell, I'll just set it for 10 years and that'll be good enough =) Magnus wrote: > Den 01-11-15 13.20, skrev "PHPGalaxy.com" <[EMAIL PROTECTED]>: > > > yeah I saw that bit on there, but I was led to believe tha by leaving it out, > > it would make the cookie permanent...I see thats not true =) so what would I > > do to make this permanent? or would I just set it for the highest time-limit > > possible? =) > > If you set it like this: > $hour = 3600; // One hour > $day = $hour * 24; // One day > $year = $day * 365; // One year > $year = $year * 2; // 2 years > setcookie ("TestCookie", $value,time()+$year); // Expire in 1 year > ?> > > There is not a good way to set a permanent cookie, the user can always > delete them if he wants to. > > Thanks. > /Magnus Hammar > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- >From PHPGalaxy.com, earn up to $10 per order selling our PHP Scripts and Software on your Site. http://www.phpgalaxy.com/aff/ Also, get a fast free POP3 email account, you @php.la at http://www.phpgalaxy.com/search/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Serious problem with Cookies..
Yes, I guess you can't make it foreever but you can give it a higher expiry date. "Phpgalaxy.Com" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > well yeah, thats always true..but this's at least as good as it gets =) ya suppose > there's any limit on how many years I can set it for? hell, I'll just set it for 10 > years and that'll be good enough =) > > > Magnus wrote: > > > Den 01-11-15 13.20, skrev "PHPGalaxy.com" <[EMAIL PROTECTED]>: > > > > > yeah I saw that bit on there, but I was led to believe tha by leaving it out, > > > it would make the cookie permanent...I see thats not true =) so what would I > > > do to make this permanent? or would I just set it for the highest time-limit > > > possible? =) > > > > If you set it like this: > > > $hour = 3600; // One hour > > $day = $hour * 24; // One day > > $year = $day * 365; // One year > > $year = $year * 2; // 2 years > > setcookie ("TestCookie", $value,time()+$year); // Expire in 1 year > > ?> > > > > There is not a good way to set a permanent cookie, the user can always > > delete them if he wants to. > > > > Thanks. > > /Magnus Hammar > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- > From PHPGalaxy.com, earn up to $10 per order selling our PHP Scripts > and Software on your Site. http://www.phpgalaxy.com/aff/ > > Also, get a fast free POP3 email account, you @php.la at > http://www.phpgalaxy.com/search/ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] fsockopen - whats the syntax of POST?
First: can I do a POST-request with fsockopen? If yes, then: whats the syntax for POST-requests? I was happy if someone could point me to a good documentation or so Thanks in advance Stefan Rusterholz, [EMAIL PROTECTED] -- interaktion gmbh Stefan Rusterholz Zürichbergstrasse 17 8032 Zürich -- T. +41 1 253 19 55 F. +41 1 253 19 56 W3 www.interaktion.ch --
RE: [PHP] Re: how can I get the post content in php
When POST data is sent to a page, it's as if somebody typed the text into a textarea and hit a submit button. Even though this is being done programmatically, the POST method will behave the same. SOmebody in their (your)code will have to write something similiar to: $postData = "xVar=" . rawurlencode( "" ); PostToHost( "http://www.domain.com"; "/phpfile.php", $postData ); then your script would access that XML data through the HTTP_POST_VARS['xVar'] or $xVar as normal /* not my function, found on some PHP site */ function PostToHost( $host, $path, $data_to_send ) { $cRetVal = ""; $fp = fsockopen( $host, 80 ); fputs( $fp, "POST $path HTTP/1.1\n" ); fputs( $fp, "Host: $host\n" ); fputs( $fp, "Content-type: application/x-www-form-urlencoded\n" ); fputs( $fp, "Content-length: " . strlen($data_to_send) . "\n" ); fputs( $fp, "Connection: close\n\n" ); fputs( $fp, $data_to_send ); while( !feof( $fp )) { $cRetVal .= fgets( $fp, 128 ); } fclose( $fp ); return $cRetVal; } > > XML file is text file. If I open the file with php like call $fp, > > that is a long string with some special char. > > post method can send a long string to the server. > > how php can receive that long string is my problem. > > > > if can do that, php can parser the xml file send form remote > > computer. I want php parser the SOAP message > > -- > > Yorgo Sun > > Project Manager > > Technology Dept. Tom.com > > Email:[EMAIL PROTECTED] Mobile:13701243390 Phone:65283399-121 TomQ > > ID:yorgo http://www.ruisoft.com > > "Johan Holst Nielsen" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > > I think you understand my problem. > > > > > > > > I will use a client program to POST the XML data to a php file > > > > on the server base HTTP > > > > in php file will get the post request, > > > > > > > > the question is, how can i get the xml data in post request > > > > > > Hmm, I dont think I understand? Where do you want to do with the > > > XML? Cant you just make a echo() in a xml document? please > > > explain? > > > ... > > > ... > > > > > > > > echo $xmldatavar; > > > ?> > > > ... > > > ... > > > ... > > > > > > Regards, > > > Johan > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Jump to internal link after $PHP_SELF post
Hi there The following problem occurs in my scripts: A large page is generated with data from a MySQL database. The various paragraphs inside this page have variable, internal links, also extracted from the database. Example: Let's assume that $value represents FOO. Now i want to take the value of this variable to post to $PHP_SELF. Example: \n";. The HTML-source should show something like This does not work... Output on the source is like , so $value appears to be empty. Please help, sombody?? Thanks! Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Jump to internal link after $PHP_SELF post
> A large page is generated with data from a MySQL database. The various > paragraphs inside this page have variable, internal links, > also extracted from the database. > Example: > Let's assume that $value represents FOO. Ok > Now i want to take the value of this variable to post to $PHP_SELF. > Example: \n";. > The HTML-source should show something like action="/domain/page.php#FOO" method="post"> Seems straightforward enough... > This does not work... Output on the source is like action="/domain/page.php#" method="post">, so $value appears > to be empty. When is $value assigned a value? Before or after the script prints out the "
Re: [PHP] Jump to internal link after $PHP_SELF post
Thanks for the quick reaction. > When is $value assigned a value? Before or after the script prints out > the ", so $value would be "para1"). After posting to SELF a jump to para1 must be made. Is this enough? Thanx, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
php-general Digest 15 Nov 2001 14:41:10 -0000 Issue 996
php-general Digest 15 Nov 2001 14:41:10 - Issue 996 Topics (messages 74660 through 74711): Controlling length of table data 74660 by: Gaylen Fraley 74661 by: Martin Towell 74666 by: Johan Holst Nielsen PHP 4.0.6 $PHP_SELF empty? 74662 by: John Steele 74663 by: David Robley 74665 by: John Steele Re: gd-lib and libjpeg issues 74664 by: David Robley Re: Session help 74667 by: Johan Holst Nielsen Re: mail() function 74668 by: Johan Holst Nielsen PHP + apache .htaccess 74669 by: EnriGA 74670 by: Johan Holst Nielsen 74671 by: EnriGA 74672 by: Johan Holst Nielsen 74674 by: EnriGA Session 74673 by: jtjohnston 74688 by: Rudolf Visagie I suck at regular expressions! 74675 by: Richard S. Crawford 74677 by: Johan Holst Nielsen 74681 by: Richard S. Crawford 74684 by: Johan Holst Nielsen 74697 by: _lallous how can I get the post content in php 74676 by: Yorgo Sun 74678 by: Johan Holst Nielsen 74679 by: Yorgo Sun 74680 by: Johan Holst Nielsen 74682 by: Yorgo Sun 74685 by: Johan Holst Nielsen 74686 by: Yorgo Sun 74689 by: Johan Holst Nielsen 74690 by: Yorgo Sun 74694 by: Andrey Hristov 74695 by: Tamas Arpad 74696 by: Yorgo Sun 74708 by: JSheble I have tried ... 74683 by: jtjohnston And ... 74687 by: jtjohnston Re: [PHP-I18N] Re: [PHP-WIN] how to get php_gettext.dll work on windows2000 / iis5 server? 74691 by: Hace 74699 by: Hace multiple include 74692 by: Briet Vincent 74693 by: Papp Gyozo pls help: add new extension to PHP (rpm) on RedHat 74698 by: S.T. Wong Serious problem with Cookies.. 74700 by: PHPGalaxy.com 74701 by: _lallous 74702 by: PHPGalaxy.com 74704 by: Magnus 74705 by: PHPGalaxy.com 74706 by: _lallous Re: NO CARGA PAGINA PHP 74703 by: Ricardo Núñez fsockopen - whats the syntax of POST? 74707 by: Stefan Jump to internal link after $PHP_SELF post 74709 by: Rob van Jaarsveld 74710 by: Boget, Chris 74711 by: Rob van Jaarsveld 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 --- This is really a combination html/php question, I believe. The problem is that I have a table that displays a field of text that can be several hundred bytes long. If, however, someone holds down a key and produces 500 letter 'x' the table data then distorts the table! Since the length of the data needs to be several hundred bytes, is there someway to either control the table data width so that the length of a non breaking string of characters will not distort the table, or is there a php string function to break the sentence into words and then I'd have to build some logic to test the length? -- Gaylen [EMAIL PROTECTED] Home http://www.gaylenandmargie.com PHP KISGB v2.22 Guestbook http://www.gaylenandmargie.com/phpwebsite --- End Message --- --- Begin Message --- if you're going to go the "break string in words" way, then try $words = explode(" ", $string); -Original Message- From: Gaylen Fraley [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 15, 2001 2:54 PM To: [EMAIL PROTECTED] Subject: [PHP] Controlling length of table data This is really a combination html/php question, I believe. The problem is that I have a table that displays a field of text that can be several hundred bytes long. If, however, someone holds down a key and produces 500 letter 'x' the table data then distorts the table! Since the length of the data needs to be several hundred bytes, is there someway to either control the table data width so that the length of a non breaking string of characters will not distort the table, or is there a php string function to break the sentence into words and then I'd have to build some logic to test the length? -- Gaylen [EMAIL PROTECTED] Home http://www.gaylenandmargie.com PHP KISGB v2.22 Guestbook http://www.gaylenandmargie.com/phpwebsite -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- End Message --- --- Begin Message --- > This is really a combination html/php question, I believe. The problem is > that I have a table that displays a field of text that can be several > hundred bytes long. If, however, someone holds down a key and produces > 500 > letter 'x' the table data then distorts the table! Since the length of > the data needs to be several hundred bytes
RE: [PHP] fsockopen - whats the syntax of POST?
Hi Stefan, Maybe this HTTPPost class will help you. http://phpclasses.upperdesign.com/browse.html/package/375 --Daniel > -Original Message- > From: Stefan [mailto:[EMAIL PROTECTED]] > Sent: Thursday, November 15, 2001 8:53 AM > To: PHP > Subject: [PHP] fsockopen - whats the syntax of POST? > > > First: can I do a POST-request with fsockopen? > If yes, then: whats the syntax for POST-requests? > > I was happy if someone could point me to a good documentation or so > > Thanks in advance > Stefan Rusterholz, [EMAIL PROTECTED] > -- > interaktion gmbh > Stefan Rusterholz > Zürichbergstrasse 17 > 8032 Zürich > -- > T. +41 1 253 19 55 > F. +41 1 253 19 56 > W3 www.interaktion.ch > -- > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Jump to internal link after $PHP_SELF post
> > When is $value assigned a value? Before or after the > > script prints out the ", so $value would be "para1"). After posting > to SELF a jump to para1 must be made. It depends on where value is coming from. If it's coming from the script server side, then you just need to make sure that $value is set before the line "
Re: [PHP] Jump to internal link after $PHP_SELF post
>It depends on where value is coming from. If it's coming from the >script server side, then you just need to make sure that $value is >set before the line "http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: I suck at regular expressions!
Actually, that does work when I'm using a string with that content. The only thing I can figure is that there is a problem with the way the the file is being read. Hmm. Ah, well. I'll make it work. Where's my hammer? At 12:18 AM 11/15/2001, Johan Holst Nielsen wrote: >Richard S. Crawford wrote: > > > Not quite. I have the same problem. > >I tried at test on my localhost. Following works for me: > >$string = "Sometime i dont wanna >know"; >if(eregi("(.+)", $string, $arr)) { >echo "Title: ".$arr[1]; >} >else { >echo "unknown title"; >} > >This works for me? > >Regards, > >Johan > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] Sliante, Richard S. Crawford http://www.mossroot.com mailto:[EMAIL PROTECTED] AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford "It is only with the heart that we see rightly; what is essential is invisible to the eye." --Antoine de Saint Exupéry "Push the button, Max!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Quick question about no result
I want to show a default piece of information if my query returns no result, and what I mean by no result is the query for a store in a certain state doesnt exist. thanks dan = Dan McCullough --- "Theres no such thing as a problem unless the servers are on fire!" h: 603.444.9808 w: McCullough Family w: At Work __ Do You Yahoo!? Find the one for you at Yahoo! Personals http://personals.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] I suck at regular expressions!
Been Using this Function for some time and works real well with two exceptions 1. if the title line has a CR in it it will no get the title Example: This is a bad Title 2. If there are any other < > tags in the title it will fail. ([^<]*)(.*)', $string, $regs ) ) { $string = $regs[2]; } } return $regs[1]; } } ?> -Original Message- From: Richard S. Crawford [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 14, 2001 11:30 PM To: [EMAIL PROTECTED] Subject: [PHP] I suck at regular expressions! I am trying to get the title of an html file... you know, the string between the < title > and < /title > tags... Here is the function I've got so far: function fileTitle($fileName) { $myFile = fopen($fileName, "r"); $myText=""; while (!feof($myFile)) { $myText .= fgets($myFile,255); } fclose($myFile); if (eregi("(.+)",$myText,$theTitle)) return $theTitle[0]; else return "(No Title)"; } The trouble is, it always returns "(No Title)", regardless of whether the file has a title defined in the header or not. I suspect I'm doing something fundamentally wrong. Can anyone set me straight? Sliante, Richard S. Crawford http://www.mossroot.com mailto:[EMAIL PROTECTED] AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford "It is only with the heart that we see rightly; what is essential is invisible to the eye." --Antoine de Saint Exupéry "Push the button, Max!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Jump to internal link after $PHP_SELF post
> >It depends on where value is coming from. If it's coming from the > >script server side, then you just need to make sure that $value is > >set before the line "\n"; $anchorTag = "FOO"; echo "\n"; $anchorTag = "BAR"; echo "\n"; ?> or something along those lines. You are going to have to set the value of the form's action on the client side, not the server side. For the checkbox, I don't know of "OnClick" is the right event. You will need to look up that form element in a javascript guide for the event that you want. HTH Chris
[PHP] First CGI, then PHP
Hi! Is it possible to add PHP-code into the html-templates of ht://dig? The problem is the execution after or before the CGI-prog has run. Of course I need 'after'. But how can I do that? What is the default order in a builtin-PHP? -- Berthold (live long and prosper...) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Newsgroup?
Does anyone know: What's the deal with the newsgroup version of this list? I'm using news.php.net as the news server address, but all I get are error messages. Is this newsgroup still functional? Christopher Raymond -- O A S I S N E T W O R K S -- INTERACTIVE FLASH MEDIA PRODUCTION HTML, JAVASCRIPT, PHP & E-COMMERCE DEVELOPMENT MACINTOSH TROUBLESHOOTING, REPAIR & NETWORKING -- WEB: http://www.oasisnetworks.com PHONE: 612.706.0767 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session
For the record: You can control the order of precedence of variable reading through a php.ini setting, variable_order, (replaces gpc_order). I believe the default is EGPCS i.e. environment, get, post, cookie, session. The last in the list takes precedence, i.e. session variables normally have precedence over get/post variables George Rudolf Visagie wrote: > > The problem lies with the fact that you have a variable 'name' that gets > posted in the form as well as a session variable 'name' that is passed to > the script when it is executed again. As far as I remember the session > variable supercedes the posted variable, so the session variable would > overwrite the value of the posted variable every time. You need to register > the session variable with another name and then toggle between the two > variables in you script. > > Also, a session variable need only be registered once: > if (!session_is_registered("name")) { > session_register("name"); > } > > Rudolf Visagie > Principal Software Developer > Digital Healthcare Solutions > Tel. +27(0)11 266 6946 > Fax. +27(0)11 266 5080 > Cell: +27(0)82 895 1598 > E-mail: [EMAIL PROTECTED] > > -Original Message- > From: jtjohnston [mailto:[EMAIL PROTECTED]] > Sent: 15 November 2001 09:08 > To: [EMAIL PROTECTED] > Subject: [PHP] Session > > Hi, > > I have read: http://www.php.net/manual/en/function.session-register.php > > Could I ask you a question about how to set a session $vars in a ? > It seems to be quite a mystery/controversy!! > > This is my problem: > http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/test_session.php > > Type something. > Press submit. > Change your text and re-submit. > > $name doesn't re-save itself. This is my code: > http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/test_session.php > s > > Would you have any suggestions? > It can't be that complicated can it? > > J.T-Johnston > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Newsgroup?
On Thursday 15 November 2001 07:41 am, Christopher Raymond wrote: > Is this newsgroup still functional? Yep -- I just checked and it's working fine for me. I'm using news.php.net connecting on port 119 (default NNTP port) --kurt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] I suck at regular expressions! -- not as bad, now
Thanks to everyone who helped me figure this out. I foolishly didn't realize that I was using the htmlspecialchars() function on the string that I was pulling from the file, but not accounting for that in the regexp. So, what I was getting was:BLAH BLAH BLAH but what I was trying to find was: < title >BLAH BLAH BLAH< /title > It's all good now. Sliante, Richard S. Crawford http://www.mossroot.com mailto:[EMAIL PROTECTED] AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford "It is only with the heart that we see rightly; what is essential is invisible to the eye." --Antoine de Saint Exupéry "Push the button, Max!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] waiting a long time for a XML file
Hello, I need some help regarding the creation of a text file which is a XML file. Actually, PHP creates the file without any problem and the XML format is fine. My only trouble is that it take on average 3 or 4 minutes to perform the task. Do you have any idea why it takes so long ?? Thanks -- Eric Trezza www.b-tween.com web design > e-communication > e-education -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: FTP Clients
I kind of like Leech FTP, http://stud.fh-heilbronn.de/~jdebis/leechftp/downloads.html George Rudi Ahlers wrote: > > Sorry for the totally OT question, but can anyone recommend a good, FREE, > FTP client for windows? I now have to pay for AceFTP aswell, which used to > be free. > Thank you > > Rudi Ahlers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Checkboxes / Undefined Variables
[EMAIL PROTECTED] wrote: > In am HTML form, checkboxes NOT checked are not passed > to the PHP script called by the form. > > Therefore, if $name_of_chechbox_3 is not passed but it's > used in the PHP script, it results in "Warning: > Undefined Variable". > In am HTML form, checkboxes NOT checked are not passed > to the PHP script called by the form. > > Therefore, if $name_of_chechbox_3 is not passed but it's > used in the PHP script, it results in "Warning: > Undefined Variable". > > How can I avoid this? As suggested, using isset($name_of_checkbox_3) is a Good Idea (tm). Suppressing the error message with @ is hacky, but will work and is less to type. Not nearly as "professional" looking, though. That said... Usually, the checkboxes are grouped together of multiple options, and you really ought to give them more meaningful names than name_of_checkbox_3... So, what *I* usually end up doing is having stuff like: ... CHECKBOX NAME=colors[1] VALUE=red ... CHECKBOX NAME=colors[2] VALUE=blue ... CHECKBOX NAME=colors[3] VALUE=green Then, in the processing script, I use: while (list($id, $color) = each($colors)){ // Deal with $id, $color passed in -- Others were not passed in } If it really is just a one-off CHECKBOX and not a group, by all means stick with isset() -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Function Call Line Number
Jason G. wrote: > Does anyone know of a way, that from within a function, you can determine > what line number and file the function was called on? Cannot be done with existing built-in PHP functions... Feel free to add that feature to the PHP source and contribute it :-) > I did try: > function myfunc($lineno = __LINE__) > { > echo $lineno; > } > but this just outputted the very line that __LINE__ resides on. > > This would be very helpful in displaying sensible error messages, like the > native php functions do. If you use http://php.net/set_error_handler properly, you can get what you want, though. That lets you register a function to be called in the event of an error, and it has optional arguments you can provide to get the __FILE__ and __LINE__ values. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: array_unique() workaround?
Spunk S. Spunk III wrote: > I'm working on a script that needs array_unique() but my host is using > 4.0.4 and it's broken in that build. Does anyone have a good workaround > for this? I can wait for my host to upgrade but if I release this code, it > would be better to have the workaround... > > I just need a good way to check for dups in an array and remove them. I > can't get my brain around it... *IF* 4.0.4 has a working http://php.netarray_flip, you can do: $temp = array_flip($array); $array = array_flip($temp); This will almost certainly be way more faster than iterating through by hand. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Multiple .ini-files for PHP
Stefan wrote: > Is there a way to have different .ini-files for each VirtualHost? > Apache is used as webserver Not really really, but you *CAN* do Apache's include (#include? ? ???...) There's *some* way of including other files anyway, even if I'm not enough of a guru to know what it is... I think maybe you just type the pathname of the file in there and it gets sucked in... So you'd have your master php.ini for the system-wide defaults, and then for each VirtualHost you can include a php.ini that does: php_value include_path "./:/home/HOSTNAME/include" and other php_value, php_flag, and EVEN php_admin_value settings. !!! S E C U R I T Y A L E R T !!! NOTE: Since this *IS* being included directly into httpd.conf, allowing end-users direct access to edit it will give them way, way, way too much power to mess up your server... The relative benefits and risks must be assessed for *YOUR* situation, but if you're an ISP, you would only want to do this with files only *YOU* can edit, or you'd want to provide an interface to end-users to extremely limit their editing capabilities somehow. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Anyone ever done this - sort a multi-dimensional array
Of the type... $array[0][0] = "!row of c's"; $array[0][1] = ""; $array[1][0] = "row of a's"; $array[1][1] = ""; $array[2][0] = "a row of b's"; $array[2][1] = ""; such that you sort on the value of the y-column? In this case, it would end up as: +--+--+ | row of a's | | | a row of b's | | | !row of c's | | +--+--+ Strange that I've been working with PHP this long and have never come across this problem. Sliante, Richard S. Crawford http://www.mossroot.com mailto:[EMAIL PROTECTED] AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford "It is only with the heart that we see rightly; what is essential is invisible to the eye." --Antoine de Saint Exupéry "Push the button, Max!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Newbie question pleeze help
Rvb Pixels wrote: > Hi, > > I'm new to the list and I have a problem with PHPNUKE 5.2 and W98. > > After installing some categories and links in the Web Links section, and > then clicking on one of the links created I keep getting the following > message error in W98SE. > > "PHP caused an invalid page fault in module PHP4TS.DLL..." > > > Does anyone know why and how can I solve this problem ? Your web server (Apache or IIS) has a log file with every error recorded, or at least, every error that isn't so horrendous that making a record is possible. For Apache with the default installation Windows, it's in: C:/Program Files/Apache Group/Apache/logs/error_log (I think) You may have some useful details in that file that can clue you in to what is happening. There may also be instructions at http://bugs.php.net about how to track down these kinds of errors. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] apache+php overloading when user clicks many times on the same link
Hello. What does apache + php do if the user refreshes a page 10 times in a while before the scripts finishes? do all 10 .php scripts finish or do the first 9 get aborted? how can i solve the problem that when someone clicks a lot on a link (always the same link) the server gets overloaded (because the action taken in the script is somehow memory consuming). i need to ensure a user (www) can run only one instance of a .php script. Peter Frlicka -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Array problrem!
De Necker Henri wrote: > Hi there. > I have an array like this : 1.2 , 0.3 , 0.5 , 1.6 , 0.3 > I output like this: > > while($data_array[$j]){ > echo "$data[$j]" ; > $j++ ; > } > > My output is like this : 1 , 0 , 0 , 1 , 0 > The values in the db are floats and are read correctly ! > > Why is the values not there.Is there a specific way to store values in a > array? Dav's answer is rather meaningless -- There *IS* no way to define the data-type of the array contents, nor of any variable in PHP. PHP is a DATA-typed language, not VARIABLE-typed. The data itself *KNOWS* its type. I'm guessing that whatever you are doing to get the data out of the database is getting integers. Show us that code, or post your entire source online. Also, how do you *KNOW* the values in the database are 1.2, 0.3, Can you see those values with some other tool? Which database are you using? -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Anyone ever done this - sort a multi-dimensional array
You can roll your own fairly easily: function mycmp($a,$b) { return strcmp($a[1],$b[1]); } usort($array, 'mycmp'); ...something like that at any rate. -Steve On Thursday, November 15, 2001, at 10:07 AM, Richard S. Crawford wrote: > Of the type... > > $array[0][0] = "!row of c's"; > $array[0][1] = ""; > $array[1][0] = "row of a's"; > $array[1][1] = ""; > $array[2][0] = "a row of b's"; > $array[2][1] = ""; > > > such that you sort on the value of the y-column? > > In this case, it would end up as: > > +--+--+ > | row of a's | | > | a row of b's | | > | !row of c's | | > +--+--+ > > Strange that I've been working with PHP this long and have never come > across this problem. > > > > Sliante, > Richard S. Crawford > > http://www.mossroot.com > mailto:[EMAIL PROTECTED] > AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford > "It is only with the heart that we see rightly; what is essential is > invisible to the eye." --Antoine de Saint Exupéry > > "Push the button, Max!" > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: silly question
First, thak's all for the answers. I didn't understood what's happend, but I've solved the problem using a Header("location: ".$PHP_SELF."?celebID=".$ID) after the update command, passing the same ID I used to update on it. I don't know if it is the best way, but now I have the "refresh" of the page. Rodrigo on 11/14/01 4:01 PM, George Whiffen at [EMAIL PROTECTED] wrote: > Rodrigo, > > I don't quite understand your problem, it might help to see some of the > php or form html. It might also help if I explain how I usually handle > updates. > > I have a single php page with the form on it which is also the target > of the form. > > Typically users get to the form via a link which includes the "id" on the > url (i.e. passed as a GET variable). The php picks up this id and uses > it to query the database to get the current data. Then the form is > presented with the form values set to the current values and the "id" > included as a hidden field. The user makes a change and presses a submit > button with the name "update" () > > The php checks to see if "update" is set (isset($update)). If it is > it uses the form values to update the database before it goes to search > for the current values. Then it just continues as normal retrieving the > database (new) values and printing out the form. i.e. the logic is : > > if (isset($update)) > { > update database for "id" record > e.g. update mytable set myfield = '".$myfield."' where id = '".$id."' > } > > select data for "id" record into myrow > e.g. select * from mytable where id = '".$id."' > > print form including data > e.g. > print ' > > > MY FIELD : > > > > > For the user this means they always have visual confirmation that their > changes have gone to the database after pressing SUBMIT. If they're > happy they have a link to go wherever they want to next. If they're > not happy they can correct the data and submit again. > > Could you be getting problems because there is confusion between your > hidden "id" and the "id" on the url? The ACTION="'.$SCRIPT_NAME.'" > should sort that out since it will remove anything passed on the url > when the form is submitted. > > Or perhaps you have set the values in the form to php variables with > the same name as the form variables e.g. > > print ' > > If this is the case, then the form will always come back with the last > entered details and not blank details since $myfield is continually > being set to the value of the HTML input variable myfield. > > Sorry I can't help more without getting a better idea of what you > are trying to achieve! > > George > > Rodrigo Peres wrote: >> >> Hi list, >> >> I have PHP code to insert the result of a form into mysql. When I nedd to >> made an update, I pass an "id" in the url and use it to make the update >> query. The problem is after I click in the update button (input submit) my >> page refresh and came back in the same state, to see the changes I need to >> type in the url again with the parameter?? why?? There's a way to avoid this >> and get a new blank form page after the update? >> >> ps: I've stored the "id" in a input type hidden, so I could click the button >> and still have the id >> >> Thank's in advance >> >> Rodrigo Peres >> -- -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: High-Volume Newsletter Techniques?
Sondra Russell wrote: > Yes, I saw the discussion a few days earlier on this topic, but I'm But did you check the archives for the same discussion last month, the month before, the month before that, ... :-) > wondering if there is still some unmined wisdom out there about > building a script that sends a newsletter out to 25,000+ people > The very impressive class I found (phpmailer-1.41) looked great, but > it didn't *directly* address the high-volume issue in the readme so > I'm still a little nervous. The internal http://php.net/mail function FORKS on each call. In layman's terms, that means that it fires up another copy of "sendmail", a very large and complex program FOR EACH MAIL. Compare this to, say, firing up Microsoft Word on a PC to send each and every email. Needless to say, this simply WILL NOT scale up well. You *can* dink around with timing to try and get mail() to not be over-loaded, but, really, that's just not going to cut it. Your next "crank it up a notch, Emril" (sp?) option is to talk directly to your SMTP server. This is not rocket science. You use http://php.net/fsockopen to the server on port 25, and then you fputs/fgets things like: "HELO yourserver.com" "FRM: [EMAIL PROTECTED]" There's well-documented series of things you are expected to fputs to the server, and responses with error code numbers you are expected to get back. I posted a minimalist sample of how to do this, oh, a couple months ago. However, you *can* use Manuel Lemos' class to deal with it instead, or some other mail package that talks directly to your SMTP server and that may be way easier. That said: *UNLESS* you really, really, need PHP to dynamically create the newsletter content on a person-by-person basis, your *BEST* option is to not use PHP to send the email at all. You can use PHP to compose the email. You can even use PHP to compose the recipient list on-the-fly and save it where the mailing list software needs it. But you really, really, really should be using custom mailing list software for mass emails if you want to keep your server not over-loaded. For starters, the mailing list software code is written in C and has been optimized for longer than PHP has existed, so it goes fast. Secondly, the programs themselves do things that make the email get out in a timely fashion -- For example: Big-time mailing list software will *SORT* the outgoing email by destination address. So all the AOL.com emails will go out, then all the ABC.com emails, ... up through all the Yahoo.com emails. Why? Because at some point, *YOUR* SMTP server has to talk to *THEIR* SMTP server (and/or via other servers that can intermediate for them) and if the emails are sorted by destination, then the software can just keep talking to the same server without re-connecting (or, at least, the connection will likely be in a cache somewhere and re-used). Actually, I don't even know the details of why it goes faster, I just know it does. It's this kind of thing that has kept mailing list software writers up at night, and the PHP Development team (rightly) ignores, as it's not within the realm of what PHP needs to focus on. > And, unfortunately, it's not one of those types of technical > challenges you can keep testing over and over without seriously > annoying the first 100 or so people on your list who *do* get the > email before the script times out. So send it to made-up emails, or get yourself a throw-away domain name on a cheap-o ISP with unlimited email forwarding and make up 40,000 email addresses randomly. (Make *SURE* the ISP knows and agrees to be the "victim" of this test of 40,000 emails every day for testing purposes!!!) It won't be a *REAL* test, since all the emails are going to the same destination, but it's going to be pretty close. > I think the amount of trash email I get each day proves that vast > mailings aren't TOO difficult, but I think I could use a little > wisdom before I give it a shot. Bottom Line: PHP is the wrong weapon. > Anyone? I'll buy you a coke! Buy a CD instead :-) [see below] -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Time out for file()?
Jean-Arthur Silve wrote: > Hi ! > > I use the file function for accessing to pages on another server. > > It works perfectly. > > But if the server does not respond or is too long to send datas, the file > function wait too long.. > > Is there a way to tune the time out ?? I would like that id the server > does not respond, the function return in few seconds only. > > I thought to a solution using : > > set_time_limit(2); > register_shutdown_function(func); > file(myurl); > set_time_limit(30); > func(); > > In this example if the file function takes more than 2 seconds, then > func() would be called. If the file function does not time out, then then > func is called too... > > But may be there is a cleanest way to do this (I checked the manual, > somethink like socket_set_timeout), in the way that if the time function > timed out then the script continues normally, returning an error: > > tuning the time out(2); > $f=file(myurl); > if ($f==false) > // Timed out > else > // ok > Use http://php.net/fsockopen, as suggested, *BUT* use the recently added optional arguments to it. You will need to have a reasonably current version of PHP to do this. The socket_blocking and socket_timeout are only useful *AFTER* you've opened the socket. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Sending mail without using mai() ?
Jaime Iniesta Aleman wrote: > Hi, is it possible to send SMTP mail if the server where are my pages > hosted forbids the use of the mail() function ? I mean, by opening a > sockets connection to an external SMTP server and writing the commands > there directly... Yes, *IF*: The ISP was not smart enough to realize this and didn't disable the http://php.net/fsockopen function Your SMTP server will accept connections from your web-server. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Login/Security Problem
Joe Van Meer wrote: > This seems to work, however, if I close out my browser and say type in > main.php (this page has the above code) in the address bar I can still > access the page. How can I fix this? Is there something else I could be > doing to improve the functionality? > Any insights would greatly be appreciated. The first question to ask is what *LEVEL* of security you need. Is this eCommerce with credit card info going back and forth, or is it your local PTA "insider" information bulletin board. Exactly how you should secure these depends a great deal on that, since higher security comes at a higher cost in terms of setup, maintenance, and bandwidth and resources. Opening up main.php should *NOT* have given you the page, *UNLESS*: 1. You used session variables, and 2. You have them set to last longer than a session, or you had another browser window open. Session Cookies only go away when you close *ALL* the browser windows. Also, as stated, checking just $islogged without at least verifying where it came from is pretty lame. Checking $HTTP_SESSION_VARS['islogged'] in a reasonably secure environment is probably "good enough" for anything short of eCommerce-level applications, as stated. If you've got eCommerce-level applications (ie, credit card info or big-money data going back and forth) you've *GOT* to switch to SSL for your server for at least *SOME* of the pages. No two ways about that. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Crash Apache load php module DSO
hi, i have installed php406 over nt(sp6) with apache1.3.9. Apache crashes when i try to loadmodule php. it says something about DSO module. thanks, marcos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: gd-lib and libjpeg issues
Bill Brennick wrote: > ./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.22 > --with-xml --with-zlib --with-gd=/usr/lib --with-jpeg-dir=/usr/lib > --with-png-dir=/usr/lib For better or worse, configure does *NOT* crap out if you specify --with-xxx-dir and it can't find it. configure just prints out a message that it couldn't cope and goes on with life. > However, I still keep getting the following message everytime I use > an app that uses GD (For example, jpgraph) > > Have looked into everything: php.ini's, apache config's, etc... Check config.log and config.cache and config mumble (There's another config.soemthingorother that tells you what got compiled in, I think) in the PHP source directory to see what did or didn't work. Also, you have to edit the Makefile of GD to get all the toys you want not the prettiest way to install software. Take heart -- It *can* be done, and I've even succeeded sometimes after many, many tries, so it can't be too tricky :-) Never have gotten a gd.so to work, though... :-( -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Check if ip is with a network block
Paul Wolstenholme wrote: > Greetings, > > I'd like to check to see if an ip is within an ip cidr style network > block (192.75.242.157 with 192.75.242.0/23). Initially, I started off > with some code derived from some perl code that I found (code below). > However, the bitmask calcution did not work ( $bitmask = 0x << > (32 - $nbits);) and the hexdec did not appear to support values as bit > as 0x. > ip = -1068764584 > start = -1068764672 > mask = -16777216 Okay, basically what's going on is that PHP is using SIGNED integers, and that's messing you up, almost for sure. Since your actual problem is to work with 3/4ths of the IP that has to match exactly, and only the last section needs the bit-math, what *I* would do is to http://php.net/explode the IPs, and do the bit-shifting on the 4th byte, and use == on the other 3 bytes. You then do not need to worry about signed/unsigned integers and wrap-around arithmetic. PHP's bit-shift operators *DO* work properly, and if you interpret the negative numbers correctly, they *ARE* the right bits for an unsigned integer, but that's too hard for my poor little brain, and doing it with explode and bit-shifting on the last byte is far more understandable. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] First CGI, then PHP
> -Original Message- > From: Berthold [mailto:[EMAIL PROTECTED]] > Sent: Thursday, November 15, 2001 9:11 AM > To: PHP General > Subject: [PHP] First CGI, then PHP > > > Is it possible to add PHP-code into the html-templates of > ht://dig? > > The problem is the execution after or before the CGI-prog > has run. Of course I need 'after'. But how can I do that? > > What is the default order in a builtin-PHP? See http://www.htdig.org/FAQ.html#q4.7 for information on incorporating PHP or other external CGI scripts into your ht://dig results pages. For a more detailed writeup of integrating ht://dig and PHP, see the "Search This!" article at http://www.devshed.com/Server_Side/PHP/Search_This/ It's written for PHP3, but as I recall everything worked pretty much the same when I moved from PHP3 to PHP4. --- Mark Roedel | "Blessed is he who has learned to laugh Systems Programmer | at himself, for he shall never cease LeTourneau University | to be entertained." Longview, Texas, USA| -- John Powell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Quick question about no result
Dan McCullough wrote: > I want to show a default piece of information if my query returns no > result, and what I mean by no result is the query for a store in a certain > state doesnt exist. http://php.net/mysql_num_rows (Or sybase_num_rows, or odbc_num_rows, or whatever your database is.) If 0 rows were returned, you print your message. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Session
Yep, 'variables_order'. -Original Message- From: George Whiffen [mailto:[EMAIL PROTECTED]] Sent: 15 November 2001 06:30 To: [EMAIL PROTECTED] Subject: Re: [PHP] Session For the record: You can control the order of precedence of variable reading through a php.ini setting, variable_order, (replaces gpc_order). I believe the default is EGPCS i.e. environment, get, post, cookie, session. The last in the list takes precedence, i.e. session variables normally have precedence over get/post variables George Rudolf Visagie wrote: > > The problem lies with the fact that you have a variable 'name' that gets > posted in the form as well as a session variable 'name' that is passed to > the script when it is executed again. As far as I remember the session > variable supercedes the posted variable, so the session variable would > overwrite the value of the posted variable every time. You need to register > the session variable with another name and then toggle between the two > variables in you script. > > Also, a session variable need only be registered once: > if (!session_is_registered("name")) { > session_register("name"); > } > > Rudolf Visagie > Principal Software Developer > Digital Healthcare Solutions > Tel. +27(0)11 266 6946 > Fax. +27(0)11 266 5080 > Cell: +27(0)82 895 1598 > E-mail: [EMAIL PROTECTED] > > -Original Message- > From: jtjohnston [mailto:[EMAIL PROTECTED]] > Sent: 15 November 2001 09:08 > To: [EMAIL PROTECTED] > Subject: [PHP] Session > > Hi, > > I have read: http://www.php.net/manual/en/function.session-register.php > > Could I ask you a question about how to set a session $vars in a ? > It seems to be quite a mystery/controversy!! > > This is my problem: > http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/test_session.php > > Type something. > Press submit. > Change your text and re-submit. > > $name doesn't re-save itself. This is my code: > http://www.collegesherbrooke.qc.ca/languesmodernes/postcard/test_session.php > s > > Would you have any suggestions? > It can't be that complicated can it? > > J.T-Johnston > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: First CGI, then PHP
Berthold wrote: > Is it possible to add PHP-code into the html-templates of ht://dig? > > The problem is the execution after or before the CGI-prog has run. > Of course I need 'after'. But how can I do that? No. Actually, Apache 2.0 was *SUPPOSED* to have "stacked handlers" so that CGI (Perl) could process, and then PHP (or vice versa). Whether that feature actually made it to the light of day, or if it actually works yet in Apache 2.0 is unknown to me. > What is the default order in a builtin-PHP? Moot, as it's either non-existent (Apache 1.x) or defined in httpd.conf (Apache 2.x) not the PHP build. http://apache.org should hopefully have *some* kind of info about "stacked handlers" if you search it... You *COULD* switch to the much less-known "fhttpd" web-server instead of Apache and get this feature *NOW* if it's really, really critical to have this feature. (Or even switch to that server *just* for your search engine...) Supposition: Your other option would be to somehow use ht://dig to pre-build pages that were PHP, and then serve those up on an HTTP request. If you regenerate your ht://dig files often enough, the search engine latency will be reasonable for most applications/pages... At least, I'm pretty sure you can do that with ht://dig without too much trouble... Zeev or Colin or somebody famous like that had an article about using htdig at some point online somewhere that may have useful nuggets of info as well that may have PHP info in it... -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Newsgroup?
Christopher Raymond wrote: > What's the deal with the newsgroup version of this list? I'm using > news.php.net as the news server address, but all I get are error messages. What error messages are you getting? You can't *POST* through the newsgroup -- Reply via email to [EMAIL PROTECTED], and it works fine. > Is this newsgroup still functional? I read your message using the newsgroup, so it would seem to be working for me... :-) -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: FTP Clients
WS-FTP LE works for me. I've used it for years now. You can find it at Download.com Bunch of stuff there. "Rudi Ahlers" <[EMAIL PROTECTED]> wrote in message 012e01c16d53$5b582120$0c00a8c0@camelot">news:012e01c16d53$5b582120$0c00a8c0@camelot... > Sorry for the totally OT question, but can anyone recommend a good, FREE, > FTP client for windows? I now have to pay for AceFTP aswell, which used to > be free. > Thank you > > > Rudi Ahlers > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: waiting a long time for a XML file
Eric Trezza wrote: > I need some help regarding the creation of a text file which is a XML > file. Actually, PHP creates the file without any problem and the XML > format is fine. My only trouble is that it take on average 3 or 4 minutes > to perform the task. > Do you have any idea why it takes so long ?? Which library are you using to do XML? What's your source code look like? See if you can't analyze what *PARTS* of the creation/writing are taking so long. Wild Guess: If it's being written to disk piece by piece, you *MIGHT* get a big speed-up in creating the XML doc as a giant string, and then writing it to disk in a "one shot" fwrite operation. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: apache+php overloading when user clicks many times on the same link
Peter Frlicka wrote: > Hello. > > What does apache + php do if the user refreshes a page 10 times in a while > before the scripts finishes? do all 10 .php scripts finish or do the first > 9 get aborted? how can i solve the problem that when someone clicks a lot > on a link (always the same link) the server gets overloaded (because the > action taken in the script is somehow memory consuming). i need to ensure > a user (www) can run only one instance of a .php script. Depends a great deal on the version of the browser/server/PHP you are running. If all goes well, PHP aborts when the user HTTP connection is closed which happens when Apache realizes the browser isn't listening any more, which happens when Apache tries to send some PHP data to the browser. Thus, in general, try sending out a "." and calling http://php.net/flush periodically so that the HTTP connection has some traffic to detect the failure of the connection so the lack of a connection will get detected by Apache and then PHP gets informed about it. If you are worried about somebody attacking your site this way, though, the root problem is not solvable within PHP. At a certain point, the reload attack won't even *REACH* the PHP stage, and they'll just be pounding on HTTP connections to Apache. If you want to solve this problem the "right" way, you need to look into "Denial Of Service" attack defenses. Be warned: At a certain level, there is almost *NOTHING* you can do to defend against a bandwidth-filling DOS attack. Your upstream bandwidth provider (ISP) has to filter out the traffic and track it back to the sender and get them (or their ISP, actually) to block it. Packets are packets, and systematically and surgically blocking only the ones you don't at the right choke-point to keep your bandwidth useful is non-trivial. Steve (?) Gibson has a rather amusing (in a tabloid sort of way) article about this at grc.com NOTE: This guys is generally the laughingstock of the security experts for his media-whore tactics. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP & FRAMES Question
This has probably been dealt with before, but I'm unable to get my link to open in the target frame, it always opens in the same frame. This line of code: printf(" %s \n", $target_url, $myrow["member_id"], $myrow["member_id"]); typically expands, when the mouse pointer is placed over it, to: http://hostname/sitename/adm_sub_dtl.php?member_id=T0003 target=sub_detl This is the code for the page which creates the framesets .. Subscriber Administration I don't see any mysteries here, and it appears syntactically correct. Any suggestions will be welcome - Miles Thompson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP & FRAMES Question
In your printf statement, you are targetting "sub_detl" whereas in your frameset you name the frame "sub_dtl". Naturally, these values should match. HTH Sam Masiello Software Quality Assurance Engineer Synacor (716) 853-1362 X289 [EMAIL PROTECTED] - Original Message - From: "Miles Thompson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, November 15, 2001 12:41 PM Subject: [PHP] PHP & FRAMES Question > This has probably been dealt with before, but I'm unable to get my link to > open in the target frame, it always opens in the same frame. This line of > code: > > printf(" %s \n", > $target_url, $myrow["member_id"], $myrow["member_id"]); > > typically expands, when the mouse pointer is placed over it, to: > > http://hostname/sitename/adm_sub_dtl.php?member_id=T0003 target=sub_detl > > This is the code for the page which creates the framesets .. > > > > Subscriber Administration > > > > > > > > I don't see any mysteries here, and it appears syntactically correct. > > Any suggestions will be welcome - Miles Thompson > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] apache don´t understand php!!----¡¡apache no entiende php!!
I have a problem:I have a php page wich runs well when I run it, but when I run a html page and links the php file, the source code is seen on the screen. It´s like apache wouldn't understand php!!. Any ideas? Thanks Hola!.tengo un problema y es que tengo una página .php que, cuando la llamo por separado, funciona de maravilla, pero cuando la enlazo desde un .htm, aparece el código a pelo, es decir, no reconoce el php. ¿¿Podeis ayudarme??.¡¡Es muy urgente!!. Gracias y un saludo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How to compile PHP with cygwin?
Hi I wonder if anyone have managed to compile PHP with cygwin. I get several errors when doing this. I also wonder if I intend to make a dll to extend PHP for windows, should I then compile PHP with cygwin or with MS Visual C++? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] The url of the last site?
Hello, I am trying to have a script that process a form and then sends the person back to the form they were on if there are errors. Does anyone know how I can get the url of the form that someone submit to the script from? Thanks Brandon
Re: [PHP] PHP & FRAMES Question
Richard, Thanks. I missed that completely. Miles At 09:47 AM 11/15/01 -0800, Richard S. Crawford wrote: >Try: > >printf("target=\"sub_detl\">%s\n",$target_url, >$myrow["member_id"],$myrow["member_id"]); > >The target attribute must be outside of the quotes which contain the URL >string, as such: > >< a href="http://my.url.com"; target="my_frame" >blah< /a > > >The way you had it rendered the link as: > >< a href="http://my.ur.com target=my_fame" >blah< /a > > >which won't work. > > >At 09:41 AM 11/15/2001, you wrote: >>This has probably been dealt with before, but I'm unable to get my link >>to open in the target frame, it always opens in the same frame. This >>line of code: >> >>printf(" %s \n", >>$target_url, $myrow["member_id"], $myrow["member_id"]); >> >>typically expands, when the mouse pointer is placed over it, to: >> >>http://hostname/sitename/adm_sub_dtl.php?member_id=T0003 target=sub_detl >> >>This is the code for the page which creates the framesets .. >> >> >>I don't see any mysteries here, and it appears syntactically correct. >> >>Any suggestions will be welcome - Miles Thompson > > >Sliante, >Richard S. Crawford > >http://www.mossroot.com >mailto:[EMAIL PROTECTED] >AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford >"It is only with the heart that we see rightly; what is essential is >invisible to the eye." --Antoine de Saint Exupéry > >"Push the button, Max!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: How to compile my own PHP extension in Windows?
Gri wrote: > Does anyone know how to compile a php extension in windows.. in linux it > is simple.. just to install php source and compile the extension. it > doesn´t work in windows. You'll need MSVC++ 6.x or higher, and a whole lot of patience... There's some configuration file or other somewhere to set up all the paths and whatnot that MSVC needs, I think, but even that probably won't quite get it right for your box... Count on this *not* being a quick job. Far easier to just *FIND* the DLLs and throw them into your directory... -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] The url of the last site?
You could process the form in the same file form action : and in the header of the page if ($Submit){ // YOUR ACTION HERE } Sjoerd van Oosten Digitaal vormgever [EMAIL PROTECTED] Datamex E-sites B.V. http://www.esites.nl Minervum 7368 Telefoon: (076) 5 730 730 4817 ZH BREDA Telefax: (076) 5 877 757 ___ -Oorspronkelijk bericht- Van: Brandon Orther [mailto:[EMAIL PROTECTED]] Verzonden: donderdag 15 november 2001 18:55 Aan: 'PHP User Group' Onderwerp: [PHP] The url of the last site? Hello, I am trying to have a script that process a form and then sends the person back to the form they were on if there are errors. Does anyone know how I can get the url of the form that someone submit to the script from? Thanks Brandon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] The url of the last site?
It's in the $HTTP_REFERER variable (speeling mistake intentional) Be warned, though - not every browser supplies this in every circumstance. Cheers Jon -Original Message- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: 15 November 2001 17:55 To: 'PHP User Group' Subject: [PHP] The url of the last site? Hello, I am trying to have a script that process a form and then sends the person back to the form they were on if there are errors. Does anyone know how I can get the url of the form that someone submit to the script from? Thanks Brandon ** 'The information included in this Email is of a confidential nature and is intended only for the addressee. If you are not the intended addressee, any disclosure, copying or distribution by you is prohibited and may be unlawful. Disclosure to any party other than the addressee, whether inadvertent or otherwise is not intended to waive privilege or confidentiality' ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: The url of the last site?
Brandon Orther wrote: > I am trying to have a script that process a form and then sends the > person back to the form they were on if there are errors. > > Does anyone know how I can get the url of the form that someone submit > to the script from? $HTTP_REFERER In the future, the answer to such a question is always in: NOTE: The existence or lack thereof of $HTTP_REFERER depends on: Your web-server being configured to provide this variable The user not surfing directly to the page Some browsers providing their previous URL, even if they *did* surf directly to the page If there is some "missing" content from , the problem is not, repeat not, with PHP -- PHP passes on everything the web-server gives it. If it's not there, it's because your web-server ain't giving it. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: apache don´t understand php!!----¡¡apache no entiende php!!
Alejandro wrote: > I have a problem:I have a php page wich runs well when I run it, but when > I run a html page and links the php file, the source code is seen on the > screen. It´s like apache wouldn't understand php!!. Any ideas? Thanks If the file ends in .html, and you have not used AddType in Apache's httpd.conf file to tell Apache to use PHP to read .html files, then you will see PHP source, cuz PHP isn't being told by Apache to process the file... Find your httpd.conf, search for "AddType" with the PHP setting, and uncomment it and/or add .html .htm .php3 .php .phtml etc to the end of that line. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Newsgroup?
[EMAIL PROTECTED] (Richard Lynch) wrote: > Christopher Raymond wrote: > >> What's the deal with the newsgroup version of this list? I'm using >> news.php.net as the news server address, but all I get are error messages. > > What error messages are you getting? > > You can't *POST* through the newsgroup -- Reply via email to > [EMAIL PROTECTED], and it works fine. hmm i can post fine on the server, I dont sent to the maillist. > I read your message using the newsgroup, so it would seem to be working for > me... :-) me too -- Henrik Hansen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] The url of the last site?
Brandon, Go to Juli Meloni's thickbook page, there is a tutorial there on PHP forms which display error message. With a bit of tweaking it's exactly what you want. http://www.thickbook.com Miles Thompson At 09:55 AM 11/15/01 -0800, Brandon Orther wrote: >Hello, > >I am trying to have a script that process a form and then sends the >person back to the form they were on if there are errors. > >Does anyone know how I can get the url of the form that someone submit >to the script from? > >Thanks >Brandon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Another POST case?
Hi! I have this using postmethod: Then I'm trying to mail the result with the mail() function. /* recipients */ $to = [EMAIL PROTECTED] ; /* subject */ $subject = "Order"; /* message */ $message = "$customer want to order:\n $cheese, $ham , $peppernoi" ; /* To send HTML mail, you can set the Content-type header. */ /* additional headers */ $headers = "From: Me [EMAIL PROTECTED]\r\n"; /* and now mail it */ mail($to, $subject, $message, $headers); And that works untill a customer orders only $cheese. SO.how do i do it if I dont want any unwanted errors? Is it possible to fetch the array or something? : ) Best Regards Raymond -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Another POST case?
0 && is_array($toppings)) { $strtoppings = implode(', ',$toppings); $msg = "The customer wants: $strtoppings."; } ?> Mike Raymond wrote: >Hi! > >I have this using postmethod: > > > > > > > >Then I'm trying to mail the result with the mail() function. > > >/* recipients */ >$to = [EMAIL PROTECTED] ; > >/* subject */ >$subject = "Order"; > >/* message */ >$message = "$customer want to order:\n $cheese, $ham , $peppernoi" ; > >/* To send HTML mail, you can set the Content-type header. */ > >/* additional headers */ >$headers = "From: Me [EMAIL PROTECTED]\r\n"; > > >/* and now mail it */ >mail($to, $subject, $message, $headers); > > >And that works untill a customer orders only $cheese. SO.how do i do it >if I dont want any unwanted errors? Is it possible to fetch the array or >something? : ) > > >Best Regards Raymond > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] EREG_REPLACE?
> Hello, ive got a problem > > I want to replace this string: > this must also be variable > > by: > > this must also be variable > > So the two tags should be placed before and after the link when a link is > in my $pagecontent > > I know it's easier to use another class, but for the moment that's not an > option. > > Greetings, > > Sjoerd > > > Sjoerd van Oosten > Digitaal vormgever [EMAIL PROTECTED] > Datamex E-sites B.V. > http://www.esites.nl > Minervum 7368 Telefoon: (076) 5 730 730 > 4817 ZH BREDA Telefax: (076) 5 877 757 > ___ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Including declare statements that contain variables
Well you have an interestingly different approach! Personally I kind of like either having the SQL statements in-line with the rest of the code or functions that retrieve data for that particular query e.g. function get_students($class) { Anyway based on your approach: 1. You could still solve your problem of having to worry when the constant definitions are included by setting global variables instead of constants and then doing an explicit eval-uation at their time of use e.g. In include : global $SelectByClass; $SelectByClass = 'Select * from students where class = \'.$class.\''; In code : GetData('SelectByClass'); In GetData: function GetData($query_mask) { extract($GLOBALS); eval ('$query_string = "'.${$query_mask}.'"'); mysql_query($query_string . This would guarantee that you always use the values of the global variables current when you issue the query. So you can move your includes back up the top! Of course it doesn't help if you ever want to use a local value of a variable in a query but it seems that doesn't interest you. 2. I notice you return a pointer to the results set rather than the results themselves. This means you still have to have mysql_fetch_... outside of GetData. Why not return an array of the result rows instead? i.e. add to GetData while ($rows[] = mysql_fetch_array($result)); mysql_free_result($result); return ($rows); This has the advantage of letting the rest of your code remain database independent. 3. You may not need to pass the connection id ($db_conn) to mysql_query. Mysql will default to using the last connect if none is specified. 4. You should be aware that you approach may have performance implications since you are carting ALL global variables into the symbol space of each call to GetData. Running under Apache with register_global_vars that meant 158 variables even without any GET or POST variables. However the new reference count implementation of variables in php4 may minimise the impact of this. With any luck, it won't actually make a copy of any of your global variables in memory! I was pleasantly surprised at how fast an extract($GLOBALS) ran, (7ms for me). I guess the choice between your approach and the more conventional approaches of in-line selects, per-select function call, or encapsulation as a data object is simply about maintainability. Personally I always prefer more lines of boring but simple code to clever structures which may be obtuse to the poor guy who ends up maintaining my code. Anyway, it's always interesting to see different approaches. I'd never properly checked out define, extract and $GLOBALS until now. Good Luck, George Fred wrote: > > I would like to offer my recent experience in the hope that it will help > others avoid the wasted effort and frustration I managed to burden myself > with yesterday. I will start by stating that the conclusions I have drawn > may seem obvious at first blush, however in a troubleshooting environment it > is sometimes difficult to see the forest for the trees. This is > particularly true when several principles of PHP syntax are working in > concert to produce a problem. > > My problems started when I found myself in the rare position of needing to > write a function that accessed global variables rather than passed values or > references. This need arose because I was writing a data access abstraction > function and would have no way of knowing in advance what variables would > need to be accessed or in what order. The total number of possible > variables was large when compared with the total number of lines of code in > the function. If I had chosen to write the function to accept an > associative array that could be extracted within the function to produce the > needed variables the total number of lines of code needed outside of the > function to produce the array would have been greater than the total number > of lines of code within the function. > > Because the purpose of choosing to use a function rather than writing the > code several times was to reduce the number of lines of code and provide > clarity to the script I decided that passing an array to the function was > not an option. > > I decided to simply write the function so that it had access to all > variables in the GLOBALS array to overcome this problem. The function was > as follows: > > // Function to send query and retrieve result pointer > function GetData($Query) > { > extract ($GLOBALS); > $Result = mysql_query($Query, $db_conn) >or die (mysql_error()); > Return $Result; > } > > The function accepts an SQL statement as an argument and returns a pointer > to a result set. The SQL statement that is passed to the function is one of > many defined constants, many of which contain variables. For example: > > define ("ClassesByTeacher","SELECT Classes.SectionNo, Period, CourseNo, > Title, Teacher FROM Classes, Attendance WHERE Classes.SectionNo = > Attenda
[PHP] require or include
Hello list, I'm just wandering what's better, require or include. Greetings, Sjoerd van Oosten Digitaal vormgever [EMAIL PROTECTED] Datamex E-sites B.V. http://www.esites.nl Minervum 7368 Telefoon: (076) 5 730 730 4817 ZH BREDA Telefax: (076) 5 877 757 ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] require or include
It all depends on the purpose. With require, the script will die on the spot if the file is not found. Also, the code will always be included in the file.. so take this example: file.php: requiretest.php: The run script would be: Of course that code would never be executed, but the required file would be parsed and included as part of the file, whereas: includetest.php: If the if() condition is not met, the file is not included at all.. so the parsed code would be: :) Mike Oosten, Sjoerd van wrote: >Hello list, > >I'm just wandering what's better, require or include. > >Greetings, > > >Sjoerd van Oosten >Digitaal vormgever [EMAIL PROTECTED] >Datamex E-sites B.V. >http://www.esites.nl >Minervum 7368 Telefoon: (076) 5 730 730 >4817 ZH BREDA Telefax: (076) 5 877 757 >___ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Books for PHP and MySQL Class
I'll be teaching a web development class in the Spring in which I plan to focus on PHP and MySQL as primary tools. These will be students who have experience with HTML And web design, but most will have no experience with programming at all. I need recommendations for book(s) that will serve as decent primers... I expect that the PHP book will have enough of the fundamentals of programming to set them on the right path... Any suggestions for a MySQL book would be great. If both were in one book, even better! -- Chris Lott <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Image Upload, renaming question
Hi there, I have an upload form on my website that works great, however I have come to a roadblock...how the heck do I rename the copied file? Everytime I upload an image it overwrites the old one with the new. The code below uploads the file and displays the following: Your photo has been uploaded successfully. Size of Image in Bytes: 36315 Image Type: image/pjpeg File exists on server. /rotatingimages/C:\PHP\uploadtemp\php12D.tmp <-- I notice that this is a temporary name Here's the code if(copy($userfile, "/ez/codesnipits/temprotatingimages/newimage.jpg")){ print "Your photo has been uploaded successfully." ; } else { print "No luck with the upload dude."; } print "Size of Image in Bytes: " . $userfile_size . ""; print "Image Type: " . $userfile_type . ""; if(file_exists($userfile)){ print "File exists on server."; grab newly added filename from directory on server $filename = $userfile; rename file $newfilename = "/rotatingimages/" . $filename; print $newfilename; } else { print "File doesn't exist on server."; } ?> Thx a bunch, Joe:) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Books for PHP and MySQL Class
"PHP and MySQL Web Development" by Welling and Thomson, from SAMS. ISBN 0-672-31784-2. An easy read, but covers everything you'd need. I'm a little biased as a reviewer for your particular needs, since I've been coding for many years, and thus skipped a bunch of the intro PHP language chapters, but I've occasionally check those chapters for a thing or two. Check it out, this book seems to be highly recommended. -Original Message- From: Chris Lott [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 15, 2001 11:41 AM To: [EMAIL PROTECTED] Subject: [PHP] Books for PHP and MySQL Class I'll be teaching a web development class in the Spring in which I plan to focus on PHP and MySQL as primary tools. These will be students who have experience with HTML And web design, but most will have no experience with programming at all. I need recommendations for book(s) that will serve as decent primers... I expect that the PHP book will have enough of the fundamentals of programming to set them on the right path... Any suggestions for a MySQL book would be great. If both were in one book, even better! -- Chris Lott <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Books for PHP and MySQL Class
So far the best books that I have found for PHP and MySQL are: PHP: Developer's Cookbook by Sterlings Hughes (SAMS) MySQL/PHP Database Applications by Jay Greenspan & Brad Bulger (M&T books) I believe another person on our mailing list is putting out a book soon... hopefully maybe he'll rear his head, this would be a good time to promote it :) *nudge nudge* Enjoy! Rick > I'll be teaching a web development class in the Spring in which I plan to > focus on PHP and MySQL as primary tools. These will be students who have > experience with HTML And web design, but most will have no experience with > programming at all. > > I need recommendations for book(s) that will serve as decent primers... I > expect that the PHP book will have enough of the fundamentals of programming > to set them on the right path... > > Any suggestions for a MySQL book would be great. If both were in one book, > even better! > > -- > Chris Lott <[EMAIL PROTECTED]> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Books for PHP and MySQL Class
I also have the PHP & MySQL Web Development book and I used it to learn PHP and MySQL. I think it is one of the better books. my opinion.. Clint -- Original Message -- From: [EMAIL PROTECTED] (Chris Lott) Date: 15 Nov 2001 19:41:18 - I'll be teaching a web development class in the Spring in which I plan to focus on PHP and MySQL as primary tools. These will be students who have experience with HTML And web design, but most will have no experience with programming at all. I need recommendations for book(s) that will serve as decent primers... I expect that the PHP book will have enough of the fundamentals of programming to set them on the right path... Any suggestions for a MySQL book would be great. If both were in one book, even better! -- Chris Lott <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Books for PHP and MySQL Class
Chris Lott wrote: > I'll be teaching a web development class in the Spring in which I plan to > focus on PHP and MySQL as primary tools. These will be students who have > experience with HTML And web design, but most will have no experience with > programming at all. > > I need recommendations for book(s) that will serve as decent primers... I > expect that the PHP book will have enough of the fundamentals of > programming to set them on the right path... I'm biased, but the PHP 4 Bible book is good. :-) The Luke and Laura book (Welling and Thompson) is probably even better for that, given that they teach 200 grad students per quarter at Melbourne Royal Institute of Technology... But none of the PHP books are really geared as "Programming 101" textbooks... Plan on spending a considerable amount of lecture time off the book about programming in general. Luke and Laura gave a great talk at the San Diego OS Conference about using PHP in the classroom, so get those slides if you can, and suck up to them a lot since they've been there. :-) > Any suggestions for a MySQL book would be great. If both were in one book, > even better! The New Riders MySQL book by Paul DuBois is the one to go for if you opt for a separate MySQL book. PS I'm available as a guest lecturer :-) -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Image Upload, renaming question
Joe Van Meer wrote: > Hi there, I have an upload form on my website that works great, however I > have come to a roadblock...how the heck do I rename the copied file? > Everytime I upload an image it overwrites the old one with the new. The > code below uploads the file and displays the following: > > Your photo has been uploaded successfully. > Size of Image in Bytes: 36315 > Image Type: image/pjpeg > File exists on server. > /rotatingimages/C:\PHP\uploadtemp\php12D.tmp <-- I notice that this is a > temporary name If two files were being uploaded at once, you'd get two different names... But it's entirely up to *YOU* to decide where to copy the file to. Maybe you'd *WANT* to replace files as they were uploaded. I tend to use the user's filename and preg_replace() to get rid of everything except a-zA-Z._- and then checking where I'm copying to tack on 1, 2, 3, ... until I find a new filename that's not in use. You should also start using http://php.net/move_uploaded_file instead of copy or whatever you are doing. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Supplied argument is not a valid MySQL result
Warning: Supplied argument is not a valid MySQL result resource in /home/sites/projects.heathermccullough.com/web/copeland/product.php on line 61 Here is the code, I fixed it once, and I cant figure out why it keeps returning. if ($submit) { $sql = ("SELECT * FROM store WHERE state = '$State' AND groups = '$group_id'"); $result = mysql_query($sql); if(mysql_num_rows($result) > 0) { < - line 61 while ($stores = mysql_fetch_array($result) ) { $store_name .= "".$stores["name"]." ".$stores["address"]." ".$stores["city"].", ".$stores["state"]." ".$stores["zip"]."".$stores["phone"]." "; } } else { $store_name .= "Copeland Furniture Company StoreMain StreetBradford, Vermont 05033802-222-5300http://www.copelandfurniture.com/companystore\"; target=\"new\">Copeland Furniture Company Store"; } MYSQL_CLOSE(); = Dan McCullough --- "Theres no such thing as a problem unless the servers are on fire!" h: 603.444.9808 w: McCullough Family w: At Work __ Do You Yahoo!? Find the one for you at Yahoo! Personals http://personals.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: require or include
Sjoerd Van Oosten wrote: > I'm just wandering what's better, require or include. Neither is "better" Now that PHP is being compiled to byte-code before execution, I don't *THINK* there's any real difference... If there *IS* a difference, it's about *WHEN* the code gets evaluated: require would get evaluated only *ONCE* when it was first encountered, and the results get pasted in. include will re-evaluate the contents every time it is encountered. -- Like music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Image Upload, renaming question
Thx Richard, I would like the files to all be dumped into one directory, each with a unique name. Then I will create a path and store that in the db. Thx for the ideas, I will check them out and get back to youvia this thread. Cheers Joe:) "Richard Lynch" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Joe Van Meer wrote: > > > Hi there, I have an upload form on my website that works great, however I > > have come to a roadblock...how the heck do I rename the copied file? > > Everytime I upload an image it overwrites the old one with the new. The > > code below uploads the file and displays the following: > > > > Your photo has been uploaded successfully. > > Size of Image in Bytes: 36315 > > Image Type: image/pjpeg > > File exists on server. > > /rotatingimages/C:\PHP\uploadtemp\php12D.tmp <-- I notice that this is a > > temporary name > > If two files were being uploaded at once, you'd get two different names... > > But it's entirely up to *YOU* to decide where to copy the file to. Maybe > you'd *WANT* to replace files as they were uploaded. > > I tend to use the user's filename and preg_replace() to get rid of > everything except a-zA-Z._- and then checking where I'm copying to tack on > 1, 2, 3, ... until I find a new filename that's not in use. > > You should also start using http://php.net/move_uploaded_file instead of > copy or whatever you are doing. > > -- > Like music? http://l-i-e.com/artists.htm > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: executing another php.script
Steve, Thanks for the reply .. but you miss the point (which i probably did not explain well). I already have a script called x.php. IT gets called from links with all the info needed. I have an instance where there will be no interaction between a user so no 'clicking' of the link will happen. I wanted to do the 'same' as a click but without the click. I have temporarily created a function to do what i need AND IF PHP is incapable of calling/executing etc a script (which i find hard to believe) i will rewrite all the other pages Thanks again DSig On Mon, 12 Nov 2001 12:11:19 -, [EMAIL PROTECTED] (Steve Brett) wrote: >you don't need a sepaerate script. >define two functions and then loop through calling the second function. > >much neater (and easier) > >Steve > >"David Tod Sigafoos" <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> I am sure that I am just .. missing this .. >> >> From one script I wish to 'execute' another script. How is this done? >> >> Setting a link and clicking is not the answer .. one script loops >> through all the 'selected' rows and I want to 'execute' another script >> for each row .. can this be done? >> >> thanks >> >> DSig >> David > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Supplied argument is not a valid MySQL result
Because you are enclosing your $sql string within () brackets, $sql is being set a boolean value, not the value of the string. Change it to $sql = "SELECT * ... '$group_id'"; -Mike Dan McCullough wrote: >Warning: Supplied argument is not a valid MySQL result resource in >/home/sites/projects.heathermccullough.com/web/copeland/product.php on line 61 > >Here is the code, I fixed it once, and I cant figure out why it keeps returning. > >if ($submit) { >$sql = ("SELECT * FROM store WHERE state = '$State' AND groups = '$group_id'"); >$result = mysql_query($sql); >if(mysql_num_rows($result) > 0) { < - line 61 > while ($stores = mysql_fetch_array($result) ) { > $store_name .= "".$stores["name"]." ".$stores["address"]." >".$stores["city"].", >".$stores["state"]." ".$stores["zip"]."".$stores["phone"]." "; > } >} else { >$store_name .= "Copeland Furniture Company StoreMain StreetBradford, Vermont >05033802-222-5300http://www.copelandfurniture.com/companystore\"; >target=\"new\">Copeland Furniture Company Store"; >} >MYSQL_CLOSE(); > >= >Dan McCullough >--- >"Theres no such thing as a problem unless the servers are on fire!" >h: 603.444.9808 >w: McCullough Family >w: At Work > >__ >Do You Yahoo!? >Find the one for you at Yahoo! Personals >http://personals.yahoo.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: executing another php.script
Mike .. thanks for trying .. but that simply is not useful. On Mon, 12 Nov 2001 10:18:34 -0500, [EMAIL PROTECTED] (Mike Harvey) wrote: >Just "include(script2.inc)" in your loop. >"David Tod Sigafoos" <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> I am sure that I am just .. missing this .. >> >> From one script I wish to 'execute' another script. How is this done? >> >> Setting a link and clicking is not the answer .. one script loops >> through all the 'selected' rows and I want to 'execute' another script >> for each row .. can this be done? >> >> thanks >> >> DSig >> David > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]