Re: [PHP] Form executes differently in IE than in FireFox?

2004-11-03 Thread Chris Dowell
Murray I'm guessing that IE sends $recid = '' whereas firefox doesn't send it at all because it's an empty form field. Try checking for empty($recid) instead - that way you can check that it not only exists (as in isset) but also that it has a value (i.e. not '', NULL, 0 or FALSE) Hope this

Re: [PHP] Strange Array Error

2004-10-21 Thread Chris Dowell
Shaun The problem is that you've assigned $test_array[] = array(); This means that the first element ($test_array[0]) is an array. You're then trying to add $i to it, as in $test_array[$i] = $test_array[$i] + 1; in terms of types what you're doing is array = array + integer Which doesn't make

Re: [PHP] Strange Array Error

2004-10-21 Thread Chris Dowell
That is, expected results, *apart* from the infinite loop you'll have due to not incrementing $i Cheers Chris Chris Dowell wrote: Shaun The problem is that you've assigned $test_array[] = array(); This means that the first element ($test_array[0]) is an array. You're then trying to add $i

Re: [PHP] File Copy

2004-10-20 Thread Chris Dowell
Aidal Could you post the relevant parts of your code so we have a little context to work in? You say you're copying a file from one location to another on the same server. If this is the case you are very unlikely to be in need of the ftp family of functions, which are only valid for use over

Re: [PHP] 'Intelligently' truncate string?

2004-10-19 Thread Chris Dowell
You could also try a combination of html_entity_decode to change all entities back, then truncate it, then use html_entities to get back to the encoded string. Hope this helps Cherrs Chris Robert Cummings wrote: On Mon, 2004-10-18 at 14:35, Murray @ PlanetThoughtful wrote: Hi All, I'm working

Re: [PHP] Session

2004-10-19 Thread Chris Dowell
Deleo We had an interesting conversation on this last just last week regarding the length of sessions. The title of the thread is [PHP]Sessions not destroyed. Try searching the archives with that text. I believe Marek's and my own messages may have the information you're looking for -

Re: [PHP] Nesting level too deep - recursive dependency?

2004-10-18 Thread Chris Dowell
Francisco You really need to post this to [EMAIL PROTECTED] - this list is for us lowly users of PHP, the developers and maintainers of the language have their own list. Cheers Chris Francisco M. Marzoa Alonso wrote: Can someone tell me if I should fill a bug report about this or is it my

Re: [PHP] Nested foreach ?

2004-10-17 Thread Chris Dowell
Stuart, Having read what you've written so far, you may want to try something like this. In your HTML (I've left the selects empty, but you can see what I mean): input type=text name=skills[0][name] /select name=skills[0][years] /select name=skills[0][used] / input type=text

Re: [PHP] add item to end of (multidimensional) array

2004-10-15 Thread Chris Dowell
try $Arr[] = array('name' = 'arnold', 'address' = 'street'); Arnold wrote: Hi, How can i add new items to an array without using an index. Normally (single dimension) you can do: Arr[]=x and this item is added to the array, but what if i have subitems like: Arr[]['name']=arnold;

Re: [PHP] Regular Expression for a UK Mobile

2004-10-15 Thread Chris Dowell
Try is_int($_POST['mobile_number']) or ctype_digit($_POST['mobile_number']) HTH Cheers Chris Robert Cummings wrote: On Fri, 2004-10-15 at 07:45, Gareth Williams wrote: Do you even need a regex? What about if (strlen($_POST['mobile_number']) != 11 substr($_POST['mobile_number'],0,3) != 447) {

Re: [PHP] Advanced maths help (for GD image functionality)

2004-10-15 Thread Chris Dowell
Problem 1) $h_1 = 600; $w_1 = 800; $h_2 = 120; $w_2 = $w_1 * ($h_2 / $h_1); Problem 2 a) Assuming you're wanting the central portion of the original image (which I think you are from what you've written) $h_1 = 600; $w_1 = 800; $h_2 = 120; $w_2 = 90; $x = ($h_1 - $h_2) / 2; $y = ($w_1 - $w_2) /

Re: [PHP] Advanced maths help (part 2)

2004-10-15 Thread Chris Dowell
I think you've a couple of problems with your second problem (problem problem problem). First of all, you're setting $dst_h to 0, which gives you a height of 0 - IIRC that's not what you wanted :) You should be setting that $dst_h = 120 as you always want it to be 120px I reckon that your code

Re: [PHP] Help with sessions problem please

2004-10-14 Thread Chris Dowell
No I think it's more likely that one of his tentacles slipped Chris Shiflett wrote: --- John Holmes [EMAIL PROTECTED] wrote: header('Location: http://www.example.org/script2.php?.SID); He is human after all. :-) Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly HTTP

