php-general Digest 21 Dec 2002 14:19:20 -0000 Issue 1776

Topics (messages 129044 through 129056):

Re: the numeric key of an array???
        129044 by: Alexander Guevara
        129045 by: John W. Holmes
        129046 by: Alexander Guevara

Re: Is there any method to filter the single quote from astring?
        129047 by: Alexander Guevara
        129050 by: Justin French
        129051 by: Philip Olson
        129053 by: Jason Wong

running perl script via su
        129048 by: Larry Brown

table trouble
        129049 by: Didier McGillis

Re: Problem with functions
        129052 by: Jeff

Re: real time output
        129054 by: Steve Yates

Re: Disable session cookies
        129055 by: ed.home.homes2see.com

session life
        129056 by: Paul Roberts

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Yeah this workes fine.. thanks!!

"Philip Olson" <[EMAIL PROTECTED]> wrote in message
Pine.BSF.4.10.10212210135051.36987-100000@localhost">news:Pine.BSF.4.10.10212210135051.36987-100000@localhost...
>
> No, but you can do this:
>
>   $arr2 = array_values($array);
>
>   print $arr2[0]; // VALUE1
>
> Regards,
> Philip Olson
>
>
> On Fri, 20 Dec 2002, Alexander Guevara wrote:
>
> > How can i do for printing the value of an array given the numeric key
for
> > example i have this code:
> >
> > $array = array (
> >     'VAL1' => "VALUE1",
> >     'VAL2' => "VALUE2",
> >     'VAL3' => "VALUE3"
> > )
> >
> > So the only way i have found to print the value is like this :
> >     echo $array['VAL1'];
> >
> > and it prints = VALUE1 but i want to know if its possible to do it
something
> > like this:
> >     echo $array[0];
> > i mean give the numeric key for printing VALUE1 so instead the string
key
> > (VAL1) use the numerc (0)
> >
> > Thanks in advance!
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>


--- End Message ---
--- Begin Message ---
> > If you're looking to loop through your array, there are other
methods.

> Well which kind of methods are you talking about?? could you tell me
some
> for do it??

foreach($array as $key=>$value)

www.php.net/foreach

