Re: [PHP] ob_start & session_start

2005-12-07 Thread Zack Bloom
Sure, ob_start begins a buffer allowing you to display content in the
browser before your script has finished executing.  This is useful when
loading a time intensive page to tell the user to wait.  When you create a
session (provide php is not configured otherwise) php attempts to store a
cookie with the session id that corisponds to the session file on the
server.  If it cannot set this cookie it appends the session id to pages in
the get format.  If you were to call session_start() after the output
buffering, content and consequentially the headers would have been already
sent to the browser.  Since cookies must be set in the headers and the
headers must be set before any content is sent to the page, to use cookie
based sessions you must begin the session before the buffer.

Hope that cleared it up,

Zack Bloom


 On 12/8/05, Chris Shiflett <[EMAIL PROTECTED]> wrote:
>
> Joe Harman wrote:
> > Okay...makes sense after you spelled it out to me.
>
> That didn't make sense to me (and I missed the original reply). Mind
> elaborating? :-)
>
> Chris
>
> --
> Chris Shiflett
> Brain Bulb, The PHP Consultancy
> http://brainbulb.com/
>
> --
> PHP General Mailing List ( http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] array carrying from one php page to another

2005-12-07 Thread Zack Bloom
you could just pass in in the address, eg:
www.example.com?var1=$var1&var2=$var2

to get them use $_REQUEST['var1']

to pass an array you could use serialize($var1) and unserialize($var1)


On 12/8/05, Chris Shiflett <[EMAIL PROTECTED]> wrote:
>
> Curt Zirzow wrote:
> >  > $array = array('my', 'list', 'of', 'stuff');
> > $_SESSION['array_for_popup'] = $array;
> > ?>
> >
> > And in the code that is called in the popup:
> >
> >  > if(!isset($_SESSION['array_for_popup']) {
> >   die('you should not be here anyway, only on a popup is this allowed');
> > }
> >
> > $array = $_SESSION['array_for_popup'];
> > // .. do your magic.
> >
> > // optionally clean things up. so the session var is removed.
> > unset($_SESSION['array_for_popup']);
> > ?>
>
> Don't forget session_start(). :-)
>
> (You might have session.auto_start enabled, but it's not by default.)
>
> Chris
>
> --
> Chris Shiflett
> Brain Bulb, The PHP Consultancy
> http://brainbulb.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] ob_start & session_start

2005-12-07 Thread Zack Bloom
I have never tried it but if it did work i doubt it would use cookies, it
would probably pass it in the addresses or throw an error.

On 12/8/05, Joe Harman <[EMAIL PROTECTED]> wrote:
>
> I guess this was just out of general curiousity... If you started
> 'session_start()' after 'ob_start()' would the sessions work
> correctly? k.. maybe I am still confused... lol... I normally do
> session_start() before the ob_start()...
>
> 
> Zack Said : 'yes, it will display the content in the buffer before
> creating the session.  If your session uses cookies (this is usually
> automatically decided by php) it cannot send out the header after the
> buffer.'
> 
>
> So, the question is really... in what order is the best way to do
> this... I would think that you always want to start a session first...
> but then again, you guys are the experts... i am sure someone knows a
> reason when you should not do that.
>
> ;o)
> Joe
>
>
>
>
> On 12/8/05, Chris Shiflett <[EMAIL PROTECTED]> wrote:
> > Joe Harman wrote:
> > > Okay...makes sense after you spelled it out to me.
> >
> > That didn't make sense to me (and I missed the original reply). Mind
> > elaborating? :-)
> >
> > Chris
> >
> > --
> > Chris Shiflett
> > Brain Bulb, The PHP Consultancy
> > http://brainbulb.com/
> >
>
>
> --
> Joe Harman
> -
> * My programs never have bugs, they just develop random features.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] ob_start & session_start

2005-12-07 Thread Zack Bloom
Sorry it looked like the rest of your email was part of the previous one.
To answer your question it is better to call session_start() before
ob_start()

