Re: [PHP] array in sessions
"Christian Dechery" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > How do I store (and update) an array within a session... > > Like I'd have > > session_start(); > $time["page1"]="20"; > > //here, should I do this? > session_register("time["page1"]"); > > //or this? > session_register("time"); It should work with this. FYI. If you set register globals off and enable track vars on in your php.ini. (It may work with other settings, but this is what I use)You don't even have to write $var = "session var"; session_register("var"); session_unregister("var"); Instead, you can write $HTTP_SESSION_VARS['var'] = "value you want to store in session"; unset($HTTP_SESSION_VARS['var']); // to unregister from session > > ?> > > cuz I'll have more pages... > $time["page20"]="300"; > > is this going to automatically load into the session vars or I have to do > something first? No. When I learn new languages, I usually write a lot of simple codes to make sure I correctly understands how it works. I suggest to do that. Regards, -- Yasuo Ohgaki -- 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] Number/Letter Passwords
""Matt Stone"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi,Hi, > I have this code below which is supposed to be generating a password like > QCCQCN2-IUZ with 10 characters - All but three in the first section (7) and > three in the last part - but does not work in all cases. Sometimes it prints > LPSA3WD-IM or G22G2G9-FC. > Is there a catch in the code that will stuff up in certain circumstances? > Please help, > > Matt stone > > _ > > define(FIRST_STR,1); > define(LAST_STR,0); > > function randomGen($length, $mode) { > $all = explode( " ", > "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z " >. "0 1 2 3 4 5 6 7 8 9"); > $allend = explode( " ", > "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"); > for($i=0;$i<$length;$i++) { > srand((double)microtime()*time()); > $randy = (($mode)? rand(0, count($all)) : rand(0, count($allend))); Count returns number of elements in array, so you should substrct 1. i.e. $randy = (($mode)? rand(0, count($all)-1) : rand(0, count($allend)-1)); Then should work all the time. Regards, -- Yasuo Ohgaki -- 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 to send attachment with email with php?
Nothing special. You can compose and send with mail(). Read related RFC or grab code does that from elsewhere on net. -- Yasuo Ohgaki "Carfield Yim" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > How to send attachment with email with php? > > -- > 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] odd
What is your session.gc_probability session.gc_maxlifetime Garbage collection is affected by these. Garbage collection will not be performed unless someone is using session and garbage collection is performed. So answer to your question is it is PHP4 session restriction that PHP does not delete session files unless garbage collection is performed. It will be deleted eventually, though. Try higher gc_probability if you have problem with that. -- Yasuo Ohgaki ""Andrius Lokotash"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi. It seems that PHP don't clean up it's temporary session files, is this a "feature" or bug? PHP versions used 4.0.1pl1 to 4.0.4-pl1 -- 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] Caller's Line number?
Not sure what you really mean. __LINE__ contains current line number in the script wherever it is used. So if you want caller's line number function foo($line) { echo 'Line number: '. $line; } foo(__LINE__); You can get the caller's line number. (Line number of foo(__LINE__);) Regards, -- Yasuo Ohgaki ""elias"" <[EMAIL PROTECTED]> wrote in message 99s17u$fd7$[EMAIL PROTECTED]">news:99s17u$fd7$[EMAIL PROTECTED]... > Hello, > > can i make a function that displays the __LINE__ of it's caller? > > ie: > > function show_caller_s_line() > { >echo "my caller's line is:" . __LINE__; > } > > 1: blahblahblah > 2: show_caller_s_line() > 3: blahblah > > output should be: > my caller's line is: 3 > > > is that possible? > > thanks. > -elias > > > > -- > 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-I18N] Jstring does'nt seemed to be working,,,
I guess you are using jstring as shared lib. (I was compiled in my PHP4.0.4pl1, but I'm using it as shared lib now) My modules are working fine with my Apache1.3.17/PHP4.0.4pl1 on Linux. Most likely your jstring.so is not located as PHP expects. Where did you put it? -- Yasuo Ohgaki "Tatsuro Nakagawa" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi. > > I've installed a module named... > > php-4.0RC2_jstring-1.0.tar.gz > > and an instalation seemed prety good, with no errros. > > BUT, it doesn't work! > > An error like this shows on my browser: > > -- ERROR MES -- > > Warning: Unable to load dynamic library './jstring.so' - ./jstring.so: cannot open shared object file: No such file or directory in /home/d2/bbs/test.php on line 2 > > Fatal error: Call to undefined function: jstr_convert_kana() in /home/d2/bbs/test.php on line 4 > > -- ERROR MES END-- > > -- SCRIPT -- > > dl("jstring.so"); > > echo jstr_convert_kana("$B#A#B#C(B", "r"); > ?> > > -- SCRIPT END -- > > Some multi-byte code in an input.. an output should be "ABC". > > Where should I look for this kind of an error? > > Thanks for helping, in forward. > > -- > Tatsuro Nakagawa > [EMAIL PROTECTED] > > -- > PHP Internationalization 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 Internationalization 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-I18N] International support
Sorry for really late reply to the message. I didn't notice. "Hironori Neal Sato" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > (I'm only cc'ing to php-i18n) > > On Thu, Feb 22, 2001 at 10:22:37AM -0800, Soma Interesting wrote: > >I'm currently working a project that is intended to handle Japanese > >character sets - and now I'm told ideally iMode too. :) The iMode isn't > >such an issue at the moment - but the article below has spooked me a > >little. At an early point in the project we tested if putting some input > >into a web form, which ultimately was handled by php then stored in > >postgres would return fully intact - and it did. This left me comfortable > >that PHP and Postgres don't seem to care what language they're storing in > >fields or variables. I'm 'guessing' that this is because the data, whether > >its English or Japanese is being stored in binary (or something else?). Of > >course I wouldn't be able to sort the data or do anything else that would > >require PHP/Postgres to be able to interpret the data. However if I compile > >Postgres with locals support for the character set/language in question - > >then postgres will be able to sort Japanese. Is this right? > > I haven't touched Postgres in last four years, but I would assume you > are correct. As far as MySQL goes, you can set locale (actually, > charset) and sorting Japanese text should work just fine. PostgreSQL works perfectly with many multi-byte char code sets also. Including many EUCs, SJIS, JIS, UTF8, etc. And it does different char set on server and client side. (i.e. I can use SJIS on client side while DB uses EUC-JP) > > >>Since r-newbold.com is in Japanese only, Studio Omame made sure to utilize > >>PHP's Japanese character set conversion functions. However, this proved to > >>be a challenge. > > > >Is this available for v4 of PHP yet? > > So far, the answer is no. I have attempted to implement Japanese > extension to PHP4 before, but bumped into few problems. At that time, > I had to quit working on it since I ran out of my spair time. But, > we do have someone else working on this issue. I don't have any > dates though. There are Japanese extentions. I use it and works perfectly with PHP4.0.4pl1 as Apache DSO. Charset conversion both manual and automatic, multi-byte charset reguler expression, Japanese char handling for email, etc. I heard the athour is working to make it standard PHP4 extention now. PS: I think I post where to get it on this list when someone asks for it. Or mail me if you really need it. Regards, -- Yasuo Ohgaki -- PHP Internationalization 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] Problems of conversion with strftime()
Optional 2nd param for date() and strftime() is UNIX timestamp (i.e. integer - seconds from epoch) So I suppose all works as it should. -- Yasuo Ohgaki "Evelio Martinez" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > setlocale("LC_ALL","es_ES"); > $fecha = date("d-m-Y"); > print $fecha ." > ";-> > 28-03-2001 ok > $fecha = "2001-03-28 18:22:00"; > print (date("d m Y H:i:s",$fecha)) ."";->01 01 1970 > 01:33:21wrong > print (date("Y m d H:i:s",$fecha)) ."";->1970 01 01 > 01:33:21wrong > print (strftime("%d-%m-%Y %T")) .""; ->28-03-2001 > 18:22:24 ok > print (strftime("%d-%m-%Y %T",$fecha)) .""; -> 01-01-1970 01:33:21 > wrong > > ?> > > > Who should I convert between date values? > > I am using postgresql date fields and the only way to format de date is > using the SQL functions > instead of formating with PHP functions. > > select to_char(date(pg_user.valuntil),'DD-MM- HH24:MI:SS') ... > > Any idea? > > Thanks in advance > > -- > Evelio Martínez > > > -- 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] alternate pattern match
Is there any reason that you cannot use regular expression? -- Yasuo Ohgaki ""Costas"" <[EMAIL PROTECTED]> wrote in message 99t43c$qr4$[EMAIL PROTECTED]">news:99t43c$qr4$[EMAIL PROTECTED]... > How do i extract the position (integer counting from the left) of the letter > M (beginning 'MSIE'. > > $str = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; > > NOTE, i only want a single integer (it is 28, i counted manuallt!!) > > 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 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] question about a loop in a loop
I think array_intersect() and array_diff() is useful for you.. http://www.php.net/manual/en/function.array-intersect.php http://www.php.net/manual/en/function.array-diff.php -- Yasuo Ohgaki "Institute for Social Ecology" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hi, > > I've been driving myself bonkers trying to figure out wy this code block > does not work as it is supposed to. am hoping that someone on this list > can shed some light on it. > > Whta I am trying to do is evluate two arrays. One array is populated with > a list. The other array is populated with list items that are found in > the first array. Array 2 can have either all of the items found in array > 1, some, or none. I want to create a marker that would tell me which > items in array 2 are found in array 1 and where. > > My code so far: > > for argument sake lets say: > > $add[$key] ($key defined earlier) is equal to "a, b, e, g" > $add[$key] is the second array > > $$key is the second array, and it equals "a, b, c, d, e, f, g, h, i" > $$key is the first array. > > > code block: > > $x = 0; > do > { >for ($y = 0; $y <= count ($add[$key]); $y++) >{ > if ($add[$key][$y] == $$key[$x]) > { > $mark[$x] = $x; > } >} >$x++; > }while ($x < count ($$key)); > > So, the idea is that every time $add[$key] at "Y" position is equal to > $$key at X position, a third array is populated with the location value of X. > > but this is not what I am getting spti back at me. $mark is populated > every iteration of the inner loop regardless if $add[$key][$y] == > $$key[$x] > > Any suggestions? > > thanks! > > Michael > > > -- > 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] Sessions stopped working with 4.04
Since you are using PHP4.0.4pl1, you also should be able to access session vars with $HTTP_SESSION_VARS. Dose it make differences? -- Yasuo Ohgaki "Shane Iseminger" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hello all, > > Of course, apologies if this was covered, I didn't see it in the archives. > > I recently upgraded to Apache 1.3.19 and PHP 4.04pl1, and my sessions just . > . . stopped working. > > I start the session, register the vars, no errors are generated, but as far > as I can tell the actual value is NOT being saved. > session_is_registered("myvar") returns a 1, but when $myvar returns nothing, > even when I've explicitly set it to a value on the previous page. I set the > value, then register the var. > > PHP writes out a session file, but it only contains the names of the vars > I've registered -- shouldn't the values be there as well? > > This code was all working, now it's busted, any ideas? Might I have missed a > compile options? I've been taking blind stabs at workarounds with no luck. > Thanks in advance . . . > > -- Shane > > > -- > 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] Storing data from several forms of the same type in an array
How about use JavaScript to do that. You should be able to access all forms, frames in browser. -- Yasuo Ohgaki ""cam k"" <[EMAIL PROTECTED]> wrote in message 99uart$a48$[EMAIL PROTECTED]">news:99uart$a48$[EMAIL PROTECTED]... > I would like to store data from several forms (same form, different data) so > that the info can be written to a database all at once. The reason being is > that I would like to have all this information tied to information from a > general form. eg. I have a general information form in one frame on my > page, and then in another frame below a form for a specific item purchased. > You can purchase several items, therefore several forms filled out. I want > to tie all these items to the info in the general form, so I want to be able > to send all the data to the database at once. Now I'm wondering if I can > store the data in an arrray in the HTTP body and post data from each form to > it, etc. I don't think its possible but .can anyone help?? > > regards > > > > > -- > 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] Session Problem (Design problem!?)
That's because your "variable_order" is "EGPCS". (Default) So your PHP is working fine. -- Yasuo Ohgaki ""Jason Lam"" <[EMAIL PROTECTED]> wrote in message 99uf64$4i9$[EMAIL PROTECTED]">news:99uf64$4i9$[EMAIL PROTECTED]... > I got this strange problem, maybe a design flaw, please look at it and tell > me what's wrong. > > 3 files in total > > 1.php3 > -- > session_start(); > ?> > > > > > > > > -- > > 2.php3 > -- > session_start(); > ?> > > session_unregister("var"); > print $var; > print "GO"; > ?> > > --- > > 3.php3 > --- > session_start(); > ?> > > session_register("var"); > print $var; > ?> > > > > When I goto 1.php3 and type in something in the text field, then goto 2.php3 > and click go, it automatically goto 3.php3 with data that I type in 1.php3. > The problem starts when I click BACK button on the browser to 1.php3 and > type in another data and click the button on the form again, but here is the > trouble. I seems to be getting the data I type in First, not the current > one. By using phpinfo(), I cannot find the data are all up to date, I wonder > how this data still ends up sitting there. > > Can anyone tell me what's going on? > > BTW, going back once again with the second set of data and proceed to 2.php3 > seems fine. Could it be cache of browser? > > > > > -- > 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] Session Problem (Design problem!?)
FYI Use $HTTP_*_VARS to avoid this kind of problems. Variable order may change server to server, so you might not able to rely on it even if you know well about it. -- Yasuo Ohgaki ""Jason Lam"" <[EMAIL PROTECTED]> wrote in message 99uf64$4i9$[EMAIL PROTECTED]">news:99uf64$4i9$[EMAIL PROTECTED]... > I got this strange problem, maybe a design flaw, please look at it and tell > me what's wrong. > > 3 files in total > > 1.php3 > -- > session_start(); > ?> > > > > > > > > -- > > 2.php3 > -- > session_start(); > ?> > > session_unregister("var"); > print $var; > print "GO"; > ?> > > --- > > 3.php3 > --- > session_start(); > ?> > > session_register("var"); > print $var; > ?> > > > > When I goto 1.php3 and type in something in the text field, then goto 2.php3 > and click go, it automatically goto 3.php3 with data that I type in 1.php3. > The problem starts when I click BACK button on the browser to 1.php3 and > type in another data and click the button on the form again, but here is the > trouble. I seems to be getting the data I type in First, not the current > one. By using phpinfo(), I cannot find the data are all up to date, I wonder > how this data still ends up sitting there. > > Can anyone tell me what's going on? > > BTW, going back once again with the second set of data and proceed to 2.php3 > seems fine. Could it be cache of browser? > > > > > -- > 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] Sessions: what's wrong sith this code?
Why do you use un/serialize() for array? If you are using PHP4 session, you don't need it. It's done in session module. Multiple serialize() may be causing your problem. -- Yasuo Ohgaki "Christian Dechery" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I tried to put an array into a session, but I can get it to work... here is > my code: > > > if(!isset($script_total_time)) > { > $script_total_time=(float)$total_time; > session_register("script_total_time"); > $step_times_array[$step]=$total_time; > $step_times=serialize($step_times_array); > //echo "step_times=\"$step_times\""; > //this when not commented, echoes perfectly the string with the > serialized array... > session_register("step_times"); > //so why doesn't it work if $step_times is in fact a string? > } > else > { > $script_total_time+=(float)$total_time; > $step_times_array=unserialize($step_times); > $step_times_array[$step]=$total_time; > $step_times=serialize($step_times_array); > } > > > the variable $script_total_time works like a charm, and it also updates > perfectly, but the step_times array simply doesn't work... I looked into > the session-cookie-file and the step_times is set but as empty... I don't > get what is wrong... For the record this is a code from a script which have > several steps, all reloads of the same .php file and I want to store the > execution times for each step (step_times) and the total running time > (already working)... > > . Christian Dechery (lemming) > . http://www.tanamesa.com.br > . Gaita-L Owner / Web Developer > > > -- > 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] Php extension for Ultradev available now !
Timely post for me. I am considering upgrading Dreamweaver and Fireworks. How and why do you like Ultradev? Why PHP user should use it? -- Yasuo Ohgaki ""Ovidiu EFTIMIE"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > For those working with ultradev : > http://www.udzone.com/showDetail.asp?TypeId=4&NewsId=488 > > > Ovidiu > > -- > 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] What is the difference between session_unset() and session_destroy()?
Anyway, session_unset() only unset session vars in memory, but session_destroy() deletes session vars from storage. i.e. You can free storage with session_destroy() without waiting garbage collection. Unless programmer discards session id, session data will be created with the same session id, though. -- Yasuo Ohgaki "Carfield Yim" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > From the manual, > session_unset ¡X Free all session variables > session_destroy ¡X Destroys all data registered to a session > > What do this document exactly mean? > > -- > 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] split string value
Use split('@',$email_address) http://www.php.net/manual/en/function.split.php -- Yasuo Ohgaki ""Jacky"" <[EMAIL PROTECTED]> wrote in message 005a01c0b8a0$453ede00$[EMAIL PROTECTED]">news:005a01c0b8a0$453ede00$[EMAIL PROTECTED]... Hi people If I have value like [EMAIL PROTECTED] stored in a variable. How do I break it up to be take only the foo.com bit to use that to redirect user back to that URL? Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself" -- 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] saving uploaded image as file Vs. directly to database
I would use filesystem if I need performance and if I don't worry about management. I would use database if I need to manage lots of them and if images have attributes. Some older databases have really poor performance when LOB is used. If it is the case, you might want to use combination of these. (i.e. Use database for management and use filesystem to store files) -- Yasuo Ohgaki ""toto"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > what's the difference between them, i mean for effectiveness and performance > ? > > > -toto- > Imagination is more important than knowledge. > > > > -- > 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] For ... in ...
You can use get_class_vars() or get_object_vars() http://www.php.net/manual/en/function.get-object-vars.php http://www.php.net/manual/en/function.get-class-vars.php You also need to use Variable variables (i.e. $$var) to iterate object properties. v1 = ".$bar->$name."\n"); } ?> Regards, -- Yasuo Ohgaki "André Næss" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Javascript has this very neat control structure that makes it easy to iterate over the properties of an object. It would be nice to see something similiar in PHP. I often use Objects as a way of "packing" data in a more orderly fashion, and sometimes I need to do stuff to all the properties of an object. A good example is when I have an object whose properties are coming from a form, and going back to the very same form if there were errors in the form. I will have to perform addslashes() and stripslashes() on all the properties in the object, and writing this without a loop can be very tedious. André Næss -- 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] For ... in ...
I thought more examples might be useful someone. $name = ".$obj->$name."\n"); } while (list($k,$v) = each($obj)) { print("foo->$k = ".$v."\n"); } foreach ($obj as $k => $v) { print("foo->$k = ".$v."\n"); } foreach ($obj as $k => $v) { print("foo->$k = ".$obj->$k."\n"); } ?> Regards, -- Yasuo Ohgaki "André Næss" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Javascript has this very neat control structure that makes it easy to iterate over the properties of an object. It would be nice to see something similiar in PHP. I often use Objects as a way of "packing" data in a more orderly fashion, and sometimes I need to do stuff to all the properties of an object. A good example is when I have an object whose properties are coming from a form, and going back to the very same form if there were errors in the form. I will have to perform addslashes() and stripslashes() on all the properties in the object, and writing this without a loop can be very tedious. André Næss -- 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] Regular expression benchmark?
Has anyone here benched standard regular expression functions (ereg(), etc) against Perl regular expression functions? (preg_match(), etc.) and POSIX extended regular expression functions? (ereg(), etc) If anyone benched regular expression functions already, I would like to know the benchmark data. Thanks. -- Yasuo Ohgaki -- 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] initialize session module
How about http://www.zend.com/zend/tut/ There are several PHP4 tutorials including PHP4 session. The error is most likely that you are specifying invalid session handler. -- Yasuo Ohgaki ""Rol"" <[EMAIL PROTECTED]> wrote in message 022a01c0b8e4$f1271ae0$[EMAIL PROTECTED]">news:022a01c0b8e4$f1271ae0$[EMAIL PROTECTED]... > Hello > > What causes this error message is there a place to read a bit more about > session module? > > Failed to initialize session module > > > Thank you > > > > > > -- > 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] Passing by reference deprecated?
FYI Unless you need to modify and return modified contents of variables, pass by reference makes script execution a little slower under PHP4. -- Yasuo Ohgaki ""Neil Kimber"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Pass by reference itself is not deprecated, just call-time > pass-by-reference. > I believe this means your calling line of code being prevented from > specifying that it should be invoked as pass-by-reference. > > So, > > > function NormalPassByRefence(&$prmValue) > { > $prmValue ++; > } > > $numValue=1; > NormalPassByRefence($numValue); // This will still work > // $numValue =2 at this point > > > function CallTimePassByRefence($prmValue) > { > $prmValue ++; > } > > $numValue=1; > CallTimePassByRefence(&$numValue); // This will no longer work - it's been > deprecated > // $numValue =1 at this point > > > > > -Original Message- > From: CC Zona [mailto:[EMAIL PROTECTED]] > Sent: 30 March 2001 04:40 > To: [EMAIL PROTECTED] > Subject: [PHP] Passing by reference deprecated? > > > set_value(&$variable,$value) >{ >$variable=value; >} > > "Warning: Call-time pass-by-reference has been deprecated - argument passed > by value; If you would like to pass it by reference, modify the declaration > of [runtime function name](). If you would like to enable call-time > pass-by-reference, you can set allow_call_time_pass_reference to true in > your INI file. However, future versions may not support this any longer. " > > When did passing by reference get deprecated? The documentation at > <http://php.net/manual/en/language.references.pass.php> doesn't suggest > what to do instead--in fact, it uses an example like the syntax above. So > my next question is: would using a return value or declaring a global be > the (only) other options? > > TIA > > -- > CC > > -- > 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]
Re: [PHP] Setcookie not working
Someone on this list mentioned, Internet Explorer does not accept cookie that has timeout less than 7200 sec from current time. (PC's clock) How about try longer timeout? PS: Is this information is correct? Anyone? Correct me if it is wrong info. -- Yasuo Ohgaki ""Sean Weissensee"" <[EMAIL PROTECTED]> wrote in message 011e01c0b845$ad8fa3a0$0200a8c0@Win98">news:011e01c0b845$ad8fa3a0$0200a8c0@Win98... When I use set cookie with an expire value it does not retain the value ? setcookie ("TestCookie2", "test", $value,time()+3600); I am using echo $TestCookie2; or echo $HTTP_COOKIE_VARS["TestCookie2"]; in another page to view the value Sean Weissensee Ion Solutions -- 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] Array in Session-Vars?
Array and Object are serialized by session module. Therefore, PHP4 session can handle both Array and Object seamlessly. (i.e. You don't have to do anything) Make sure you define Class (include class def) before starting session. Don't forget re-initialize resources such as database link also. How about read http://www.zend.com/zend/tut/ There are useful tutorials. -- Yasuo Ohgaki ""Thomas H$BgH(Ber"" <[EMAIL PROTECTED]> wrote in message 9a1e71$eun$[EMAIL PROTECTED]">news:9a1e71$eun$[EMAIL PROTECTED]... > Hi all, > > i need to use an array in a session variable. > On a page i fill the Sessionvar : > $HTTP_SESSION_VARS["xy"] []=$whatever > (The var is registered with session_register("xy")) > I mean that the entry would made at the end of the array, is it not so? > > But evrey time i proove the entries with count($HTTP_SESSION_VARS["xy"]) , > there are only one entry. > > > Have somebody an idea? > > Thanks, > > Thomas > > > > > > -- > 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] apache_lookup_uri problem
I haven't use apache_lookup_uri() yet, but I believe it is for getting local server's uri info. I think your PHP script is located web document root, right? Therefore, you get "/" before the string. If you want to get remote URI info, use HEAD request. (Refer to RFC for details) -- Yasuo Ohgaki "Chris Cochella" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am using the apache_lookup_uri function and I am having a problem. > > I have PHP4 as an Apache module. > > If I give the command: > > > $link = "http://www.mysite.com/"; > > $lookup_results = apache_lookup_uri($link); > > > And I output: > > echo $lookup_results->uri; > echo $lookup_results->status; > > I get: > > /http://www.mysite.com > > (that is if the page that has the script is in document root) > and > a status of: > > 200 > > > Even if the link is bad I get a status of 200. > > Why is there a leading "/"? > Am I forming the the URI incorrectly and that is causing a prepend to the > link? > > Any help would be great. I have scanned the archives and various script > archives with no results. > > Thanks in advance. > > Chris > > > -- > 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] header() vs HTTP_REFERER (Netscape 6)
HTTP_REFERER is set by browser. I treat HTTP_REFERER header as user input, so I don't trust it. Using HTTP_REFERER can open security hole in your web site. I suggest to change your authentication code, so that you don't rely on HTTP_REFERER. Regards, -- Yasuo Ohgaki ""Scott Fletcher"" <[EMAIL PROTECTED]> wrote in message 9a2cpr$5d0$[EMAIL PROTECTED]">news:9a2cpr$5d0$[EMAIL PROTECTED]... > I had now found the problem. The website that have been in use for a > while work pretty well with IE and Netscape Navigator. Until NS6 came, > that's when the website start having some problem. > The website use the login page and any web pages after logging are > controlled by the security check. Security check is made of scripts that > check to be sure there is no direct access attempt and it also use the cache > expiration, etc. > So, I noticed when I use the HTTP_REFERER on every web pages as part of > the security check, it work pretty well. However, when I use the php code, > "header();" and automatically go to the next web page, the HTTP_REFERER > can't recieve data from the last page that use the php code, "header();". > It only affected NS6, it doesn't affected IE and Netscape Navigator. > > Why is that? What is the work-around to this problem? > > Thanks, > Scott > > > > -- > 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] Passing by reference deprecated?
I benched function with and without reference for a relatively large data (512KB, I think). I iterated 10,000 or 100,000 times to see the difference. (I posted the result in this list) The result is almost the same and should not be worried much about performance, but function without reference was faster than with reference. i.e. function($data) vs. function(&$data) function($data) was a little faster. This is my guess (I'm not reading source code, so correct me if I'm wrong). With reference, PHP need to additional work to make it as reference, since there is &. While without reference, PHP only need to add symbol and increment reference count for the variable. I guess the additional work to make reference (&) makes function(&$date) a little slower. Anyway, I think it worth to know that Pass by value can make execution slower in most languages, but not in PHP4. This is really good feature, because programmer can only use pass by reference when they want change function parameter and return the change to caller. It makes a little easier to read PHP4 script. Regards, -- Yasuo Ohgaki - Original Message - From: "Neil Kimber" <[EMAIL PROTECTED]> To: "Yasuo Ohgaki" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, March 30, 2001 6:51 PM Subject: RE: [PHP] Passing by reference deprecated? > I'm surprised. I would have thought that it would have been the other way > around. Passing by reference should have similar implications to reference > counting as used the Zend engine. It means that physical memory does not > have to be allocated to passed variables (thereby saving resources in > physical memory and time used in allocating and copying memory). > > In fact, because the Zend engine uses reference counting it will in effect > use pass by reference for all parameters. In the case of a parameter passed > as 'non-reference' it will only be allocated its own memory at a time that > the parameter value is changed within the function. You can see a detailed > explanation of how reference counting works here: > > http://www.zend.com/zend/art/ref-count.php > > I am not familiar with the parser source, so these are purely my thoughts on > my understanding of the parser behaviour. I'd be interested to hear of other > peoples views. > > > -Original Message- > From: Yasuo Ohgaki [mailto:[EMAIL PROTECTED]] > Sent: 30 March 2001 10:08 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Passing by reference deprecated? > > > FYI > > Unless you need to modify and return modified contents of variables, pass by > reference makes script execution a little slower under PHP4. > > -- > Yasuo Ohgaki > > > ""Neil Kimber"" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Pass by reference itself is not deprecated, just call-time > > pass-by-reference. > > I believe this means your calling line of code being prevented from > > specifying that it should be invoked as pass-by-reference. > > > > So, > > > > > > function NormalPassByRefence(&$prmValue) > > { > > $prmValue ++; > > } > > > > $numValue=1; > > NormalPassByRefence($numValue); // This will still work > > // $numValue =2 at this point > > > > > > function CallTimePassByRefence($prmValue) > > { > > $prmValue ++; > > } > > > > $numValue=1; > > CallTimePassByRefence(&$numValue); // This will no longer work - it's > been > > deprecated > > // $numValue =1 at this point > > > > > > > > > > -Original Message- > > From: CC Zona [mailto:[EMAIL PROTECTED]] > > Sent: 30 March 2001 04:40 > > To: [EMAIL PROTECTED] > > Subject: [PHP] Passing by reference deprecated? > > > > > > set_value(&$variable,$value) > >{ > >$variable=value; > >} > > > > "Warning: Call-time pass-by-reference has been deprecated - argument > passed > > by value; If you would like to pass it by reference, modify the > declaration > > of [runtime function name](). If you would like to enable call-time > > pass-by-reference, you can set allow_call_time_pass_reference to true in > > your INI file. However, future versions may not support this any longer. " > > > > When did passing by reference get deprecated? The documentation at > > <http://php.net/manual/en/language.references.pass.php> doesn't suggest > > what to do instead--in fact, it uses an example like the syntax above. So > > my next question is: would using a return value or declaring a globa
Re: [PHP] Size Limit for PHP scripts
If you don't have errata in your script. I think you got similar experience as I did. I use PHP4.0.4pl1/Apache DSO/Linux I had a script that will not include files more than 20. PHP silently fails to include statement like and no output on browser what so ever. Note: PHP can include files more than 20 files. I changed require_once('file_to_include'); to require('file_to_include'); then it starts working. It also starts working when I edit few lines in those files for some reason. After that, I could never reproduce problem, since I didn't save the script causes this problem. My suggestion: 1) Try require/include/require_once/include_once, see if it helps. 2) Change your script a bit, see if it helps. I didn't report this as bug, since I don't have script that causes this problem now. I suggest you to report this as a bug and keep scripts that causes this. BTW, do you use multi-type char codeset? Regards, -- Yasuo Ohgaki ""Wally Hartshorn"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The script I'm calling (member.php) is 41K bytes (1,200 lines) It includes() global.php, which is 8K bytes (300 lines). That in turn requires() sessions.php, which is 13K bytes (370 lines). That makes a total code size at execution of about 62K bytes (1,870 lines). If I just remove some unused code from member.php, reducing its size to 32K bytes (940 lines), it works fine. (It isn't that particular code. I could remove any large section of unused code and it would work.) Note that global.php is also included by several other scripts, each of which are much smaller than member.php, and in each of those cases it works fine. Any ideas? If there isn't a limit within PHP on script size, is there perhaps some limit within the iPlanet web server on the PHP script size? Wally >>> "Cal Evans" <[EMAIL PROTECTED]> 03/30/01 01:53PM >>> If there is, I've not found it. I have many pages that include files that contain class definitions. My average page includes 8 classes and my average class is 250-400 lines of code. Have you debugged your individual scripts first before including them in other pages? Cal http://www.calevans.com -Original Message- From: Wally Hartshorn [mailto:[EMAIL PROTECTED]] Sent: Friday, March 30, 2001 1:53 PM To: [EMAIL PROTECTED] Subject: [PHP] Size Limit for PHP scripts Is there a limit to the size of PHP scripts? I'm having a problem in which scriptA.php is including() scriptB.php, which then requires() scriptC.php. The result is that PHP itself dies. If I remove some code from scriptA.php to reduce the size of the script, it works fine. (The code that I'm removing wasn't being executed during this testing, so the code itself wasn't the problem.) If there is some limit, is there a parameter I can set to change it? Here's my setup: PHP 4.0.4 pl1 iPlanet 4.1 sp5 Solaris 2.7 Sun ES 250, 1GB RAM Thanks, Wally Hartshorn -- 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]
Re: [PHP] Size Limit for PHP scripts
Typo in my post ""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message 9a3hpe$n1m$[EMAIL PROTECTED]">news:9a3hpe$n1m$[EMAIL PROTECTED]... SNIP > > BTW, do you use multi-type char codeset? BTW, do you use multi-byte char codeset? > Regards, > > -- > Yasuo Ohgaki -- 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] Compile .php file is possible ?
I found interesting link http://www.deskcode.com/phpcompiler/ PHPCompiler v0.0.2 Beta PHPCompiler is an Overlay Manager i.e. A program that converts your PHP Scripts to Windows EXEcutable files that can be ran on any windows platform which has the necessary runtime DLL's. PHPCompiler works on the original PHP Parser and tacks the source of your scripts at the end of a custom coded loader. Its fairly easy to use and when used in conjunction with PHP-GTK(URL) can be used to create true GUI Applications. -- Yasuo Ohgaki ""Marian Vasile"" <[EMAIL PROTECTED]> wrote in message 9a1cr4$5fr$[EMAIL PROTECTED]">news:9a1cr4$5fr$[EMAIL PROTECTED]... > I need a method to compile my php files to give them to a customer. > > The main problem is that this customer have an account on a shared hosting > service and (I think) he can't install a compiler or something new on that > server. > > Is it possible to encrypt my files ? > > Plz HELP ASAP > > Yours, > Marian > > > > -- > 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] FYI: PostgreSQL users
Some users in PHP General list may be interested in. Tom Lane has posted patch for pg_dump to PostgreSQL Admin List. He said it works with 7.0 (and he said it may work for 6.5 - not tested) This means you can backup/restore large object w/o upgrading to 7.1. Check out the PostgreSQL Admin List if you need it. (There is news server for the list, too. news://news.postgresql.org ) Regards, -- Yasuo Ohgaki -- 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] [Fwd: php...]
PHP has type juggling feature. PHP4 supports "total equality"(?) operator "===". If you need variable to be match for both type and value. Use "===", then you can avoid type juggling. http://www.php.net/manual/en/language.types.type-juggling.php http://www.php.net/manual/en/language.operators.comparison.php Regards, -- Yasuo Ohgaki > I'm sure you appreciate the importance of transitive equality in programming > languages (especially they all aspire to be pseudo-mathematical), which is > why I think you'll appreciate this. > > > $a = "0"; > $b = 0; > $c = ""; > $d = " "; > > $a == $b // T > $b == $c // T > $a == $c // F!! > > $b == $c // T > $b == $d // T > $c == $d // F!! > > ?> > > Perl, of course, outputs the expected values: $a, $b, $c and $d are equal > under '==', and only $a and $b are equal under 'eq'. PHP's '===' operator > (its equivalent to 'eq') says that $a, $b, $c and $d are all different. > > Doesn't that seem like a fundamental flaw? How can equality NOT be > transitive?? How can anyone be expected to write programs in such an > environment? > > D > > > -- 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] Compiling under RH7
How did you install Apache and PHP? PRM or source? I compile from source for these. You might have httpd.conf that is actually used by apache may be located some where else. If you are compile from source and need the same file layout as RedHat, use --with-layout=RedHat (or like) for Apache's configure. (How about run 'find / -name httpd.conf'? You might find more than one.) Regards, -- Yasuo Ohgaki "Jon Jacob" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am still only getting the source of the php file. Has anybody > successfully compiled Apache 1.3.x (1.3.19 in my case) and PHP > (4.0.4pl1) under RH7? My httpd.conf has the proper AddType line and the > php4 module is installed according to httpd -l. > > If you have done this successfully, please let me know. I have been > racking my brain for three straight days trying to get this to work. > > Thanks. > > > _ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.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 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] hash suggestions wanted
If you need shorter result, how about use a part of md5 hash result? -- Yasuo Ohgaki ""David P. Schwartz"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > the PHP crypt function uses DES and it only generates a hash based on the > first 8 chars of a string, although it produces a 12-char hash. Md5 can hash > a string of indefinite length, but it produces a much longer hash (34 chars or > so). > > I need something that can provide me with a 12-16 char hash of an indefinite > string (usually under 100 chars in my case) using standard hasing algorithms. > > Any suggestions? > > Thanks > -David Schwartz > > > -- > 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] Question using chop :-)
It's not explain why you get additional char at the end of string, but chop() in PHP does not get rid of last char, but it also suppose to get rid of spaces including newline. What char code are you using? Char code may be the cause. -- Yasuo Ohgaki ""Marcus Ouimet"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have got chop to work for me to remove characters at the end of the > string using something like: > > echo $listing_values1 = chop(substr($listing_values['name'],0,4); > echo $listing_values1 ['name'] . '...' . ' ' . "\n"; > > Works great except for the fact after the name there appears to be a letter > ie: > > Brita Water Filter > > Would become: > > BritaB... > > The letter is different for each entry. What am I oing wrong. Any help > appreciated thanks in advance... > > > > > -- > 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] Install
There is a section for that in the PHP Manual http://jp.php.net/manual/en/migration4.php I suggest you to read www.zend.com documents also. Regards, -- Yasuo Ohgaki ""Chris"" <[EMAIL PROTECTED]> wrote in message 00ce01c0b942$4cc0d5a0$01c8c8c8@ibcserver">news:00ce01c0b942$4cc0d5a0$01c8c8c8@ibcserver... Hi, I am trying to find some info on upgrading from php3 to php4. I can't seem to find any docs about upgrading, just installing. Is this the same thing? Do I have to re-compile apache just to go from php3 to php4? Thanks, Chris. -- 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] Disk Quota Through web
You need to provide what OS you are using. I think you may get better response if you ask mailing list discussing about your OS for this matter. Regards, -- Yasuo Ohgaki ""pnp"" <[EMAIL PROTECTED]> wrote in message 013301c0b8e5$37735220$[EMAIL PROTECTED]">news:013301c0b8e5$37735220$[EMAIL PROTECTED]... Hi All There I am new to this mailing list I had virtual domain hosted on my server with No. of users With control panel of mine,I want to add Quota feature to my panel By which users can check for there quota Through web for the amount of space they are using I am a baby for php so please help me out from scratch Thanks Regards -- 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] problem loading extension
How about take a look at notes (PHP Manual)? http://www.php.net/manual/en/install-windows.php You might need to change \ to /, or / to \, or get rid of drive letter in extension_dir, as I needed to load extension for PHP for Windows. Regards, -- Yasuo Ohgaki "Christian Dechery" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I posted a message a while ago about having trouble loading php_mssql.dll > extension. > It gave me that error: 'can't find ...'. So I was stuppid enough to realize > I didn't have MS SQL 7 installed here. > > Somone here told me to download a proggie called Dependency Walker, that > lists all the dependencies of a DLL. > So I did it, and it really was missing a DLL (MS SQL). > > So I installed MS SQL 7 here, and now Dependency Walker doesn't give me any > error, but PHP still gives me the message and still does not load > php_mssql.dll. Why? MSSQL is started, working perfectly, PHP is working fine... > > what may be wrong? > > . Christian Dechery (lemming) > . http://www.tanamesa.com.br > . Gaita-L Owner / Web Developer > > > -- > 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] Saving file
Reading RFCs will help. RFC 2068 RFC 1945 RFC 2936 Regards, -- Yasuo Ohgaki "Adi Wibowo" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi I write a script that create a report. > Using header ("location : filename") to tell browser to download file > instead of displaying it to screen. > > On some computer it work, but on another (using the same browser) is > always displayed. I try to change file extension to treat browser to > download it, but still doesn't work. > > Do you have any suggestion to push browser to always download the file? > > Thank you so much. > > > Adi Wibowo --- > * Work matter: [EMAIL PROTECTED] > * Private matter : [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] Saving file
Oops I pasted older RFC number for HTTP/1.1, newer version is RFC 2616 Reading older version will also help, though. -- Yasuo Ohgaki "Adi Wibowo" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi I write a script that create a report. > Using header ("location : filename") to tell browser to download file > instead of displaying it to screen. > > On some computer it work, but on another (using the same browser) is > always displayed. I try to change file extension to treat browser to > download it, but still doesn't work. > > Do you have any suggestion to push browser to always download the file? > > Thank you so much. > > > Adi Wibowo --- > * Work matter: [EMAIL PROTECTED] > * Private matter : [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] [Fwd: php...]
I missed that you are discussing about transitivity. Your claim sound fair to me too. I'm relatively new to PHP :) So I'm not sure, but it's probably because historical reason that PHP dose not have transitivity for equality operator. We can still workaround with type casting, though. Do you know annotated manual? http://www.php.net/manual/en/ Your post would be a great note for many users. How about add them to sections that I've been mentioned. "Yasuo Ohgaki" <[EMAIL PROTECTED]> wrote in message news:... > PHP has type juggling feature. PHP4 supports "total equality"(?) operator "===". > If you need variable to be match for both type and value. Use "===", then you > can avoid type juggling. > > http://www.php.net/manual/en/language.types.type-juggling.php > http://www.php.net/manual/en/language.operators.comparison.php > > Regards, > -- > Yasuo Ohgaki > > > I'm sure you appreciate the importance of transitive equality in programming > > languages (especially they all aspire to be pseudo-mathematical), which is > > why I think you'll appreciate this. > > > > > > > $a = "0"; > > $b = 0; > > $c = ""; > > $d = " "; > > > > $a == $b // T > > $b == $c // T > > $a == $c // F!! As you mentioned it's worth to note. Since $a and $d is string that have different content, so PHP evaluates it as FALSE. > > > > $b == $c // T > > $b == $d // T > > $c == $d // F!! This is the same. > > > > ?> > > > > Perl, of course, outputs the expected values: $a, $b, $c and $d are equal > > under '==', and only $a and $b are equal under 'eq'. PHP's '===' operator > > (its equivalent to 'eq') says that $a, $b, $c and $d are all different. It also worh to note. === expects the same type although PHP loosely typed language. > > > > Doesn't that seem like a fundamental flaw? How can equality NOT be > > transitive?? How can anyone be expected to write programs in such an > > environment? We still can cast variables, so I suggest cast when you needed. Regards, -- Yasuo Ohgaki -- 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] Database connections
You don't have to call mysql_close(). PHP handles cleaning resources when script execution is ended. You can set default connection parameters for MySQL in php.ini. I don't know if you need to call mysql_connect(). (I don't use MySQL :) Regards, -- Yasuo Ohgaki ""David Hynes"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm using PHP on a windows box to access a MySQL database. > > I noticed that I do not need to open a database connection before performing > a mysql_db_query(). Is this bad coding ? Should the database connection > always be made ? Is this specific to Windows ? > > # $databaseConnection = mysql_connect ("localhost", "", ""); ## I don't > seem to need this line, or the last one > mysql_db_query("dbnam", "SQL query"); > # mysql_close ($databaseConnection); > > Thanks, > David. > > --- > Fed202 Solutions > www.fed202solutions.com > Mobile : 07779 293368 > --- > > > -- > 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] known problems with session_register()?
What is your php.ini? If you are enabled track vars and disabled register globals, all you have to do is assign values to $HTTP_SESSION_VARS and unset($HTTP_SESSION_VARS['your_session_var']). You don't need to use session_register(), session_unregister() if it's the case. Refer to User Notes in Session Section - Annotated PHP Manual for details. Regards, -- Yasuo Ohgaki "Felix Kronlage" <[EMAIL PROTECTED]> wrote in message 20010401181830.B5417@mad">news:20010401181830.B5417@mad... > Hi, > > are there any knows problems/bugs with session_register()? > > With openbsd as a platform (not tested on others) I have the problem > that 20% of the times sessions don't get initialized correctly. > The session-file is created in /tmp (cookies for session-use are turned off), > just the variables registered via session_registered are not written into the file. > The same piece of code works on the same box, with same php 80% of the times. > (Had this problem with php4.0.4x up to php4.0.5rc3). > > any hints on this? > -fkr > -- > gpg-fingerprint: 076E 1E87 3E05 1C7F B1A0 8A48 0D31 9BD3 D9AC 74D0 > |http://www.hazardous.org/ | whois -h whois.ripe.de FKR-RIPE | > |all your base are belong to us | shame on me | fkr@IRCnet | > > > -- > 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] Attach File in PHP's Mail Function.
This has been asked recently. You can search archives. Look for links can be found at http://www.php.net/support.php Most easiest way is grabbing mail class that can handle attachment. There are many of them on the net. I think www.zend.com code exchange might have one. If you want to do it by yourself, you need to read related RFCs. Regards, -- Yasuo Ohgaki ""Mark Lo (3)"" <[EMAIL PROTECTED]> wrote in message 000701c0bb1b$d3b772a0$2e53fea9@mark">news:000701c0bb1b$d3b772a0$2e53fea9@mark... > Hi, > > I would like to ask how to attach a file in PHP's Mail Function ?? > > Thank you > > Mark > > > -- > 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] php-4.0.5-dev with Apache rpm
Annotated manual is useful. Refer to http://www.php.net/manual/en/install.linux.php http://www.php.net/manual/en/install.apache.php You need to install apache-devel RPM if you are using RedHat. Regards, -- Yasuo Ohgaki ""Paul Juliano"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > Hi, > > How do I manually compile php-4.0.5-dev with an Apache rpm installation? Or do > I have to install both apache and php manually? I know how to do the second > method, but as much as possible, I don't want to hose the running apache install. > > Thanks. > > __ > www.edsamail.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 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] Parent class
Did you try $b->a()? It should work. -- Yasuo Ohgaki "Milan Mlynarcik" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Is there way to access paret class from outside of class ??? > I know that to access parent object from within the class I can use code > like this one: > class a > { > vara; > > function a() > { > $this->a = "OK"; > } > } > > class b extends a > { > function b() > { > //here I access a class directly > a::a(); > } > } > ?> > > But I would like to know how to access a class like this: > > $b = new b(); > //and now I want to access class a with something like > $b->a::a(); > //but this doesn't work > ?> > Is it possible ??? If yes how ??? > > > -- > 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] I can't connect php with apache.
I guess your httpd.conf is not allowing. Is your httpd.conf allow CGI script? Refer to Apache manual for that. Regards, -- Yasuo Ohgaki "Kukai" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all, > > I have been trying to install PHP4.0 to Apache1.3 on Win2K platform. > I followed the instruction carefully, and all of applications, PHP4.0, > Apache1.3, MySQL are installed correctly, I think. However when I put > the URI into the browser, http://localhost/test.php, I got message "The > page cannot be found". I checked error log said > > "[Mon Apr 02 03:02:03 2001] [error] [client 127.0.0.1] Invalid URI in > request GET /test.php HTTP/1.1" > > I changed every elements related with this error message. > And I found out one thing that if I changed name from test.php to test > php3, it seems ok. It didn't generate error message. But it is still not > be shown in browser, it show brank page. But when I push source bottum, > it is shown collect source code... I don't know what I should do > next. Is there someone who can explain this situation? Please. > > Thank you. > > kukai > > -- > 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] Why does it work this way?
It seems PHP used to allow "+" for string concatenation according to php.ini warn_plus_overloading = off ; my php.ini entry If you turn on this warring, you may see warning for that. I guess PHP is doing this $str = "a"; $str++; as $str = "a"; $str = $str + $str; // $str now stores "aa" PHP syntax/functions looks and works like C most of the time, but there many function/feature that does not work like C. Regards, -- Yasuo Ohgaki ""Mark Roedel"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... -Original Message- From: Boget, Chris [mailto:[EMAIL PROTECTED]] Sent: Monday, April 02, 2001 11:12 AM To: Mark Roedel Subject: RE: [PHP] Why does it work this way? >> Because "z"+1 turns out to be "aa" (which, if you ask me, >> makes about as much sense as any of the alternatives), > > How is it that "z" + 1 is "aa"? What is PHP using behind the > scenes to get/generate this value? Let me start by correcting myself on a minor technicality. "z"+1 turns out to be 1 (because "z" has an integer value of 0). It's "z"++ that turns out to be "aa". Perhaps one of the core developers who has a better understanding of the behind-the-scenes operations of PHP can elaborate on this, but what it basically points out to me is that "incrementing" and "adding one" aren't always the same thing. I assume this behavior is tied closely to what PHP determines the type of a variable at any given time to be. If we take that as a starting point, then what I see happening is that, for the purposes of incrementing, there are certain ranges defined within PHP. 0-9 is one, obviously. a-z appears to be another. If, for the purposes of the increment operator only, you treat the letters of the alphabet as a range of integers, then the result you're seeing makes perfect sense. You get to your highest digit, then go back to zero and increment the next column. The problem, in the "for" loop that we started out discussing, is that there doesn't seem to be any way to make a comparison that follows those same rules. You can't treat them as integers, because "aa" and "z" have the same integer-value -- zero. Treating them as strings gives the result we've already seen. Other interesting sort-of-related notes: While incrementing works (sort of) on strings, decrementing doesn't appear to have any effect at all. $test="z"; echo $test--; echo $test; results in "zz" Incrementing only appears to work on strings within particular ranges of characters. $test="("; echo $test++; echo $test; results in "((" --- Mark Roedel | "The most overlooked advantage to owning a Systems Programmer| computer is that if they foul up there's no LeTourneau University | law against whacking them around a little." Longview, Texas, USA | -- Owen Porterfield -- 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] is this syntax correct?
I think many users are confusing about PHP4 session. I thought this info might be useful for someone. There are 3 ways to start PHP4 session. (as far as I know) 1) Using php.ini: "session.auto_start = 1" to automatically start session for any request. 2) Using session_start(): Explicitly start PHP4 session with "session_start()" 3) Using session functions: Implicitly start PHP4 session with "session_register()" If you are having trouble with PHP4 session, set "error_reporting = E_ALL" in php.ini. Is there any other way to start PHP4 session? Regards, -- Yasuo Ohgaki "Jack Dempsey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Jacky, > > basic thing about sessions: you need session_start() at the top of every > page in which you expect to use them...check out zend.com for some > tutorials...but yes, you do need it at the top of that page... > > -jack > "Jacky@lilst" wrote: > > > > Not really, do I need to have session_start at the sender page and the > > receiver page? > > Jack > > [EMAIL PROTECTED] > > "There is nothing more rewarding than reaching the goal you set for > > yourself" > > - Original Message - > > From: Wade Halsey <[EMAIL PROTECTED]> > > To: Jacky@lilst <[EMAIL PROTECTED]> > > Sent: Monday, April 02, 2001 3:48 AM > > Subject: Re: [PHP] is this syntax correct? > > > > > do you have > > > session_start(); > > > at the top of the next page? > > > > > > - Original Message - > > > From: Jacky@lilst <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Monday, April 02, 2001 10:43 PM > > > Subject: Re: [PHP] is this syntax correct? > > > > > > > > > > I also tried this syntax: > > > > > > > global $test; > > > > $test = "foo"; > > > > session_register("test"); > > > > ?> > > > > > > > > and it still not work as when I go to next page, and try echo $test, > > > nothing > > > > come up. > > > > Jack > > > > [EMAIL PROTECTED] > > > > "There is nothing more rewarding than reaching the goal you set for > > > > yourself" > > > > - Original Message - > > > > From: Joseph Bannon <[EMAIL PROTECTED]> > > > > To: Jacky@lilst <[EMAIL PROTECTED]> > > > > Sent: Monday, April 02, 2001 3:44 AM > > > > Subject: RE: [PHP] is this syntax correct? > > > > > > > > > > > > > > So what is the right way to do? > > > > > > > > > > > > > > > I resent my email to the list. I've done mostly DB work, so I need to > > > know > > > > > what those functions do. > > > > > > > > > > J > > > > > > > > > > > > > > > > > > > > > > -- > > > > 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 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] known problems with session_register()?
Try register globals off, see if it helps. (You need to use $HTTP_SESSION_VARS) I always set track vars to on (It's always on from 4.0.3(?), if I remember correctly), register globals OFF. It works fine. (I use custom session handling functions, though) FYI: It seems there is race condition problem in current session module, but it shouldn't occur that often. I don't know if it's closed or not. Search BugDB if you need. One thing I can think of is your script may be running to long, try to increase max_execution_time in your php.ini. Session is stored to whatever (file/mm/user) when script execution is ended. Regards, -- Yasuo Ohgaki - Original Message - From: "Felix Kronlage" <[EMAIL PROTECTED]> To: "Yasuo Ohgaki" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, April 02, 2001 9:21 PM Subject: Re: [PHP] known problems with session_register()? > On Mon, Apr 02, 2001 at 09:13:41PM +0900, Yasuo Ohgaki wrote: > > > If you are enabled track vars and disabled register globals, all you have to do > > is assign values to $HTTP_SESSION_VARS and > > both are on. Could there be a problem with session_register() ? > I do think it's odd, that the same code, on the same box, same > php, same everything works 80% of the time and fails in 20% of the time. > (no, there can't be a race-condition). > > -fkr > -- > gpg-fingerprint: 076E 1E87 3E05 1C7F B1A0 8A48 0D31 9BD3 D9AC 74D0 > |http://www.hazardous.org/ | whois -h whois.ripe.de FKR-RIPE | > |all your base are belong to us | shame on me | fkr@IRCnet | > > -- 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] known problems with session_register()?
I forgot to mention that I haven't tested session module behavior when script execution is timed out. So it may/ may not be the cause. I set max_execution_time = 300 for file uploading, so I never worried about time out. Does anyone know what happens to session vars in this case? Regards, -- Yasuo Ohgaki ""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Try register globals off, see if it helps. > (You need to use $HTTP_SESSION_VARS) > > I always set track vars to on (It's always on from 4.0.3(?), if I remember > correctly), register globals OFF. > It works fine. (I use custom session handling functions, though) > > FYI: It seems there is race condition problem in current session module, but it > shouldn't occur that often. I don't know if it's closed or not. Search BugDB if > you need. > > One thing I can think of is your script may be running to long, try to increase > max_execution_time in your php.ini. Session is stored to whatever > (file/mm/user) when script execution is ended. > > Regards, > -- > Yasuo Ohgaki > > - Original Message - > From: "Felix Kronlage" <[EMAIL PROTECTED]> > To: "Yasuo Ohgaki" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Monday, April 02, 2001 9:21 PM > Subject: Re: [PHP] known problems with session_register()? > > > > On Mon, Apr 02, 2001 at 09:13:41PM +0900, Yasuo Ohgaki wrote: > > > > > If you are enabled track vars and disabled register globals, all you have to > do > > > is assign values to $HTTP_SESSION_VARS and > > > > both are on. Could there be a problem with session_register() ? > > I do think it's odd, that the same code, on the same box, same > > php, same everything works 80% of the time and fails in 20% of the time. > > (no, there can't be a race-condition). > > > > -fkr > > -- > > gpg-fingerprint: 076E 1E87 3E05 1C7F B1A0 8A48 0D31 9BD3 D9AC 74D0 > > |http://www.hazardous.org/ | whois -h whois.ripe.de FKR-RIPE | > > |all your base are belong to us | shame on me | fkr@IRCnet | > > > > > > -- > 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] Why does it work this way?
I didn't read carefully yours and original post. Sorry. Anyway, warn_plus_overloading=On ; warn if the + operator is used with strings does not raise warnings on my PHP4.0.4pl1 for some reason. I think incrementing strings should results in 1 if type juggling works as documented. -- Yasuo Ohgaki ""Mark Roedel"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > -Original Message- > From: Yasuo Ohgaki [mailto:[EMAIL PROTECTED]] > Sent: Monday, April 02, 2001 8:00 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Why does it work this way? > > > I guess PHP is doing this > > $str = "a"; > $str++; > > as > > $str = "a"; > $str = $str + $str; // $str now stores "aa" On my installation of PHP (4.0.4pl1, Apache 1.3.17, FreeBSD 4.2-STABLE), the above snippet results in $str storing a zero value. (Which makes sense. The numerical value of "a" is zero.) However $str = "a"; $str++; results in $str storing the value "b". It's $str = "z"; $str++; that results in "aa" being stored in $str. (This behavior was, in fact, what started the thread you replied into.) --- Mark Roedel ([EMAIL PROTECTED]) || "There cannot be a crisis next week. Systems Programmer / WebMaster || My schedule is already full." LeTourneau University ||-- Henry Kissinger -- 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] register_globals on or off?
Refer to the PHP Manual for details. http://www.php.net/manual/en/language.variables.external.php The Manual is worth to read :) (Don't forget to read FAQ also, it seems FAQ is updated recently) Regards, -- Yasuo Ohgaki ""hi"" <[EMAIL PROTECTED]> wrote in message 9acn9h$bgp$[EMAIL PROTECTED]">news:9acn9h$bgp$[EMAIL PROTECTED]... > Hi, > > Could someone explain what the following passage in php.ini means: > > You should do your best to write your scripts so that they do not require > ; register_globals to be on; Using form variables as globals can easily > lead > ; to possible security problems, if the code is not very well thought of. > > If register_globals is off, does that mean you cannot access form variables > by just referring to their name? And, if that is so, how do you pass > information from forms to your action script? > > > > -- > 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] socket functions
Did you read the Manual? >From PHP Manual = socket_set_blocking Description int socket_set_blocking (int socket descriptor, int mode) If mode is false, the given socket descriptor will be switched to non-blocking mode, and if true, it will be switched to blocking mode. This affects calls like fgets() that read from the socket. In non-blocking mode an fgets() call will always return right away while in blocking mode it will wait for data to become available on the socket. This function was previously called as set_socket_blocking() but this usage is deprecated. = There is note that says it does not work with PHP4/Win32. I may need to check BugDB to find out status of this problem. I compile with --enable-sockets, so I don't know if it available without it. Regards, -- Yasuo Ohgaki "Joseph Blythe" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Joseph Blythe wrote: > > > hello, > > > > does anyone know if set_nonblock() works, what paramaters it takes > > and what it returns? > > > > there is only one mention of it in the manual under accept_connect, > > and I can not seem to set the socket to non block?? > > > > also has anybody successfully written a way to time out a read with > > the new socket fuctions I can not get this to work eithier. > > > > any help would be appreciated, > > > > regards, > > > > joseph > > Well after no response from this list I can assume that this function is > indeed dead, I had to go back to the generic network functions to get a > non blocking socket to work and be able to wrap a loop around the socket > read to time it out after so many seconds. If anyone knows any different > please let me know. > > Regards > > Joseph > > > > > -- > 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] problems with session_register()...
Try to use $HTTP_SESSION_VARS, it may work for you. There are many number of notes in Annotated PHP Manual. Some of them may help. By the way, you don't need to serialize Array/Object for PHP4 session. Regards, -- Yasuo Ohgaki "Christian Dechery" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Why does one variable gets registered and the other don't (the order > doesn't alter anything.. I've tried)... > > > $script_total_time=(float)$total_time; > session_register("script_total_time"); > $step_times_array[$step]=$total_time; > $step_times=serialize($step_times_array); > //echo "step_times=\"$step_times\""; > session_register("step_times"); > > > after that (and there are no mentions to either of those vars after that), > these are the contents of the session-cookie: > script_total_time|d:4.8891049623489;!step_times| > > step_times simply doesn't get registered... > > BTW... the commented echo above outputs: > step_times="a:1:{s:8:"download";d:4.8891049623489;}" > > what is wrong with my code? > > > . Christian Dechery (lemming) > . http://www.tanamesa.com.br > . Gaita-L Owner / Web Developer > -- 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] APC breaking under freebsd!
I don't use FreeBSD, so how about try to ask in apc mailing list? You may get better support with APC mailing list. -- from APC home page-- Join the APC mailing list, send an e-mail message with 'subscribe' as the subject to [EMAIL PROTECTED] For other readers, APC now support encoding script (well the author uses term "compile", refer to README.compiler) like Zend Encoder. APC is getting better and better :) Regards, -- Yasuo Ohgaki "Dan Phoenix" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Trying to enable apc under freebsd php. Running into problems compiling it > right into apache. > > gcc -I. -I/usr/home/dphoenix/freebsd/php-4.0.4pl1/ext/apc > -I/usr/home/dphoenix/freebsd/php-4.0.4pl1/main > -I/usr/home/dphoenix/freebsd/php-4.0.4pl1 > -I/usr/home/dphoenix/freebsd/apache_1.3.19/src/include > -I/usr/home/dphoenix/freebsd/apache_1.3.19/src/os/unix > -I/usr/home/dphoenix/freebsd/php-4.0.4pl1/Zend -I/usr/local/curl/include > -I/usr/local/include/freetype -I/usr/local/gd -I/usr/local/mysql/include > -I/usr/home/dphoenix/freebsd/php-4.0.4pl1/ext/xml/expat/xmltok > -I/usr/home/dphoenix/freebsd/php-4.0.4pl1/ext/xml/expat/xmlparse > -I/usr/home/dphoenix/freebsd/php-4.0.4pl1/TSRM -DXML_BYTE_ORDER=12 -O2 > -c apc_sem.c && touch apc_sem.lo > apc_sem.c:33: redefinition of `union semun' > *** Error code 1 > > any ideas? > > trying DSO method returns this > > [root@frodo apc]# phpize > aclocal: not found > autoconf: Undefined macros: > configure.in:43:AC_PROG_LIBTOOL > You should add the contents of `/usr/local/share/aclocal/libtool.m4' to > `aclocal.m4'. > [root@frodo apc]# > > very interestingnot sure how to proceed at this point. > as it is i had to cd into ports collection to install autoconf for this > apc thing. Any ideas would be great. > > > > -- > Dan > > +--+ > | BRAVENET WEB SERVICES | > | [EMAIL PROTECTED]| > | make installworld| > | ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail | > | ln -s /var/qmail/bin/newaliases /usr/sbin/newaliases | > +__+ > > > > -- > 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] file upload question
Yes. Refer to PHP Manual. There is description for that. -- Yasuo Ohgaki "Joe Stump" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm in the habit of putting all my form variables into an array (ie: > ) so > that I have a nice little package to pass to functions. My question is can you > put files into those as well? If so how does it handle the $file_name and > $file_size variables PHP creates? > > --Joe > > > > /**\ > *Joe Stump - PHP/SQL/HTML Developer * > * http://www.care2.com - http://www.miester.org - http://gtk.php-coder.net * > * "Better to double your money on mediocrity than lose it all on a dream." * > \**/ > > -- > 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] sockets (long)
set_nonblock() is in PHP C source, but not in the PHP Manual. May be it's dead? It seems it take one parameter (file descriptor), let us know if it works. I might want to use it in the future :) >From socket.c 529 /* {{{ proto bool set_nonblock(int fd) 530Sets nonblocking mode for file descriptor fd */ 531 PHP_FUNCTION(set_nonblock) 532 { 533 zval **fd; 534 int ret; 535 536 if (ZEND_NUM_ARGS() != 1 || 537 zend_get_parameters_ex(1, &fd) == FAILURE) { 538 WRONG_PARAM_COUNT; 539 } 540 convert_to_long_ex(fd); 541 542 ret = fcntl(Z_LVAL_PP(fd), F_SETFL, O_NONBLOCK); 543 544 RETURN_LONG(((ret < 0) ? -errno : ret)); 545 } 546 /* }}} */ Hope this helps. -- Yasuo Ohgaki "Joseph Blythe" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Plutarck wrote: > > > Very recently (a few days at most ago) someone was complaining about the > > problem you are having. > > > > According to them they can't get the socket function to accept socket > > nonblocking. > > > > It would seem that the function is broken, so you can't set nonblocking to a > > valid value at the current time. > > > > Hopefully it will be fixed in 4.0.5, due out in a few days. > > > It was probaly me as I posted a message about this a few days ago ;-) > > I really hope that it does get fixed in 4.0.5 > > Oh well as they say !@#$ happens, > > Thanks, > > Joseph > > > > -- > 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] can I detect html email capability?
You cannot detect directly, but you can do 1) Send e-mail ask user to reply 2) Get mailer header from e-mail, then decided if it support HTML e-mail However, I think it would be more appropriate to let the user choose mail format via. web site. It's just a matter of writing a URL in mail. Regards, -- Yasuo Ohgaki ""Matthew Delmarter"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello all, > > Out of curiosity I am looking at what can be done with email marketing. I am > currently looking at a solution that apparently can "send a query to an > email address to detect if it can receive images. If so it sends an HTML > email, otherwise just text." (quote) > > Does this sound correct? I never knew such things could be done. If so, can > it be done with PHP? > > I look forward to your reply... > > Regards, > > Matthew Delmarter > > > -- > 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] foreach ?!
> if ($mem_obj->home_email1!=='') > $vars["home_email1"] = " value=$mem_obj->home_email1>"; I think I don't understand what you really want to do. Anyway what's $mem_obj? Does $mem_obj->home_email1 have $HTTP_POST_VARS['home_email1'] before you test it? Sound like this is the cause to me. Regards, -- Yasuo Ohgaki ""TV Karthick Kumar"" <[EMAIL PROTECTED]> wrote in message 031001c0bde4$f1638c00$[EMAIL PROTECTED]">news:031001c0bde4$f1638c00$[EMAIL PROTECTED]... > Hi List.. > > I have the following code, which actually sets up the value of of the > hidden variable and passes onto the next page and there I manipulate the > data and send them emails. > > But passing the hidden variables depends upon the mem_id, that is the > hidden variable has to be passed for 'n' number of records. For example, if > I have two records then the I am checking the first record and finding out > the available email id (the various chances are home_email1, home_email2, > work_email1, work_email2 etc. and I have max. 4 email addresses in each > record) and passing it as an hidden variable to the next page. Here it's > very important to note that, at times, 4 emails will be available or 4 > emails will NOT be available (it'll be empty) and sometimes only 1 or 2 will > be available. There are possibilities like this. > > Now, as I have this code in place, what's happening is : when I pass any > of the email address of the first record, it's getting passed, where the > home_email1 is available and then when I pass any of the email address of > the second record, it's getting passed - BUT it's getting overwritten and I > have the value of the second record and I lost the first one. > > What I want is - I want the hidden variables to be passed and kept for > the number of records selected and then I would use pass them as hidden > variables and use it in the next page. I know that I have to use Arrays for > this, but what's next ?. > > Here's my code: > > if ($mem_obj->home_email1!=='') > $vars["home_email1"] = " value=$mem_obj->home_email1>"; > > if ($mem_obj->home_email2!=='') > $vars["home_email2"] = " value=$mem_obj->home_email2>"; > > if ($mem_obj->work_email1!=='') > $vars["work_email1"] = " value=$mem_obj->work_email1>"; > > if ($mem_obj->work_email2!=='') > $vars["work_email2"] = " value=$mem_obj->work_email2>"; > > Any help is much useful to me. > > Thanks in advance. > > ~ Karthick > > > > -- > 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] array speed
Just make sure you use foreach() instead of while() when you loop many times. foreach() is roughly 50% faster when I benched them. And never pass type other than object or array. foreach() simply dose not work with error message. (i.e. You will get 'server not found or dns error' or empty output) Regards, -- Yasuo Ohgaki "Kurth Bemis" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > i'm concerned about the speed at which httpd (with php4.0.1pl1 compiles in > as a static mod) can "chew" through a 350 element 2d array. Can anyone > offer any information? > > ~kurth > > > -- > 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] Nested for() loops? -> Now Multi Dimension Arrays
Simple to fix it. You just need to resolve ambiguity with {}. > $res = $i * $j; > $target_array[$i][$j] = $res; > print("result = $target_array[$i][$j] "); print("result = {$target_array[$i][$j]} "); Regards, -- Yasuo Ohgaki <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Joe Stump wrote: > > > > A copy and paste into foo.php and then a php -q foo.php yielded results for > > me. > > Yeah, it's giving me results too today. I don't know what went wrong > yesterday. > > To extend my question, I'm trying to work with multidimensional arrays. > > For example, I would like to do this: > > error_reporting(E_ALL); > > $target_array = array(); > > echo "starting "; > > for( $i=0; $i<5; $i++ ) >for( $j=0; $j<5; $j++ ) >{ > $res = $i * $j; > $target_array[$i][$j] = $res; > print("result = $target_array[$i][$j] "); print("result = {$target_array[$i][$j]} "); >} > echo "done"; > ?> > > And this is my result today: > starting > result = Array[0] > result = Array[1] > result = Array[2] > result = Array[3] > result = Array[4] > result = Array[0] > result = Array[1] > result = Array[2] > result = Array[3] > result = Array[4] > result = Array[0] > result = Array[1] > result = Array[2] > result = Array[3] > result = Array[4] > result = Array[0] > result = Array[1] > result = Array[2] > result = Array[3] > result = Array[4] > result = Array[0] > result = Array[1] > result = Array[2] > result = Array[3] > result = Array[4] > done > > My thinking is that PHP ought to be like C when doing simple stuff like > this. > I must have something wrong with the declaration of the array. > > How do you declare a multidimensional array??!!?? > How do you work with it then??? > > Thanks in advance!! > > John > > -- > 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] HELP!! comparing arrays
How about post some code that does not work as expected? (Simpler code is better) Regards, -- Yasuo Ohgaki ""paula"" <[EMAIL PROTECTED]> wrote in message 001501c0bf29$2f35e740$0f01a8c0@pau">news:001501c0bf29$2f35e740$0f01a8c0@pau... Hi- I'm new here and have this problem that's DRIVING ME CRAZY. I have two arrays as a result of two queries that I have to compare. Supose this two tables: This is my today table showing my actual stock (2001-04): t-shirtblue L jacket blackM sweater red S shirt whiteM Then I have a future stock table, it's showing changes for the next month (2001-05). t-shirt red L sweatergreenS If the user selects in a menu 2001-04 the orginal first table should display. But if user selects 2001-05 this should be display: t-shirt red L jacket blackM sweatergreen S shirt whiteM This has to work with PHP3 and using PHPLIB templates. I've tried EVERYTHING! Nested whiles, nested for, just E V E R Y T H I N G . I don't know what else to do and my nerves are about to kill me. PLEASE! ANY HELP IS WELCOME!! thank you people, /paula -- 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] Extension_dir in php.ini?
If you are talking about PHP on UNIX, I think the default is /usr/local/lib/php/extensions/no-debug-non-zts- For windows, I don't know. Regards, -- Yasuo Ohgaki "Lindsay Adams" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Okay, you may call me an idiot all you want, > But if the extension_dir= ./ > In php.ini > And PHP is loaded as an apxs module in apache, then just where does ./ point > to? > > ServerRoot? > DocumentRoot? > Some other directory? > > Having a major brain in getting my .so into the right place. > > Also, how can I compile libpdf.so (version 3) to work with PHP4.0.4pl1? > > If I have to go backwards in PHP (say to 4.0.3pl1) to be able to get PDF > support compiled into PHP (because it just isn't working for me on 4.0.4pl1) > then somebody please tell me that. > > I have read through all the suggestions in the list archive > I have downloaded the latest versions of files pertaining to pdf and > 4.0.4pl1 from cvs.php.net and yet, I still get the problem, during > ./configure, of it complaing about my version 3 pdflib, not being version 3 > because it can't find pdf_show_boxed(). > > I _NEED_ pdf support, so any help in choosing the right set of versions > would be greatly helpful! > > Thanks gang! > > Ps- yes, I also changed ext/crypt.c php_srand... On line 150(or thereabouts) > to make php work at all on my box (Qube2) > > > -- > 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] adding methods to classes
""Dean Hall"" <[EMAIL PROTECTED]> wrote in message 9ao8dc$s6t$[EMAIL PROTECTED]">news:9ao8dc$s6t$[EMAIL PROTECTED]... > Stupid me. Just extend the class. > > Now the real question: > > Is there any dynamic binding in PHP? You can do simlar thing with Variable Function. For example. class foo { var $function_name; function foo($fname) {$this->function_name = $fname; $this->$function_name;} function a() {echo 'a';} function b() {echo 'b';} } foo('b'); // calls foo::b() >Can I override a method in a subclass? Yes. -- Yasuo Ohgaki > > Dean. > > > > > -- > 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] new php.net look
Read FAQ. Description is in there. Regards, -- Yasuo Ohgaki "jaxon" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > The older look was neat to show off to people re: pop up menus, etc., > > but this is > > a real speed demon, and will be much more useful for searching around. > > Speaking of which - there used to be a little HOWTO for doing those kind of > popups - does anyone know where it has gone to? > > regards, > jaxon > > > > > > > Thanks again! > > > > > > > -- > 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] "configure" not doing anything and file not found
There is compile instruction at www.php4win.de I think you need CygWin and VC to compile windows version of PHP. You may get better answer on php-windows list. Regards, -- Yasuo Ohgaki ""Plutarck"" <[EMAIL PROTECTED]> wrote in message 9aor0h$uo0$[EMAIL PROTECTED]">news:9aor0h$uo0$[EMAIL PROTECTED]... > I'm trying to compile PHP version 4.0.4pl1 (module and/or cgi) on my windows > 98 system using Microsoft Visuall C++, and I have two "little" problems. > > For one thing, doing anything like this in my DOS prompt: > > ./configure > ./configure --with-mysql > configure > /configure > > et al > > ...returns: > Bad command or file name. > > I've heard that means that "Dev Tools" aren't on my system, which is why > "make" or "make install" didn't do anything. But I installed cygwin > utilities and UnxUtils. I also have Active Perl installed on my system. > > So what do I need to do to get such commands to do what they are supposed > to? > > > And I'm not sure if this is related, but when I try to compile the source > code as an apache module I get: > > fatal error C1083: Cannot open source file: > 'C:\php-4.0.4pl1\Zend\zend_language_scanner.cpp': No such file or directory > > > Seing as how there are no .cpp files in the source code from php.net, I > imagine it would be hard to find that file ;) > > I'm using this article for instruction: > http://www.mm4.de/php4win/article.php3?id=2&language=en > > > -- > Plutarck > Should be working on something... > ...but forgot what it was. > > > > -- > 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] how much data can a session store?
It depends how you are going to store session data what you have. Assuming you have large enough H/W. If you are using 'file', you probably could store up to file size max on your OS. If you are using 'mm', relatively small amount of data will be able to stored. It's depends on how much shared memory can allocate. It's OS dependent. If you are using 'user', depends on your custom session handler and underlying storage. If you have large session data, it would slows things down even with relatively small number of active users unless you do something. (Session data is read and written whenever user access pages) Regards, -- Yasuo Ohgaki ""Tobias Talltorp"" <[EMAIL PROTECTED]> wrote in message 9as098$lup$[EMAIL PROTECTED]">news:9as098$lup$[EMAIL PROTECTED]... > Just a quick question... > > How much data can a session store? > The reason I$B%((Bm asking is that I have developed a news system and want a > "preview"-thingy and for this I want to store the data in a session. The > main-content can be very large. > > Thanks, > // Tobias > > > > -- > 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] Encoding
Take a look at www.zend.com for Zend Encoder or http://apc.communityconnect.com/ and get 1.0.9 source. Look for file name like README.Compiler. Regards, -- Yasuo Ohgaki ""Kevin Pate"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am creating a PHP/Apache/PostgreSQL project for a client and I want to > keep them from "prying" at my source code. How can I encode or compile the > PHP source code into a binary format? > > Kevin Pate > RHCE / MCSE / CCNA > Pate Consulting > [EMAIL PROTECTED] > www.pateconsulting.com > main 832.237.5920 > fax 832.237.5924 > mobile 713.823.8845 > pager 713.608.3936 > > > -- > 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] huge PHP file, hardcore processing
IIS ISAPI(PHP4.0.4pl1 and PHP4.0.5RC1) does not work well for me and too many problems. So I switched to Apache. However, ob_implicit_flush() seems slows things down on W2K/Apache/PHP4.0.4RC1 also. (ob_implicit_flush() may slow things down, but it's more apparent than my Linux/Apache box) You may get better result on UNIX/Apache. Someone mentioned he/she does not have any problem with W2K/IIS ISAPI/PHP4.0.3pl1 with more than 250,000 hits/day. You may want to down grade your PHP to 4.0.3pl1. Regards, -- Yasuo Ohgaki "Christian Dechery" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a huge (at least I think, for a script anyway) PHP script... it is > over 1.000 lines of code. > And it updates (do an entire DELETE-ALL / LOAD-ALL) an SQL Server database > (over 35MB). It runs for over an hour (sometimes 2hs)... and I divided it > into steps... so each step is a function in the script that when is over > calls a javascript function that reloads the script to the next step. > > I was wondering if this is enough to get a good 'memory-cleaning'. Or it > would be better to have lots of files (in total, there are 27 separate > steps). I began noticing some processing slowness after the first 35 > mins... it get's 'tired'. The script starts running and with > ob_implicit_flush() on, the output is flushed almost at real time... but > after 10 or 12 steps it starts to get slow and do NO FLUSHING at all... > only showing the entire output at once after the whole step has ended. > Should I split it into files? Is because it's running on (eek!) IIS? Maybe > the size of the file is getting in the way? > > Can someone help me out? > > Ah... one other thing. Has anybody experienced very weird behaviours of PHP > with IIS? Sometimes I press 'stop' at the browser but PHP is still running. > I can see it eating up memory in the TaskManager. And it won't stop until I > kill it. And the most weird part is, as soon as I call a script (any > script) PHP returns to the TaskManager with the same amount of memory it > had when it was running tha massive script mentioned above. Does IIS really > suck, or is there something very wrong with my config? > > . Christian Dechery (lemming) > . http://www.tanamesa.com.br > . Gaita-L Owner / Web Developer > > > -- > 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] while loop
> > On Tue, 10 Apr 2001 15:16, Zeus wrote: > > > > $query = mysql_query("some SQL here"); > > > > while ($row = mysql_fetch_array($query)) { This line is the same as do while( ($row = mysql_fetch_array($query)) == TRUE) { Common coding style in C/C++ and PHP :) Regards, -- Yasuo Ohgaki ""Zeus"" <[EMAIL PROTECTED]> wrote in message 00b601c0c183$55647f60$4f7618d2@zeus">news:00b601c0c183$55647f60$4f7618d2@zeus... > Isn't the '=' operator suppose to be used for assigning and not for > evaluation. > > I thought '==' should be used in this context? > > Zeus > - Original Message - > From: David Robley <[EMAIL PROTECTED]> > To: Zeus <[EMAIL PROTECTED]>; Michael Hall <[EMAIL PROTECTED]>; Jacky > <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Tuesday, 10 April, 2001 1:53 PM > Subject: Re: [PHP] while loop > > > > On Tue, 10 Apr 2001 15:16, Zeus wrote: > > > > $query = mysql_query("some SQL here"); > > > > while ($row = mysql_fetch_array($query)) { > > > > do stuff; > > > > } > > > > > > Isn't this suppose to be an infinite loop? > > > > > > while ($row is assigned to mysql_fetch_array($query)) { > > > do stuffs; > > > } > > > > > > someone correct me if I'm wrong? > > > > > > Zeus > > > > Consider yourself corrected :-) mysql_fetch-array returns an array > > corresponding to the fetched row, or _false if there are no more rows_ > > > > So as soon as there are no more rows, $row = mysql_fetch_array($query) > > evaluates to false and the while exits. > > > > -- > > David Robley| WEBMASTER & Mail List Admin > > RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ > > AusEinet| http://auseinet.flinders.edu.au/ > > Flinders University, ADELAIDE, SOUTH AUSTRALIA > > > -- > 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] php -> html
It's not simple with PHP3. (I don't know better way to do this with PHP3. You can make a wrapper function for output functions and store output to files. If you must use PHP3) If you need to do this a lot, upgrade to PHP4. It's easy with PHP4, since PHP4 supports output buffering functions. ob_start(), ob_get_contents(), etc. Much easier, much faster. Regards, -- Yasuo Ohgaki ""ewoong"" <[EMAIL PROTECTED]> wrote in message 9auilj$9st$[EMAIL PROTECTED]">news:9auilj$9st$[EMAIL PROTECTED]... > Hello.. ^^ > > I am trying to save results for php files. > > for example.. > > I create abc.php3 following as.. > > # abc.php3 > >echo ("hello"); > ?> > > If I run abc.php3 , the results is .. > >hello. > > > So.. > > How can I this results to save file. > > # abc.html > >hello > > > > -- > 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] register_shutdown_function - uses for
For another example use of shutdown function. Take a look at how PEAR destructor is implemented. It's using shutdown function. Regards, -- Yasuo Ohgaki ""Greig, Euan"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I was hoping that I could use this function to enable me to finish scripts tidily when they time out or are aborted by the user. eg display the message "script timed out". However this will not work as no output is allowed in the shutdown function. I can see other ways to do what I want (but suggestions would always be welcome) but the real point of this email is this: what sort of thing would you use register_shutdown_function to achieve? > > Euan Greig > Technical Consultant > BRANN DATA > [EMAIL PROTECTED] > 01285 645997 > > > > > > ** > Any opinions expressed in this email are those of the individual and > not necessarily the Company. This email and any files transmitted with > it, including replies and forwarded copies (which may contain alterations) > subsequently transmitted from the Company, are confidential and solely for > the use of the intended recipient. If you are not the intended recipient > or the person responsible for delivering to the intended recipient, be > advised that you have received this email in error and that any use is > strictly prohibited. > > ** > > -- > 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] Developing new PHP modules
If you take a look at PHP source code, you'll find some description for making new modules. I think you need to read source to understand how to code a new module. Not much descriptions, but PHP manual has section for it, too. I use emacs to browse C/C++ sources, but you can use lxr.php.net or cvs.php.net to browse PHP source. Regards, -- Yasuo Ohgaki "Carlos Serrão" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all, > > I don't know if I'm in the correct mailling list or not, but > could someone provide me with some information about the developement > of new PHP modules (documentation, source-code, ...) ? > > Thanks in advance. > > Best regards, > > _ > Carlos Serrão [EMAIL PROTECTED] > http://www.carlos-serrao.com > DCTI - IS/IT DepartmentIS/IT Research and Development > ADETTI/ISCTE - Av.Forcas Armadas 1600-082 LISBOA Portugal > Tel.: +351217903064/+351217903901 Fax: +351217935300 > > > -- > 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] assignment operator works for comparison??
> if($shiny = 0) This line is the same as if ((shiny = 0) == TRUE) It's common error with PHP and C. You could make use of this like if ($fp = fopen($filename,'r')) since this is the same as if (($fp = fopen($filename,'r')) == TRUE) code after this line is executed when fopen() success to open file. Regards, -- Yasuo Ohgaki ""Dan"" <[EMAIL PROTECTED]> wrote in message 9avrti$olc$[EMAIL PROTECTED]">news:9avrti$olc$[EMAIL PROTECTED]... > This confused me for awhile, because the single equal sign seemed to work > for comparison, but created inexplicable errors in my programs. It seems > strange to me that a successful variable value assignment does not return > true. > > example: > > > $shiny = 1; > if($shiny = 0){ echo("This wont print"); } > echo( $shiny ); //this will return 0 > > ?> > > --Dan > > > > -- > 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] What is the syntax to get the HTTP_ENV_VARS?
Did you read PHP Manual? If you don't read online manual, I suggest to read it. Annotated manual is very useful. http://www.php.net/manual/en/language.variables.external.php Regards, -- Yasuo Ohgaki "Phil Labonte" <[EMAIL PROTECTED]> wrote in message 1B5C7FA9D60DD511ABEF00508BFDEFDC106A@EXCHANGE">news:1B5C7FA9D60DD511ABEF00508BFDEFDC106A@EXCHANGE... > > I want to get the hostname from the browsers that access my site. > > What is the syntax to use with the HTTP_ENV_VARS? > > mysql_query("INSERT INTO weblog(ip, hostname, port, time) " . " \ > VALUES('$REMOTE_ADDR', '$HTTP_ENV_VARS', '$REMOTE_PORT', \ > '$time')"); > > 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 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] foreach vs. while(list() = each())
One apparent problem with foreach() is it can misbehave code as follows. (4.0.4pl1, 4.0.5RC6) function foo($a) { foreach ($a[0] as $k => $v) { echo $k.$v; } } $a = 'abc'; foo($a); You'll get 'server not found' or browser waiting forever with this code. (If you don't, please let me know) String can be accessed like array, but foreach does not handle invalid parameter well. While() does not misbehave with equivalent code. Regards, -- Yasuo Ohgaki "Joe Stump" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > What are the differences in these? I know with while() you have to reset() the > array afterwards, but foreach() you don't. Also foreach() appears to be quite > a bit faster. > > My main question is there ANY difference in how these two loop through the > array. > > --Joe > > > > /**\ > *Joe Stump - PHP/SQL/HTML Developer * > * http://www.care2.com - http://www.miester.org - http://gtk.php-coder.net * > * "Better to double your money on mediocrity than lose it all on a dream." * > \**/ > > -- > 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] checkdnsrr() in PHP 4.0.5rc1
If you are using Windows, no. (resolver does not work under windows) Regards, -- Yasuo Ohgaki "Jochen Kaechelin" <[EMAIL PROTECTED]> wrote in message NFBBLHGFAKNLFNPOHMPHCEENCGAA.jk@intern">news:NFBBLHGFAKNLFNPOHMPHCEENCGAA.jk@intern... > What about this error: > > checkdnsrr() is not supported in this PHP build > > Any answers? > > -- > Jochen Kaechelin - Ihr WEBberater > Stuttgarter Str.3, D-73033 Goeppingen > Tel. 07161-92 95 94, Fax 07161-92 95 98 > http://www.wa-p.de, mailto:[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] install LONG_MAX
Do you install Linux kernel source? and have correct symlink for kernel headers? Sounds like it's the cause to me. Regards, -- Yasuo Ohgaki ""Plamen Slavov"" <[EMAIL PROTECTED]> wrote in message 002a01c0c276$32b005e0$98d209c0@plamensl2">news:002a01c0c276$32b005e0$98d209c0@plamensl2... > Hi all, > i try to install e php-4.0.4pl1 on a redhat 6.0 with apache_1.3.19, > but when i try to make php i get the following error message: > > make[1]: Entering directory `/home/plamen/www/php-4.0.4pl1/Zend' > /bin/sh ../libtool --silent --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../main >-DXML_BYTE_ORDER=12 -g -O2 -c zend_hash.c > zend_hash.c: In function `zend_hash_add_or_update': > zend_hash.c:257: `LONG_MAX' undeclared (first use in this function) > zend_hash.c:257: (Each undeclared identifier is reported only once > zend_hash.c:257: for each function it appears in.) > zend_hash.c: In function `zend_hash_del_key_or_index': > zend_hash.c:502: `LONG_MAX' undeclared (first use in this function) > zend_hash.c: In function `zend_hash_find': > zend_hash.c:852: `LONG_MAX' undeclared (first use in this function) > zend_hash.c: In function `zend_hash_exists': > zend_hash.c:902: `LONG_MAX' undeclared (first use in this function) > make[1]: *** [zend_hash.lo] Error 1 > make[1]: Leaving directory `/home/plamen/www/php-4.0.4pl1/Zend' > make: *** [all-recursive] Error 1 > > Does someone have any ideas how to fix this? > i do not know where the problem is > > > -- > 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] Database result set question
Most PostgreSQL functions are wrapper functions for libpq. Reading documents about libpq will help. Answer to your question is, it does not read all data into memory. I think most DB doesn't do that also. Data will be buffered in PostgreSQL backend, size is depends on your configuration. I'm not sure if it buffers on client side. Regards, -- Yasuo Ohgaki "Morgan Curley" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Just out of curiosity, can anyone explain the mechanics behind accessing a > database query result set. > ie > $result_id = pg_execute( 'select * from my_table' ); > > when I call loop through pg_fetch_row( $result_id, $rom_num ) or > pg_fetch_object( $result_id, $rom_num ) > has php read the entire result set into memory( say the result set has > 10,000 records ), cached a fixed number of records in memory or does it > simply have a record_set_pointer of some sort that tells the DB where to > fetch the next asked for record from. > > This is probably a DB engine setting but I am curious what the process is. > > Thanks, > Morgan > > > -- > 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] System V Semaphores
It means your OS does not allocate enough resources. Linux: $ ipcs -l -s FreeBSD: $ ipcs -S Refer to your OS manual to change them. Regards, -- Yasuo Ohgaki ""Philip Murray"" <[EMAIL PROTECTED]> wrote in message 002e01c0c20a$b17e9ba0$0201a8c0@sparlak">news:002e01c0c20a$b17e9ba0$0201a8c0@sparlak... > Hi, > > I've been trying to use SystemV Semaphores as a kind of locking system in a > webpage, but after a few hours I get this message: > > Warning: semget() failed for key 0x0: No space left on device in > /1/home//admin/htdocs/prop/lock.php on line 8 > > Warning: 0 is not a SysV semaphore index in > /1/home//admin/htdocs/prop/lock.php on line 19 > > Couldn't grab lock! > > It isn't disk space, and there's plenty of free memory. So how do I fix it > and stop it doing it in the future? > > Apart from this it seems to work fine. I've attached some sample code which > is pretty much exactly what I'm doing. > > > Cheers > > > -- > 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] is_null
It's supported from 4.0.4, I think. Regards, -- Yasuo Ohgaki "Jennifer" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I wanted to use is_null, but it isn't available in my version > (4.0B2) > > What would be an equivalent? I'm fairly new to PHP. > > I was using isset, but sometimes it is set to Null. > > Null values are unacceptable, but zero is a perfectly acceptable > value for what I want. > > Jennifer > > -- > 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] ROUND inconsistency
MySQL is returning floor. (I'm not a MySQL heavy user, though :) PHP's result is correct for its function name, I think. If MySQL returns floor for round(), how about use floor() in PHP? Regards, -- Yasuo Ohgaki "Lee Howard" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Using MySQL 3.23.32 on RedHat Linux 7.0... > > MySQL's ROUND function rounds 5 up when the preceding digit is odd and down > when the preceding digit is even. > > mysql> select round(1.5); > ++ > | round(1.5) | > ++ > | 2 | > ++ > 1 row in set (0.00 sec) > > mysql> select round(2.5); > ++ > | round(2.5) | > ++ > | 2 | > ++ > 1 row in set (0.00 sec) > > I think that this is technically the correct behavior, scientifically, > anyway. However, this is not the common "lay-man's" method of rounding, > which is to always round 5 up, as exhibited by PHP-4.0.4pl1... > > > > > > Apache 1.3.14 output for this is: > > 2 > 3 > > This discrepancy causes a difficulty in programming PHP and MySQL together, > for example, because all of the rounding must be done in either PHP or > MySQL but not both partially unless you want conflicting data. > > I would like to see MySQL ROUND() syntax expand to be ROUND(X,D,M) where > optional M value indicates the method of rounding, the default being the > current method. > > I would also like to see PHP round() syntax expand to be > double round (double val [, int precision] [, char method]) > where the optional method value indicates the method of rounding, the > default being the current method. > > Thanks. > > Lee Howard > > > -- > 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] ROUND inconsistency
Correction, MySQL is not returning floor, since it returns 2 for round(1.5). - I didn't see it. MySQL should not return 2 for round(2.5), but it should return 3. I think it's MySQL bug. How about ask in MySQL mailing list? -- Yasuo Ohgaki ""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message 9b60qv$v9b$[EMAIL PROTECTED]">news:9b60qv$v9b$[EMAIL PROTECTED]... > MySQL is returning floor. (I'm not a MySQL heavy user, though :) > > PHP's result is correct for its function name, I think. > If MySQL returns floor for round(), how about use floor() in PHP? > > Regards, > -- > Yasuo Ohgaki > > > "Lee Howard" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Using MySQL 3.23.32 on RedHat Linux 7.0... > > > > MySQL's ROUND function rounds 5 up when the preceding digit is odd and down > > when the preceding digit is even. > > > > mysql> select round(1.5); > > ++ > > | round(1.5) | > > ++ > > | 2 | > > ++ > > 1 row in set (0.00 sec) > > > > mysql> select round(2.5); > > ++ > > | round(2.5) | > > ++ > > | 2 | > > ++ > > 1 row in set (0.00 sec) > > > > I think that this is technically the correct behavior, scientifically, > > anyway. However, this is not the common "lay-man's" method of rounding, > > which is to always round 5 up, as exhibited by PHP-4.0.4pl1... > > > > > > > > > > > > Apache 1.3.14 output for this is: > > > > 2 > > 3 > > > > This discrepancy causes a difficulty in programming PHP and MySQL together, > > for example, because all of the rounding must be done in either PHP or > > MySQL but not both partially unless you want conflicting data. > > > > I would like to see MySQL ROUND() syntax expand to be ROUND(X,D,M) where > > optional M value indicates the method of rounding, the default being the > > current method. > > > > I would also like to see PHP round() syntax expand to be > > double round (double val [, int precision] [, char method]) > > where the optional method value indicates the method of rounding, the > > default being the current method. > > > > Thanks. > > > > Lee Howard > > > > > > -- > > 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]
Re: [PHP] return parse error
"or" requires expression. "return" is not a expression. That why you get parse error. Regards, -- Yasuo Ohgaki ""Peter Harkins"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > This generates a parse error: > mysql_connect("localhost", "root", "rootpw") or return("bar"); > > But all the following work fine: > mysql_connect("localhost", "root", "rootpw") or die("bar"); > > mysql_connect("localhost", "root", "rootpw") or print("bar"); > > if (!mysql_connect("localhost", "root", "rootpw")) { > return("bar"); > } > > Why? mysql_connect returns false on failure either way... I notice die > > and print are functions but return seems not to be, it doesn't have a > 'function.[name].html' file in the manual. *scratches head* I can't see > > any reason in the manual for this behavior. Am I missing something? > > PHP is running on Linux 2.2.19 and identifies as '4.0.2'. phpinfo also > says: > './configure' '--with-mysql' '--with-apache=../apache_1.3.12' '-- > enable-track-vars' '--disable-debug' '--disable-xml' > > > > > > -- > 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] return parse error
Small additional info about "expression" and "language construct". Expression is anything that have value. Therefore, if language construct returns value => valid expression. Following code works: ($val) ? include('abc.php') : include('def.php'); Following code does NOT work: ($val) ? echo('abc') : echo('def'); both "include" and "echo" is language construct, but "include" returns value. Thus "include" is valid expression while "echo" is not. "return" does not return value. (It returns value to caller, but not return value for expression context) User defined functions always return value, even if there is no "return" statement => functions are always valid expression. Hope this helps. -- Yasuo Ohgaki "Jeffrey Paul" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > At 03:56 AM 4/13/2001, Peter Harkins wrote: > > This generates a parse error: > > mysql_connect("localhost", "root", "rootpw") or > > return("bar"); > > > > But all the following work fine: > > mysql_connect("localhost", "root", "rootpw") or die("bar"); > > > > mysql_connect("localhost", "root", "rootpw") or > > print("bar"); > > > > if (!mysql_connect("localhost", "root", "rootpw")) { > > return("bar"); > > } > > > > Why? mysql_connect returns false on failure either way... I > > notice die > > > return isn't a function but a language construct. This is why the third > working line with the curlybraces works, and without them it doesn't. > > include() is a language construct too. the particulars of using language > constructs (like return() and include()) with control structure syntax are > explained on the page for include(). > > http://us2.php.net/manual/en/function.include.php > > -j (aka sneak) > > > > -- > [EMAIL PROTECTED] - 0x514DB5CB > he who lives these words shall not taste death > becoming nothing yeah yeah > forever liquid cool > > > -- > 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] session
I guess you are using "files" session module. If you take a look at note in PHP Manual, there is my note why your session files are not deleted. (See Session reference) Hope this helps. -- Yasuo Ohgaki ""E K L"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, >Is there anybody can help to do this: > >My web site has 3 pages :a.php, b.php and c.php. I want to capture the > session in those 3 pages. Without an id, visitor can't view my page. When > visitors leave the site, thier session should be removed. > >The problem is how to remove the session. I have tried several function > of session such as session_destroy(), session_unregister. But, i still faild > to clear the session. What should i do? > > For ur information, the session.cookie_lifetime is set to 0 in my server. > Should i change the value? If yes, then how to do it? Please give me your > hands, thank you > > E K > _ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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 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 without a webserver
You can use PHP for many purposes. You can use PHP - General scripting language. (Use GCI binary with -q option. You may need other setting to meet your purpose) - GUI Application development (USE PHP-GTK) Refer to following link for PHP-GTK http://gtk.php.net/ There is compiler (I don't use it so I'm not sure if it is a really a compiler or not) for PHP that works under Windows. Look for my post in mailing list archive for URL. (I think you can find, if you search "Compiler" as keyword.) Regards, -- Yasuo Ohgaki ""Plutarck"" <[EMAIL PROTECTED]> wrote in message 9b9qu0$786$[EMAIL PROTECTED]">news:9b9qu0$786$[EMAIL PROTECTED]... > I've heard much about how PHP is far more than just a language for web > programming, and I agree. I agree enough that I would like to actually try > it. I'd like to use PHP scripting in a C/C++ program that doesn't need a > webserver as an intermediary. I basically want to use PHP in a > standalone/TCP-IP program rather than having to build a whole "IMF-esk" > hairball myself. > > > Are there any articles or documentation which focuses, or at least would > give me useful information, on how such a task would be accomplished? I'm > looking at the API documentation itself which will be helpful, but is there > anything a little more "pointed" than that? > > I'd love to see PHP grow an arm of offline scripting. It would just be > _perfect_ for compiling high-level developer-friendly scripts into a format > usable for 3D real-time environment manipulation, for instance. > > > > -- > Plutarck > Should be working on something... > ...but forgot what it was. > > > > > > -- > 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] unregister part of array in session
You are registered $array as session, You need to unset() element. I think it should work. Regards, -- Yasuo Ohgaki ""Tobias Talltorp"" <[EMAIL PROTECTED]> wrote in message 9bd8un$kqt$[EMAIL PROTECTED]">news:9bd8un$kqt$[EMAIL PROTECTED]... > I know how to unset a specific value in an ordinary array: > unset ($array["one"]); > How do I do this if my array is in a session? > > Here is my code: > session_start(); > $array = array(one=> "number one", two=> "Number two", three=> "Number > three"); > session_register("array"); > ?> > > I tried this... Didn't work: > session_start(); > session_unregister("array[one]"); > ?> > > Thanks, > // Tobias Talltorp > > > > > -- > 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] unregister part of array in session
PHP4 session may not work as it should, unless you use it consistent way. i.e. Use session_(un)register() and only use globals, OR enable track_vars and disable register_globals and only use $HTTP_SESSION_VARS w/o session_(un)register(). It may work even if register_globals is on. I didn't test session module with this configuration enough. Following code works as expected on my systems (PHP4.0.4-PHP4.0.5RC1/Apache SAPI/W2K and PHP4.0.4-PHP4.0.4RC6/Apache SAPI/Linux at least) === code begin === Session Test 1, 'b'=>2 ); print_r($HTTP_SESSION_VARS); } elseif (isset($HTTP_GET_VARS['b'])) { unset($HTTP_SESSION_VARS['a']['a']); print_r($HTTP_SESSION_VARS); } else { print_r($HTTP_SESSION_VARS); } ?> code end It should work as expected when you enable track_vars AND disable register_globals in your php.ini. The reason why there is session_register()/unregister() is there is no way for session module to know which variables are session variables. With $HTTP_SESSION_VARS, session module knows all variable in $HTTP_SESSION_VARS are session variables. So programmer does not have to use session_(un)register(). There is also known problem that $HTTP_SESSION_VARS does not work like other $HTTP_*_VARS. You will see what I mean if you write some test codes with register_globals = on. I don't know why many people use register_globals = on track_vars = off magic_quote = on Life would be much easier with register_globals = off track_vars = on magic_quote = off Hope this helps, -- Yasuo Ohgaki ""Tobias Talltorp"" <[EMAIL PROTECTED]> wrote in message 9bempj$a77$[EMAIL PROTECTED]">news:9bempj$a77$[EMAIL PROTECTED]... > I did it! > Too much work for something as simple as this though IMO. I think I will > write a function for this... > > session_start(); > $newarray = $HTTP_SESSION_VARS["array"]; > unset ($newarray["one"]); > $array = $newarray; > session_register("array"); > ?> > > Thanks, > // Tobias > > > ""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message > 9bdeag$88r$[EMAIL PROTECTED]">news:9bdeag$88r$[EMAIL PROTECTED]... > > You are registered $array as session, > > You need to unset() element. I think it should work. > > > > Regards, > > -- > > Yasuo Ohgaki > > > > > > ""Tobias Talltorp"" <[EMAIL PROTECTED]> wrote in message > > 9bd8un$kqt$[EMAIL PROTECTED]">news:9bd8un$kqt$[EMAIL PROTECTED]... > > > I know how to unset a specific value in an ordinary array: > > > unset ($array["one"]); > > > How do I do this if my array is in a session? > > > > > > Here is my code: > > > > > session_start(); > > > $array = array(one=> "number one", two=> "Number two", three=> "Number > > > three"); > > > session_register("array"); > > > ?> > > > > > > I tried this... Didn't work: > > > > > session_start(); > > > session_unregister("array[one]"); > > > ?> > > > > > > Thanks, > > > // Tobias Talltorp > > > > > > > > > > > > > > > -- > > > 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 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] is it safe to stripslashes() on all form variables?
If you strip slashes, it will make a security hole. For example, SELECT * FROM tablename WHERE name = '$name'; what if $name is \'garbage\';DROP TABLE tablename;SELECT \'something After stripslashes($name) SELECT * FROM table WHERE name = 'garbage';DROP TABLE tablename;SELECT 'something'; Regards, -- Yasuo Ohgaki ""Noah Spitzer-Williams"" <[EMAIL PROTECTED]> wrote in message 9bf7ec$m1m$[EMAIL PROTECTED]">news:9bf7ec$m1m$[EMAIL PROTECTED]... > would there be any problems caused if i used the stripslashes() function on > all posted variables from a form to eliminate sql query errors? > > - Noah > > > > -- > 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] is it safe to stripslashes() on all form variables?
If you strip slashes, it will make a security hole. For example, SELECT * FROM tablename WHERE name = '$name'; what if $name is \'garbage\';DROP TABLE tablename;SELECT \'something After stripslashes($name) SELECT * FROM table WHERE name = 'garbage';DROP TABLE tablename;SELECT 'something'; Regards, -- Yasuo Ohgaki ""Noah Spitzer-Williams"" <[EMAIL PROTECTED]> wrote in message 9bf7ec$m1m$[EMAIL PROTECTED]">news:9bf7ec$m1m$[EMAIL PROTECTED]... > would there be any problems caused if i used the stripslashes() function on > all posted variables from a form to eliminate sql query errors? > > - Noah > > > > -- > 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] is it safe to stripslashes() on all form variables?
Previous post does not address how to avoid making this kind of security hole. Anyway, if anyone want to avoid creating security hole like this. Do not stripslashes() added by magic_quote. If you use stripslashes(), use addslashes() again. If you do not use magic_quote, use addslashes() before feeding to database, shell or whatever that might be dangerous w/o slashes. Disabling magic quote will reduce amount of code and increase performance a little, unless application is very small. Without magic_quote, script does not have to get rid of slashes to use value from browser and add slashes again before feeding to database. Code would be cleaner and easier to read also. (Especially for programmers are not used to PHP.) Hope this helps someone. -- Yasuo Ohgaki ""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message 9bg8tl$rvl$[EMAIL PROTECTED]">news:9bg8tl$rvl$[EMAIL PROTECTED]... > If you strip slashes, it will make a security hole. > > For example, > > SELECT * FROM tablename WHERE name = '$name'; > what if $name is > \'garbage\';DROP TABLE tablename;SELECT \'something > > After stripslashes($name) > SELECT * FROM table WHERE name = 'garbage';DROP TABLE tablename;SELECT > 'something'; > > Regards, > -- > Yasuo Ohgaki > > > ""Noah Spitzer-Williams"" <[EMAIL PROTECTED]> wrote in message > 9bf7ec$m1m$[EMAIL PROTECTED]">news:9bf7ec$m1m$[EMAIL PROTECTED]... > > would there be any problems caused if i used the stripslashes() function on > > all posted variables from a form to eliminate sql query errors? > > > > - Noah > > > > > > > > -- > > 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]
Re: [PHP] Is it possible to parse a variable by character?
[Cross post to php-lang] Regular expression functions can do the job and already have reply. Answer for the original question: How to access string by character. I'm not sure if accessing string as array is going to be depreciated or not. (Or is it already depreciated???) But you could do $str = 'abc'; for ($i = 0; $i < strlen($i); $i++) { echo $str[$i]; } It prints characters in string one by one. I also not sure behavior of following code is defined or not. (It's used to be undefined. You probably should not rely on this.) $str = 'abc'; $str[0] = 'X'; You may get $str = 'Xbc' or $str[0] = 'X'. Anyone knows current status on this??? Regards, -- Yasuo Ohgaki "Sean Coyle" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hey there guys, > > This may seem like a dumb question, but I have to ask it anyway. > > I have a form in one of my php based scripts that allows for file uploads. > I recently noticed a potential issue if people upload files containing > anything else but the standard characters ([_a-z0-9-]+(\.[_a-z0-9-]). > > I am not sure if this can be done, but what I need to do is parse this > variable (lets call it $file_name) by character looking for anything save > letters a-z (A-Z) and numbers 0-9. Any arrangements of numbers, letters and > full stops (.) are to be permitted, and if any character does not meet those > specifications, that single character should be converted to an underscore. > > Any ideas on how I can go about doing something like this? > > BTW: (Some background info) I examined the average validate e-mail idea, > however, rather than reject the string, I would like to be able to 'replace' > the offending character. > > Thanks in advance, > > Sean > > > -- > 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] New problem with PHP "odbc_exec".
[From BugDB] ID: 10375 Updated by: kalowsky Reported By: [EMAIL PROTECTED] Old-Status: Open Status: Closed Bug Type: Reproduceable crash PHP Version: 4.0.4pl1 Assigned To: Comments: fixed in cvs, will not be in 4.0.5, but later releases. Previous Comments: --- [2001-04-18 08:23:59] [EMAIL PROTECTED] Documentation tells me that odbc_autocommit can be called with one or two parameters. (Without the OnOff parameter, this function returns auto-commit status for connection_id. ) Calling with two parameters works, with one I get a crash. I'm using ODBC 3.520.5303.2 against a Access 2000 database with Access ODBC driver 4.00.5303.01 --- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=10375&edit=2 -- PHP Development 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] You may find other bugs in BugDB. Regards, -- Yasuo Ohgaki ""Scott Fletcher"" <[EMAIL PROTECTED]> wrote in message 9bk5j8$iks$[EMAIL PROTECTED]">news:9bk5j8$iks$[EMAIL PROTECTED]... > Hi! I don't understand why PHP is having trouble with the odbc_exec. Is > there a bug in PHP code? Here's what the error messages said! > > "SQL error: [OpenLink][ODBC][Driver]No key columns found for table > referenced by keyset driven cursor., SQL state IM909 in SQLExecDirect". > > This show that it had to do with primary (or secondary) keys or index > issues. I'm using MS-SQL Sever and this table I'm using in the database > have primary key already! > > So, what can I do to fix it? I need it to be working. When I use the > Linux odbctest command and it execute without a problem. So, it is obvious > the problem lie with PHP code, odbc_exec(); > > Thanks, > Scott > > > > -- > 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] Images only with 256 Colors?!
Don't forget take a look at dev-list archive, there are many useful posts how to compile with gd2. -- Yasuo Ohgaki ""Nils Sondermann"" <[EMAIL PROTECTED]> wrote in message 9bjthb$fu2$[EMAIL PROTECTED]">news:9bjthb$fu2$[EMAIL PROTECTED]... > I want do create Images dynamicly, i have a High Color png but after > CreateImagefrompng() it have only 256 colors. What can i do? > > thx > Nils > > > > -- > 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] Is it possible to parse a variable by character?
I got reply from core developer implementing new syntax. The implementation of syntax $var{index} is not finished yet. So PHP programmers are NOT supposed to use it yet. If you are curious, take a look at php-lang list archive. Again $var{index} is NOT supposed to used. (yet) -- Yasuo Ohgaki "CC Zona" <[EMAIL PROTECTED]> wrote in message 9bjdbf$aq1$[EMAIL PROTECTED]">news:9bjdbf$aq1$[EMAIL PROTECTED]... > In article <9bjcj6$dg6$[EMAIL PROTECTED]>, > [EMAIL PROTECTED] ("Yasuo Ohgaki") wrote: > > > I'm not sure if accessing string as array is going to be depreciated or not. > > (Or is it already depreciated???) > > I made a note of this a while ago when it came up on the list, because > initially it sounded to me too like it was being deprecated. It's not. > It's the current *method* for accessing string offsets that is expected to > be deprecated in the near future. So instead of using $string[offset], we > just should get into the habit of using $string{offset} now to save > ourselves the hassle of going back to fix it later. > > -- > CC > > -- > 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] Creating UTF-8 characters from scratch
I don't know about "Cyrillic", but anyway, Why not just assign UTF-8 char codes to variables? (It would be nice if there is hex2bin(), though. You can use sprintf() assign sort of binary value, but it would not work well to assign multi-byte char values since it interpret as integer) I think PHP is basically multi-byte char safe. (Code like BIG5 would not work, though) I use PostgreSQL with EUC-JP for backend and client. (PostgreSQL supports UTF-8 also and you don't have to do anything special for UTF-8 as well as various EUC/Mule codes. PostgreSQL users also can rely on automatic code conversion between backend and client. For example, I can use EUC for client while backend is using UTF8.) It's possible to pass query like this to pg_exec() (You will see some garbage unless your mail client support JIS char code which is one of multi-byte char code) $text = 'PgSQL work well with '; $query =<< wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I want to try inserting a UTF-8 string into a varchar field. I'd like to > try something like cyrillic, which I know uses multiple byte characters > mixed with single byte characters. Anyone know how to create binary > values as an argument to insert into a field? > > -- > 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]