Re[2]: [PHP] Super bizarre changing variable!!

2007-10-05 Thread Richard Davey
Hi Brian, Friday, October 5, 2007, 1:28:35 PM, you wrote: This is indeed the complete code, I did not cut anything out for brevity, which is why this appears to be so impossible. eAccelerator is activated, could something be corrupt? Could a corrupt index cause this? In table1,

Re[4]: [PHP] Super bizarre changing variable!!

2007-10-05 Thread Richard Davey
Hi Brian, Friday, October 5, 2007, 2:10:32 PM, you wrote: I definitely misunderstood what you guys are saying about the length. That's clearly a problem for a lot of my values. I can switch them both to bigint. One table has 34,000,000 records and it's OK if this is hung up for a few

Re: [PHP] Super bizarre changing variable!!

2007-10-04 Thread Richard Davey
Hi Brian, Thursday, October 4, 2007, 4:50:09 PM, you wrote: I'm running the following code: $query3 = DELETE FROM table1 WHERE referer=$referer ORDER BY creation LIMIT $numtodelete; $result3 = mysql_query($query3); $string = $total found, $n kept, $numtodelete extras removed

Re: [PHP] Opening a file

2007-09-05 Thread Richard Davey
Hi Dan, Wednesday, September 5, 2007, 3:24:43 PM, you wrote: Opening this file is proving to be a pain. I have a folder that contains a PHP page and a text file. I am trying to open the contents of the txt file using file() but it keeps erroring out. Below is the code I'm using to try and

Re: [PHP] Getting a 'newline' out of a string

2007-08-10 Thread Richard Davey
Hi Faither, Friday, August 10, 2007, 5:16:09 PM, you wrote: I'm kind of lost with how str_replace , preg_replace, ereg_replace or even explode are handling a \n-ewline. I have a text string from a form and am trying to replace the \n or chr(10) or however you might call the newline with a

Re: [PHP] Recursion and threaded message boards...

2007-08-10 Thread Richard Davey
Hi Tony, Friday, August 10, 2007, 5:23:28 PM, you wrote: I have to write some PHP backend code for a threaded message board. The db has a message table, and each message has a parent id. Does anyone have any advice for someone whos never done this in PHP? I'm currently thinking that I

Re[2]: [PHP] Friday morning brain farts....

2007-08-10 Thread Richard Davey
Hi Stut, Friday, August 10, 2007, 4:44:14 PM, you wrote: On my production servers error_reporting is set to E_ALL, display_errors is off and log_errors is on. I get an email from each server containing the contents of the error log from the previous day and my first task each day is to go

Re[2]: [PHP] Friday morning brain farts....

2007-08-10 Thread Richard Davey
Hi Robert, Friday, August 10, 2007, 4:13:02 PM, you wrote: On Fri, 2007-08-10 at 11:00 -0400, Daniel Brown wrote: Remember to clean that input before you sit down at the table, there, boy! It's safe to ignore the `Undefined index` notices. That will just appear if a variable is

Re: [PHP] manual vs. meta refresh

2007-08-10 Thread Richard Davey
Hi Kevin, Friday, August 10, 2007, 7:26:30 PM, you wrote: I doubt this, but is there any way to determine via PHP if a browser was refreshed automatically via a META tag vs the person clicking the refresh button? You could dynamically generate the meta tag, so it refreshes to your page

Re: [PHP] Hosting cost

2007-08-10 Thread Richard Davey
Hi Richard, Friday, August 10, 2007, 11:10:21 AM, you wrote: This is off topic so feel free to reply off list. My question is how much is it reasonable to charge for the following: 1. Building a very small website (you can see it here: http://www.cleardebtadvice.co.uk) 2. Hosting it

Re[2]: [PHP] javascript in head or in body ?

2007-08-07 Thread Richard Davey
Hi Greg, Tuesday, August 7, 2007, 9:52:28 PM, you wrote: PHP is the absolute worst language to do any sort of OO programming in. Ignoring the digg user mentality of that statement, try ASP if you want to see OO suck *royally* Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk

Re: [PHP] Array difficulty

2007-07-31 Thread Richard Davey
Hi Carlton, Tuesday, July 31, 2007, 2:27:46 PM, you wrote: I have an array like this: $chance = array(lowercase = 27, uppercase = 62, integer = 46); The values for each of the keys are randomly generated. I want to find the key name of the one which has the highest value. Currently, I'm

Re[2]: [PHP] Reading registry values

2007-07-30 Thread Richard Davey
Hi, Monday, July 30, 2007, 7:40:52 PM, you wrote: I'm not sure that there's actually anything you'd need to access in the server registry (and certainly no registry in Linux if you're also transitioning from Windows to Linux). And depending on what the ActiveX control your ASP pages accessed