On 12/8/05, Zack Bloom <[EMAIL PROTECTED]> wrote:
>
> I have never tried it but if it did work i doubt it would use cookies, it
> would probably pass it in the addresses or throw an error.
>
> On 12/8/05, Joe Harman <[EMAIL PROTECTED]> wrote:
> >
> > I guess this was just out of general curiousity... If you started
> > 'session_start()' after 'ob_start()' would the sessions work
> > correctly? k.. maybe I am still confused... lol... I normally do
> > session_start() before the ob_start()...
> >
> > 
> > Zack Said : 'yes, it will display the content in the buffer before
> > creating the session.  If your session uses cookies (this is usually
> > automatically decided by php) it cannot send out the header after the
> > buffer.'
> > 
> >
> > So, the question is really... in what order is the best way to do
> > this... I would think that you always want to start a session first...
> > but then again, you guys are the experts... i am sure someone knows a
> > reason when you should not do that.
> >
> > ;o)
> > Joe
> >
> >
> >
> >
> > On 12/8/05, Chris Shiflett <[EMAIL PROTECTED] > wrote:
> > > Joe Harman wrote:
> > > > Okay...makes sense after you spelled it out to me.
> > >
> > > That didn't make sense to me (and I missed the original reply). Mind
> > > elaborating? :-)
> > >
> > > Chris
> > >
> > > --
> > > Chris Shiflett
> > > Brain Bulb, The PHP Consultancy
> > > http://brainbulb.com/
> > >
> >
> >
> > --
> > Joe Harman
> > -
> > * My programs never have bugs, they just develop random features.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>


Re: [PHP] What software do you use for writing PHP?

2005-12-08 Thread Zack Bloom
I wish I had the punch card version.  I have to rewire my php box everytime
I want to change something.

On 12/8/05, David Robley <[EMAIL PROTECTED]> wrote:
>
> John Nichel wrote:
>
> > Miles Thompson wrote:
> >> At 11:45 AM 12/7/2005, Jay Blanchard wrote:
> >>
> >>> [snip]
> >>> > Two words  punch cards. 'Nuff said.
> >>> >
> >>>
> >>> Come on now Jay, we know you're old and all, but everyone knows that
> you
> >>> cannot edit php with punch cards.  Hanging chads will cause too many
> >>> fatal errors.  ;)
> >>> [/snip]
> >>>
> >>>
> >>> ROFLMMFAO
> >>
> >>
> >> Why these clumsy interfaces?
> >>
> >> Just plug the Firewire in your ear!
> >
> > n00b
> >
> > ;)
> >
>
> Punch cards? Looxury. Toggle switches on the front of the computer
>
>
>
> Cheers
> --
> David Robley
>
> Circular Definition: see Definition, Circular.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Jim Moseby wrote:
>
> >>
> >> Curt Zirzow wrote:
> >> > On Tue, Dec 06, 2005 at 06:36:33PM +0100, M. Sokolewicz wrote:
> >> >
> >> >>Jason Petersen wrote:
> >> >>
> >> >>>On 12/6/05, Jeff McKeon <[EMAIL PROTECTED]> wrote:
> >> >>>
> >> >>>
> >> Hey all,
> >> 
> >> Forever now I've been using Frontpage for all my web work
> >> including php.
> >> I'm sure there's better software out there that is more suited to
> >> writing and editing PHP pages.  What do you all use?
> >> 
> >> >>>
> >> >>>
> >> >>>Vim is my editor of preference.  If I have to use Windows,
> >> I usually go
> >> >>>with
> >> >>>Homesite (because I already have a licensed copy) or
> >> Textpad (because it's
> >> >>>better than Notepad).
> >> >>>
> >> >>>IDEs?  Who needs 'em ;)
> >> >>>
> >> >>>Best,
> >> >>>Jason
> >> >>>
> >> >>
> >> >>same here :)
> >> >>Vim on UNIX machines, and Textpad on Windows
> >> >
> >> >
> >> > man you guys are wimps.. gvim on windows... :)
> >>
> >> Pt'Edit' in DOS.  ;)
> >>
> >
> > (Pt * 2)  'edlin' in DOS.  :P
>
> (Pt * 3) SPF on IBM mainframe
>
>
> Cheers
> --
> David Robley
>
> You have two choices for dinner: Take it or Leave it.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Mime-type handling

2005-12-08 Thread Zack Bloom
mime types are very unreliable and should never be used for file type
authentication (they can also be faked by users).  Instead you could try
using the extension of the file or an identifying statement in the file.

On 12/8/05, Manuel Vacelet <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I'm facing a bad behaviour of 'file' command used by fileinfo PECL module
> (recommanded for mime-type checking):
> * Some Microsoft Excel documents are detected as Microsoft Word documents
> * Some HTML files are just text/plain
> * ...
>
> I tested on multiple machines (with different version of file) and I
> sometimes obtain a diffrent behaviour but never the one expected :/ I also
> looked for the latest version of file but it seems that the file used to
> detect the mime-type is out of date...
>
> My questions are:
> * If you already encounter this problem, how did you solve it ?
> * Where can I find an up-to-date version of magic number list usable with
> file for mime type checking ?
>
> Thanks,
> Regards,
> Manuel
>
>


Re: [PHP] Re: QUERY_STRING Variables and POST

2005-12-08 Thread Zack Bloom
use $_REQUEST['name'] to get value

