[PHP] file uploads

2003-12-01 Thread Jon Bennett
Hi,

I have a file upload problem, but I don't think it's a permission thing 
(if only, that would be simple!).

I have written a resizing method for a class I'm working on, and it 
always fails on the imageJpeg() at the end of the method. This is the 
error I get...

imagejpeg(): Unable to open 
'/Library/WebServer/Documents/my_site/_lib/_products/2_big_me.jpg' for 
writing in 
/Library/WebServer/Documents/my_site/_lib/_classes/class.products.php 
on line 132

Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know it's 
not the permissions, could someone have a little look  at my method and 
let me know if there's anything wrong with it please

// $ID is an integer used for naming purposes
// $aImage is an array, it's basically a copy of $_FILES["image"]
// BASE_DIR is a constant var and holds, yep you guessed it, the base 
dir of the site!
// IMGMAXHEIGHT & IMGMAXWIDTH are also constants used for resizing 
purposes

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' 
.  $aNewImage['new_name'];
 
// copy original image
$aNewImage['original_image'] = 
ImageCreateFromJpeg($aImage['tmp_name']);
$aNewImage['sizes'] = getimagesize($aImage['tmp_name']);
$aNewImage['width'] = $aNewImage['sizes'][0];
$aNewImage['height'] = $aNewImage['sizes'][0];

if($aNewImage['width'] >= IMGMAXWIDTH || $aNewImage['height'] 
>= IMGMAXHEIGHT){

// calculate ratios
$iRatio_w = IMGMAXWIDTH / $aNewImage['width'];
$iRatio_h = IMGMAXHEIGHT / $aNewImage['height'];
$iRatio = $iRatio_w < $iRatio_h ? $iRatio_w:$iRatio_h;

// calculate new dimensions
$aNewImage['new_width'] = $aNewImage['width'] * $iRatio;
$aNewImage['new_height'] = $aNewImage['height'] * $iRatio;

// save resized image
$aNewImage['new_image'] = 
ImageCreateTrueColor($aNewImage['new_width'], 
$aNewImage['new_height']);
ImageCopyResized($aNewImage['new_image'], 
ImageCreateFromJpeg($aImage['tmp_name']), 0, 0, 0, 0, 
$aNewImage['new_width'], $aNewImage['new_height'], $aNewImage['width'], 
$aNewImage['height']);
//ImageJpeg($aNewImage['new_image'], 
$aNewImage['image_loc']);
ImageJpeg($aNewImage['original_image'], 
$aNewImage['image_loc']);
    
    } else {

// save original image
//ImageJpeg($aImage['tmp_name'], $aNewImage['image_loc']);
ImageJpeg($aNewImage['original_image'], 
$aNewImage['image_loc']);
//ImageJpeg($this->aArgs['Image']['tmp_name'], 
$aNewImage['image_loc']);
}
}

I have ftp'd into my local server and the folder in question is set at 
777, and like I said it works fine if I don't use this class

Any ideas ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
Just to clarify about using move_uploaded_file()

I call the storeBigImage methid from aother method like so

function addProduct(){

	$this->storeBigImage($ID, $_FILES["image"]);

}

that doesn't work, if I use this:

function addProduct(){

	// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}

The above works fine, which I find very strange indeed!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 12:50, Jon Bennett wrote:

Hi,

I have a file upload problem, but I don't think it's a permission 
thing (if only, that would be simple!).

I have written a resizing method for a class I'm working on, and it 
always fails on the imageJpeg() at the end of the method. This is the 
error I get...

imagejpeg(): Unable to open 
'/Library/WebServer/Documents/my_site/_lib/_products/2_big_me.jpg' for 
writing in 
/Library/WebServer/Documents/my_site/_lib/_classes/class.products.php 
on line 132

Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know 
it's not the permissions, could someone have a little look  at my 
method and let me know if there's anything wrong with it please

// $ID is an integer used for naming purposes
// $aImage is an array, it's basically a copy of $_FILES["image"]
// BASE_DIR is a constant var and holds, yep you guessed it, the base 
dir of the site!
// IMGMAXHEIGHT & IMGMAXWIDTH are also constants used for resizing 
purposes

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' 
.  $aNewImage['new_name'];
 
// copy original image
$aNewImage['original_image'] = 
ImageCreateFromJpeg($aImage['tmp_name']);
$aNewImage['sizes'] = getimagesize($aImage['tmp_name']);
$aNewImage['width'] = $aNewImage['sizes'][0];
$aNewImage['height'] = $aNewImage['sizes'][0];

if($aNewImage['width'] >= IMGMAXWIDTH || $aNewImage['height'] 
>= IMGMAXHEIGHT){

// calculate ratios
$iRatio_w = IMGMAXWIDTH / $aNewImage['width'];
$iRatio_h = IMGMAXHEIGHT / $aNewImage['height'];
$iRatio = $iRatio_w < $iRatio_h ? $iRatio_w:$iRatio_h;

// calculate new dimensions
$aNewImage['new_width'] = $aNewImage['width'] * $iRatio;
$aNewImage['new_height'] = $aNewImage['height'] * $iRatio;

// save resized image
$aNewImage['new_image'] = 
ImageCreateTrueColor($aNewImage['new_width'], 
$aNewImage['new_height']);
ImageCopyResized($aNewImage['new_image'], 
ImageCreateFromJpeg($aImage['tmp_name']), 0, 0, 0, 0, 
$aNewImage['new_width'], $aNewImage['new_height'], 
$aNewImage['width'], $aNewImage['height']);
//ImageJpeg($aNewImage['new_image'], 
$aNewImage['image_loc']);
ImageJpeg($aNewImage['original_image'], 
$aNewImage['image_loc']);

} else {

// save original image
//ImageJpeg($aImage['tmp_name'], $aNewImage['image_loc']);
ImageJpeg($aNewImage['original_image'], 
$aNewImage['image_loc']);
//ImageJpeg($this->aArgs['Image']['tmp_name'], 
$aNewImage['image_loc']);
}
}