Re: [PHP] how to use imagestring() function with Chinese String

2007-07-28 Thread Richard Davey
Hi Davis, Saturday, July 28, 2007, 1:54:22 AM, you wrote: Hi! I am trying to use the imagestring() function to put a string of Chinese characters from a $_GET variable onto an image. However, the characters do not display right (English is fine). Is there a way I can fix this or it is the

Re: [PHP] query not working properly

2007-07-26 Thread Richard Davey
Hi Joey, Thursday, July 26, 2007, 1:36:37 PM, you wrote: Hi everyone, I'mt trying to do the below query which itself works correctly, but when I add a order by statement just bombs. $query = select * from articles where ( {$now} BETWEEN startdate AND enddate) and categoryid = 1

[PHP] How to get stored procedure return values via PDO?

2007-07-26 Thread Richard Davey
Hi, I'm calling a MySQL Stored Procedure via PDO (PHP 5.2.3) $stmt = $dbh-prepare('CALL forum_post(?, ?, ?, ?, ?, @status, @thread_id, @message_id)'); At the moment in order to get the values of status, thread_id and message_id I need to issue a second query: $sql = SELECT @status AS status,

Re: [PHP] Re: How to get stored procedure return values via PDO?

2007-07-26 Thread Richard Davey
Hi M., Thursday, July 26, 2007, 2:09:47 PM, you wrote: Richard Davey wrote: Hi, I'm calling a MySQL Stored Procedure via PDO (PHP 5.2.3) $stmt = $dbh-prepare('CALL forum_post(?, ?, ?, ?, ?, @status, @thread_id, @message_id)'); At the moment in order to get the values of status

Re[2]: [PHP] Better way to store data in memory?

2007-07-25 Thread Richard Davey
Hi Richard, Wednesday, July 25, 2007, 5:20:32 AM, you wrote: It's possible, maybe, that using imagecolorat and imagesetcolor (or whatever it is) would be faster than array access... In the end I implemented RLE on the image data, and depending on the image in question it is saving sometimes

Re: [PHP] Notice warnings and performance

2007-07-25 Thread Richard Davey
Hi Erfan, Wednesday, July 25, 2007, 9:39:35 AM, you wrote: The site I'm working on has a lot of notice warnings, thousands. And they are all about: (Notice: Undefined variable..) I was wondering if I set the php.ini file to not log these in file or display them, does all of these notice

Re: [PHP] global variable does not exist anymore?

2007-07-25 Thread Richard Davey
Hi Patrik, Wednesday, July 25, 2007, 11:30:56 PM, you wrote: Dear my friends... I create a very simple script in html and php as a first step. I use suse, apache2, mysql and php. I wonder why this script does not work: !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html

Re: [PHP] module loading problems

2007-07-25 Thread Richard Davey
Hi Chris, Wednesday, July 25, 2007, 5:36:29 PM, you wrote: I'm running PHP 5.2.0 on windows XP SP2 lately when it starts I have been getting the an error when it tries to load the mysqli dll. It loads the standard mysql dll fine and all the dlls are in the same place the path and php

Re[2]: [PHP] Help needed with Curl