On 12/8/05, Michael B Allen <[EMAIL PROTECTED]> wrote:
>
> On Thu, 08 Dec 2005 17:56:14 -0500
> Roman Ivanov <[EMAIL PROTECTED]> wrote:
>
> > Michael B Allen wrote:
> > > I'm using the POST method but I would also like to access QUERY_STRING
> > > parameters. Is there a convienient global array for these? If not,
> > > what is the definitive method for accessing them?
> >
> > $_GET
> > $_REQUEST
> > +
> > read manual
>
> Using the POST method and a URL like:
>
> http://server.com/foo.php?name=value
>
> I get:
>
> $_SERVER['QUERY_STRING']  // empty string
> $_GET['name'] // not defined
> $_SERVER['PHP_SELF']  // no ?name=value
> $_REQUEST['QUERY_STRING'] // empty string
>
> Any ideas?
>
> Thanks,
> Mike
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] What software do you use for writing PHP?

2005-12-08 Thread Zack Bloom
Notepad++ is inherently better then notepad (and textpad) and free.





I wish I had the punch card version.  I have to rewire my php box everytime
I want to change something.


 On 12/8/05, David Robley <[EMAIL PROTECTED]> wrote:

> John Nichel wrote:
>
> > Miles Thompson wrote:
> >> At 11:45 AM 12/7/2005, Jay Blanchard wrote:
> >>
> >>> [snip]
> >>> > Two words  punch cards. 'Nuff said.
> >>> >
> >>>
> >>> Come on now Jay, we know you're old and all, but everyone knows that
> you
> >>> cannot edit php with punch cards.  Hanging chads will cause too many
> >>> fatal errors.  ;)
> >>> [/snip]
> >>>
> >>>
> >>> ROFLMMFAO
> >>
> >>
> >> Why these clumsy interfaces?
> >>
> >> Just plug the Firewire in your ear!
> >
> > n00b
> >
> > ;)
> >
>
> Punch cards? Looxury. Toggle switches on the front of the computer
>
>
>
> Cheers
> --
> David Robley
>
> Circular Definition: see Definition, Circular.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Jim Moseby wrote:
>
> >>
> >> Curt Zirzow wrote:
> >> > On Tue, Dec 06, 2005 at 06:36:33PM +0100, M. Sokolewicz wrote:
> >> >
> >> >>Jason Petersen wrote:
> >> >>
> >> >>>On 12/6/05, Jeff McKeon <[EMAIL PROTECTED]> wrote:
> >> >>>
> >> >>>
> >> Hey all,
> >> 
> >> Forever now I've been using Frontpage for all my web work
> >> including php.
> >> I'm sure there's better software out there that is more suited to
> >> writing and editing PHP pages.  What do you all use?
> >> 
> >> >>>
> >> >>>
> >> >>>Vim is my editor of preference.  If I have to use Windows,
> >> I usually go
> >> >>>with
> >> >>>Homesite (because I already have a licensed copy) or
> >> Textpad (because it's
> >> >>>better than Notepad).
> >> >>>
> >> >>>IDEs?  Who needs 'em ;)
> >> >>>
> >> >>>Best,
> >> >>>Jason
> >> >>>
> >> >>
> >> >>same here :)
> >> >>Vim on UNIX machines, and Textpad on Windows
> >> >
> >> >
> >> > man you guys are wimps.. gvim on windows... :)
> >>
> >> Pt'Edit' in DOS.  ;)
> >>
> >
> > (Pt * 2)  'edlin' in DOS.  :P
>
> (Pt * 3) SPF on IBM mainframe
>
>
> Cheers
> --
> David Robley
>
> You have two choices for dinner: Take it or Leave it.
>
> --
> PHP General Mailing List (http://www.php.net/ )
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Forwarding $_POST Values

2005-12-09 Thread Zack Bloom
Guys just stop.  This should be the last post regarding this.


On 12/9/05, John Nichel <[EMAIL PROTECTED]> wrote:
>
> vizion wrote:
> 
> > Well if you were not rude then you certainly are now -
> > Too much correspondence with you in that vein could contaminate the
> > environment. 
>
> You should take your act on the road.
>
> > Also sounds like you have a few prejudices to grow out of .. who would
> you
> > like to be when you grow up?
>
> Ohh...Jay, take heed, we have an Internet psychologist here.
>
> > BTW
> > I suggest you use a dictionary if you cannot use a spellchecker.
>
> Holy cow...not his spelling.  Oh dear, I bet he feels so bad now.  It's
> not ofter one gets hit with a n00b slam like spelling.
>
> And for the OP: RTFM
>
> There, was that more to the point?
>
> --
> 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
>
>