php-general Digest 15 Jul 2009 04:16:48 -0000 Issue 6230

Topics (messages 295369 through 295391):

Re: MySQL Queries in PHP
        295369 by: Jan G.B.

How to set find pathes for PHP CLI?
        295370 by: Tir
        295373 by: Ashley Sheridan

[GD] Image errors
        295371 by: Il pinguino volante
        295374 by: Martin Scotta
        295375 by: Ashley Sheridan
        295376 by: Martin Scotta
        295378 by: Ashley Sheridan
        295380 by: Martin Scotta
        295382 by: Ashley Sheridan
        295383 by: Martin Scotta

Re: Weird domain seting in setcookie()
        295372 by: Bob McConnell
        295377 by: Michelle Konzack
        295379 by: Lists

Re: Doubts concerning a general Insert method
        295381 by: MEM

Alphabetical pagination
        295384 by: Miller, Terion
        295386 by: Dan Shirah
        295388 by: Andrew Ballard

Pattern Matching
        295385 by: VamVan

Mac OS X Server
        295387 by: The Doctor

Re: Email security
        295389 by: Dewey Williams

General good practice question about functions directory location
        295390 by: Al

Thanx
        295391 by: Girish Padia

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
2009/7/14 Tom Chubb <tomch...@gmail.com>

> 2009/7/14 Eddie Drapkin <oorza...@gmail.com>
>
> > On Tue, Jul 14, 2009 at 2:29 AM, Tom Chubb<tomch...@gmail.com> wrote:
> > > Hi List,
> > > Just wanted to pick your brains please?
> > > I'm trying to standardise on the way I query databases and move away
> from
> > > the Dreamweaver built-in functions (which I know you all hate!) ;)
> > > I've been on this list for about 5 years now and I don't think I've
> ever
> > > heard anyone mention the Pear packages, eg: MDB_QueryTool and wondered
> if
> > > there was any reason why not?
> > > I found some classes on phpclasses and have already started using one
> of
> > > them by Henry Chen and there are plenty more.
> > > I am still using Dreamweaver as the text editor for PHP on a Mac and
> > trying
> > > to code things manually but building SQL queries are one of the biggest
> > > problems I come across.
> > > To be honest, Dreamweaver used to be fine but for me, historically on
> > both
> > > PC and Mac, after a while it decides that it can connect to the DB but
> > > cannot see any of the tables which prevent using the wizards which is
> why
> > > I'm moving away from it.
> > > All tutorials on the net are different and I'd like some info on the
> best
> > > practices that you guys follow when dealing with MySQL.
> > > Thanks in advance,
> > >
> > > Tom
> > >
> > > PS - I'm only dealing with simple queries: show, insert, update,
> delete,
> > > etc.
> > >
> >
> > I've always enjoyed writing SQL myself, as it is sort of challenging
> > and interesting to do, so I've always written them by hand.  I'd
> > recommend learning SQL yourself, as the queries tools generate, in my
> > experience, are never quite as useful as hand-written, nor as fast.
> > It's not that difficult to do and if you can't write queries yourself,
> > whether you do or not, no one is going to take you very seriously as a
> > web developer.  So, my best suggestion to you is to just buck up and
> > learn SQL, as useless as that is.
> >
>
> That's still useful Eddie, and I suspect that's what a lot of people
> actually do.
> I do understand SQL (at a very basic level) but I'm trying to start using
> the same custom functions for future projects and thought, "I wonder if
> there's anything in Pear?"
>

Well, PDO is an approach. There are abstractions available like dddbl, which
I believe are quite useful.
Check www.dddbl.de

Don't know about other pear classes, though

regards

--- End Message ---
--- Begin Message ---
I have many scripts that I need execute with PHP CLI. They are located in a 
few directories. I don't want to write full path to script every time when I 
start it. Therefore I've added this paths to the PATH environment variable. 
But PHP don't find my scripts. How could i set paths on which PHP would find 
my script when i call e.g. "php -f my_script.php"? 



--- End Message ---
--- Begin Message ---
On Tue, 2009-07-14 at 20:46 +0400, Tir wrote:
> I have many scripts that I need execute with PHP CLI. They are located in a 
> few directories. I don't want to write full path to script every time when I 
> start it. Therefore I've added this paths to the PATH environment variable. 
> But PHP don't find my scripts. How could i set paths on which PHP would find 
> my script when i call e.g. "php -f my_script.php"? 
> 
> 
> 
When you set the paths, did you restart the computer? Windows needs a
full restart if you edit your paths; Linux machines won't, but you've
not mentioned  what your OS is.

Thanks
Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Hi to all

I get a problem processing an image with GD libraries.