2007-07-24 Thread Richard Davey
Hi Daniel, Tuesday, July 24, 2007, 2:34:06 PM, you wrote: In order to enable cURL on a Windows box, you have to copy libeay32.dll and ssleay32.dll from the DLL folder of the PHP/ binary package to the SYSTEM folder. (to be safe, you may want to do both C:\WINDOWS\SYSTEM\ and

Re[4]: [PHP] Help needed with Curl

2007-07-24 Thread Richard Davey
Hi Daniel, Tuesday, July 24, 2007, 3:57:11 PM, you wrote: On 7/24/07, Richard Davey [EMAIL PROTECTED] wrote: *Never* put PHP DLLs into the Windows System folder. It's neither required, nor sensible. Keep them where they belong - in your PHP folder. Heh which is why I prefer

Re[4]: [PHP] Help needed with Curl

2007-07-24 Thread Richard Davey
Hi Dave, Tuesday, July 24, 2007, 4:45:13 PM, you wrote: No I don't have a local certificate created. I'm only need to do a post using xml-rpc and I have SSLVerifyPeer turned off. This turns off client certificate authentication $xmlrpc_client-setSSLVerifyPeer(0); What does your PHP error

Re[2]: [PHP] Pirate PHP books online?

2007-07-23 Thread Richard Davey
Hi Crayon, Monday, July 23, 2007, 4:09:57 PM, you wrote: On Monday 23 July 2007 22:26, Larry Garfield wrote: So when does Rasmus Lerdorf and the Deathly Hallows open in theaters? They've got to make Rasmus Lerdorf and the Order of the PHP first. Or even Rasmus Lerdorf and the Order of

[PHP] Better way to store data in memory?

2007-07-23 Thread Richard Davey
Hi php-general collective, I'm building up some image data in my PHP script (ready for output to the browser). Having to do some complex per pixel manipulation, which is fine - but I'm just wondering is there a quicker / more efficient way of storing the pixel data than in an array? At the

Re[2]: [PHP] Better way to store data in memory?

2007-07-23 Thread Richard Davey
Hi Robert, Monday, July 23, 2007, 6:00:50 PM, you wrote: What kind of data? Can't you just store it in the image? Or a working copy of the image? Afraid not, I'm performing deformation on the data that requires a temporary location before rendering to the final image. If this was a straight

Re[2]: [PHP] Re: Pirate PHP books online?

2007-07-17 Thread Richard Davey
Hi John, Tuesday, July 17, 2007, 1:02:15 PM, you wrote: Really? Did you cite and pay every source you used in your book? And what about those of us who downloaded books that we've bought? Neither of these things apply to my rant, don't quote me out of context. Seriously, I think you need

Re[2]: [PHP] Re: Pirate PHP books online?

2007-07-17 Thread Richard Davey
Hi John, Tuesday, July 17, 2007, 2:01:42 PM, you wrote: So it isn't as black and white as you say. There apparently is a place where you can not only copy, but redistribute, and as long as you gave proper credit, you don't have to pay. Citing a reference in a book to another is not the same

Re[2]: [PHP] Re: Pirate PHP books online?

2007-07-17 Thread Richard Davey
Hi John, Tuesday, July 17, 2007, 3:27:16 PM, you wrote: Citing a reference in a book to another is not the same as reproducing that ENTIRE book wholesale, page for page, illustration for illustration. All right, supposing I do a cut copy paste on a section of a book, not the whole thing,

Re[4]: [PHP] Re: Pirate PHP books online?

2007-07-16 Thread Richard Davey
Hi Crayon, Monday, July 16, 2007, 4:22:14 PM, you wrote: I think no matter which way you dice it, sending 1 email is a lot more energy efficient than printing 1 book. Just because the tree itself is renewable, the *energy* used in cutting it down, turning it into paper, turning the paper

Re[2]: [PHP] Re: Pirate PHP books online?

2007-07-16 Thread Richard Davey
Hi Jochem, Monday, July 16, 2007, 6:11:12 PM, you wrote: no personal attack is intended here ... I hope you don't mind if I rebutt/discuss, I find it a rather interesting topic :-) Not at all, my original post wasn't meant personally towards you specifically, just in general. did you look

Re: [PHP] I am lost

2007-07-15 Thread Richard Davey
Hi Grant, Saturday, July 14, 2007, 8:07:43 PM, you wrote: Previously I had PHP on my older computer using IIS 5.1 it worked fine. But I'm on my new computer using IIS 7 and features like include or completely normal scripts that use to work no longer work. I have try to see if it's the web

Re: [PHP] Php code in html buttons

2007-07-10 Thread Richard Davey
Hi k, Tuesday, July 10, 2007, 11:59:42 PM, you wrote: I'm trying to make a button execute some php code when the button is clicked. I'm not sure if it is the button i'm coding wrong or the php code. Here is the code I am using. ?php echo button action='?php

Re[2]: [PHP] Re: php security books

2007-07-04 Thread Richard Davey
Hi Andrew, Wednesday, July 4, 2007, 4:23:38 PM, you wrote: Avoid the O'Reilly one as it is flawed. In what way? Its written by Chris Shiflett, isn't that enough reason? No, not really. The errata are clearly published online, and while you could argue that some of them shouldn't have

Re[4]: [PHP] Re: php security books

2007-07-04 Thread Richard Davey
Hi Andrew, Wednesday, July 4, 2007, 8:29:51 PM, you wrote: I have no doubt he is a great bloke and a great public speaker / PR for PHP application level security, I apologise if it sounded like FUDing (why does that sound dirty?). I just don't like / agree with his book or some of the

Re[2]: [PHP] HTML in database

2007-07-04 Thread Richard Davey
Hi Bruce, Thursday, July 5, 2007, 1:26:01 AM, you wrote: Thanks. Sorry, I should have mentioned I'm using MS Sql Server and I don't see a mssql equivalent to that function. MSSQL treats '' as an escaped ', not \' like MySQL does. So you can't addslashes it. Perform your own ' to ''

Re[3]: [PHP] HTML in database

2007-07-04 Thread Richard Davey
Thanks. Sorry, I should have mentioned I'm using MS Sql Server and I don't see a mssql equivalent to that function. MSSQL treats '' as an escaped ', not \' like MySQL does. So you can't addslashes it. Perform your own ' to '' conversion. And to reply to my own reply :) ... If you can, use

[PHP] Swear filter ideas

2007-06-27 Thread Richard Davey
Hi all, Just wanting to pick your collective brains on this one: How do you go about implementing a swear / bad-word filter in PHP? Reasons for needing one aside, I'm just wondering if you favour a regexp, a substr_count, or what? Do you like to *** out the bad words, or just error back to the

[PHP] Counting Capital Letters

2007-06-20 Thread Richard Davey
Hi, I've written a short regexp which will *count* how many capital letters are in a given string (the woefully simple: '/[A-Z]/') Although it's an English language web site, I'm curious how you'd count capital letters that span beyond just the standard A-Z. For example characters such as the

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Larry, Tuesday, June 19, 2007, 2:55:07 AM, you wrote: Perhaps you're looking for in_array()? If only it was that simple! But pray tell how an in_array search is going to find: $userparam = test['bob'][]; within: Array ( [test] = Array ( ['bob'] = Array

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Stut, Tuesday, June 19, 2007, 10:16:02 AM, you wrote: If you can't control $userparam and it has to look like you have it then you're parsing of it is a little more involved, but still fairly simple. What are you actually trying to do? Where will $userparam actually come from? There is

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Stut, Tuesday, June 19, 2007, 12:09:12 PM, you wrote: If you have no control over what the fields in the form will be, what are you doing with the data? Surely if you're writing logic that requires you to know what the fields are called, you need to have control over it. Here, this

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Stut, Tuesday, June 19, 2007, 1:16:54 PM, you wrote: The problem is finding a way to expand the input name (which is a string) into a format that $_POST can be searched for. Or do the reverse, iterate through $_POST to find a match for the input name and get that value. Try this overly

Re: [PHP] Re: Comparing string to array

2007-06-19 Thread Richard Davey
Hi Al, Tuesday, June 19, 2007, 1:46:47 PM, you wrote: preg_grep() or foreach($_POST as $value){ if(empty($value)) continue; $good_stuff[] = $value; } A classic case of not reading the post fully methinks. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Stut, Tuesday, June 19, 2007, 1:49:53 PM, you wrote: Very nice, thank you. I was hoping there would be a way to do it without resorting to eval(), but if even you can't figure out how, I'm not going to waste any more time trying to either :) You probably could by breaking it into each

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Jim, Tuesday, June 19, 2007, 5:06:47 PM, you wrote: DON'T USE SINGLE QUOTES IN YOUR NAME= ATTRIBUTE Hate to piss on your bonfire but a single quote is a perfectly valid (if somewhat stupid choice of) character for inclusion in an array key. Cheers, Rich -- Zend Certified Engineer

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Jim, Tuesday, June 19, 2007, 5:29:55 PM, you wrote: Richard Davey wrote: Hi Jim, Tuesday, June 19, 2007, 5:06:47 PM, you wrote: DON'T USE SINGLE QUOTES IN YOUR NAME= ATTRIBUTE Hate to piss on your bonfire but a single quote is a perfectly valid (if somewhat stupid choice

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Jim, Tuesday, June 19, 2007, 5:47:29 PM, you wrote: Jim Lucas wrote: $userparam = test['sam'][]; then what you are saying it that this HAS to be your search string? Heck no, it doesn't *have* to be. Feel free to remove the quotes from it and then attempt my original question