Re: [PHP] Query Returning Error

2004-10-13 Thread Chris Dowell
You can get around this problem more easily by putting your variables inside curly brackets when they appear inside strings. See here: http://uk.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex Or as an example: ?php $Query01 = SELECT * FROM Users WHERE UserID

[PHP] Using HTTP/PUT with PHP Apache Any browser in the whole world that works properly??????

2004-10-13 Thread Chris Dowell
Guys According to the docs, you need to use either php://stdin or php://input to read from files uploaded via PUT, however I'm unable to get even that far. My HTML form is as shown: form action=index.php method=put enctype=multipart/form-data input type=file name=putfile /input type=submit /

Re: [PHP] Exporting HTML to Excel

2004-10-13 Thread Chris Dowell
Header(Content-type: application/ms-excel); or whatever the content type should be (on IE you can probably get away with application/octet-stream as it bases its decisions of file extensions for a lot of things). HTH Chris Philip Thompson wrote: How exactly would I change the mime headers?

Re: [PHP] Using HTTP/PUT with PHP Apache Any browser in the whole world that works properly??????

2004-10-13 Thread Chris Dowell
hoping that the gateways will respect this fact (although I'm not holding my breath). If anyone has any alternate suggestions (other than Stop using MS gateway servers, which is unfortunately impossible given our clients), I'd be happy to hear them. Cheers Chris John Nichel wrote: Chris Dowell wrote

Re: [PHP] Exporting HTML to Excel

2004-10-13 Thread Chris Dowell
meek / sorry [skulks off into dark corner to cry] Philip Thompson wrote: Chris, as you may have (or may have not) noticed, I did that. Look at my original email. I wasn't sure if there was more to it than that. ~Philip On Oct 13, 2004, at 8:34 AM, Chris Dowell wrote: Header(Content-type

Re: [PHP] Exporting HTML to Excel

2004-10-13 Thread Chris Dowell
In an attempt to make amends, have you tried PEAR's Spreadsheet_Excel_Writer? http://pear.php.net/package/Spreadsheet_Excel_Writer It certainly works, we used it last week (although I have no *personal* experience of it) Cheers Chris Chris Dowell wrote: meek / sorry [skulks off into dark

Re: [PHP] With a graphic image, making text transparent

2004-10-12 Thread Chris Dowell
http://uk.php.net/imagecolorallocatealpha Todd Cary wrote: I would like to place text on a graphic but vary the transparency of the text. Can this be done with the gd library? Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] RE: **[SPAM]** RE: [PHP] Newsgroups Space

2004-10-09 Thread Chris Dowell
Matthew Sims wrote: Nice idea, but you want to be future-proof, don't you? Once alt.binaries.vr.animals.lobster starts filling up with 5 hour Virtual Reality ROMs you're looking at needing a lot more than that. I'd go with about 6 YB if I were you, and that's only because there aren't any SI

Re: [PHP] Sessions not destroyed

2004-10-09 Thread Chris Dowell
As Marek has stated a number of times, the session options in php.ini are meant to be set to reasonable values for the usage pattern for your server, in order that you can achieve a balance between a /tmp or /var/tmp of several zillion kilobytes, and a constant 100% cpu usage as the gc routine

Re: [PHP] Grab an array from a cookie without throwing errors?

2004-10-09 Thread Chris Dowell
pedantry Of course, you're running unserialize() twice. What about if (empty($_COOKIE['bookmarks']) || !($bookmarks = unserialize($_COOKIE['bookmarks']))) { $bookmarks = array(); } Does the same with only one call to a potentially weighty function. /pedantry Cheers Chris John Nichel wrote:

Re: [PHP] Callback functions inside classes - how to?

2004-10-09 Thread Chris Dowell
From the manual: http://uk.php.net/manual/en/language.pseudo-types.php#language.types.callback If you want to change things in the callback, the function (or method) should accept its parameters by reference. e.g. class A { function name($a, $b, $c) { $a = $b . $c; return; } function

Re: [PHP] Grab an array from a cookie without throwing errors?

2004-10-09 Thread Chris Dowell
pedantry Of course, you're running unserialize() twice. What about if (empty($_COOKIE['bookmarks']) || !($bookmarks = unserialize($_COOKIE['bookmarks']))) { $bookmarks = array(); } Does the same with only one call to a potentially weighty function. /pedantry Cheers Chris John Nichel wrote:

Re: [PHP] RE: **[SPAM]** RE: [PHP] Newsgroups Space

2004-10-08 Thread Chris Dowell
Nice idea, but you want to be future-proof, don't you? Once alt.binaries.vr.animals.lobster starts filling up with 5 hour Virtual Reality ROMs you're looking at needing a lot more than that. I'd go with about 6 YB if I were you, and that's only because there aren't any SI prefixes higher than

Re: [PHP] splitting string into array

2004-09-29 Thread Chris Dowell
In PHP4 $array = explode(';', chunk_split(A12B05C45D34, 3, ';')); In PHP4 $array = str_split(A12B05C45D34, 3); RTFM Cheers Chris blackwater dev wrote: How can I take a string and create an array? Example, A12B05C45D34 I need to split this into chunks of three A12,B05,C45..etc? Thanks! -- PHP

Re: [PHP] How can I formated a PHP script into colored HTML

2004-09-28 Thread Chris Dowell
There's also a pear package that might help you: http://pear.php.net/package/Text_Highlighter Cheers Chris Jason Wong wrote: On Tuesday 28 September 2004 12:40, [EMAIL PROTECTED] wrote: How can I make a code into html format like this You can have a look at the highlight_file()

Re: [PHP] Wrong php.ini being read at my hosting account

2004-09-24 Thread Chris Dowell
I think you really need to contact your hosting company and berate them for lying to you. Like Jason says, the definitive list is from *your* php_info(), not the hosting companies - you might like to send them copies of both and ask them to explain the differences. Cheers Chris missshus

[PHP] Pear::Image_Text - how to change background color from black

2004-09-24 Thread Chris Dowell
Guys Without hacking the pear library, does anyone know of any way (using the API) to change the background color of an image created with Image_Text from black? The bg is black because the image resource is created using imagecreatetruecolor() which returns a black image - this is on some of

[PHP] [SOLVED] [PHP] Pear::Image_Text - how to change background color from black

2004-09-24 Thread Chris Dowell
Just FYI I figured it out - there is an $options['canvas'] option which accepts, amongst other things, a handle to an image resource. Trivial then to use imagecreate() and imagecolorallocate() to create a white-background starting point. Sorry for wasting everyone's time Cheers Chris Chris

Re: [PHP] interesting behavior of ob_end_flush() in __destruct()

2004-09-24 Thread Chris Dowell
it seems that php first ends output buffering and then calls then destructs the objects. so the output buffering is still ended when the destructor is calles. one has to unset the object to reverse that order manually. aRZed If I remember correctly, there were a number of posts about this

Re: [PHP] Mohavi

2004-09-22 Thread Chris Dowell
Yeah I've rebuilt a huge CoOperative Marketing Fund Administration tool using version 1.3 or 1.4 (I can't be arsed to look right now). It's good for what it does - the only problem I have lies in the fact that the classes you generate for actions and views are generally quite large, and if the