This is my function

   public function showPicture($id) {
       header('Content-type: image/jpeg');
       $mime = mime_content_type($this->updir.$id.'.png');
       $type = explode('/',$mime);
       $type = 'imagecreatefrom'.$type[1];
       $immagine = $tipo($this->updir.$id.'.png');
       imagejpeg($immagine,null,100);
       imagedestroy($immagine);
   }

If i commentize the "header" function i get a lot of strange simbols (such as the code of a jpeg image!) but no errors. The result of this code is a blank page. In Firefox the title sets to "picture.php (JPEG image)" and if i right-click it and click on "Proprieties" i get "0px × 0px (resized as 315px × 19px)".

P.S.: I get the same result when I write $immagine = imagecreatefromjpeg(...)

(Sorry for my english)

Thanks in advance,
Alfio.

--- End Message ---
--- Begin Message ---
$immagine = $tipo($this->updir.$id.'.png');

$tipo is undefined


On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
volante<tuxs...@codeinside.it> wrote:
> Hi to all
>
> I get a problem processing an image with GD libraries.
>
> This is my function
>
>   public function showPicture($id) {
>       header('Content-type: image/jpeg');
>       $mime = mime_content_type($this->updir.$id.'.png');
>       $type = explode('/',$mime);
>       $type = 'imagecreatefrom'.$type[1];
>       $immagine = $tipo($this->updir.$id.'.png');
>       imagejpeg($immagine,null,100);
>       imagedestroy($immagine);
>   }
>
> If i commentize the "header" function i get a lot of strange simbols (such
> as the code of a jpeg image!) but no errors.
> The result of this code is a blank page. In Firefox the title sets to
> "picture.php (JPEG image)" and if i right-click it and click on
> "Proprieties" i get "0px × 0px (resized as 315px × 19px)".
>
> P.S.: I get the same result when I write $immagine =
> imagecreatefromjpeg(...)
>
> (Sorry for my english)
>
> Thanks in advance,
> Alfio.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
Martin Scotta

--- End Message ---
--- Begin Message ---
On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
> $immagine = $tipo($this->updir.$id.'.png');
> 
> $tipo is undefined
> 
> 
> On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
> volante<tuxs...@codeinside.it> wrote:
> > Hi to all
> >
> > I get a problem processing an image with GD libraries.
> >
> > This is my function
> >
> >   public function showPicture($id) {
> >       header('Content-type: image/jpeg');
> >       $mime = mime_content_type($this->updir.$id.'.png');
> >       $type = explode('/',$mime);
> >       $type = 'imagecreatefrom'.$type[1];
> >       $immagine = $tipo($this->updir.$id.'.png');
> >       imagejpeg($immagine,null,100);
> >       imagedestroy($immagine);
> >   }
> >
> > If i commentize the "header" function i get a lot of strange simbols (such
> > as the code of a jpeg image!) but no errors.
> > The result of this code is a blank page. In Firefox the title sets to
> > "picture.php (JPEG image)" and if i right-click it and click on
> > "Proprieties" i get "0px × 0px (resized as 315px × 19px)".
> >
> > P.S.: I get the same result when I write $immagine =
> > imagecreatefromjpeg(...)
> >
> > (Sorry for my english)
> >
> > Thanks in advance,
> > Alfio.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 
> 
> -- 
> Martin Scotta
> 
Also, it doesn't look like you're actually doing anything with $type

Thanks
Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
He is calling the function by variable

something like this

$func = 'var_dump';

$func( new Foo );

On Tue, Jul 14, 2009 at 1:30 PM, Ashley
Sheridan<a...@ashleysheridan.co.uk> wrote:
> On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
>> $immagine = $tipo($this->updir.$id.'.png');
>>
>> $tipo is undefined
>>
>>
>> On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
>> volante<tuxs...@codeinside.it> wrote:
>> > Hi to all
>> >
>> > I get a problem processing an image with GD libraries.
>> >
>> > This is my function
>> >
>> >   public function showPicture($id) {
>> >       header('Content-type: image/jpeg');
>> >       $mime = mime_content_type($this->updir.$id.'.png');
>> >       $type = explode('/',$mime);
>> >       $type = 'imagecreatefrom'.$type[1];
>> >       $immagine = $tipo($this->updir.$id.'.png');
>> >       imagejpeg($immagine,null,100);
>> >       imagedestroy($immagine);
>> >   }
>> >
>> > If i commentize the "header" function i get a lot of strange simbols (such
>> > as the code of a jpeg image!) but no errors.
>> > The result of this code is a blank page. In Firefox the title sets to
>> > "picture.php (JPEG image)" and if i right-click it and click on
>> > "Proprieties" i get "0px × 0px (resized as 315px × 19px)".
>> >
>> > P.S.: I get the same result when I write $immagine =
>> > imagecreatefromjpeg(...)
>> >
>> > (Sorry for my english)
>> >
>> > Thanks in advance,
>> > Alfio.
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
>>
>>
>> --
>> Martin Scotta
>>
> Also, it doesn't look like you're actually doing anything with $type
>
> Thanks
> Ash
> www.ashleysheridan.co.uk
>
>