Re: [PHP] Force zero numbers on a integer

2007-06-19 Thread Richard Davey
Hi, Tuesday, June 19, 2007, 5:17:29 PM, you wrote: I have a integer that is submitted by the user and i need it to always contain 5 digits. If the user submitted 45, i need it to be 00045. If the user submitted 4595, i need it to be 04595. How can i do this? Given PHPs type switching

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Jim, Tuesday, June 19, 2007, 6:21:25 PM, you wrote: let me try this again. in the submitted $_POST array, you are looking for a key (test) that contains a given $username that may or may not have any values set? Correct? Sorry not even close. Here, let me try again... $param =

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Robin, Tuesday, June 19, 2007, 8:28:50 PM, you wrote: On 19/06/07, Richard Davey [EMAIL PROTECTED] wrote: $userparam = test['sam'][]; // How to check if $userparam exists in the $_POST array // and get all the values from it? full_key_exists(test['sam'][], $_POST

[PHP] Comparing string to array

2007-06-18 Thread Richard Davey
Hi all, Ok it's 2am, my brain has gone to mush and I am having trouble figuring out an easy way to do this, can anyone shed some light? Take a peek at the following code: // START pre ?php print_r($_POST); $userparam = test['sam'][]; // How to check if $userparam exists in

Re[7]: [PHP] Need a more elegant way of bitwise ORing values