I have ftp'd into my local server and the folder in question is set at 
777, and like I said it works fine if I don't use this class

Any ideas ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
--
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] file uploads

2003-12-01 Thread Jon Bennett
Hi Chris,

I think you're referring to this:

$_FILES["image"]["tmp_name"]

In my class I pass this as a reference:

$aArgs['Image'] = $_FILES["image"];

Then, $aImage in my storeBigImage() method is passed the 
$aArgs['Image'] when it's called:

$this->storeBigImage($productID, $aArgs['Image']);

All the image details are there because otherwise functions like 
getimagesize would fail, it just won't save the resized or, if the 
dimensions of the uploaded image aren't bigger than my max width and 
height, original image, and I really have no idea why!!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/


On 1 Dec 2003, at 13:36, Chris Hayes wrote:

PHP first gives the file a temporary name on a temporary location. 
This name is not the same as the name given in the upload form.
I think the temp filename is in the $_FILES array too, do a 
print_r($_FILES) to check.


Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know 
it's not the permissions, could someone have a little look  at my 
method and let me know if there's anything wrong with it please

--
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] Question on sending PhP variable results to an HTML page to be displayed.

2003-12-01 Thread Jon Bennett
Hi Al,

I'd add a scrolling tag to your iFrame, as you won't ever need it to 
scroll.



hth

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 14:04, Al Costanzo wrote:

Hi Jay,

This will not work because the page in question ends in .HTML but I did
discover a way to do what I need and an answer to many other posts.
Here is the answer:

To make a PHP command to execute on a .html page create another page 
ending
in .php with the code there. Where you need to display this in your 
.html
page use the  html tag.  It works just fine.

A person gave me this idea by emailing me and saying why not use a 
frameset
to do this. This is kinda what IFRAME does but it is more like a little
window.  Same concept but it does not interfere with how a search 
engine
indexes a website.

Anyone interested in seeing the resulting code, it is located at:
http://www.dynamicsubmission.com and a one line php program returns 
the date
to the page.

I would like to thank everyone for their ideas and this is a very 
useful
resource to have.

I may know a great deal about seach engines, but when it comes to 
php...
well ... thanks for the help!

Al Costanzo
- Original Message -
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "Al Costanzo" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, December 01, 2003 8:49 AM
Subject: RE: [PHP] Question on sending PhP variable results to an HTML 
page
to be displayed.

[snip]
If you use the date function in PhP you can get the date and it will 
not
change in the cache since the actual code is not on the page that
generated
it.

My question is how do I get the answer that I have in a PHP variable
back to
an HTML page and give it lets say to JavaScript to display.
[/snip]
Why do you need to give it to JavaScript to display? Consider this in
your HTML 


--
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] file uploads

2003-12-01 Thread Jon Bennett
Ok, I've got it sorted now, but I'm buggered as to why this didn't work 
the way I hoped. It seems that if I use an indexed or associative array 
to store the location and new image file name, imagejpeg never works, 
but if I use a normal var it does !! what's with that!

// doesn't work
$aNewImage['image_loc'] = $aNewImage['image_dir'] . 
$aNewImage['new_name'];

// does work!!
$sImageLoc = '/Library/Webserver/Documents/wrox_site/_img/_products/' . 
$aNewImage['new_name'];

Why oh why is that the case ??? Would love to know.

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 14:00, Jon Bennett wrote:

Hi Chris,

I think you're referring to this:

$_FILES["image"]["tmp_name"]

In my class I pass this as a reference:

$aArgs['Image'] = $_FILES["image"];

Then, $aImage in my storeBigImage() method is passed the 
$aArgs['Image'] when it's called:

$this->storeBigImage($productID, $aArgs['Image']);

All the image details are there because otherwise functions like 
getimagesize would fail, it just won't save the resized or, if the 
dimensions of the uploaded image aren't bigger than my max width and 
height, original image, and I really have no idea why!!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/


On 1 Dec 2003, at 13:36, Chris Hayes wrote:

PHP first gives the file a temporary name on a temporary location. 
This name is not the same as the name given in the upload form.
I think the temp filename is in the $_FILES array too, do a 
print_r($_FILES) to check.


Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know 
it's not the permissions, could someone have a little look  at my 
method and let me know if there's anything wrong with it please

--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
well I'll be dammed, that was it! Geeze, you look at something for so 
long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, where 
You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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] file uploads

2003-12-01 Thread Jon Bennett
I'm trying to return a value if the file uploads correctly, using 
return, but I don't seem to be getting anything back.

I've added this to my storeImages method

return = $aNewImage['new_name'];

and when I call the method from my addProduct() method I use this:

$sThumbnailFileName = $this->_storeImages($iProductId,  
$aArgs["Image"], 'thumb');

I then assumed I'd be able to just reference the $sThumbnailFileName 
var so I can insert the filename into the db, but it always goes in 
blank, does $sThumbnailFileName not get returned 
$aNewImage['new_name'], or is it stuck in an array or something ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:26, Jon Bennett wrote:

well I'll be dammed, that was it! Geeze, you look at something for so 
long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, 
where You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
sorry, made a mistake when writing my email:

return = $aNewImage['new_name'];

should be:

return $aNewImage['new_name'];

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:57, Jon Bennett wrote:

I'm trying to return a value if the file uploads correctly, using 
return, but I don't seem to be getting anything back.

I've added this to my storeImages method

return = $aNewImage['new_name'];

and when I call the method from my addProduct() method I use this:

$sThumbnailFileName = $this->_storeImages($iProductId,  
$aArgs["Image"], 'thumb');

I then assumed I'd be able to just reference the $sThumbnailFileName 
var so I can insert the filename into the db, but it always goes in 
blank, does $sThumbnailFileName not get returned 
$aNewImage['new_name'], or is it stuck in an array or something ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:26, Jon Bennett wrote:

well I'll be dammed, that was it! Geeze, you look at something for so 
long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, 
where You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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 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] file uploads

2003-12-01 Thread Jon Bennett
Down't worry, it's sorted!

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:57, Jon Bennett wrote:

I'm trying to return a value if the file uploads correctly, using 
return, but I don't seem to be getting anything back.

I've added this to my storeImages method

return = $aNewImage['new_name'];

and when I call the method from my addProduct() method I use this:

$sThumbnailFileName = $this->_storeImages($iProductId,  
$aArgs["Image"], 'thumb');

I then assumed I'd be able to just reference the $sThumbnailFileName 
var so I can insert the filename into the db, but it always goes in 
blank, does $sThumbnailFileName not get returned 
$aNewImage['new_name'], or is it stuck in an array or something ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:26, Jon Bennett wrote:

well I'll be dammed, that was it! Geeze, you look at something for so 
long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, 
where You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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 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] file uploads

2003-12-02 Thread Jon Bennett
Hi,

I'm working on a class and when a user submits a form to add a new 
product, I'm calling the addProduct method and within that method I 
call another method of the class 3 times. Once for a thumbnail image, 
once for a preview image and once for the full image, is this 
considered the correct approach ???

function myMethod (){

myOtherFunc("full");
myOtherFunc("preview");
myOtherFunc("thumb);
}

Id that the best way to write it ?? It would appear to only have 1 
method running at any one time, so making them work in succession would 
be the obvious answer:

function myMethod (){

if(myOtherFunc("full")){
if(myOtherFunc("preview")){
if(myOtherFunc("thumb)){
echo "all methods returned true!";
} else {
echo "last method returned false!";
}
} else {
echo "2nd method returned false!";
}
} else {
echo "1st method returned false!";
}
}
Is there not a better way of handling this function chain (for want of 
a better word) ???

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 16:05, Jon Bennett wrote:

Down't worry, it's sorted!

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:57, Jon Bennett wrote:

I'm trying to return a value if the file uploads correctly, using 
return, but I don't seem to be getting anything back.

I've added this to my storeImages method

return = $aNewImage['new_name'];

and when I call the method from my addProduct() method I use this:

$sThumbnailFileName = $this->_storeImages($iProductId,  
$aArgs["Image"], 'thumb');

I then assumed I'd be able to just reference the $sThumbnailFileName 
var so I can insert the filename into the db, but it always goes in 
blank, does $sThumbnailFileName not get returned 
$aNewImage['new_name'], or is it stuck in an array or something ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:26, Jon Bennett wrote:

well I'll be dammed, that was it! Geeze, you look at something for 
so long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, 
where You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] related products, how to's best practices

2003-12-04 Thread Jon Bennett
Hi,

Why should I not use drop downs ?? are they generally out of favour now 
?? why ???

I ask because I was thinking of having each categories products listed 
in a drop down !

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 4 Dec 2003, at 13:05, Richard Davey wrote:

Hello Jon,

Thursday, December 4, 2003, 12:59:17 PM, you wrote:

JB> They are in groups (type, category) but the problem is the way 
their
JB> products relate doesn't correspond to their type (book, video etc) 
or
JB> their category (like Classic Books, Rewarding Social Skills etc) 
and
JB> some products appear in more than one category as well.

Not much choice then - you have to present them an interface to all of
the products for them to select from. Alphabetical sorting perhaps,
with a small search field so they can search on product title perhaps,
or filter out specific categories.
You can't have them in a drop-down (well, technically you could, but
this isn't a PHP issue anymore, it's a user-interface one).
--
Best regards,
 Richardmailto:[EMAIL PROTECTED]
--
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] related products, how to's best practices

2003-12-04 Thread Jon Bennett
They are in groups (type, category) but the problem is the way their 
products relate doesn't correspond to their type (book, video etc) or 
their category (like Classic Books, Rewarding Social Skills etc) and 
some products appear in more than one category as well.

Any other ideas ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 4 Dec 2003, at 12:46, Richard Davey wrote:

Hello Jon,

Thursday, December 4, 2003, 12:42:28 PM, you wrote:

JB> I don't think getting the info into the db will be a problem, what 
I
JB> see as a problem is how an admin will select 3 out of 200+ 
products.
JB> Obviously a drop down is a bad idea, but so would a alphabetical 
list.
JB> has anyone got any insight into the best way to solve this.

When they add the products in the first place, couldn't they put them
into groups? You could then code something to select 3 random products
out of the same group, they would, by their grouped nature, be
"related" and no-one has to admin anything.
--
Best regards,
 Richardmailto:[EMAIL PROTECTED]
--
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] related products, how to's best practices

2003-12-04 Thread Jon Bennett
Hi,

I'm currently working on my first e-commerce site and would like to 
offer my client the option of adding, maybe 3, related products for 
each product using the CMS I'm developing. I guess this would be much 
like Amazon et all.

I don't think getting the info into the db will be a problem, what I 
see as a problem is how an admin will select 3 out of 200+ products. 
Obviously a drop down is a bad idea, but so would a alphabetical list. 
has anyone got any insight into the best way to solve this.

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] related products, how to's best practices

2003-12-04 Thread Jon Bennett
Would I be right in thinking that php alone can't change the content of 
a dropdown once the browser has loaded the file without a page refresh 
??? In which case I need to source out some javascript, anyone got 
anything that might help me (code, tute, urls etc) as I'm not having 
much luck with google ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 4 Dec 2003, at 14:57, Jon Bennett wrote:

How about a dropdown for each category (max 25 products per cat I'd 
think) with either a series of radio buttons or another dropdown to 
determine the order of preference (1,2 or3), how would something like 
that stand up to the user interface and usuability bods ??

Dang, that wouldn't work, because it would only give you the option to 
add one product from each category, bugger! Could only do the above if 
I repeated all the dropdowns for each cat 3 times!