-- 
Martin Scotta

--- End Message ---
--- Begin Message ---
On Tue, 2009-07-14 at 13:41 -0300, Martin Scotta wrote:
> He is calling the function by variable
> 
> something like this
> 
> $func = 'var_dump';
> 
> $func( new Foo );
> 
> On Tue, Jul 14, 2009 at 1:30 PM, Ashley
> Sheridan<a...@ashleysheridan.co.uk> wrote:
> > On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
> >> $immagine = $tipo($this->updir.$id.'.png');
> >>
> >> $tipo is undefined
> >>
> >>
> >> On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
> >> volante<tuxs...@codeinside.it> wrote:
> >> > Hi to all
> >> >
> >> > I get a problem processing an image with GD libraries.
> >> >
> >> > This is my function
> >> >
> >> >   public function showPicture($id) {
> >> >       header('Content-type: image/jpeg');
> >> >       $mime = mime_content_type($this->updir.$id.'.png');
> >> >       $type = explode('/',$mime);
> >> >       $type = 'imagecreatefrom'.$type[1];
> >> >       $immagine = $tipo($this->updir.$id.'.png');
> >> >       imagejpeg($immagine,null,100);
> >> >       imagedestroy($immagine);
> >> >   }
> >> >
> >> > If i commentize the "header" function i get a lot of strange simbols 
> >> > (such
> >> > as the code of a jpeg image!) but no errors.
> >> > The result of this code is a blank page. In Firefox the title sets to
> >> > "picture.php (JPEG image)" and if i right-click it and click on
> >> > "Proprieties" i get "0px × 0px (resized as 315px × 19px)".
> >> >
> >> > P.S.: I get the same result when I write $immagine =
> >> > imagecreatefromjpeg(...)
> >> >
> >> > (Sorry for my english)
> >> >
> >> > Thanks in advance,
> >> > Alfio.
> >> >
> >> > --
> >> > PHP General Mailing List (http://www.php.net/)
> >> > To unsubscribe, visit: http://www.php.net/unsub.php
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Martin Scotta
> >>
> > Also, it doesn't look like you're actually doing anything with $type
> >
> > Thanks
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> 
> 
> 
> -- 
> Martin Scotta
> 

Bottom post ;)

$type = explode('/',$mime);
$type = 'imagecreatefrom'.$type[1];

$immagine = $tipo($this->updir.$id.'.png');
imagejpeg($immagine,null,100);
imagedestroy($immagine);

I'm not sure you understood what I meant. line 2 above $type is assigned
to the string 'imagecreatefrom'.$type[1];

Now I assume that was to be used later in some sort of eval() statement,
but its never called again, so the line really does nothing.