Re: [PHP] inserting timestamp into mysql field

2004-09-22 Thread Chris Dowell
That's not 100% correct If you have more than one TIMESTAMP field only the first (IIRC) will be filled with the current time - other TIMESTAMP fields will only be filed if you set them = NULL. This is true of MySQL 4.1.2 - there is more fine-grained control over the behaviour from 4.1.2

Re: [PHP] inserting timestamp into mysql field

2004-09-21 Thread Chris Dowell
Not really a MySQL question - the answer happens to be MySQL, but the question asks how to do it in PHP This might still be necessary if the OP is using something like DB_DataObject, as you can't really use NOW() in that situation Try strftime [ http://uk.php.net/strftime - RTFM :) ] - a good

Re: [PHP] Infinate looping

2004-09-21 Thread Chris Dowell
Are you by any chance doing something like this? while (1) { $dbh = mysql_connect(x, x, x); mysql_query(...); sleep(10); } If so, you could run into that maxclients problem very quickly because you're not closing those mysql connections (they'll time out eventually, and there are persistent

Re: [PHP] password-protecting with PHP, help plz

2004-09-21 Thread Chris Dowell
And after that - go and try to find out a little on your own - contrary to a common misconception, it's not the sole purpose of members of this list to write all your code for you. The old favourites RTFM and STFW would serve you well here - there are thousands of PHP tutorials that will tell

Re: [PHP] empty variable

2004-09-21 Thread Chris Dowell
Just to clear up, there is no isempty() function - the correct function is empty() and its details can be found here: http://uk.php.net/empty Cheers Chris -{ Rene Brehmer }- wrote: At 01:54 20-09-2004, Chris Mach wrote: What is the best way to determine if a variable is empty? I have a feeling

Re: [PHP] generating a mysql script

2004-09-21 Thread Chris Dowell
If course, if you don't have shell access, phpMyAdmin is all you'll ever need http://www.phpmyadmin.net Cheers Chris Brian V Bonini wrote: On Mon, 2004-09-20 at 19:37, Stut wrote: On Mon, 20 Sep 2004 16:20:21 -0700, AMC [EMAIL PROTECTED] wrote: Is there a tool that will generate a script