How easy is it to change the content of a dropdown without page 
refreshes ??? I could then have a dropdown for categories and a 
dynamic dropdown for the products in that category, that would be much 
easier to repeat.

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 4 Dec 2003, at 14:02, Justin French wrote:

On Thursday, December 4, 2003, at 11:42  PM, Jon Bennett wrote:

I'm currently working on my first e-commerce site and would like to 
offer my client the option of adding, maybe 3, related products for 
each product using the CMS I'm developing. I guess this would be 
much like Amazon et all.

I don't think getting the info into the db will be a problem, what I 
see as a problem is how an admin will select 3 out of 200+ products. 
Obviously a drop down is a bad idea, but so would a alphabetical 
list. has anyone got any insight into the best way to solve this.
Why is a drop-down a bad idea?  My only concerns would be

a) bloated code (200 options at 20 chars each = 4000 chars (4k?)
b) a long list to scroll through for the user
c) combo boxes wouldn't allow the user to choose the order of the 
three related products -- you'd need 3 drop-down menu's for that :)

Perhaps it could be a series of drop-downs (CDs|Books|Videos or 
A-K|L-Z etc)

The other solutions I have depend on your target market -- for a CMS 
in a controlled environment and limited user group, you might be able 
to get away with the following ideas:

1. Using CSS2's overflow property to create a little scrollable area. 
 Again, these could be broken into categories to make it easier for 
the user.


A product
A product
A product
A product
...
A product

2. Javascript pop-up -- you could take this part of the process out 
of the main window, and into a JS pop-up window which let's the user 
dig through categories, do searches, WHATEVER to find each product.  
Then some JS code on the pop-up could talk back to the main window 
and 'fill in' 3 text-fields / hidden fields with the related product 
ID's / descriptions / etc.

You'd need to know a fair bit about JS, or get some serious help 
here, but IT CAN BE DONE.

Justin French

--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] related products, how to's best practices

2003-12-04 Thread Jon Bennett
How about a dropdown for each category (max 25 products per cat I'd 
think) with either a series of radio buttons or another dropdown to 
determine the order of preference (1,2 or3), how would something like 
that stand up to the user interface and usuability bods ??

Dang, that wouldn't work, because it would only give you the option to 
add one product from each category, bugger! Could only do the above if 
I repeated all the dropdowns for each cat 3 times!

How easy is it to change the content of a dropdown without page 
refreshes ??? I could then have a dropdown for categories and a dynamic 
dropdown for the products in that category, that would be much easier 
to repeat.

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 4 Dec 2003, at 14:02, Justin French wrote:

On Thursday, December 4, 2003, at 11:42  PM, Jon Bennett wrote:

I'm currently working on my first e-commerce site and would like to 
offer my client the option of adding, maybe 3, related products for 
each product using the CMS I'm developing. I guess this would be much 
like Amazon et all.

I don't think getting the info into the db will be a problem, what I 
see as a problem is how an admin will select 3 out of 200+ products. 
Obviously a drop down is a bad idea, but so would a alphabetical 
list. has anyone got any insight into the best way to solve this.
Why is a drop-down a bad idea?  My only concerns would be

a) bloated code (200 options at 20 chars each = 4000 chars (4k?)
b) a long list to scroll through for the user
c) combo boxes wouldn't allow the user to choose the order of the 
three related products -- you'd need 3 drop-down menu's for that :)

Perhaps it could be a series of drop-downs (CDs|Books|Videos or 
A-K|L-Z etc)

The other solutions I have depend on your target market -- for a CMS 
in a controlled environment and limited user group, you might be able 
to get away with the following ideas:

1. Using CSS2's overflow property to create a little scrollable area.  
Again, these could be broken into categories to make it easier for the 
user.


A product
A product
A product
A product
...
A product

2. Javascript pop-up -- you could take this part of the process out of 
the main window, and into a JS pop-up window which let's the user dig 
through categories, do searches, WHATEVER to find each product.  Then 
some JS code on the pop-up could talk back to the main window and 
'fill in' 3 text-fields / hidden fields with the related product ID's 
/ descriptions / etc.

You'd need to know a fair bit about JS, or get some serious help here, 
but IT CAN BE DONE.

Justin French

--
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] how to determine if shopping cart has been abandoned?

2003-12-04 Thread Jon Bennett
why not only reduce the stock once a sale has gone through ???

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 5 Dec 2003, at 01:09, Justin Patrin wrote:

Of course, now you have to deal with putting inventory back on the 
shelf when the session expiresand you have no way of knowing when 
that would happen unless you're storing *something*.

Chris W. Parker wrote:

Justin French <mailto:[EMAIL PROTECTED]>
on Thursday, December 04, 2003 2:48 PM said:
Rather than storing the shopping cart in a DB, store the cart in the
session.  When the session dies, so does the cart.
When/if they choose to save it, it THEN gets ported into a database.
Aaah...! This makes sense.
Thanks,
Chris.
--
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/
--
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] convert date from UK to US for strtotime

2004-01-14 Thread Jon Bennett
Hi,

I'm trying to re-work this code from the php site 
<http://uk.php.net/strtotime> so that my users can input dates in UK 
format (dd-mm-) and still use strtotime.

// from http://uk.php.net/strtotime

$date=explode("/",trim($records[2]));
$posted=strtotime ($date[1]."/".$date[0]."/".$date[2]);
so far I've got:

// converts a UK date (DD-MM-YYY) to a US date (MM-DD-) so 
strtotime doesn't fail
function convertDate ($sDate) {

$aDate = explode("/",trim($sDate[2]));

$return = strtotime ($aDate[1]."/".$aDate[0]."/".$aDate[2]);

return $return;
}
But this always fails, any idea why ??

What I really need is to re-order the string that a user inputs, say, 
21/04/2004, so that it becomes 04/21/2004 so I can use strtotime.

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 14 Jan 2004, at 13:32, Chris W wrote:

I wanted to run by everyone what I am doing in my application to help
prevent someone from inadvertently or intensionally breaking the system
and compromising security.  First some quick background.  This is an
Apache/php/mysql project.  It is a wish list database where people can
create an account, then a wish list and share it with all their friends
and family so they will know what to get them for their birthday or
Christmas or whatever event.  There are many other features that I 
won't go into here, if you want to know more, you can take a look at 
the work in progress at http://thewishzone.com:8086

The first thing I do when getting data from a post or a get is run it
through a function that first checks to make sure it isn't any longer
than I am expecting (I will also eventually have java script that does
client side checking too, but a post or get can easily be faked so I
am checking on the server side as well)  I then verify that every 
character in the string is with in the ascii range of a space to the ~ 
which is basically all the characters on the key board.  If either 
test fails I print an error and stop the script.  If the value is 
supposed to be an integer or float I also check to make sure there 
aren't any non-numeric characters in the value.  Then finally before I 
put it in the database I use the mysql_real_escape_string function and 
put single quotes around my values in the sql statements.

Are there many php or mysql configuration considerations for making 
the site secure?  I have already done the obvious with my sql and set 
up the grant tables with passwords for all users and removed the 
[EMAIL PROTECTED] user.

--
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] convert date from UK to US for strtotime

2004-01-14 Thread Jon Bennett
ok,

got it:

// converts a UK date (DD-MM-YYY) to a US date (MM-DD-) and vice 
versa
function convertDate ($sDate) {

$aDate = split ("/", $sDate);

$return = $aDate[1]."/".$aDate[0]."/".$aDate[2];

return $return;
}
Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 14 Jan 2004, at 13:50, Jon Bennett wrote:

Hi,

I'm trying to re-work this code from the php site 
<http://uk.php.net/strtotime> so that my users can input dates in UK 
format (dd-mm-) and still use strtotime.

// from http://uk.php.net/strtotime

$date=explode("/",trim($records[2]));
$posted=strtotime ($date[1]."/".$date[0]."/".$date[2]);
so far I've got:

// converts a UK date (DD-MM-YYY) to a US date (MM-DD-) so 
strtotime doesn't fail
function convertDate ($sDate) {

$aDate = explode("/",trim($sDate[2]));

$return = strtotime ($aDate[1]."/".$aDate[0]."/".$aDate[2]);

return $return;
}
But this always fails, any idea why ??

What I really need is to re-order the string that a user inputs, say, 
21/04/2004, so that it becomes 04/21/2004 so I can use strtotime.

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 14 Jan 2004, at 13:32, Chris W wrote:

I wanted to run by everyone what I am doing in my application to help
prevent someone from inadvertently or intensionally breaking the 
system
and compromising security.  First some quick background.  This is an
Apache/php/mysql project.  It is a wish list database where people can
create an account, then a wish list and share it with all their 
friends
and family so they will know what to get them for their birthday or
Christmas or whatever event.  There are many other features that I 
won't go into here, if you want to know more, you can take a look at 
the work in progress at http://thewishzone.com:8086

The first thing I do when getting data from a post or a get is run it
through a function that first checks to make sure it isn't any longer
than I am expecting (I will also eventually have java script that does
client side checking too, but a post or get can easily be faked so I
am checking on the server side as well)  I then verify that every 
character in the string is with in the ascii range of a space to the 
~ which is basically all the characters on the key board.  If either 
test fails I print an error and stop the script.  If the value is 
supposed to be an integer or float I also check to make sure there 
aren't any non-numeric characters in the value.  Then finally before 
I put it in the database I use the mysql_real_escape_string function 
and put single quotes around my values in the sql statements.

Are there many php or mysql configuration considerations for making 
the site secure?  I have already done the obvious with my sql and set 
up the grant tables with passwords for all users and removed the 
[EMAIL PROTECTED] user.

--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] best paractice example page creation php / mysql

2004-01-15 Thread Jon Bennett
Hi,

One of the sections in the site I'm developing is a training section. 
Within this section there are sub sections which each need the option 
of having multiple examples added. Each example will be made up of 2 
sections a UL list and a 2 column table with a title and intro as well.

The way I was thinking of doing this was to have 3 tables:

training_subsections
training_list_items
training_table_items
Then once a training sub section has been added into the system they 
can then add example pages. With this current setup I was thinking I'd 
ask the user how many list items and how many table items they want for 
this item (I will add the option to add more at a later date if 
nessecary) and then build the form on the fly from these 2 figures.

My problem is, is it a 'reccomended' way of doing things to query the 
db multiple times for each new list_item and table_item in one go ??? I 
could just have an examples table with say 10 list_item columns and 10 
x 2 table columns but that seems like a short cut really and leaves no 
room for scaleability.

Any thoughts ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] best paractice example page creation php / mysql

2004-01-15 Thread Jon Bennett
Ahh, i was originally thinking of having a examples table, but when 
writing the post I decided it might not be nessecary :-)

ok, that bit I understand fine, it's getting the data into the DB first 
that's bugging me, would something like this be ok ?

function addNews($aArgs, $aListItems, $aTableItems) {

// create example record
$sql = "INSERT INTO _training_examples (
training_id,
status,
created_dt,
modified_dt
) values (
".$this->$_iTrainingId.",
1,
NOW(),
NOW()
)";
if (DB::isError($rsTmp = $this->_oConn->query($sql))) {

catchExc($rsTmp->getMessage());
return false;
} else {

/ Use MySQL's LAST_INSERT_ID() method to query for the 
insert id
$sql = "SELECT LAST_INSERT_ID()";

// Check for DB class exceptions
if (DB::isError($iExampleId = $this->_oConn->getOne($sql))) 
{

// Report exceptions if present
catchExc($iExampleId->getMessage());
// Unset the product id
unset($iExampleId);
}
$i = 0;

while (count($aListItems)){
// add multiple records to db for list_items
$sql = "INSERT INTO _training_list_items (
training_id,
example_id,
listitem,
status,
created_dt,
modified_dt
) values (
".$this->$_iTrainingId.",
".$iExampleId.",
".$aListItems[$i]['List Item Text'].",
1,
NOW(),
NOW()
)";
$i++
}