Thanks
Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Tue, Jul 14, 2009 at 1:48 PM, Ashley
Sheridan<a...@ashleysheridan.co.uk> wrote:
> On Tue, 2009-07-14 at 13:41 -0300, Martin Scotta wrote:
>> He is calling the function by variable
>>
>> something like this
>>
>> $func = 'var_dump';
>>
>> $func( new Foo );
>>
>> On Tue, Jul 14, 2009 at 1:30 PM, Ashley
>> Sheridan<a...@ashleysheridan.co.uk> wrote:
>> > On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
>> >> $immagine = $tipo($this->updir.$id.'.png');
>> >>
>> >> $tipo is undefined
>> >>
>> >>
>> >> On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
>> >> volante<tuxs...@codeinside.it> wrote:
>> >> > Hi to all
>> >> >
>> >> > I get a problem processing an image with GD libraries.
>> >> >
>> >> > This is my function
>> >> >
>> >> >   public function showPicture($id) {
>> >> >       header('Content-type: image/jpeg');
>> >> >       $mime = mime_content_type($this->updir.$id.'.png');
>> >> >       $type = explode('/',$mime);
>> >> >       $type = 'imagecreatefrom'.$type[1];
>> >> >       $immagine = $tipo($this->updir.$id.'.png');
>> >> >       imagejpeg($immagine,null,100);
>> >> >       imagedestroy($immagine);
>> >> >   }
>> >> >
>> >> > If i commentize the "header" function i get a lot of strange simbols 
>> >> > (such
>> >> > as the code of a jpeg image!) but no errors.
>> >> > The result of this code is a blank page. In Firefox the title sets to
>> >> > "picture.php (JPEG image)" and if i right-click it and click on
>> >> > "Proprieties" i get "0px × 0px (resized as 315px × 19px)".
>> >> >
>> >> > P.S.: I get the same result when I write $immagine =
>> >> > imagecreatefromjpeg(...)
>> >> >
>> >> > (Sorry for my english)
>> >> >
>> >> > Thanks in advance,
>> >> > Alfio.
>> >> >
>> >> > --
>> >> > PHP General Mailing List (http://www.php.net/)
>> >> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Martin Scotta
>> >>
>> > Also, it doesn't look like you're actually doing anything with $type
>> >
>> > Thanks
>> > Ash
>> > www.ashleysheridan.co.uk
>> >
>> >
>>
>>
>>
>> --
>> Martin Scotta
>>
>
> Bottom post ;)
>
> $type = explode('/',$mime);
> $type = 'imagecreatefrom'.$type[1];
>
> $immagine = $tipo($this->updir.$id.'.png');
> imagejpeg($immagine,null,100);
> imagedestroy($immagine);
>
> I'm not sure you understood what I meant. line 2 above $type is assigned
> to the string 'imagecreatefrom'.$type[1];
>
> Now I assume that was to be used later in some sort of eval() statement,
> but its never called again, so the line really does nothing.
>
> Thanks
> Ash
> www.ashleysheridan.co.uk
>
>

Mmmm, No

$type = explode('/',$mime); # type is array
$type = 'imagecreatefrom'.$type[1]; # type is a string

He is actually re-assigning the var ussing the content of the var.
Sounds crazy, but I use this method a lot, it helps to keep the scope clean.

-- 
Martin Scotta
ps. "tipo" is "type" in Spanish

--- End Message ---
--- Begin Message ---
On Tue, 2009-07-14 at 14:16 -0300, Martin Scotta wrote:
> On Tue, Jul 14, 2009 at 1:48 PM, Ashley
> Sheridan<a...@ashleysheridan.co.uk> wrote:
> > On Tue, 2009-07-14 at 13:41 -0300, Martin Scotta wrote:
> >> He is calling the function by variable
> >>
> >> something like this
> >>
> >> $func = 'var_dump';
> >>
> >> $func( new Foo );
> >>
> >> On Tue, Jul 14, 2009 at 1:30 PM, Ashley
> >> Sheridan<a...@ashleysheridan.co.uk> wrote:
> >> > On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
> >> >> $immagine = $tipo($this->updir.$id.'.png');
> >> >>
> >> >> $tipo is undefined
> >> >>
> >> >>
> >> >> On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
> >> >> volante<tuxs...@codeinside.it> wrote:
> >> >> > Hi to all
> >> >> >
> >> >> > I get a problem processing an image with GD libraries.
> >> >> >
> >> >> > This is my function
> >> >> >
> >> >> >   public function showPicture($id) {
> >> >> >       header('Content-type: image/jpeg');
> >> >> >       $mime = mime_content_type($this->updir.$id.'.png');
> >> >> >       $type = explode('/',$mime);
> >> >> >       $type = 'imagecreatefrom'.$type[1];
> >> >> >       $immagine = $tipo($this->updir.$id.'.png');
> >> >> >       imagejpeg($immagine,null,100);
> >> >> >       imagedestroy($immagine);
> >> >> >   }
> >> >> >
> >> >> > If i commentize the "header" function i get a lot of strange simbols 
> >> >> > (such
> >> >> > as the code of a jpeg image!) but no errors.
> >> >> > The result of this code is a blank page. In Firefox the title sets to
> >> >> > "picture.php (JPEG image)" and if i right-click it and click on
> >> >> > "Proprieties" i get "0px × 0px (resized as 315px × 19px)".
> >> >> >
> >> >> > P.S.: I get the same result when I write $immagine =
> >> >> > imagecreatefromjpeg(...)
> >> >> >
> >> >> > (Sorry for my english)
> >> >> >
> >> >> > Thanks in advance,
> >> >> > Alfio.
> >> >> >
> >> >> > --
> >> >> > PHP General Mailing List (http://www.php.net/)
> >> >> > To unsubscribe, visit: http://www.php.net/unsub.php
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Martin Scotta
> >> >>
> >> > Also, it doesn't look like you're actually doing anything with $type
> >> >
> >> > Thanks
> >> > Ash
> >> > www.ashleysheridan.co.uk
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Martin Scotta
> >>
> >
> > Bottom post ;)
> >
> > $type = explode('/',$mime);
> > $type = 'imagecreatefrom'.$type[1];
> >
> > $immagine = $tipo($this->updir.$id.'.png');
> > imagejpeg($immagine,null,100);
> > imagedestroy($immagine);
> >
> > I'm not sure you understood what I meant. line 2 above $type is assigned
> > to the string 'imagecreatefrom'.$type[1];
> >
> > Now I assume that was to be used later in some sort of eval() statement,
> > but its never called again, so the line really does nothing.
> >
> > Thanks
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> 
> Mmmm, No
> 
> $type = explode('/',$mime); # type is array
> $type = 'imagecreatefrom'.$type[1]; # type is a string
> 
> He is actually re-assigning the var ussing the content of the var.
> Sounds crazy, but I use this method a lot, it helps to keep the scope clean.
> 