2007-06-16 Thread Richard Davey
Hi tedd, Saturday, June 16, 2007, 1:18:58 PM, you wrote: How about? switch (1) { case $allow_fraction: $filter['flags'] = FILTER_FLAG_ALLOW_FRACTION; break; case $allow_thousand: $filter['flags'] = FILTER_FLAG_ALLOW_THOUSAND;

Re: [PHP] Creating 'Previous - Next Buttons' Logic - Novice Question

2007-06-15 Thread Richard Davey
Hi, Friday, June 15, 2007, 9:53:24 PM, you wrote: I know very little about PHP ... however, I am hoping that there is some kind of preset open source php code that I might be able to use. There is the Pear pagination package which can do this, although not quite in the way you want it done

Re: [PHP] Re: outputing image part 2

2007-06-15 Thread Richard Davey
Hi Ross, Friday, June 15, 2007, 10:00:53 PM, you wrote: I have this $img_url=http://www.xxx.co.uk/images/ENbb24469/room1.JPG;; echo img src=\common/display_image.php?img_url='$img_url'\ width=\200\ height=\100\ /; and on the display image page I have: $img_url= $_GET['img_url'];

Re[2]: [PHP] Re: outputing image part 2

2007-06-15 Thread Richard Davey
Hi Ross, Friday, June 15, 2007, 10:40:37 PM, you wrote: Any ideas how to save the imagecopyresampled() to the folder? Call imagepng (or imagejpeg or whatever) and pass it a filename to save the image instead of output it. Check the help files for examples. Cheers, Rich -- Zend Certified

Re: [PHP] London PHP salaries

2007-06-14 Thread Richard Davey
Hi Javier, Thursday, June 14, 2007, 9:23:25 AM, you wrote: I've received a job offer from a London zone 1 based company as Senior PHP developer. I'm really interested but I live in Spain an have no idea about UK salaries so I wonder if somebody could give me a clue. How much money is a

Re[2]: [PHP] Re: London PHP salaries

2007-06-14 Thread Richard Davey
Hi Daniel, Thursday, June 14, 2007, 7:40:52 PM, you wrote: I gross ~$2,400 per month. [snip] So, with bills alone, it costs me a minimum of $2,700. That leaves me with about $900 extra which then goes to repaying loans I'm curious.. how does $2,400 - $2,700 = $900 left over

Re[2]: [PHP] London PHP salaries

2007-06-14 Thread Richard Davey
Hi Daevid, Thursday, June 14, 2007, 9:26:44 PM, you wrote: We had an employee (a friend of mine) start a UK office, and due to corporate legal reasons, and taxes, etc, he got paid in US DOLLARS. Aside from even more legal/tax issues he personally had to face, his salary was almost halved, as

Re[4]: [PHP] London PHP salaries

2007-06-14 Thread Richard Davey
Hi Tijnema, Friday, June 15, 2007, 12:10:56 AM, you wrote: It's actually 1 USD = 0.50 GBP. Ohh nice :) Yeah, it makes buying software from the US a dream at the moment. Same goes for domain names, server hosting, etc. Of course it means SELLING software into the US is a complete bitch, but

Re[6]: [PHP] London PHP salaries

2007-06-14 Thread Richard Davey
Hi Crayon, Friday, June 15, 2007, 2:06:47 AM, you wrote: On Friday 15 June 2007 07:39, Richard Davey wrote: Yeah, it makes buying software from the US a dream at the moment. Huh? When software comes across the pond they usually markup at 1USD=1GBP Sure, bastards like Adobe rip us off

[PHP] Need a more elegant way of bitwise ORing values

2007-06-13 Thread Richard Davey
Hi all, Can anyone think of a more elegant way of achieving the following? ?php $flags = array(); if ($allow_fraction) { $flags[] = FILTER_FLAG_ALLOW_FRACTION; } if ($allow_thousand) { $flags[] = FILTER_FLAG_ALLOW_THOUSAND; } if ($allow_scientific) { $flags[] =

Re[2]: [PHP] Need a more elegant way of bitwise ORing values

2007-06-13 Thread Richard Davey
Hi Zoltán, Wednesday, June 13, 2007, 2:21:18 PM, you wrote: 2007. 06. 13, szerda keltezéssel 14.13-kor Richard Davey ezt írta: Hi all, Can anyone think of a more elegant way of achieving the following? ?php $flags = array(); if ($allow_fraction) { $flags

Re[4]: [PHP] Need a more elegant way of bitwise ORing values

2007-06-13 Thread Richard Davey
Hi Tijnema, Wednesday, June 13, 2007, 2:42:28 PM, you wrote: Nice one, but you could also do it like this: ?php $filter['flags'] = FALSE; if ($allow_fraction) { $filter['flags'] = $filter['flags'] | FILTER_FLAG_ALLOW_FRACTION; } if ($allow_thousand) { $filter['flags'] =

Re[4]: [PHP] Need a more elegant way of bitwise ORing values

2007-06-13 Thread Richard Davey
Hi Zoltán, Wednesday, June 13, 2007, 3:09:16 PM, you wrote: 2007. 06. 13, szerda keltezéssel 15.42-kor Tijnema ezt írta: On 6/13/07, Richard Davey [EMAIL PROTECTED] wrote: Hi Zoltán, Wednesday, June 13, 2007, 2:21:18 PM, you wrote: 2007. 06. 13, szerda keltezéssel 14.13-kor Richard

Re[6]: [PHP] Need a more elegant way of bitwise ORing values

2007-06-13 Thread Richard Davey
Hi Robert, Wednesday, June 13, 2007, 3:15:39 PM, you wrote: It's terribly verbose and inefficient... ?php $filter['flags'] = 0; if( $allow_fraction ) { $filter['flags'] |= FILTER_FLAG_ALLOW_FRACTION; } if( $allow_thousand ) { $filter['flags'] |= FILTER_FLAG_ALLOW_THOUSAND;

Re[8]: [PHP] Need a more elegant way of bitwise ORing values

2007-06-13 Thread Richard Davey
Hi Robert, Wednesday, June 13, 2007, 3:37:38 PM, you wrote: Personally I hate constants (can't use non-scalar values so why get used ot them... also they're just another point for name collision) so if it were my own code I'd do something more like the following: Sure, but the filter

Re[2]: [PHP] Need a more elegant way of bitwise ORing values

2007-06-13 Thread Richard Davey
Hi Richard, Wednesday, June 13, 2007, 6:44:55 PM, you wrote: if ($allow_fraction) //Should we warn you that $allow_fraction is not actually defined?... Should I warn you that to save everyone's sanity I only posted what was needed from the code? ;) $allow_fraction came from a function

Re[2]: [PHP] checking the aspect ratio of an images

2007-06-08 Thread Richard Davey
Hi Crayon, Friday, June 8, 2007, 6:08:30 PM, you wrote: On Friday 08 June 2007 22:17, tedd wrote: Wednesday, June 6, 2007, 11:41:19 AM, you wrote: I want to force users to insert landscape rather portrait images. I don't want to be too pedantic about it but they do need to have

Re[2]: [PHP] checking the aspect ratio of an images

2007-06-08 Thread Richard Davey
Hi Robert, Friday, June 8, 2007, 7:21:39 PM, you wrote: Precisely defined limits are not the same as precisely defined values. I might precisely define the amount of entropy on a random value as being some formula based on the current temperature of my CPU. The formula is quite precise, but

Re[4]: [PHP] checking the aspect ratio of an images

2007-06-08 Thread Richard Davey
Hi Robert, Friday, June 8, 2007, 7:47:17 PM, you wrote: On Fri, 2007-06-08 at 19:35 +0100, Richard Davey wrote: Hi Robert, Friday, June 8, 2007, 7:21:39 PM, you wrote: Precisely defined limits are not the same as precisely defined values. I might precisely define the amount of entropy

Re: [PHP] PHP Corrupts URLs

2007-06-08 Thread Richard Davey
Hi Nathan, Friday, June 8, 2007, 9:47:22 PM, you wrote: I have a php script that gets a url from a GET query parameter. I have been running this script on PHP 5.2.2 on Ubuntu Linux, and everything works as expected. I have just installed PHP 5.2.3 on OS X via MacPorts, and the same query

Re: [PHP] checking the aspect ratio of an images

2007-06-06 Thread Richard Davey
Hi, Wednesday, June 6, 2007, 11:41:19 AM, you wrote: I want to force users to insert landscape rather portrait images. I don't want to be too pedantic about it but they do need to have an approximate 4x3 aspect ratio. You can't really be 'approximate' when coding. You need to set some hard

Re: [PHP] Re: customer ids

2007-06-06 Thread Richard Davey
Hi Burn, Wednesday, June 6, 2007, 3:55:21 PM, you wrote: Here's how I do it, for 1 single table though.. you'll have to write yourself the mod to check on more tables. If you plan to have 10 millions records make sure the maxrand is higher. When the do loop exits you have a unique id.

Re[2]: [PHP] Re: customer ids

2007-06-06 Thread Richard Davey
Hi Burn, Wednesday, June 6, 2007, 4:39:05 PM, you wrote: Worst thing that can happen is having mysql throw an error while trying to insert an ID that's already present in the database. It gets more complicated and unpredictable if the field isn't required to be unique at database design

Re[2]: [PHP] Parse domain from URL

2007-06-06 Thread Richard Davey
Hi Brad, Wednesday, June 6, 2007, 5:04:41 PM, you wrote: Yes, that's basically what my code already does. The problem is that what if the url is http://yahoo.co.uk/; (note the lack of a subdomain) Your script thinks that the domain is co.uk. Just like my existing code does. So we can't

Re[2]: [PHP] Double checking - I should turn off magic quotes

2007-06-04 Thread Richard Davey
Hi Dave, Monday, June 4, 2007, 3:25:25 PM, you wrote: No, you should check the ini setting in your code and react accordingly. Sorry, I don't quite follow you here. If I turn magic quotes off on both my testing environment and my server, as is preferable according to the manual, then my

[PHP] Return or not to return, that is the question

2007-05-30 Thread Richard Davey
Hi all, Just a quick straw-poll really: What is your take on using 'return' when you end a function, if you don't actually need to return a value? If you have to return say a true/false as the result of an operation, then it's an obvious choice. But what if all the function does is perform an

Re[2]: [PHP] Return or not to return, that is the question

2007-05-30 Thread Richard Davey
Hi Dave, Wednesday, May 30, 2007, 12:20:48 PM, you wrote: If there is no need to return a value then I don't do so. However, the function is going to process something, and surely you should check that the processing has succeeded or failed? I have exception and error handling dealt with

Re[2]: [PHP] Return or not to return, that is the question

2007-05-30 Thread Richard Davey
Hi Chris, Wednesday, May 30, 2007, 1:17:39 PM, you wrote: If there is no need to return a value then I don't do so. However, the function is going to process something, and surely you should check that the processing has succeeded or failed? This is precisely the point I was going to

Re[2]: [PHP] Return or not to return, that is the question

2007-05-30 Thread Richard Davey
Hi Paul, Wednesday, May 30, 2007, 4:07:00 PM, you wrote: I demur at your final point: If we don't use exit() and the function performs non-aborting error handling, it's going to return to the calling function which in most cases will need to know whether its child function succeeded or

Re: [PHP] RE: Return or not to return, that is the question

2007-05-30 Thread Richard Davey
Hi Jared, Wednesday, May 30, 2007, 4:10:45 PM, you wrote: [snip] I think putting return; at the end of every function is probably a healthy practice, but is it best practice? If it's poorly written and/or poorly factored code, it doesn't make any difference if they have returns on

Re: [PHP] installing error

2007-05-26 Thread Richard Davey
Hi Rafael, Saturday, May 26, 2007, 12:38:15 AM, you wrote: Hello does anyone know the correct way to install PHP and APACHE (last versions both of them) on WinXP???, Im doing it with the installers and I cannot even run phpinfo(); script, I see apache's error log and it says that i cant find

Re[2]: [PHP] Include???

2007-05-25 Thread Richard Davey
Hi Tedd, Friday, May 25, 2007, 2:42:34 PM, you wrote: At 3:28 PM +0100 5/23/07, Richard Davey wrote: if ($_POST['status_code'] == 'C') ^^ Read-up on the if/else structure and comparison operators. You'd never use a single equals sign in this example. Rich: Read

Re[2]: [PHP] Include file questions

2007-05-25 Thread Richard Davey
Hi Tijnema, Friday, May 25, 2007, 5:58:46 PM, you wrote: On 5/25/07, Robert Cummings [EMAIL PROTECTED] wrote: Very. Each directory contains very specific types of code/content. Tracking down where any given function, class, custom tag, behaviour, etc is defined is extremely simple. Cheers,

Re[2]: [PHP] ftp root dir?

2007-05-22 Thread Richard Davey
Hi Al, Tuesday, May 22, 2007, 4:19:22 PM, you wrote: I know that; but, I writing a script, that can be used on different servers, which creates a directory and I want to make certain it is created on the DOC ROOT. I don't want the user to have to test the ftp connection with a ftp utility

Re: [PHP] convert numerical day of week

2007-05-22 Thread Richard Davey
Hi Dave, Tuesday, May 22, 2007, 5:46:38 PM, you wrote: How can I convert the numerical day of week to the string version? Example, if the day of the week is 1 I would like to print out 'Sunday'. $days = array(1 = 'Sunday', 2 = 'Monday', 3 = 'Tuesday', etc ...); then just $today = $days[1];

[PHP] When does PHP free-up memory allocated to it?

2007-05-21 Thread Richard Davey
Hi, Quick question - does anyone know when PHP actually frees allocated memory during the process of a script? I'm using 5.2.2. For example I see the following results when profiling: Memory: 256 KB Load a 1024x768 JPEG (via GD) Memory: 4 MB Create thumbnail (via GD) Memory: 5.2 MB Destroy

Re[2]: [PHP] When does PHP free-up memory allocated to it?

2007-05-21 Thread Richard Davey
Hi Richard, Tuesday, May 22, 2007, 1:24:35 AM, you wrote: I would have expected (or rather, hoped) that the memory use would have dropped down quite dramatically after destroying the image resource that was using up nearly 4MB of memory, but it didn't seem to change. How are you measuring

Re: [PHP] Uploading Files Should I use MySQL or Server for storage?

2007-05-20 Thread Richard Davey
Hi benc11, Monday, May 21, 2007, 2:16:19 AM, you wrote: I am in the process of adding a part to my website which would include pictures, pdf files, txt files, and excel files. The files sizes could be anywhere on average of 100k to 2mb. Do you think I should be uploading the files to a

Re[2]: [PHP] stay logged in for session

2007-05-18 Thread Richard Davey
Hi Edward, Friday, May 18, 2007, 12:43:43 PM, you wrote: Just because some user agents handle non-standard data doesn't make it correct. You mean user agents follow RFCs to the letter? :) Since when? :) I do agree with your comment, but it's a LOT more than some user agents. Every browser in

[PHP] A Guide to running Apache 2, PHP 4 PHP 5 on Windows XP

2007-05-17 Thread Richard Davey
Hi all, I'm very happy to announce that I've just released my comprehensive guide to installing, configuring and running Apache 2, PHP 4.4.7 and PHP 5.2.2 on Windows XP. The guide is broken down into small manageable sections and contains over 50 screen shots of the entire process, so you won't

Re[2]: [PHP] A Guide to running Apache 2, PHP 4 PHP 5 on Windows XP

2007-05-17 Thread Richard Davey
Hi Robert, Thursday, May 17, 2007, 4:43:14 PM, you wrote: Suggestion: get rid of Windows XP and use a real OS There's always one ;) You have previously and the past redundancy since previous implies the past and past implies previous. Fixed :) Cheers, Rich -- Zend Certified

Re[4]: [PHP] A Guide to running Apache 2, PHP 4 PHP 5 on Windows XP

2007-05-17 Thread Richard Davey
Hi Greg, Thursday, May 17, 2007, 5:01:18 PM, you wrote: There's always one ;) No, there's more than one. Sure, but you're in the minority*, so what do I care? :) * I just took the Zend PHP IDE research poll, and at the end it gives you the chance to view the stats of everyone else who took

Re[2]: [PHP] A Guide to running Apache 2, PHP 4 PHP 5 on Windows XP

2007-05-17 Thread Richard Davey
Hi Jon, Thursday, May 17, 2007, 5:46:12 PM, you wrote: I find it funny that the addition of the numbers above would logically put me in the 0% category. You could select multiple operating systems from the list. 50% of them used Linux too. It didn't show how the results were mixed though,

Re[6]: [PHP] A Guide to running Apache 2, PHP 4 PHP 5 on Windows XP

2007-05-17 Thread Richard Davey
Hi Greg, Thursday, May 17, 2007, 5:49:45 PM, you wrote: Sure, but you're in the minority*, so what do I care? :) I'm not asking you to care. Windoze still sucks, no matter how many idiots use it. The virus protection racket alone is enough to make me throw up. Viruses? God, that old

Re[2]: [PHP] A Guide to running Apache 2, PHP 4 PHP 5 on Windows XP

2007-05-17 Thread Richard Davey
Hi Lester, Thursday, May 17, 2007, 6:24:44 PM, you wrote: How about installation time. Just clocked up 6.5 Hours re-installing XP on a machine. To get the last linux machine to the same level - 20 mins. Of cause running Eclipse - it does not matter what the OS is :( Yeah I'd take

Re[8]: [PHP] A Guide to running Apache 2, PHP 4 PHP 5 on Windows XP

2007-05-17 Thread Richard Davey
Hi Robert, Thursday, May 17, 2007, 7:01:00 PM, you wrote: I had 500 things I wanted to change, then I switched from Windows to Linux in 2000 and found that they had been addressed. Sure enough though, I'm working on a new list. There's only a few things on it though ;) I envy those who's

Re[8]: [PHP] A Guide to running Apache 2, PHP 4 PHP 5 on Windows XP

2007-05-17 Thread Richard Davey
Hi Greg, Thursday, May 17, 2007, 7:23:47 PM, you wrote: Viruses? God, that old bullshit ladened chestnut*. At least come up with some kind of valid OS argument, please. 1. The virus and malware protection racket - M$ spent billions of 2. Perpetual Upgrading - you can use Ubuntu Linux 6.06

  1   2   3   4   5   6   7   8   9   10   >