And then repeat the 2 while loop for the table_items table.

Is it ok to have INSERT statements enclosed in a while loop ???

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 15 Jan 2004, at 18:45, Richard Davey wrote:

Hello Jon,

Thursday, January 15, 2004, 6:23:51 PM, you wrote:

JB> The way I was thinking of doing this was to have 3 tables:

JB> training_subsections
JB> training_list_items
JB> training_table_items
JB> My problem is, is it a 'reccomended' way of doing things to query 
the
JB> db multiple times for each new list_item and table_item in one go 
??? I

There is no reason why you can't, but I'm quite convinced that with a
little more fore-thought you could come up with a table structure that
meant you didn't have to do this.
For example (if I've understood your post correctly) why not have a
training_examples table and then use an ExampleID for the subsections,
list items and table items.
That way you know which example you're dealing with and can bring back
all of the sub sections accordingly, linking in the list and table
items.
If this isn't possible, post a few more details about what you want to
achieve and perhaps your table schema.
--
Best regards,
 Richardmailto:[EMAIL PROTECTED]
--
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] Non American strtotime

2004-01-16 Thread Jon Bennett
try using this function to re-order UK to US dates and vice versa

// converts a UK date (DD-MM-YYY) to a US date (MM-DD-) and vice 
versa so strtotime doesn't fail
// expects a string such as "24/05/2004" or "05/24/2004"
function convertDate ($sDate) {

$aDate = split ("/", $sDate);

$return = $aDate[1]."/".$aDate[0]."/".$aDate[2];

return $return;
}
hth,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 16 Jan 2004, at 11:13, Tom wrote:

Is there a way I can force PHP's time functions not to read date 
strings
in the American MM-DD- format?

I am using strtotime and strftime and date at various points (mainlty 
to
avoid some niggly 0/NULL problems between PHP and mySQL
and datefields).

My date calculations (which are done in mySQL) are coming out with
screwy results: adding 6 months the 3rd July becomes 7th September.
("03/07/2004" reads as 7th March, add six months for 7th September
which is then displayed as "07/09/2003").
Is there a way I can have strtotime read "10-01-2004" (and all other 
such
date connotations) as the 10th Jan and not 1st Oct?

Thanks.

--
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] dynamic array creation from form elements

2004-01-16 Thread Jon Bennett
Hi,

I've got a dynamically generated form and once it's submitted I need to 
_push the data from my form elements into an array so I can ad them to 
the db. My form elements are created like so:



$i = 1;

while ($i <= $iListItems){

?>


List Item :




++$i;
?>

And after the form is submitted I assumed I could do this...

$aListItems = array();

$i = 1;

while ($i <= $iListItems) {

$tempItem = $_POST["listItem" . $i];
array_push($aListItems, $tempItem);
++$i;
}
print_r ($aListItems);

but nothing appears to be added to the db, how can I access the $_POST 
vars within a loop ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] dynamic array creation from form elements

2004-01-16 Thread Jon Bennett
Hi,

Sorry for the double post, meant to say 'but nothing appears to be 
added to the array' not the db!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
--
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] dynamic array creation from form elements

2004-01-16 Thread Jon Bennett
Hi Rich,

$iListItems is set when a user chooses how many list elements they 
require (this is for the example pages I was asking about) and is 
always greater than 0 (we don't get this far in the script if it's 
not!).

Anyway, it was my silly fault, I had changed the name of my form 
elements whilst trying to fix it but hadn't gone back to the very 
begining in my browser so my loop was looking for the wrong post names! 
Doh!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 16 Jan 2004, at 15:36, Richard Davey wrote:

Hello Jon,

Friday, January 16, 2004, 3:29:07 PM, you wrote:

JB> And after the form is submitted I assumed I could do this...

JB> $aListItems = array();

JB> $i = 1;

JB> while ($i <= $iListItems) {

JB>  $tempItem = $_POST["listItem" . $i];
JB>  array_push($aListItems, $tempItem);
JB>  ++$i;
JB> }
JB> print_r ($aListItems);

JB> but nothing appears to be added to the db, how can I access the 
$_POST
JB> vars within a loop ??

I can't see the whole script, so this is just guess work - but your
loop is checking to see if $i (1) is less than $iListItems, but as far
as I can see this isn't defined anywhere in your code, so the loop
will never actually go through because it's saying 1 <= 0.
Where is $iListItems set and to what value?

Your loop will work, but it's not obvious it's getting the chance to.

Also you don't need to array_push it, you could just do:

$aListItems[] = $tempItem;

--
Best regards,
 Richardmailto:[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: dynamic array creation from form elements

2004-01-16 Thread Jon Bennett
Hi Ben,

Sorry, it does work - so I can safely say you can concat the name of a 
associ array :-)

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 16 Jan 2004, at 15:38, Ben Ramsey wrote:

Try using $_POST["listItem$i"] instead of $_POST["listItem" . $i]
or do something like this:
$post_var_name = 'listItem' . $i;

this do $_POST[$post_var_name];

I don't think you can do any evaluation within the brackets.  Thus, 
you couldn't use the concatenating dot.

-Ben

--
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] dynamic array creation from form elements

2004-01-16 Thread Jon Bennett
nice one, solves my next problem as well if any elements are empty!

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 16 Jan 2004, at 15:47, John W. Holmes wrote:

Jon Bennett wrote:
Hi,
I've got a dynamically generated form and once it's submitted I need 
to _push the data from my form elements into an array so I can ad 
them to the db. My form elements are created like so:

$i = 1;
while ($i <= $iListItems){
?>

List Item :

Why don't you just skip the whole "$i" counter thing and name your 
input elements as "listItem[]" ? Name every one of them that; the same 
thing. Now when you submit your form, you'll already have an array, 
$_POST['listItem']. $_POST['listItem'][0] will be what was in the 
first one, $_POST['listItem'][1] in the second, etc.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.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] Re: Flash-PHP Socket Connection

2004-01-21 Thread Jon Bennett
You would use sockets if you were developing a client/server 
application
that was making a LOT of requests very quickly.

Opening and closing connections using normal HTTP methods gets slow 
when
carrying out such intense data communication.

A good example would be an online game where you need to constantly 
know the
location of all players all the time.


But unless that's the case then there's no need to use sockets, just 
output xml via php/mysql and send that to flash.

Or, if you're ok writing OOP php, then check out amf to php, you can 
then use flash remoting.

http://amfphp.org/

Good luck,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 21 Jan 2004, at 13:52, Donald Tyler wrote:

You would use sockets if you were developing a client/server 
application
that was making a LOT of requests very quickly.

Opening and closing connections using normal HTTP methods gets slow 
when
carrying out such intense data communication.

A good example would be an online game where you need to constantly 
know the
location of all players all the time.

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 20, 2004 7:55 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Flash-PHP Socket Connection
Use xmlReceiver to trigger the back end PHP script. Have that script
generate XML which you parse in Flash. Plain text will work, but a 
single
quotation mark in the text sends you off to never never land. Here's an
example:

xmlReceiver.load( "http://"; + host + "feed_xml_article.php");

I know it's not a socket, but it's plenty fast.

Regards - Miles Thompson

PS What good would a socket to PHP do, anyway? (I probably just 
revealed my
ignorance!) /mt

At 11:03 PM 1/20/2004 +0100, Eric Bolikowski wrote:
Hey Ben

I know it may sound nuts, but I really want to make a socket 
connection
between a Flash and a PHP file.

Normally I would simply read in a text file/read XML/send data with 
GET or
POST, but I'm looking for a socket connections of following reasons:

1) I want a fast connection
2) I'm looking at this as a challenge, because it doesn't seem like 
anyone
else has done this before

Eric

"Ben Ramsey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
What I mean is: you shouldn't need to use sockets to read in a file 
from
Flash unless you're trying to do something more complicated, but from
the way it sounds, you just want to pull data from MySQL with a PHP
script and output it to Flash.  The PHP script could just echo plain
text and Flash can read that in just fine without needing to connect 
via
a socket.
-Ben

Ben Ramsey wrote:

Flash has the ability to read in text files, so you could use PHP to
output data in the correct format and use Flash to read the PHP 
script
like it reads a text file.  We did this in ASP once upon a time.

Here's a tutorial about reading text files into Flash:
http://www.virtual-fx.net/tutorials/html/loadtextfile.htm
Also, from what I understand, Flash now has a great XML parser, so 
you
could use PHP to generate XML and Flash could read in the XML as
variables.  You might want to look into that, but I think it's only
available in the newest version.

-Ben

Eric Bolikowski wrote:

Hi everybody

I'm working on a site that will be based on Flash, PHP and MySQL. 
PHP
will
work as a middleware for Flash and MySQL.

My problem is communication between Flash and PHP.
I'm really out looking for using the socket functions in PHP and
Flash
to
make fast connection.

I have googled for almost an hour now, and I can't seem to find any
interesting. The only info I find, is about sending data between
Flash
and
PHP with HTTP GET or HTTP POST.
So if anybody has some general information on this or a link to a
tutorial
on the subject, I would like to get those resources.
Thanks a lot

Eric
--
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 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] Re: Flash-PHP Socket Connection

2004-01-21 Thread Jon Bennett
you might want to check out http://www.flash-remoting.com/ as well. 
There's also a book from oreilly.

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 21 Jan 2004, at 14:40, Jon Bennett wrote:

You would use sockets if you were developing a client/server 
application
that was making a LOT of requests very quickly.

Opening and closing connections using normal HTTP methods gets slow 
when
carrying out such intense data communication.

A good example would be an online game where you need to constantly 
know the
location of all players all the time.


But unless that's the case then there's no need to use sockets, just 
output xml via php/mysql and send that to flash.

Or, if you're ok writing OOP php, then check out amf to php, you can 
then use flash remoting.

http://amfphp.org/

Good luck,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 21 Jan 2004, at 13:52, Donald Tyler wrote:

You would use sockets if you were developing a client/server 
application
that was making a LOT of requests very quickly.

Opening and closing connections using normal HTTP methods gets slow 
when
carrying out such intense data communication.

A good example would be an online game where you need to constantly 
know the
location of all players all the time.

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 20, 2004 7:55 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Flash-PHP Socket Connection
Use xmlReceiver to trigger the back end PHP script. Have that script
generate XML which you parse in Flash. Plain text will work, but a 
single
quotation mark in the text sends you off to never never land. Here's 
an
example:

xmlReceiver.load( "http://"; + host + "feed_xml_article.php");

I know it's not a socket, but it's plenty fast.

Regards - Miles Thompson

PS What good would a socket to PHP do, anyway? (I probably just 
revealed my
ignorance!) /mt

At 11:03 PM 1/20/2004 +0100, Eric Bolikowski wrote:
Hey Ben

I know it may sound nuts, but I really want to make a socket 
connection
between a Flash and a PHP file.

Normally I would simply read in a text file/read XML/send data with 
GET or
POST, but I'm looking for a socket connections of following reasons:

1) I want a fast connection
2) I'm looking at this as a challenge, because it doesn't seem like 
anyone
else has done this before

Eric