It's not crazy, I do it a lot, but he *does nothing with it* after that,
and the scope of the variable is limited to the function.

Thanks
Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Why are you ussing GD?
All you need is output the image to the browser?

try this... I didn't test/run this code, but it may work...

public function showPicture( $id ) {
      header('Content-type:' . mime_content_type( $this->updir . $id .
'.png' ) );
      readfile( $this->updir . $id . '.png' );
  }

hey, look, just 2 lines!

On Tue, Jul 14, 2009 at 2:20 PM, Ashley
Sheridan<a...@ashleysheridan.co.uk> wrote:
> On Tue, 2009-07-14 at 14:16 -0300, Martin Scotta wrote:
>> On Tue, Jul 14, 2009 at 1:48 PM, Ashley
>> Sheridan<a...@ashleysheridan.co.uk> wrote:
>> > On Tue, 2009-07-14 at 13:41 -0300, Martin Scotta wrote:
>> >> He is calling the function by variable
>> >>
>> >> something like this
>> >>
>> >> $func = 'var_dump';
>> >>
>> >> $func( new Foo );
>> >>
>> >> On Tue, Jul 14, 2009 at 1:30 PM, Ashley
>> >> Sheridan<a...@ashleysheridan.co.uk> wrote:
>> >> > On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
>> >> >> $immagine = $tipo($this->updir.$id.'.png');
>> >> >>
>> >> >> $tipo is undefined
>> >> >>
>> >> >>
>> >> >> On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
>> >> >> volante<tuxs...@codeinside.it> wrote:
>> >> >> > Hi to all
>> >> >> >
>> >> >> > I get a problem processing an image with GD libraries.
>> >> >> >
>> >> >> > This is my function
>> >> >> >
>> >> >> >   public function showPicture($id) {
>> >> >> >       header('Content-type: image/jpeg');
>> >> >> >       $mime = mime_content_type($this->updir.$id.'.png');
>> >> >> >       $type = explode('/',$mime);
>> >> >> >       $type = 'imagecreatefrom'.$type[1];
>> >> >> >       $immagine = $tipo($this->updir.$id.'.png');
>> >> >> >       imagejpeg($immagine,null,100);
>> >> >> >       imagedestroy($immagine);
>> >> >> >   }
>> >> >> >
>> >> >> > If i commentize the "header" function i get a lot of strange simbols 
>> >> >> > (such
>> >> >> > as the code of a jpeg image!) but no errors.
>> >> >> > The result of this code is a blank page. In Firefox the title sets to
>> >> >> > "picture.php (JPEG image)" and if i right-click it and click on
>> >> >> > "Proprieties" i get "0px × 0px (resized as 315px × 19px)".
>> >> >> >
>> >> >> > P.S.: I get the same result when I write $immagine =
>> >> >> > imagecreatefromjpeg(...)
>> >> >> >
>> >> >> > (Sorry for my english)
>> >> >> >
>> >> >> > Thanks in advance,
>> >> >> > Alfio.
>> >> >> >
>> >> >> > --
>> >> >> > PHP General Mailing List (http://www.php.net/)
>> >> >> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Martin Scotta
>> >> >>
>> >> > Also, it doesn't look like you're actually doing anything with $type
>> >> >
>> >> > Thanks
>> >> > Ash
>> >> > www.ashleysheridan.co.uk
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Martin Scotta
>> >>
>> >
>> > Bottom post ;)
>> >
>> > $type = explode('/',$mime);
>> > $type = 'imagecreatefrom'.$type[1];
>> >
>> > $immagine = $tipo($this->updir.$id.'.png');
>> > imagejpeg($immagine,null,100);
>> > imagedestroy($immagine);
>> >
>> > I'm not sure you understood what I meant. line 2 above $type is assigned
>> > to the string 'imagecreatefrom'.$type[1];
>> >
>> > Now I assume that was to be used later in some sort of eval() statement,
>> > but its never called again, so the line really does nothing.
>> >
>> > Thanks
>> > Ash
>> > www.ashleysheridan.co.uk
>> >
>> >
>>
>> Mmmm, No
>>
>> $type = explode('/',$mime); # type is array
>> $type = 'imagecreatefrom'.$type[1]; # type is a string
>>
>> He is actually re-assigning the var ussing the content of the var.
>> Sounds crazy, but I use this method a lot, it helps to keep the scope clean.
>>
>
> It's not crazy, I do it a lot, but he *does nothing with it* after that,
> and the scope of the variable is limited to the function.
>
> Thanks
> Ash
> www.ashleysheridan.co.uk
>
>