while(list($key,$value) = each($array)

www.php.net/each
www.php.net/list

$cnt = count($array);
for($x=0;$x<$cnt;$x++)

www.php.net/count

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/


--- End Message ---
--- Begin Message ---
Thanks.....

it worked fine.. and the reply at the botton too..

Thank you so much!
"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
000101c2a896$70aad5c0$7c02a8c0@coconut">news:000101c2a896$70aad5c0$7c02a8c0@coconut...
> > > If you're looking to loop through your array, there are other
> methods.
>
> > Well which kind of methods are you talking about?? could you tell me
> some
> > for do it??
>
> foreach($array as $key=>$value)
>
> www.php.net/foreach
>
> while(list($key,$value) = each($array)
>
> www.php.net/each
> www.php.net/list
>
> $cnt = count($array);
> for($x=0;$x<$cnt;$x++)
>
> www.php.net/count
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>


--- End Message ---
--- Begin Message ---
It works.. but when you retrieve the data from the database to a text box it
doesnt appear if it has the single quote ('), o tought it was cause i have
the stripslashes but i delete stripslashes and it still doesnt appear in the
text box!


"Justin French" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
don't filter the quotes... escape them with add_slashes()

justin

on 20/12/02 10:50 PM, ŞüYam ([EMAIL PROTECTED]) wrote:

> as title that I'm getting a trouble on filtering the single quote '  ,
since
> there would be error when storing those string into MySQL, thus, i have to
> find the appropriate method to solve it, anybody can help please?
> thx a lot
>
>


--- End Message ---
--- Begin Message ---
on 21/12/02 2:00 PM, Alexander Guevara ([EMAIL PROTECTED]) wrote:

> It works.. but when you retrieve the data from the database to a text box it
> doesnt appear if it has the single quote ('), o tought it was cause i have
> the stripslashes but i delete stripslashes and it still doesnt appear in the
> text box!

Huh?  I can't really understand what you're saying.

If you're adding stuff to a database, and getting an error, use
addslashes(), then on the way out of the database, you need to
stripslashes(). Easy.

If you don't get any errors, then magic quotes is probably enabled in your
php.ini file.


Justin




> "Justin French" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> don't filter the quotes... escape them with add_slashes()
> 
> justin
> 
> on 20/12/02 10:50 PM, ŞüYam ([EMAIL PROTECTED]) wrote:
> 
>> as title that I'm getting a trouble on filtering the single quote '  ,
> since
>> there would be error when storing those string into MySQL, thus, i have to
>> find the appropriate method to solve it, anybody can help please?
>> thx a lot
>> 
>> 
> 
> 

--- End Message ---
--- Begin Message ---
He is referring to a question that is answered here:

  http://www.php.net/manual/en/faq.html.php#faq.html.encoding

Spoiler: htmlspecialchars() -> http://www.php.net/htmlspecialchars

Regards,
Philip Olson


On Sat, 21 Dec 2002, Justin French wrote:

> on 21/12/02 2:00 PM, Alexander Guevara ([EMAIL PROTECTED]) wrote:
> 
> > It works.. but when you retrieve the data from the database to a text box it
> > doesnt appear if it has the single quote ('), o tought it was cause i have
> > the stripslashes but i delete stripslashes and it still doesnt appear in the
> > text box!
> 
> Huh?  I can't really understand what you're saying.
> 
> If you're adding stuff to a database, and getting an error, use
> addslashes(), then on the way out of the database, you need to
> stripslashes(). Easy.
> 
> If you don't get any errors, then magic quotes is probably enabled in your
> php.ini file.
> 
> 
> Justin
> 
> 
> 
> 
> > "Justin French" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > don't filter the quotes... escape them with add_slashes()
> > 
> > justin
> > 
> > on 20/12/02 10:50 PM, ŞüYam ([EMAIL PROTECTED]) wrote:
> > 
> >> as title that I'm getting a trouble on filtering the single quote '  ,
> > since
> >> there would be error when storing those string into MySQL, thus, i have to
> >> find the appropriate method to solve it, anybody can help please?
> >> thx a lot
> >> 
> >> 
> > 
> > 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
On Saturday 21 December 2002 15:02, Justin French wrote:

> If you're adding stuff to a database, and getting an error, use
> addslashes(), then on the way out of the database, you need to
> stripslashes(). Easy.

This seems to be a common misconception (yes, I did it too when I first 
started out) -- you don't stripslashes() when retrieving the data. The 
slashes that were added with addslashes() are _not_ stored when the data is 
inserted.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Most legends have their basis in facts.
                -- Kirk, "And The Children Shall Lead", stardate 5029.5
*/

--- End Message ---
--- Begin Message ---
I am getting a lot of information about running the web server as root and
the associated problems and so on as I've been looking for a quick solution.
I have a perl script that is run by cron that executes sequence of events
via sftp.  The sftp client has no option that I know of to denote a
different user than the one executing the command using rsa so I set up a
user with the same name as the user needed to log into the remote server and
run it under cron for that user.  I want to place a simple button on my web
site that executes that script but it has to be run by that user.  Since
there will be no interface on the site for which commands can be sent using
this page I'm not too worried about any kind of exploit.  I also don't want
to have to go through the process of installing and learning the methods of
use for apache suExec.  I also don't want the entire web server running as
this user.  Does anyone know of a quick and dirty solution for this

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388



--- End Message ---
--- Begin Message --- Hello everyone, I was looking for some help, its late and I'm trying to help a friend finish up a project.

here is an example and the jpg of what the page is supposed to look like.

http://www.heathermccullough.com/bocajava/bocabucks/bocabucks.html
http://www.heathermccullough.com/bocajava/bocabucks/sample.html

The middle where the text and the photo images are a problem. When I push the text table it pushes that whole side out further, and as you can see by the sample image it supposed to be closer together.

Any help would be appreaciated.

thanks





_________________________________________________________________
MSN 8: advanced junk mail protection and 3 months FREE*. http://join.msn.com/?page=features/junkmail&xAPID=42&PS=47575&PI=7324&DI=7474&SU= http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_advancedjmf_3mf

--- End Message ---
--- Begin Message ---
Whenever I have had similar errors, it usually was a syntax error in or
before the function code. Just a thought.

Jeff
"Beauford.2002" <[EMAIL PROTECTED]> wrote in message
003601c2a840$41278ec0$6401a8c0@p1">news:003601c2a840$41278ec0$6401a8c0@p1...
> Hi,
>
> I keep getting errors in my script that says 'x' function is undefined or
> 'y' function is undefined. I defined it as 'function test ($a, $b)' and
call
> it using 'test($a, $b)' From my knowledge this is correct, but it just
> simply doesn't work.
>
> Anyone have any ideas on this?
>
> TIA
>
>


--- End Message ---
--- Begin Message ---
"Art Chevalier" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I want to start a native process and capture the output while it is being
> generated and display it to the screen. I dont want to output to be
> displayed on the screen all at once after the process completes.

http://www.php.net/manual/en/ref.outcontrol.php

However note the section in flush() that says, "Note: flush() has no effect
on the buffering scheme of your webserver or the browser on the client side.
Several servers, especially on Win32, will still buffer the output from your
script until it terminates before transmitting the results to the browser."

This was my issue with using this capability of PHP...it didn't seem to
work, like Perl's "$| = 1;" did on the same server (Unix Apache).  The
server's config has the output_buffering INI setting set to "no value".
Seems odd since I got the Perl script to not buffer, which would imply it's
not a browser issue.

 - Steve Yates
 - A fool and his money are soon popular.

~ Taglines by Taglinator - www.srtware.com ~



--- End Message ---
--- Begin Message ---
 I'm guessing then that it's possible to use only server side sessions
and use trans_id then if you need to store values throughout a site? 

Ed


On Fri, 20 Dec 2002, John W. Holmes wrote:

> > Is there any way to disable using cookies in sessions? I haven't found
> a
> > good
> > reason to do this, only my boss's predisposition against cookies ;).
> 
> Yep, session.use_cookies setting in php.ini. Set it to zero to not use
> cookies. 
> 
> ---John W. Holmes...
> 
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Hi

I'm setting a session with
session_set_cookie_params (time()+6480000);
so the cookie should last 70 days+ but the data wasn't
returned.

from looking in the manual i see that session_cache_expire is used to set or print the 
current value of the expire. Its set in php.ini by default to 180 minutes. 

So it seems that the garbage collector will clean up the session file after 180 mins 
or 10800 seconds which is less then i was expecting after setting the cookie life.

do i need to set

session_set_cookie_params (time()+6480000);
session_cache_expire (6480000);

for the data to still be available if the user returns during the cookies life and is 
this on a per session basis.

Paul Roberts
[EMAIL PROTECTED]
++++++++++++++++++++++++

--- End Message ---

Reply via email to