Re: [PHP] menu Q
http://www.css-discuss.org/ :-) I tried that also :) Had to put this to stylesheet to get it 'fire' select.menu {} But it didn't solve the problem... thanks for the effort anyway. -Will Kim Christensen [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] On 2/17/06, William Stokes [EMAIL PROTECTED] wrote: I have a select menu on a header bar on my page. The header bar is 20px high. The menu, code and style below, works ok on Opera but not in Ie6 or Firefox. In these browsers the menu 'streches' the bar height so that the bg image starts repeating itself. (looks nasty) It's almost like the menu prints one 'invisble' or empty row beneath the menu so that the header bar becomes about 30 or 35px high. Any ideas? Try using defining the style as a class instead of ID, since ID makes every child element inside the parent inheriting the style - seems that different browsers handle this differently, but my guess is that this is the case. So, remove the # in the style sheet and call upon the style by using class=menu instead of id=menu. This might not be a PHP related issue. I don't know. But this one is really bothering me. http://www.css-discuss.org/ :-) -- Kim Christensen [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] umlaut problem in firefox
Hi to all, I just reinstalled one of our servers last week, and I am noticing a wierd problem. On the old one was php4 running. Suse 9.1 OS. Everything worked very well. On the new one Suse 10. Php5. Only with firefox (sometimes and not always) and only on some computers the umlauts öäüüü characters are not displayed correctly and they are not submitted correctly to the system. Since then we have some strange problems with our application. Example: S�dbrookmerland instead of Südbrookmerland It seems like an encoding problem, but I really didn't figure it out untill now. Any ideeas??? Best Regards, Andy.
[PHP] archiving?
i have a question about what i beleive to be called archiving... i am building a news script and would like to limit post to be displayed per page i have done this successfully. what i am having probplems with is displaying the next set of news. here is my code: ?php include(core.php); session_start(); $gi = mysql_query(select * from news ORDER by id asc); while ($d = mysql_fetch_array($gi)) { $id = $d[id]; $title = $d[title]; $news = $d[news]; $poster = $d[poster]; $pdate = $d[date]; $ptime = $d[time]; ? b ui?php echo($title); ?/u/ibrbr p ?php $i = $i + 1; echo($news); ?brbr Posted By: ?php echo($poster); ?, On ?php echo($pdate); ? @ ?php echo($ptime); ? br ?php if ($nerd == bignerds) { echo(a href=\admin.php\Edit Post/a ); echo(nbsp; a href=\admin.php?view=delete_newsid=$iddelete=true\Delete Post/abrbr); } if ($i = 1) { break; } ? /b ?php } ? this gets it to stop after one post. i was thinking about setting a variable on the last post displayed, but to me this doesn't seem like the most logical way. if someone could point me in the right direction, or send me to a tutorial on the subject i would greatly appreaciate it... thank you in advance
[PHP] Re: archiving?
benifactor wrote: i have a question about what i beleive to be called archiving... i am building a news script and would like to limit post to be displayed per page i have done this successfully. what i am having probplems with is displaying the next set of news. here is my code: ?php include(core.php); session_start(); $gi = mysql_query(select * from news ORDER by id asc); while ($d = mysql_fetch_array($gi)) { $id = $d[id]; $title = $d[title]; $news = $d[news]; $poster = $d[poster]; $pdate = $d[date]; $ptime = $d[time]; ? b ui?php echo($title); ?/u/ibrbr p ?php $i = $i + 1; echo($news); ?brbr Posted By: ?php echo($poster); ?, On ?php echo($pdate); ? @ ?php echo($ptime); ? br ?php if ($nerd == bignerds) { echo(a href=\admin.php\Edit Post/a ); echo(nbsp; a href=\admin.php?view=delete_newsid=$iddelete=true\Delete Post/abrbr); } if ($i = 1) { break; } ? /b ?php } ? this gets it to stop after one post. i was thinking about setting a variable on the last post displayed, but to me this doesn't seem like the most logical way. if someone could point me in the right direction, or send me to a tutorial on the subject i would greatly appreaciate it... thank you in advance Use mysql to display. SELECT * FROM table WHERE id $storedone ORDER BY id DESC LIMIT 5 Gives out the 5 news on the next page after the stored one. -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: umlaut problem in firefox
Andy wrote: Hi to all, I just reinstalled one of our servers last week, and I am noticing a wierd problem. On the old one was php4 running. Suse 9.1 OS. Everything worked very well. On the new one Suse 10. Php5. Only with firefox (sometimes and not always) and only on some computers the umlauts öäüüü characters are not displayed correctly and they are not submitted correctly to the system. Since then we have some strange problems with our application. Example: S�dbrookmerland instead of Südbrookmerland It seems like an encoding problem, but I really didn't figure it out untill now. Any ideeas??? Best Regards, Andy. This looks like a problem with your encoding. Have you added this to your HTML header? meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 Do you get the Text out of the database? How is it encoded? Also you can use recode() to recode a string. http://de3.php.net/manual/en/function.recode-string.php Greets Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: archiving?
Barry wrote: benifactor wrote: i have a question about what i beleive to be called archiving... i am building a news script and would like to limit post to be displayed per page i have done this successfully. what i am having probplems with is displaying the next set of news. here is my code: ?php include(core.php); session_start(); $gi = mysql_query(select * from news ORDER by id asc); while ($d = mysql_fetch_array($gi)) { $id = $d[id]; $title = $d[title]; $news = $d[news]; $poster = $d[poster]; $pdate = $d[date]; $ptime = $d[time]; ? b ui?php echo($title); ?/u/ibrbr p ?php $i = $i + 1; echo($news); ?brbr Posted By: ?php echo($poster); ?, On ?php echo($pdate); ? @ ?php echo($ptime); ? br ?php if ($nerd == bignerds) { echo(a href=\admin.php\Edit Post/a ); echo(nbsp; a href=\admin.php?view=delete_newsid=$iddelete=true\Delete Post/abrbr); } if ($i = 1) { break; } ? /b ?php } ? this gets it to stop after one post. i was thinking about setting a variable on the last post displayed, but to me this doesn't seem like the most logical way. if someone could point me in the right direction, or send me to a tutorial on the subject i would greatly appreaciate it... thank you in advance Use mysql to display. SELECT * FROM table WHERE id $storedone ORDER BY id DESC LIMIT 5 Gives out the 5 news on the next page after the stored one. sorry a small mistake it has to be id $storedone -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: umlaut problem in firefox
From the DB I get the text correctly. meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 This is a good question I have to check it. The DB encoding is : iso-8859-1. Now, the strange thing is that is does not appear ALWAYS and only sometimes and only in firefox. So.. I cannot really reproduce the error every time which is hard to debug. Regards. - Original Message - From: Barry [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Friday, February 17, 2006 11:05 AM Subject: [PHP] Re: umlaut problem in firefox Andy wrote: Hi to all, I just reinstalled one of our servers last week, and I am noticing a wierd problem. On the old one was php4 running. Suse 9.1 OS. Everything worked very well. On the new one Suse 10. Php5. Only with firefox (sometimes and not always) and only on some computers the umlauts öäüüü characters are not displayed correctly and they are not submitted correctly to the system. Since then we have some strange problems with our application. Example: S�dbrookmerland instead of Südbrookmerland It seems like an encoding problem, but I really didn't figure it out untill now. Any ideeas??? Best Regards, Andy. This looks like a problem with your encoding. Have you added this to your HTML header? meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 Do you get the Text out of the database? How is it encoded? Also you can use recode() to recode a string. http://de3.php.net/manual/en/function.recode-string.php Greets Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] anyone care to explain the logic behind this output ....
THIS CODE php -r ' $a = array(0, 1); $b = array(1 = 0, 0 = 1); var_dump($a $b); // true var_dump($a $b); // true var_dump($b $a); var_dump($b $a); echo \n\$a:\n; var_dump((bool)$a, (int)$a, (string)$a, intval($a), strval($a)); echo \n\$b:\n; var_dump((bool)$b, (int)$b, (string)$b, intval($b), strval($b)); ' OUTPUTS (on php5.0.4): bool(true) bool(true) bool(true) bool(true) $a: bool(true) int(1) string(5) Array $b: bool(true) int(1) string(5) Array WHICH MEANS THAT: one the one hand $a is greater than AND less than $b but on the other hand casting $a OR $b to either a boolean, integer or string results in the exact same value. ie: php -r ' $a = array(0, 1); $b = array(1 = 0, 0 = 1); var_dump( ((($a $b) === ($b $a)) === ((int)$a === (int)$b)) ); // WTF IT'S TRUE ' weird? I think so - but then again I'd never test that array $a is greater than array $b because this is meaningless to me (in what way is $a greater - how is this quantified, what 'rules' determine 'greatness' in this context?) PS - changing the $b array to something else (anything else as far as i can tell) causes the weirdness to not occur - which gives me the impression this could be a bug, anyone else get this impression? for instance try changing the second line of the code above to (merely switching the order or the defined array elements): $b = array(0 = 1, 1 = 0); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP !== Hypertext Pre-Processor
Richard Lynch wrote: On Thu, February 16, 2006 9:38 am, tedd wrote: Gustavo said: This great programming language is *much more* than a Hypertext Pre-Processor! It is? I've seen a fair number of PHP applications that had nothing to do with Hypertext... GD, libPDF, Ming, GTK... Hell, for the past year or two, I've been replacing/writing new shell scripts written in BASH/Perl with PHP. None of them output HTML. ;) -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP !== Hypertext Pre-Processor
I'm a bit confused by the need for this debate. As far as I'm concerned PHP stopped being an acronym a while back. Why can't it just be PHP? Why does it need to be redefined? Does anyone actually use the full name these days? In essence, does it really matter? -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP job postings?
Curt Zirzow wrote: snip If I was scouting for postions that need to area specific, i'd first look for a php group that is located within the area. Go to local colleges post announcments. Look at any sort of group that is related to php like a linux group. /snip I second that. I lean on the Buffalo LUG all the time when I have stuff I need to contract out (or side work that I don't have time for). -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP !== Hypertext Pre-Processor
[snip] Hell, for the past year or two, I've been replacing/writing new shell scripts written in BASH/Perl with PHP. None of them output HTML. ;) [/snip] Pretty Hot Performer Actually I had done a lot of this as well. Sometimes much quicker than SED and AWK are for getting the command line widget to 'market'. If I need a small tool to get something done I now more often turn to PHP to knock it out. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HN CAPTCHA at http://www.phpclasses.org
on 02/17/2006 01:55 AM tedd said the following: Most of those who are aware of disability issues, don't use any barriers at all. CAPTCHA is often used to prevent abuses from people using automated robot programs. To solve the problem of visually impaired people, there are audio CAPTCHA solutions. Regards, Manuel Lemos -snip- http://www.access-matters.com/2005/05/22/quiz-115-did-a-captcha-catch-ya/ -- before installing a CAPTCHA. Accessibility matters. I am not sure what you mean. Are you saying that nobody should use audio CAPTCHA because one user was not able to configure his browser to play the audio CAPTCHA? I am sure that it is something easier to achieve than screen reader software that many blind users use to access read Web pages loud. Manuel Lemos Manuel: As a friend of mine, who is very knowledgeable/experienced in these matters, said: The audio variants are still barriers because there are too may reasons why they might fail to work. As I said before, there are many other simple methods that robots don't do well. Use those instead. CPATCHAs are dead and should be buried. Anyone still using them is either too cheap to learn how to use an alternative well, or simply doesn't care about accessibility. It's time to move on. Now, perhaps you don't agree with his assessment, but I think that finding other methods to accomplish what you want has merit. You know, even with audio CPATCHA's visually impaired and other disabled groups are still against it -- what does that say? tedd -- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Japanese spam on list
Whats that Japanese spam mail on this list about Oo -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ! in front of a variable?
Hey all, I've got some code from someone else I've inherited and need to sort out some problems with. The programmer that wrote it originally was much better than I and programmed a little over my head to say the least. One function that I've come across that has 5 variables as input: function($var1,$var2,!$var2,$var3-cc,$var3-bcc); The question I have is on the 3rd input variable, what does the ! in front of $var2 do to that variable? Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ! in front of a variable?
Jeff wrote: Hey all, I've got some code from someone else I've inherited and need to sort out some problems with. The programmer that wrote it originally was much better than I and programmed a little over my head to say the least. One function that I've come across that has 5 variables as input: function($var1,$var2,!$var2,$var3-cc,$var3-bcc); The question I have is on the 3rd input variable, what does the ! in front of $var2 do to that variable? Jeff Looks like it's type casting the variable. To what I don't know...I've never seen '!' used in a function like that. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ! in front of a variable?
boolean Not operator - Original Message - From: Jeff [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Friday, February 17, 2006 4:06 PM Subject: [PHP] ! in front of a variable? Hey all, I've got some code from someone else I've inherited and need to sort out some problems with. The programmer that wrote it originally was much better than I and programmed a little over my head to say the least. One function that I've come across that has 5 variables as input: function($var1,$var2,!$var2,$var3-cc,$var3-bcc); The question I have is on the 3rd input variable, what does the ! in front of $var2 do to that variable? Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ! in front of a variable?
John Nichel wrote: Jeff wrote: Hey all, I've got some code from someone else I've inherited and need to sort out some problems with. The programmer that wrote it originally was much better than I and programmed a little over my head to say the least. One function that I've come across that has 5 variables as input: function($var1,$var2,!$var2,$var3-cc,$var3-bcc); The question I have is on the 3rd input variable, what does the ! in front of $var2 do to that variable? Jeff Looks like it's type casting the variable. To what I don't know...I've never seen '!' used in a function like that. causes a boolean var to be the opposite !$var = true returnes false Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ! in front of a variable?
[snip] I've got some code from someone else I've inherited and need to sort out some problems with. The programmer that wrote it originally was much better than I and programmed a little over my head to say the least. One function that I've come across that has 5 variables as input: function($var1,$var2,!$var2,$var3-cc,$var3-bcc); The question I have is on the 3rd input variable, what does the ! in front of $var2 do to that variable? [/snip] Hmmm. Looks like a weird mistake, to be sure. If $var2 is boolean it should pass the opposite of its current state. Is $var2 a boolean? It is being passed twice here, once AS and once AS NOT. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] anyone care to explain the logic behind this output ....
On 17/02/06, Jochem Maas [EMAIL PROTECTED] wrote: THIS CODE php -r ' $a = array(0, 1); $b = array(1 = 0, 0 = 1); var_dump($a $b); // true var_dump($a $b); // true var_dump($b $a); var_dump($b $a); [...] OUTPUTS (on php5.0.4): bool(true) bool(true) bool(true) bool(true) [...] weird? I think so - but then again I'd never test that array $a is greater than array $b because this is meaningless to me (in what way is $a greater - how is this quantified, what 'rules' determine 'greatness' in this context?) The rules are simple enough, and listed in the documentation here: http://www.php.net/manual/en/language.operators.comparison.php#AEN4390 But if you apply those comparison rules to your four expressions, you'd expect to see bool(true) bool(false) bool(true) bool(false) What you need to know to explain your results is that internally, PHP doesn't do a greater-than comparison, it converts them into less-than-or-equals by reversing the values. So your expressions become: $a $b $b = $a $b $a $a = $b Now if you apply the comparison rules to your arrays using those rewritten operations, you get true every time. Fun eh? -robin
Re: [PHP] PHP job postings + previous hosting question
Just wanted to thank everyone for the helpful suggestions and ideas regarding these two topics. I've had to put my web hosting decision on the back burner for now while I deal with other big projects and other fun issues so I apologize for not getting back to the people who responded (publicly or privately). I'm not sure how I missed the links section on php.net for the job postings, I went through that site pretty thoroughly I thought (hah guess not), and thanks for all the other recommendations. There's a PHP group that meets in DC that I had talked to my boss about going to and college campuses are always a good place to check (especially since we're about 2 miles from a metro stop). I appreciate all the great feedback. Thanks again everyone! -TG ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array_map help
I've got the following code and I am not doing something right. Either my function is wrong, or the way Im using array_map is wrong, as slashes are still making it into the data, and the asdf iosn't getting appended to each value. Thanks, Mark // function to remove stripped slashes function detectMGQ($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // added in to detect if this function is working $value .= $value.'asdf'; return $value; } // construct field and value pairs into array $field_values = array( 'name' = $clean[name], 'email' = $clean[email], 'username' = $clean[username], 'accesslevel' = $clean[accesslevel], 'status'= $clean[status], 'password' = base64_encode(rc4($clean[password1])) ); // walk through the values and strip out the slashses $field_values = array_map( detectMGQ, $field_values ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HN CAPTCHA at http://www.phpclasses.org
Hello, on 02/17/2006 01:19 PM tedd said the following: I am not sure what you mean. Are you saying that nobody should use audio CAPTCHA because one user was not able to configure his browser to play the audio CAPTCHA? I am sure that it is something easier to achieve than screen reader software that many blind users use to access read Web pages loud. Manuel Lemos Manuel: As a friend of mine, who is very knowledgeable/experienced in these matters, said: The audio variants are still barriers because there are too may reasons why they might fail to work. As I said before, there are many other simple methods that robots don't do well. Use those instead. CPATCHAs are dead and should be buried. Anyone still using them is either too cheap to learn how to use an alternative well, or simply doesn't care about accessibility. It's time to move on. Now, perhaps you don't agree with his assessment, but I think that finding other methods to accomplish what you want has merit. You know, even with audio CPATCHA's visually impaired and other disabled groups are still against it -- what does that say? I think there are some misunderstandings . First, CAPTCHA means completely automated public Turing test to tell computers and humans apart. Any automated method on which robots don't do well, is a CAPTCHA. Therefore, to be accurate the person that wrote your quote is in contradiction. There may be better solutions, than the image or audio based, but those solutions are still CAPTCHAs because the goal is to halt robots. Another, point, blind people or people with other disabilities need all the sympathy they can get to make their lives better. Calling everybody that use image or audio CAPTCHAs too cheap does not seem to get them much more sympathy. These complaints seem to be too selfish. If somebody employs a CAPTCHA in a site is because he needs to solve a problem of abuse. It seems that somebody that complains against CAPTCHA does not care about the losses that the abuses may cause to site maintainers if the CAPTCHAs are removed or replaced by other easier to defeat CAPTCHAs. Nobody knows everything, starting by me. If there are better CAPTCHAs than the image or audio based, I would like to know about them. It would certainly be more constructive than calling too cheap to everybody using common CAPTCHA. I understand that the life of blind people is already very painful and slow. So I imagine the frustration of not getting enough attention to their cause because their are often a neglected minority. OTOH, that minority must also try to understand that CAPTCHA are necessary and must be effective. A CAPTCHA attempt that still permits abuses is not effective and sites may be still victims of extensive abuse. Consider this site that has a text based CAPTCHA at the bottom. It is very easy for a robot to read the numbers, make the calculations an enter the result without human intervention. Basically, it becomes very easy to abuse this CAPTCHA. In this aspect, this CAPTCHA is worse than image or audio based. http://pooteeweet.org/blog/329 A good CAPTCHA must be fuzzy. If you know other fuzzy CAPTCHA besides these, it may help to sharing that knowledge. -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] anyone care to explain the logic behind this output ....
Robin Vickery wrote: On 17/02/06, Jochem Maas [EMAIL PROTECTED] wrote: THIS CODE php -r ' $a = array(0, 1); $b = array(1 = 0, 0 = 1); var_dump($a $b); // true var_dump($a $b); // true var_dump($b $a); var_dump($b $a); [...] OUTPUTS (on php5.0.4): bool(true) bool(true) bool(true) bool(true) [...] weird? I think so - but then again I'd never test that array $a is greater than array $b because this is meaningless to me (in what way is $a greater - how is this quantified, what 'rules' determine 'greatness' in this context?) The rules are simple enough, and listed in the documentation here: http://www.php.net/manual/en/language.operators.comparison.php#AEN4390 But if you apply those comparison rules to your four expressions, you'd expect to see bool(true) bool(false) bool(true) bool(false) exactly. What you need to know to explain your results is that internally, PHP doesn't do a greater-than comparison, it converts them into less-than-or-equals by reversing the values. So your expressions I learnt this on internals - which was what trigger me to investigate this... the thing I really couldn't grok was how php was auto-casting the arrays when doing the LT/GT comparison (well apparently it wasn't casting them at all!) thanks to you and David for helping to clear up my confusion (and for pointing out what I had missed - or forgotten about - in the manual) rgds, Jochem become: $a $b $b = $a $b $a $a = $b Now if you apply the comparison rules to your arrays using those rewritten operations, you get true every time. Fun eh? -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attaching MySQL 5.0.18 to PHP 4.4.2
I forgot to mention that that php and mysql are installed on a windows machine which means I didn't have to run the configure script that would associate mysql with php. How do I do this on a windows machine? Paul On 2/17/06, Kim Christensen [EMAIL PROTECTED] wrote: On 2/17/06, Paul Goepfert [EMAIL PROTECTED] wrote: Hi all, I know the subject doesn't seem too clear so here is what I am talking aboukt. I recently installed php on my windows machine. The PHP compiler works great. However upon looking through the phpinfo () document I noticed that the MySQL client version was 3.23.49. I assume that is the built in version of MySQL. I also have installed MySQL 5.0.18 on my system. I have my database in the 5.0.18 version of MySQL . How do I asssociate the MySQL 5.0.18 version with php? http://php.net/manual/en/ref.mysqli.php This isn't really the answer to your question per se, but will probably solve things along the way. -- Kim Christensen [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ! in front of a variable?
Jay Blanchard wrote: [snip] I've got some code from someone else I've inherited and need to sort out some problems with. The programmer that wrote it originally was much better than I and programmed a little over my head to say the least. One function that I've come across that has 5 variables as input: function($var1,$var2,!$var2,$var3-cc,$var3-bcc); The question I have is on the 3rd input variable, what does the ! in front of $var2 do to that variable? [/snip] Hmmm. Looks like a weird mistake, to be sure. If $var2 is boolean it should I'd say it looks odd - but I wouldn't charcterise it as a mistake without seeing the function and the code that calls it. the ! is the logical NOT operator - what Jay says is correct but I'd like to add that $var2 would be negated regardless of whether the value of $var2 is a boolean or not. how this is done internally has everything to do with the php's auto-casting rules (i.e. the rules it uses to determine how/when to automatically cast a variable of a given type to another type in order to be able to use the value in a given context. as an example, the following line fo code says if $x is NOT set then do stuff: if (!isset($x)) { /*do stuff*/ } check here for more info on logical operators: http://nl2.php.net/manual/en/language.operators.logical.php also try running this code to get a feeling for what auto-casting does in relation to the NOT operator: // echo 'pre' // uncomment this if running in a browser class Test {} class Test2 { var $v; function Test2($v) { $this-v = $v; } } $a = 1; $b = 0; $c = true; $d = false; $e = ; $f = non-empty-string; $g = array(); $h = array(1,2,3); $i = new Test(); $j = new Test2(test); var_dump(!$a, !$b, !$c, !$d, !$e, !$f, !$g, !$h, !$i, !$j); pass the opposite of its current state. Is $var2 a boolean? It is being passed twice here, once AS and once AS NOT. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ! in front of a variable?
At 07:06 AM 2/17/2006, Jeff wrote: I've got some code from someone else I've inherited and need to sort out some problems with. The programmer that wrote it originally was much better than I and programmed a little over my head to say the least. One function that I've come across that has 5 variables as input: function($var1,$var2,!$var2,$var3-cc,$var3-bcc); Jeff, I can understand why you'd think someone was more proficient at a given language if they knew shortcuts and back alleys in the language that you hadn't yet learned. However, in my view a major aspect of being a good programmer is writing clearly documented or self-documenting code. The whole purpose of script is to be easy for humans to read. If a script is obscure, I think that's more likely a failure of the author than the reader. $var2,!$var2, I have to question the elegance of code that persuades the programmer to pass the same variable twice, once as vanilla and again as NOT vanilla. I'd first check to make sure that this negation weren't something better performed within the function itself. function($var1,$var2, I don't know if your clip was a literal quote from that other person's script, but I wouldn't happily hire or work with a programmer who preferred to use variable names like var1 and var2 -- unless the function were an abstrated meta-function, say part of a compiler; and in that case I'd likely omit the literal arguments and process an abstract argument array. Self-documenting variable names like $sLogon (type string) and $bLoggedOn (type Boolean) that indicate both purpose and type make programming, debugging, and later modification much, much easier. Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array_map help
Mark Steudel wrote: I've got the following code and I am not doing something right. Either my function is wrong, or the way Im using array_map is wrong, as slashes are still making it into the data, and the asdf iosn't getting appended to each value. I rewrote what you had like so: ?php function detectMGQ($value) { //return get_magic_quotes_gpc() ? stripslashes($value): $value; return $value.-TEST; } $clean = array( name = name, email = email, username = username, accesslevel = accesslevel, status= status, ); $field_values = array_map( detectMGQ, $clean ); var_dump($field_values); ? and it adds '-TEST' to every value as expected. not sure whats going wrong with your code exactly by I have got some general comments... (maybe the code I rewrote helps you to figure otu what was/is going wrong.) Thanks, Mark // function to remove stripped slashes function detectMGQ($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // added in to detect if this function is working $value .= $value.'asdf'; if $value equals ABC then it would equal ABCABCasdf aftyer that last line of code was run. return $value; } // construct field and value pairs into array $field_values = array( 'name' = $clean[name], 'email' = $clean[email], yuou don't need to wrap $clean[email] in quotes - it's waste of time+cpu BUT you should always delimit the array key with quotes because it is a string not a constant (or does you code actually define a constant named 'email'?) i.e. $clean[email] is better off being $clean['email'] 'username' = $clean[username], 'accesslevel' = $clean[accesslevel], 'status'= $clean[status], 'password' = base64_encode(rc4($clean[password1])) ); // walk through the values and strip out the slashses $field_values = array_map( detectMGQ, $field_values ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] List of units
I'm trying to list the hdd units from a server PHP machine running on windows, and can´t find a right function to do that. (Don't like to do a map A-Z function code) ¿Anyone know how to do that in a good way? Thanks, Diego. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need help interpreting server log entries
We are seeing this message in our server logs with respect to one of our internal extensions. What is the meaning of Overrun in this context? acd-result.c(114) : Block 0x0816D12C status: Beginning: Overrun (magic=0x0021, expected=0x7312F8DC) End: Unknown TIA Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ! in front of a variable?
I took me a little while to notice that it wasn't a function declaration :p It's just as Jay said, it's calling function with those arguments, where '!$var2' extends to '!(bool)$var2' or treat/cast this value as/to boolean, and pass it's inverted value or NOT $var2. Jay Blanchard wrote: [snip] I've got some code from someone else I've inherited and need to sort out some problems with. The programmer that wrote it originally was much better than I and programmed a little over my head to say the least. One function that I've come across that has 5 variables as input: function($var1,$var2,!$var2,$var3-cc,$var3-bcc); The question I have is on the 3rd input variable, what does the ! in front of $var2 do to that variable? [/snip] Hmmm. Looks like a weird mistake, to be sure. If $var2 is boolean it should pass the opposite of its current state. Is $var2 a boolean? It is being passed twice here, once AS and once AS NOT. -- Atentamente, J. Rafael Salazar Magaña Innox - Innovación Inteligente Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE [EMAIL PROTECTED] http://www.innox.com.mx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] array_map help
Thank you I will give it a try. -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Friday, February 17, 2006 9:24 AM To: Mark Steudel Cc: php-general@lists.php.net Subject: Re: [PHP] array_map help Mark Steudel wrote: I've got the following code and I am not doing something right. Either my function is wrong, or the way Im using array_map is wrong, as slashes are still making it into the data, and the asdf iosn't getting appended to each value. I rewrote what you had like so: ?php function detectMGQ($value) { //return get_magic_quotes_gpc() ? stripslashes($value): $value; return $value.-TEST; } $clean = array( name = name, email = email, username = username, accesslevel = accesslevel, status= status, ); $field_values = array_map( detectMGQ, $clean ); var_dump($field_values); ? and it adds '-TEST' to every value as expected. not sure whats going wrong with your code exactly by I have got some general comments... (maybe the code I rewrote helps you to figure otu what was/is going wrong.) Thanks, Mark // function to remove stripped slashes function detectMGQ($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // added in to detect if this function is working $value .= $value.'asdf'; if $value equals ABC then it would equal ABCABCasdf aftyer that last line of code was run. return $value; } // construct field and value pairs into array $field_values = array( 'name' = $clean[name], 'email' = $clean[email], yuou don't need to wrap $clean[email] in quotes - it's waste of time+cpu BUT you should always delimit the array key with quotes because it is a string not a constant (or does you code actually define a constant named 'email'?) i.e. $clean[email] is better off being $clean['email'] 'username' = $clean[username], 'accesslevel' = $clean[accesslevel], 'status'= $clean[status], 'password' = base64_encode(rc4($clean[password1])) ); // walk through the values and strip out the slashses $field_values = array_map( detectMGQ, $field_values ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Last Sunday in September?
Hi, I'm building a program and I need to find the last Sunday in September for every year because the following Monday is the start of a new year for us. So 2006 ends on September 24th 2006 and the new year (2007) starts on September 25th 2006. I was thinking that using the strtotime() would get me this information possibly? Is there an easy way to get this information? Pseudo code: If ((date last Sunday in September this year) (date Jan 1 of next year)) { year++ } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: menu Q
I use Fx 1.5.0.1 and Opera 9-prev2 and everything seems to be Ok. The select it's inside a form, and my guess is that you haven't set any padding/margin for that form, so try adding something like FORM { padding: 0; margin: 0; } By the way, this questions should not be here, what Kim posted was a really better place to post it: http://www.css-discuss.org --having said that, I must confess I thought I was reading a message from that list, so maybe you got confused as well? William Stokes wrote: I have a select menu on a header bar on my page. The header bar is 20px high. The menu, code and style below, works ok on Opera but not in Ie6 or Firefox. In these browsers the menu 'streches' the bar height so that the bg image starts repeating itself. (looks nasty) It's almost like the menu prints one 'invisble' or empty row beneath the menu so that the header bar becomes about 30 or 35px high. Any ideas? [···] $sql=SELECT * FROM x_table ORDER BY sorter ASC; $result=mysql_query($sql); $num = mysql_num_rows($result); $cur = 1; print form name=\form\; print select name=\val_team\ size=\1\ id=\menu\ onChange=\javascript:goToURL()\; print option selected value=\\Valitse joukkue:/option; while ($num = $cur) { $row = mysql_fetch_array($result); $jouk_nimi = $row[jouk_nimi]; $team_id = $row[jouk_id]; print option value=\index.php?team=$team_id\$jouk_nimi/option; $cur++; } print /select; print /form; StyleSheet: #menu{ height: 18px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; text-align: left; background-color: #CC; BORDER-RIGHT: #FF 1px solid; BORDER-TOP: #FF 1px solid; BORDER-LEFT: #FF 1px solid; BORDER-BOTTOM: #FF 1px solid; COLOR: #FF; } -- Atentamente, J. Rafael Salazar Magaña Innox - Innovación Inteligente Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE [EMAIL PROTECTED] http://www.innox.com.mx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Last Sunday in September?
There's going to be 'tighter' and more efficient ways to do this.. probably some using strtotime(). I have an irrational distrust of the results from strtotime() though, so I use it sparingly. Here's a simple solution though: ?php // Designate month $month = 2; // Designate year $year = 2006; // Find last day of the month by finding how many days are in month // Could also do $month + 1, $day = 0 $lastday = date(t, mktime(0, 0, 0, $month, 1, $year)); // Find out what numerical day of the week it is, 0 = sunday, 6 = saturday $dayofweek = date(w, mktime(0, 0, 0, $month, $lastday, $year)); // Subtract day of week from current day. If you're already on last // sunday of the month, it'll be $lastday - 0 so it all works out $lastsunday = date(Y-m-d, mktime(0, 0, 0, $month, $lastday - $dayofweek, $year)); echo $lastsunday; ? There's going to be a dozen ways to skin this one, just showing one way. -TG = = = Original message = = = Hi, I'm building a program and I need to find the last Sunday in September for every year because the following Monday is the start of a new year for us. So 2006 ends on September 24th 2006 and the new year (2007) starts on September 25th 2006. I was thinking that using the strtotime() would get me this information possibly? Is there an easy way to get this information? Pseudo code: If ((date last Sunday in September this year) (date Jan 1 of next year)) year++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ! in front of a variable?
Ooops.. I made the same mistake in my private reply.. hah.. = = = Original message = = = I took me a little while to notice that it wasn't a function declaration :p ~It's just as Jay said, it's calling function with those arguments, where '!$var2' extends to '!(bool)$var2' or treat/cast this value as/to boolean, and pass it's inverted value or NOT $var2. Jay Blanchard wrote: [snip] I've got some code from someone else I've inherited and need to sort out some problems with. The programmer that wrote it originally was much better than I and programmed a little over my head to say the least. One function that I've come across that has 5 variables as input: function($var1,$var2,!$var2,$var3-cc,$var3-bcc); The question I have is on the 3rd input variable, what does the ! in front of $var2 do to that variable? [/snip] Hmmm. Looks like a weird mistake, to be sure. If $var2 is boolean it should pass the opposite of its current state. Is $var2 a boolean? It is being passed twice here, once AS and once AS NOT. -- Atentamente, J. Rafael Salazar Maga~a Innox - Innovaci~n Inteligente Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE [EMAIL PROTECTED] http://www.innox.com.mx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Last Sunday in September?
$currentTS = strtotime(now); $currentYear = date(Y); $nextYear = $currentYear + 1; $lastSundayInSepCurrentYearTS = strtotime(last Sunday, strtotime(10/1/$currentYear)); $firstDayNextYearTS = strtotime(1/1/$nextYear); // // So your psuedocode becomes... // if (($currentTS $lastSundayInSepCurrentYearTS) ($currentTS $firstDayNextYearTS)) { $year++; } Shaunak Kashyap Senior Web Developer WPT Enterprises, Inc. 5700 Wilshire Blvd., Suite 350 Los Angeles, CA 90036 Main: 323.330.9900 www.worldpokertour.com Confidentiality Notice: This e-mail transmission (and/or the attachments accompanying) it may contain confidential information belonging to the sender which is protected. The information is intended only for the use of the intended recipient. If your are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking of any action in reliance on the contents of this information is prohibited. If you have received this transmission in error, please notify the sender by reply e-mail and destroy all copies of this transmission. -Original Message- From: Jay Paulson [mailto:[EMAIL PROTECTED] Sent: Friday, February 17, 2006 10:07 AM To: php-general@lists.php.net Subject: [PHP] Last Sunday in September? Hi, I'm building a program and I need to find the last Sunday in September for every year because the following Monday is the start of a new year for us. So 2006 ends on September 24th 2006 and the new year (2007) starts on September 25th 2006. I was thinking that using the strtotime() would get me this information possibly? Is there an easy way to get this information? Pseudo code: If ((date last Sunday in September this year) (date Jan 1 of next year)) { year++ } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with HUGE floating values and fmod
Hi there, I'm trying to calculate check digits for a payment system, using the ISO 7064 (MOD 97-10) algorithm, wich is, already translated to PHP: $check=98-fmod(($num*100),97); Where $num is a huge number... Example: 90150123123400043211 should have check digit 51 In windows calculator: 98 - ( (90150123123400043211 * 100) mod 97) works OK and I get 51 as result In PHP I get 13... Any problems with the number beeing this huge? Notice that I tried to echo number_format(90150123123400043211+1);, in order to test some math on this number, and got 90,150,123,123,400,040,000 wich is strange... If possible, please reply to [EMAIL PROTECTED] Thanks in advance. Marco Almeida Project Manager WEBDADOS Tecnologias de Informação Telef.: +351 21 466 93 00 Fax: +351 21 466 42 81 Móvel: +351 96 324 43 44 Email: [EMAIL PROTECTED] www: http://www.webdados.pt Morada: R. 9 de Abril, 3-3A, Sala 4 2765-545 S. Pedro do Estoril -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HN CAPTCHA at http://www.phpclasses.org
Manuel: Your points are well taken. A good CAPTCHA must be fuzzy. If you know other fuzzy CAPTCHA besides these, it may help to sharing that knowledge. The CAPTCHA I was primarily referring to was the image one -- however, it's just another barrier. I am sure there are all sorts of ways to fool a computer while making it easy for a human to comply, like Enter the third word of the first paragraph; or What is the color of an orange?; or presenting an easy question from a vast lists of questions provided at random. While computers could be designed to answer such questions, the amount of time required would be better spent going after those sites that don't have any CAPTCHA. As for me, I'm trying to understand both sides and see if there is a midway solution. However, it appears that both sides are steadfastly rooted in their opinion. One side wants barriers and the other side doesn't -- mutually exclusive positions. I can't help but think there must be a software solution. tedd -- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ! in front of a variable?
Ok, the variable is boolean and that does make sense. Thanks for all the replies. Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What does a ? represent
I'm not sure if these completely answer your question but they might get you started: http://dev.mysql.com/doc/refman/4.1/en/mysql-stmt-prepare.html http://dev.mysql.com/doc/refman/4.1/en/mysql-stmt-execute.html Shaunak Kashyap Senior Web Developer WPT Enterprises, Inc. 5700 Wilshire Blvd., Suite 350 Los Angeles, CA 90036 Main: 323.330.9900 www.worldpokertour.com Confidentiality Notice: This e-mail transmission (and/or the attachments accompanying) it may contain confidential information belonging to the sender which is protected. The information is intended only for the use of the intended recipient. If your are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking of any action in reliance on the contents of this information is prohibited. If you have received this transmission in error, please notify the sender by reply e-mail and destroy all copies of this transmission. -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Friday, February 17, 2006 11:54 AM To: php-general@lists.php.net Subject: [PHP] What does a ? represent In the some code I'm working with I see many database queries using the PEAR DB class where ? is used for a value in the SQL. What is the rule for using ? in this way what value does it take. Example code. $ticket=$db-getRow( SELECT id,department,`from`, cc, bcc FROM tickets WHERE id=?, array($tid) ); Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What does a ? represent
It's usually used as a single character wildcard. So something = ? would match A, B, 1, etc.. but not AB, A1. -TG = = = Original message = = = In the some code I'm working with I see many database queries using the PEAR DB class where ? is used for a value in the SQL. What is the rule for using ? in this way what value does it take. Example code. $ticket=$db-getRow( SELECT id,department,`from`, cc, bcc FROM tickets WHERE id=?, array($tid) ); Jeff ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with HUGE floating values and fmod
On Fri, Feb 17, 2006 at 06:48:13PM -, Marco Almeida wrote: Hi there, I'm trying to calculate check digits for a payment system, using the ISO 7064 (MOD 97-10) algorithm, wich is, already translated to PHP: $check=98-fmod(($num*100),97); Where $num is a huge number... Example: 90150123123400043211 should have check digit 51 In windows calculator: 98 - ( (90150123123400043211 * 100) mod 97) works OK and I get 51 as result In PHP I get 13... You will need to use GMP or BCMath to do math operations numbers that size. See: http://php.net/language.types.integer.php Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] URL problem
I have a following directory: - folder (site) index.php - folder (example) index.php the url to this directory will be: http://www.example.com/site/index.php but I need redirect with: header() function to the index.php inside the folder example without the url change I mean, I want to keep the same url but diferent directory -- Este mensaje ha sido analizado por MailScanner en busca de virus y otros contenidos peligrosos, y se considera que está limpio.
RE: [PHP] URL problem
If you are in a *nix environment, make a symlink from site_folder/index.php - site_folder/example_folder/index.php and that should do it. Shaunak Kashyap Senior Web Developer WPT Enterprises, Inc. 5700 Wilshire Blvd., Suite 350 Los Angeles, CA 90036 Main: 323.330.9900 www.worldpokertour.com Confidentiality Notice: This e-mail transmission (and/or the attachments accompanying) it may contain confidential information belonging to the sender which is protected. The information is intended only for the use of the intended recipient. If your are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking of any action in reliance on the contents of this information is prohibited. If you have received this transmission in error, please notify the sender by reply e-mail and destroy all copies of this transmission. -Original Message- From: Jesús Alain Rodríguez Santos [mailto:[EMAIL PROTECTED] Sent: Friday, February 17, 2006 2:49 PM To: php-general@lists.php.net Subject: [PHP] URL problem I have a following directory: - folder (site) index.php - folder (example) index.php the url to this directory will be: http://www.example.com/site/index.php but I need redirect with: header() function to the index.php inside the folder example without the url change I mean, I want to keep the same url but diferent directory -- Este mensaje ha sido analizado por MailScanner en busca de virus y otros contenidos peligrosos, y se considera que está limpio. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What does a ? represent
Not is SQL, the single character wildcard is the underscore. In SQL the ? is usually used for argument replacement, much like the %s in printf. Satyam - Original Message - From: [EMAIL PROTECTED] To: php-general@lists.php.net Cc: [EMAIL PROTECTED] Sent: Friday, February 17, 2006 9:24 PM Subject: Re: [PHP] What does a ? represent It's usually used as a single character wildcard. So something = ? would match A, B, 1, etc.. but not AB, A1. -TG = = = Original message = = = In the some code I'm working with I see many database queries using the PEAR DB class where ? is used for a value in the SQL. What is the rule for using ? in this way what value does it take. Example code. $ticket=$db-getRow( SELECT id,department,`from`, cc, bcc FROM tickets WHERE id=?, array($tid) ); Jeff ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What does a ? represent
-Original Message- From: Shaunak Kashyap [mailto:[EMAIL PROTECTED] Sent: Friday, February 17, 2006 15:22 To: php-general@lists.php.net Subject: RE: [PHP] What does a ? represent I'm not sure if these completely answer your question but they might get you started: http://dev.mysql.com/doc/refman/4.1/en/mysql-stmt-prepare.html http://dev.mysql.com/doc/refman/4.1/en/mysql-stmt-execute.html Shaunak Kashyap Senior Web Developer WPT Enterprises, Inc. 5700 Wilshire Blvd., Suite 350 Los Angeles, CA 90036 Main: 323.330.9900 Yes, that has the data I needed, thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] array_map help
I figured out that nothing was wrong with this (other than the other things you pointed out) and that I was just uploading the wrong file to the wrong place ... oops Thanks again, Mark -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Friday, February 17, 2006 9:24 AM To: Mark Steudel Cc: php-general@lists.php.net Subject: Re: [PHP] array_map help Mark Steudel wrote: I've got the following code and I am not doing something right. Either my function is wrong, or the way Im using array_map is wrong, as slashes are still making it into the data, and the asdf iosn't getting appended to each value. I rewrote what you had like so: ?php function detectMGQ($value) { //return get_magic_quotes_gpc() ? stripslashes($value): $value; return $value.-TEST; } $clean = array( name = name, email = email, username = username, accesslevel = accesslevel, status= status, ); $field_values = array_map( detectMGQ, $clean ); var_dump($field_values); ? and it adds '-TEST' to every value as expected. not sure whats going wrong with your code exactly by I have got some general comments... (maybe the code I rewrote helps you to figure otu what was/is going wrong.) Thanks, Mark // function to remove stripped slashes function detectMGQ($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // added in to detect if this function is working $value .= $value.'asdf'; if $value equals ABC then it would equal ABCABCasdf aftyer that last line of code was run. return $value; } // construct field and value pairs into array $field_values = array( 'name' = $clean[name], 'email' = $clean[email], yuou don't need to wrap $clean[email] in quotes - it's waste of time+cpu BUT you should always delimit the array key with quotes because it is a string not a constant (or does you code actually define a constant named 'email'?) i.e. $clean[email] is better off being $clean['email'] 'username' = $clean[username], 'accesslevel' = $clean[accesslevel], 'status'= $clean[status], 'password' = base64_encode(rc4($clean[password1])) ); // walk through the values and strip out the slashses $field_values = array_map( detectMGQ, $field_values ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Last Sunday in September?
Here is how I did it. ?php //total days in september $septNumberOfDays = 30; //get the day of the month for 12:00:00am on the last day of September of the current year $septLastDay = date('w', mktime(0, 0, 0, 9, $septNumberOfDays, date('Y'))); //if the last day itself isn't a sunday if($septLastDay != 0) { //set the last sunday timestamp $septLastSunday = mktime(0, 0, 0, 9, ($septNumberOfDays - $septLastDay), date('Y')); } else { //otherwise set the last sunday timestamp to the last day of sept $septLastSunday = mktime(0, 0, 0, 9, $septNumberOfDays, date('Y')); } print date('l, F j, Y', $septLastSunday); ? Jay Paulson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I'm building a program and I need to find the last Sunday in September for every year because the following Monday is the start of a new year for us. So 2006 ends on September 24th 2006 and the new year (2007) starts on September 25th 2006. I was thinking that using the strtotime() would get me this information possibly? Is there an easy way to get this information? Pseudo code: If ((date last Sunday in September this year) (date Jan 1 of next year)) { year++ } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Locking Up
Hello List, I'm having an intermittent problem where the session locks up for some of my users. When the session locks up, the browser just sits there waiting for a response from the server. It seems to be random, which makes it very difficult to debug. It also seems to happen system wide, and not just on a particular page (a home-made CRM). The server is running Apache 2.x and PHP 4.4.X on RHEL on a quad-processor server with 8 GB RAM. We do an hourly backup that does cause some delays, but the session lockups do not necessarily happen around that time. Could this be caused by the session garbage collection (we use the default PHP sessions), and if it is, what would/could be done to better the situation? Thanks, -- Ray Hauge Programmer/Systems Administrator American Student Loan Services 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] anyone care to explain the logic behind this output ....
(Don't you hate it when people forget to post back to the list...) The secret is actually hidden in the docs, http://php.net/manual/en/language.operators.comparison.php When comparing $a $b, you compare the first value of $a (0) to the value with the same key in $b (1). 0 1 -- true When you compare $b $a, the first value of $b is 0, with a key of 1. The value in $a is 1, 0 1 -- true The discussion on php-dev, where you found this example, reveals that PHP makes the assumption that $a $b == $b $a. This means that they can reuse the less than function for greater than calls. In this case the assumption isn't actually valid. $a $b should be 0 1 -- false. David Jochem Maas wrote: THIS CODE php -r ' $a = array(0, 1); $b = array(1 = 0, 0 = 1); var_dump($a $b); // true var_dump($a $b); // true var_dump($b $a); var_dump($b $a); echo \n\$a:\n; var_dump((bool)$a, (int)$a, (string)$a, intval($a), strval($a)); echo \n\$b:\n; var_dump((bool)$b, (int)$b, (string)$b, intval($b), strval($b)); ' OUTPUTS (on php5.0.4): bool(true) bool(true) bool(true) bool(true) $a: bool(true) int(1) string(5) Array $b: bool(true) int(1) string(5) Array WHICH MEANS THAT: one the one hand $a is greater than AND less than $b but on the other hand casting $a OR $b to either a boolean, integer or string results in the exact same value. ie: php -r ' $a = array(0, 1); $b = array(1 = 0, 0 = 1); var_dump( ((($a $b) === ($b $a)) === ((int)$a === (int)$b)) ); // WTF IT'S TRUE ' weird? I think so - but then again I'd never test that array $a is greater than array $b because this is meaningless to me (in what way is $a greater - how is this quantified, what 'rules' determine 'greatness' in this context?) PS - changing the $b array to something else (anything else as far as i can tell) causes the weirdness to not occur - which gives me the impression this could be a bug, anyone else get this impression? for instance try changing the second line of the code above to (merely switching the order or the defined array elements): $b = array(0 = 1, 1 = 0); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DB Error ??? help please ...
hi all, today, i get this error frequently : A fatal error has occurred DB Error: extension not found [line 542 of /var/www/horde/kronolith/lib/Driver/sql.php] ... but php5-mysql is installed. and also i installed pear db ... what may cause this problem ? and how can i fix this ? help please ... many thanks in advance ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Locking Up
Hello List, I'm having an intermittent problem where the session locks up for some of my users. When the session locks up, the browser just sits there waiting for a response from the server. It seems to be random, which makes it very difficult to debug. It also seems to happen system wide, and not just on a particular page (a home-made CRM). The server is running Apache 2.x and PHP 4.4.X on RHEL on a quad-processor server with 8 GB RAM. We do an hourly backup that does cause some delays, but the session lockups do not necessarily happen around that time. Could this be caused by the session garbage collection (we use the default PHP sessions), and if it is, what would/could be done to better the situation? Thanks, -- Ray Hauge Programmer/Systems Administrator American Student Loan Services 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving a BLOB image to a file (SOLVED)
On 2/16/06, tedd [EMAIL PROTECTED] wrote: However, after given it some thought, I would imagine that one could get a unique generated string, create a file with that string, give the file the correct permissions, then pull the image from the dB and save, do image processing, and then reload the image into a web page, and delete the file without any conflict. I can envision lot's of users doing that simultaneously without problems. BUT, I haven't tried it yet! I have used a user's IP address (dots removed) and microtime appended to create a unique file name. The target directory is world writable. Not the most elegant solution... I found that sometimes the file had not been written yet and trying to display it on a page right away resulted in file not found... Rendering the image to the screen without saving to a file works best for me. -- Gerry http://portal.danen.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Logging visitors path and presenting this to visitors
Hi, I am about to create a feature that will help the visitor in his/her navigation of the page. I want to store the visitors last 10 pages that was visited so that this person easily can go back to a page he was at before, without using the BACK button. I see two solutions to this, but I am not sure on witch one to choose. 1. Create a session variable that contains the last 10 pages and update that variable for every page he/she visits. 2. Have a database table that contains this information that is related to the session ID. I am concerned that 2 will take resources from the server, but I would use an already created link to the database. So maybe the inserts and selects are neglectable? Number 2 can also be extended to an even better solution, when the user comes back, the data can be recovered if we set a cookie for this. However 1 is much easier to implement, but 2 can be extended to better functionality. Witch one would you choose? /Peter
Re: [PHP] Logging visitors path and presenting this to visitors
On Fri, 2006-02-17 at 23:47, Peter Lauri wrote: Hi, I am about to create a feature that will help the visitor in his/her navigation of the page. I want to store the visitors last 10 pages that was visited so that this person easily can go back to a page he was at before, without using the BACK button. I see two solutions to this, but I am not sure on witch one to choose. 1. Create a session variable that contains the last 10 pages and update that variable for every page he/she visits. 2. Have a database table that contains this information that is related to the session ID. I am concerned that 2 will take resources from the server, but I would use an already created link to the database. So maybe the inserts and selects are neglectable? Number 2 can also be extended to an even better solution, when the user comes back, the data can be recovered if we set a cookie for this. However 1 is much easier to implement, but 2 can be extended to better functionality. Witch one would you choose? It's volatile data that you have no desire to keep between sessions (otherwise you wouldn't link it to the session) in which case unless there's a LOT of it there's no point using another table -- especially since it sounds like it will be loaded on every page. If you want maintainability, use a nice associative array structure that can easily be adapted later. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php