-- 
Martin Scotta

--- End Message ---
--- Begin Message ---
From: Michelle Konzack
> 
> on two websites I have encountered that cookies are not working
properly
> and are accesibel from other subdomains which I do not  want.  The
line
> is:
> 
> setcookie('AdminOnCrack', $drug, $timeout, '/',
$_SERVER['HTTP_HOST']);
> 
> but the "domain" is always prefixed with a ".".
> 
> OK, now I have tested it using:
> 
> setcookie('AdminOnCrack', $drug, $timeout, '/', 'myspace.tdwave.net');
> 
> but with the same problem. I do not want that the cookies are
available
> in <*.myspace.tdwave.net>.
> 
> Any suggestions?

In Firefox 3.0 under Tools->Options->Privacy, uncheck "Accept
third-party cookies".

Bob McConnell

--- End Message ---
--- Begin Message ---
Hi Bob,

Am 2009-07-14 11:46:16, schrieb Bob McConnell:
> In Firefox 3.0 under Tools->Options->Privacy, uncheck "Accept
> third-party cookies".

What has this to do with the Webbrowser?

In the PHP manual it is written:

----[ url 'http://de.php.net/manual/en/function.setcookie.php' ]--------
<snip>
domain

The domain that the cookie is available. To make the cookie available on
all subdomains of example.com then you'd set it to '.example.com'. The .
is not required but makes it compatible with more browsers. Setting it
to www.example.com will make the cookie only available in the www
subdomain. Refer to tail matching in the » spec for details.
<snip>
------------------------------------------------------------------------

This mean, if I wan to have the COOKIE available in the subdomains

foo.myspace.tdwave.net
bar.myspace.tdwave.net
baz.myspace.tdwave.net

I have to use the domain ".myspace.tdwave.net" with a preceding DOT. But
this is not what I want because I want to have the COOKIE only available
in

myspace.tdwave.net

so, I have set the the domain  explicit  to  "myspace.tdwave.net"  which
should register the cookie as it is according to the PHP manual or not?

Thanks, Greetings and nice Day/Evening
    Michelle Konzack

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   c/o Shared Office KabelBW  ICQ #328449886
+49/177/9351947    Blumenstasse 2             MSN LinuxMichi
+33/6/61925193     77694 Kehl/Germany         IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


--- End Message ---
--- Begin Message ---
Michelle Konzack wrote:
[snip]
so, I have set the the domain  explicit  to  "myspace.tdwave.net"  which
should register the cookie as it is according to the PHP manual or not?

Thanks, Greetings and nice Day/Evening
    Michelle Konzack


the above will still make the cookie available to:

> foo.myspace.tdwave.net
> bar.myspace.tdwave.net
> baz.myspace.tdwave.net


Donovan



--
  =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
  D. BROOKE                       EUCA Design Center
                               WebDNA Software Corp.
  WEB:> http://www.euca.us  |   http://www.webdna.us
  =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o
  WebDNA: [** Square Bracket Utopia **]

--- End Message ---
--- Begin Message ---
Ok... according to the above posts, I've started to create my generic CRUD 
class however, I'm wondering:

Any of you have already used a DAO design pattern in conjunction with a CRUD 
generic class? 
Know that I'm trying to create a generic CRUD class on a DAO Design pattern, it 
seems that it makes no sense at all.

Is there an advantage on doing this?

My thought:
On a "insert to database" scenario for example:
Without the CRUD generic class: to do an insert, we instantiate a DAO class and 
then call the insert method. Nothing more. Done.

With the CRUD generic class: maybe we will have less code on the DAO site but, 
at the end, to insert a record, we still need to instantiate a DAO and call a 
insert method SO...

I see not big advantage on using both...

Can I have your advice on this please?


Thanks,
Márcio