"Ben Ramsey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
What I mean is: you shouldn't need to use sockets to read in a file 
from
Flash unless you're trying to do something more complicated, but 
from
the way it sounds, you just want to pull data from MySQL with a PHP
script and output it to Flash.  The PHP script could just echo plain
text and Flash can read that in just fine without needing to 
connect via
a socket.
-Ben

Ben Ramsey wrote:

Flash has the ability to read in text files, so you could use PHP 
to
output data in the correct format and use Flash to read the PHP 
script
like it reads a text file.  We did this in ASP once upon a time.

Here's a tutorial about reading text files into Flash:
http://www.virtual-fx.net/tutorials/html/loadtextfile.htm
Also, from what I understand, Flash now has a great XML parser, so 
you
could use PHP to generate XML and Flash could read in the XML as
variables.  You might want to look into that, but I think it's only
available in the newest version.

-Ben

Eric Bolikowski wrote:

Hi everybody

I'm working on a site that will be based on Flash, PHP and MySQL. 
PHP
will
work as a middleware for Flash and MySQL.

My problem is communication between Flash and PHP.
I'm really out looking for using the socket functions in PHP and
Flash
to
make fast connection.

I have googled for almost an hour now, and I can't seem to find 
any
interesting. The only info I find, is about sending data between
Flash
and
PHP with HTTP GET or HTTP POST.
So if anybody has some general information on this or a link to a
tutorial
on the subject, I would like to get those resources.
Thanks a lot

Eric
--
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 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Simple RegEx to pull out content between 2 markers

2008-03-29 Thread Jon Bennett
Hi,

I need to grab the what's between 2 markers in a Textile / html
string, but my regex skills aren't all that hot. The text I have is:



h3. Article Content

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.

p(image). !/app/image/1/large! Caption

p(image). !/app/image/24/large! drunken jonty





h3. Article Content

!/app/image/7/thumb! Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.





h3. Article Content

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.

* Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
* Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur.
* Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum.



I'd like to grab the contents of left, right and main individually so
I can place them in separate form fields.

Any help greatly appreciated. I'm certain this is a cinch for people
who use regex often.

Thanks,

Jon


-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] sorting multi array

2007-04-25 Thread Jon Bennett

hi,

I have the following array, which I need to sort by quantity...

Array
(
   [2408] => Array
   (
   [name] => Havaianas Top Pink Crystal
   [size] => 5 (37/38)
   [quantity] => 4
   )

   [3388] => Array
   (
   [name] => Havaianas Brazil Silver
   [size] => 6/7 (39/40)
   [quantity] => 6
   )

   [2666] => Array
   (
   [name] => Havaianas Brasil Black
   [size] => 8/9 (41/42)
   [quantity] => 1
   )

   [3210] => Array
   (
   [name] => Havaianas Margaridas Yellow
   [size] => 5 (37/38)
   [quantity] => 1
   )

   [2552] => Array
   (
   [name] => Havaianas Flash White
   [size] => 5 (37/38)
   [quantity] => 1
   )
)

I need to keep the indexes if poss.

Many thanks,

jon

--


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Function for crypt and decript.

2004-01-26 Thread Jon Bennett
http://uk.php.net/md5

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 23 Jan 2004, at 09:55, <[EMAIL PROTECTED]> wrote:

Hi all,
are in PHP, functions for crypt and decrypt string?
I would to use this function in my script in PHP, how can I use this?
I need of an example for use this and a list of this function.
Thanks in advance.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Googlebot

2004-01-28 Thread Jon Bennett
from google http://www.google.com/webmasters/facts.html

Fiction:
Sites are not included in Google's index if they use ASP (or some other  
non-html file-type.)

Fact:
At Google, we are able to index most types of pages and files with very  
few exceptions. File types we are able to index include: pdf, asp, jsp,  
hdml, shtml, xml, cfm, doc, xls, ppt, rtf, wks, lwp, wri.

I notice php is not mentioned in this list, surely it can index php  
generated pages ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
iChat (AIM): jbendotnet
On 27 Jan 2004, at 14:53, Ben Ramsey wrote:

Perhaps this link will help:
http://www.google.com/webmasters/
Frank Tudor wrote:

That's not very helpful.
I am also curious about this.
Anyone have a more thought provoking answer?
Frank
--- Raditha Dissanayake <[EMAIL PROTECTED]> wrote:
If you read the pages on google you will know the answer.

Hartley, Matt wrote:


Is Googlebot (or any other bot) able to follow links that are
php?

e.g.
Contact Us
width="110" height="111"

border="0">

Is there a way to invite bots to your site?

Thanks
Matt



--  
Raditha Dissanayake.

-- 
--
http://www.radinks.com/sftp/ |
http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file
uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
--
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] Googlebot

2004-01-28 Thread Jon Bennett
is that it tends to avoid or downgrade URI's with parameters tacked 
onto
the end.
Does that go for internal links in your site then ???

news.php?start=10 etc ??? Could be tricky writing dyamic pages then.

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
iChat (AIM): jbendotnet
On 28 Jan 2004, at 01:05, Mike Migurski wrote:

Is Googlebot (or any other bot) able to follow links that are php?
As others have already pointed out to you, what better place to find
information about google than google?
That, or your server logs - googlebot is great about identifying 
itself.

RTFM's aside, a little understanding of how HTTP request-response loop
goes a long way. There's no reason why google (or any other bot) 
shouldn't
be capable of making a GET request for a *.php resource. My 
understanding
is that it tends to avoid or downgrade URI's with parameters tacked 
onto
the end.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html
--
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] Nested PHP

2004-02-02 Thread Jon Bennett
you can also do stuff like this...



if ($someVar == true) {

?>


someVar appears to be true



someVar appears to be false


Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media creative
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
iChat (AIM): jbendotnet
On 1 Feb 2004, at 16:44, John Nichel wrote:

Russell Shaw wrote:

Hi,
I have php code embedded in html, that is read by apache.
Is nested php code allowable such as:
\" ?>";
?>
...

...
  

  

Yes.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.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