Re: [PHP] Re: mysql_connect does not connect

2004-09-21 Thread Chris Dowell
Sam, You're correct - the manual does leave a little bit of a grey area about which extension you should use for 4.1.0 MySQL version 4.1.3 However, as you're using 5.0.1 this really shouldn't confuse you to quite the extent which it has. Sam Hobbs wrote: Curt Zirzow [EMAIL PROTECTED] wrote

Re: [PHP] mysql_connect does not connect

2004-09-21 Thread Chris Dowell
[snippy] Sam Hobbs wrote: Um.. you do realize you have more problems than php not being able to connect to the database. This is the type of unproductive comment that causes problems. The only reason you are saying this is because you are desperate to make me wrong. You have exhausted

Re: [PHP] fopen problem, 5 line script

2004-09-16 Thread Chris Dowell
Irrelevant, Warren Mag, the point is that you're trying to use a function (filesize) that uses the stat() system call. This function is not supported using the http wrapper to fopen (because HTTP doesn't support it at all) So regardless of whether you should be using the file name or the handle

Re: [PHP] File Download Problems

2004-09-16 Thread Chris Dowell
Chances are your 1KB file contains an error message - try changing the Content-Type to text/plain or text/html to see what PHP is throwing at you Cheers Chris Marek Kilimajer wrote: PHP Junkie wrote: Ave, I've been having a very nagging and frustrating problem for a while and I hope someone can

Re: [PHP] mysql_connect does not connect

2004-09-16 Thread Chris Dowell
All this is irrelevant; while you're still trying to use MySQL 5 with mysql_connect() instead of mysqli_connect(), it WILL NEVER WORK Sort that out first before you start worrying about firewalls - you can't test the firewall if you can't ever have a successful test case. Cheers Chris Markus

Re: [PHP] something like an SID

2004-09-15 Thread Chris Dowell
Try this: http://uk.php.net/output_add_rewrite_var Dennis Gearon wrote: You make a good point, Marek. They CAN open a new window with different results. Maybe it's up to each page to keep track of where it is at, via form elements alone, instead of through session values. Hadn't thought of

Re: [PHP] Capturing an Image of a web page

2004-09-15 Thread Chris Dowell
You can try this: http://open.thumbshots.org/image.pxf?url=http://www.php.net But I'm not sure how useful it will be to you - it's a database of thumbnails, not a tool to dynamically generate them. [EMAIL PROTECTED] wrote: Has anyone run across a tool available to PHP that can render an image of

Re: [PHP] php - no results - display other message

2004-09-15 Thread Chris Dowell
Or alternatively $result = mysql_query(SELECT * FROM tablename); if (mysql_num_rows($result)) { while ($row = mysql_fetch_row($result)) { // display results } } else echo No results; Hope this helps Cheers Chris John Nichel wrote: Dustin Krysak wrote: Hi there... I have a simple search page

Re: [PHP] Removing strange chars from array (or string)

2004-09-15 Thread Chris Dowell
Zoran Sounds like your problem is with line endings - your unix (i presume) box ends its lines with a newline (\n) Windows ends lines with a carraige return followed by a newline (\r\n or CRLF) Notepad doesn't recognise a newline on its own as either a valid character or a valid line ending,

Re: [PHP] something like an SID

2004-09-15 Thread Chris Dowell
Perhaps it's something Freudian to do with your chequered past Just a thought :) John Holmes wrote: Subject: Re: [PHP] something like an SID Anyone else read that as something like an STD ?? and thought we were getting more spam to the list!?!? ;) ---John Holmes... -- PHP General Mailing List

Re: [PHP] mysql_connect does not connect

2004-09-14 Thread Chris Dowell
Sam Your problem probably does stem from the extension not being installed. You say you're using (IIRC) mySQL 4.1 This requires you to use the mysqli extension, not the mysql extension As you're on windows, it's probably just a case of uncommenting the extension=php_mysqli.dll line in your

Re: [PHP] [PHP-GEN] Check Boxes

2004-09-10 Thread Chris Dowell
Try something along these lines: ... Date: input type=checkbox name=columns[] value=date / Time: input type=checkbox name=columns[] value=time / Cost: input type=checkbox name=columns[] value=cost / Colour: input type=checkbox name=columns[] value=colour / ... ?php ... mysql_query(SELECT .

Re: [PHP] Array inside Class

2004-09-10 Thread Chris Dowell
From the manual: In PHP 4, only constant initializers for var variables are allowed. To initialize variables with non-constant values, you need an initialization function which is called automatically when an object is being constructed from the class. Such a function is called a constructor