--- End Message ---
--- Begin Message ---
I am trying to make a page that displays a-z like a b c d e etc as links
then when you click open one it reloads itself and shows only the query
results that go with that letter...i'm not getting it....I get a page that
says ARRAY over and over...

What I have so far:
                             <?php

if(!isset($_SESSION['RestaurantList']))

{
                                      // List not grabbed yet, so run
query and store in $_SESSION

                                                        $sql = "SELECT
DISTINCT name FROM restaurants  GROUP BY name DESC";

$result = mysql_query($sql) or die(mysql_error()) ;

$count = mysql_num_rows($result);

echo $count;
                                                            

while($row = mysql_fetch_array($result)) {

                                                        

$name=array($row['name'],0,1);

//$name = array('name');

                                                        echo "<a
href=\"page.php?name=" .$name. "\"> $name</a>\n";

} 
                                                        

                                                                    }

                                                                    

$alphabet = range('A', 'Z');

foreach ($alphabet as $letter) {

echo '<a href="' . $_SERVER['PHP_SELF']

. '?letter=' . $letter . '">' . $letter . '</a>';

} 
                                                                    

                                                                 

                                                                    

?>


--- End Message ---
--- Begin Message ---
>
> I am trying to make a page that displays a-z like a b c d e etc as links
> then when you click open one it reloads itself and shows only the query
> results that go with that letter...i'm not getting it....I get a page that
> says ARRAY over and over...
>
> What I have so far:
>                             <?php
>
> if(!isset($_SESSION['RestaurantList']))
>
> {
>                                      // List not grabbed yet, so run
> query and store in $_SESSION
>
>                                                        $sql = "SELECT
> DISTINCT name FROM restaurants  GROUP BY name DESC";
>
> $result = mysql_query($sql) or die(mysql_error()) ;
>
> $count = mysql_num_rows($result);
>
> echo $count;
>
>
> while($row = mysql_fetch_array($result)) {
>
>
>
> $name=array($row['name'],0,1);
>
> //$name = array('name');
>
>                                                        echo "<a
> href=\"page.php?name=" .$name. "\"> $name</a>\n";
>
> }
>
>
>                                                                    }
>
>
>
> $alphabet = range('A', 'Z');
>
> foreach ($alphabet as $letter) {
>
> echo '<a href="' . $_SERVER['PHP_SELF']
>
> . '?letter=' . $letter . '">' . $letter . '</a>';
>
> }
>
>
>
>
>
>
> ?>
>

Well, are you opposed to using Javascript?

//javascript function
<script language="JavaScript">
<!--
function searchLetter(letter) {
document.my_form.letter.value=letter;
document.my_form.submit();
}
//-->
</script>

//You could make a hidden form field to store the value of the letter
selected.
<form name="my_form" method="POST" action="<?php echo $_SERVER['PHP_SELF'];
?>">
<input type="hidden" name="letter" value="<?php echo $_POST['letter']; ?>">
</form>

//Perform your query and search only for the letter if it isn't blank.
<?php
$selected_letter = $_POST['letter'];
if ($select_letter != "") {
$sql = "SELECT DISTINCT name FROM restaurants WHERE name LIKE
'$letter%' GROUP BY name DESC";
}
?>
//Print out all your letters
<?php
$alphabet = range('A', 'Z');

foreach ($alphabet as $letter) {
?>
//Have the links call a javascript function that updates the letter selected
and resubmits the form to perform your new query
<a href="javascript:searchLetter('<?php echo $letter; ?>')">$letter</a>
<?php
}
?>

Something like that. I haven't tested any of that code just typed it up real
quick to give you an idea of one way to possibly do it.

Hope that helps.

Dan

--- End Message ---
--- Begin Message ---
On Tue, Jul 14, 2009 at 3:38 PM, Miller,
Terion<tmil...@springfi.gannett.com> wrote:
> I am trying to make a page that displays a-z like a b c d e etc as links
> then when you click open one it reloads itself and shows only the query
> results that go with that letter...i'm not getting it....I get a page that
> says ARRAY over and over...
>
> What I have so far:
>                             <?php
>
> if(!isset($_SESSION['RestaurantList']))
>
> {
>                                      // List not grabbed yet, so run
> query and store in $_SESSION
>
>                                                        $sql = "SELECT
> DISTINCT name FROM restaurants  GROUP BY name DESC";
>
> $result = mysql_query($sql) or die(mysql_error()) ;
>
> $count = mysql_num_rows($result);
>
> echo $count;
>
>
> while($row = mysql_fetch_array($result)) {
>
>
>
> $name=array($row['name'],0,1);




Why are you setting the value of $name to an array? If you try to echo
$name after this statement (as you are below), PHP will echo the word
"Array".



>
> //$name = array('name');
>
>                                                        echo "<a
> href=\"page.php?name=" .$name. "\"> $name</a>\n";
>
> }
>
>
>                                                                    }
>
>
>
> $alphabet = range('A', 'Z');
>
> foreach ($alphabet as $letter) {
>
> echo '<a href="' . $_SERVER['PHP_SELF']
>
> . '?letter=' . $letter . '">' . $letter . '</a>';
>
> }
>
>
>
>
>
>
> ?>

If the list of restaurants is very long, I wouldn't store it in a
session variable. It is the same for every person who visits your
site, so there is little use storing separate redundant copies in
session scope where it will needlessly fill up disk space and/or
memory.

As far as the query is concerned, you could do this:

<?php

$index_letter = $_GET['letter'];

if (preg_match('/^[A-Za-z]$/', $index_letter)) {

    $sql = "SELECT DISTINCT name FROM restaurants WHERE name LIKE
'$index_letter%' GROUP BY name DESC";

//....
?>

I would also consider whether you really need the keyword DISTINCT in
the query. In a properly normalized table, name should probably
already be distinct (and constrained by a UNIQUE index on that
column).

Andrew

--- End Message ---
--- Begin Message ---
Hello Guys,

I have a question related to pattern matching and wildcards. This is the
scenario.

I have friendly urls on my website. So retrive their path as arguments for
every page.

so for example if I have www.xx.com/contact/me my args array will be

args(
   0 => contact,
   1 => me
)

My requirement is to change the page title on the fly with specific
patterns, so what I do is define a look up table with these columns.

path, pageTitle

contact/me - Contact US

perfect match would be easy because I can exactly look for what I want.

It becomes tricky when I introduce wild cards like contact/* for example. It
could also be contact/me/*

How would I match patterns for this kind of relative matches.? Any ideas
anyone?

Thanks,
V

--- End Message ---
--- Begin Message ---
ALl right,

I just install MySQL 5.1.36 on a Mac OS X Server but the PHP
is looking at the Mysql 5.0.67 ?

How do I tell the php.ini to look at the 5.1 instead of the 5.0?

-- 
Member - Liberal International  This is doc...@nl2k.ab.ca
Ici doc...@nl2k.ab.ca God, Queen and country! Beware Anti-Christ rising!
Never Satan President Republic!
The fool says in his heart, "There is no God". They are corrupt, and their ways 
are vile; there is no one who does good. - Ps 53:1

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Tiji varghese [mailto:tij...@yahoo.co.in]
> Sent: Tuesday, July 14, 2009 7:47 AM
> To: PHP General
> Subject: [PHP] Email security
>
> Hello,
>
> I've implemented a contact form on my website that would email me the
> contents of the form and also add it to the database. Its working
> perfectly but I'm not too sure about the security part. I don't know
> much about the security issues concerned with email forms and the
> measures to check it. Please help.
>
> Thanks,
> Tiji

[Dewey Williams]

There are a number of easy to use sanitizing scripts available for processing forms for email and database use - find and use one! Forms are notoriously easy to compromise for sending spam and corrupting web sites.

A program I have used in the past is FormMail by http://www.tectite.com. There are many other FormMail programs available by the same name - this one is well documented and easy to set up. It doesn't provide as much database security as you may want, but it does a good job of hiding email and preventing cross-site scripting attacks.

Dewey Williams


--- End Message ---
--- Begin Message --- Most of my scripts are written for use on shared hosts. I've generally put my function and config files in a web-space directory. However, I been thinking it would be less bother to make stuff more secure if the functions, et al, were above the root directory.

I realize, some hosts still don't let the owner use the space above the document_root. So, I'll provide a means so the directory can be installed under it.

What's your opinion and practice?

--- End Message ---
--- Begin Message ---
Dear All,

Thanx for the responce shown by you all. Your responce helped me to clear my
doubts. Well, I am very much new to PHP developements. You can visit me at
http://www.girishphpmysql.blogspot.com. I am willing to know about sessions
to track the user login and logout. Your same responce will help me again.




fromLists <li...@euca.us>
toGirish Padia <girishpa...@gmail.com>

date14 July 2009 19:39
subjectRe: [PHP] Need Help.

hide details 19:39 (14 hours ago) Reply



Girish Padia wrote:

Dear Sir,

I am facing two problem while developing my site in php.
1) I want to delete browser history whenever i migrate from one page to
another. so that user can never press "Back" button.




Why?

I could see a purpose for this if there is a form post
and you don't want the user to resubmit... but, are you wanting this
feature globally?

Donovan

--- End Message ---

Reply via email to