php-general Digest 18 Oct 2007 10:50:32 -0000 Issue 5078
Topics (messages 263273 through 263289):
Re: Which PHP-Editor to use?
263273 by: Matt Arnilo S. Baluyos (Mailing Lists)
263274 by: Matt Arnilo S. Baluyos (Mailing Lists)
263276 by: Zoltán Németh
263277 by: Nathan Nobbe
263278 by: Chen Lei
Re: Sessions - Ini settings and timeout
263275 by: Zoltán Németh
HELP!! how can arithmetic variables(string) ??
263279 by: LKSunny
263281 by: Nathan Nobbe
263283 by: Colin Guthrie
How to display ALL session variables?
263280 by: Ronald Wiplinger
263282 by: Nathan Nobbe
263284 by: truncatei.gmail.com
263285 by: Nathan Nobbe
263286 by: Ronald Wiplinger
263288 by: Nathan Nobbe
Re: How to display ALL session variables? - solved
263287 by: Ronald Wiplinger
Strange behaviour of static declared content.
263289 by: Joshua Bacher
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 ---
Does Eclipse already have word-wrap?
To my disappointment, it was still lacking that basic functionality
the last time I tried it.
On 8/3/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> eclipse with php eclipse, but i may be switching to eclipse pdt once it
> becomes stable if there is no support for xdebug in php eclipse when it
> does.
>
> -nathan
>
> On 8/2/07, Merlin <[EMAIL PROTECTED]> wrote:
> >
> > Hi there,
> >
> > I have worked now for several years happily with homesite 4.5, but now
> > it looks like I have to switch to another system as homesite will not
> > run without admin rights on a XP machine.
> >
> > What editors do you use? Do you have any recomendations on a special
> > one? I have looked into eclipse, but I would hear from your experience
> > which one would you recommend me to switch to?
> >
> > Thank you for any comment.
> >
> > Best regards,
> >
> > Merlin
--
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.
--- End Message ---
--- Begin Message ---
On 10/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> 2007/10/18, Matt Arnilo S. Baluyos (Mailing Lists)
> <[EMAIL PROTECTED]>:
> > Does Eclipse already have word-wrap?
> >
> > To my disappointment, it was still lacking that basic functionality
> > the last time I tried it.
>
> PHP Eclipse's auto format code?
Hmmm. Not so sure if that's the name they use for such feature. But
something that does basic word-wrapping for Eclipse.
--
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.
--- End Message ---
--- Begin Message ---
2007. 10. 18, csütörtök keltezéssel 12.56-kor Matt Arnilo S. Baluyos
(Mailing Lists) ezt írta:
> Does Eclipse already have word-wrap?
>
> To my disappointment, it was still lacking that basic functionality
> the last time I tried it.
>
I use easyeclipse for php, and I think I've seen some option like that
somewhere but cannot remember where since I don't need it and never
needed...
greets
Zoltán Németh
>
> On 8/3/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> > eclipse with php eclipse, but i may be switching to eclipse pdt once it
> > becomes stable if there is no support for xdebug in php eclipse when it
> > does.
> >
> > -nathan
> >
> > On 8/2/07, Merlin <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi there,
> > >
> > > I have worked now for several years happily with homesite 4.5, but now
> > > it looks like I have to switch to another system as homesite will not
> > > run without admin rights on a XP machine.
> > >
> > > What editors do you use? Do you have any recomendations on a special
> > > one? I have looked into eclipse, but I would hear from your experience
> > > which one would you recommend me to switch to?
> > >
> > > Thank you for any comment.
> > >
> > > Best regards,
> > >
> > > Merlin
>
> --
> Stand before it and there is no beginning.
> Follow it and there is no end.
> Stay with the ancient Tao,
> Move with the present.
>
--- End Message ---
--- Begin Message ---
On 10/18/07, Zoltán Németh <[EMAIL PROTECTED]> wrote:
>
> 2007. 10. 18, csütörtök keltezéssel 12.56-kor Matt Arnilo S. Baluyos
> (Mailing Lists) ezt írta:
> > Does Eclipse already have word-wrap?
> >
> > To my disappointment, it was still lacking that basic functionality
> > the last time I tried it.
>
a quick google tells the story of word wrap in eclipse; strangely ive never
felt the need for it and ive been using php-eclipse for about 2 years now.
i go to kate for all my peripheral editing needs. i was using jedit; but
kate
is much leaner and i use kde anyway. plus protoeditor can be compiled into
kate which is nice.
-nathan
--- End Message ---
--- Begin Message ---
Matt Arnilo S. Baluyos (Mailing Lists) 写道:
On 10/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
2007/10/18, Matt Arnilo S. Baluyos (Mailing Lists)
<[EMAIL PROTECTED]>:
Does Eclipse already have word-wrap?
To my disappointment, it was still lacking that basic functionality
the last time I tried it.
PHP Eclipse's auto format code?
Hmmm. Not so sure if that's the name they use for such feature. But
something that does basic word-wrapping for Eclipse.
When press Return inside a string, it auto generate " . " at the point,
and split to two lines, like this:
$str = "asf asdflk jasfdljaserija slfdkjalsdjtoia sjdflk ajsotiu " .
"aslfdj atsujaoisdjfalstjioaew fasd";
It provide the Code Formatter, but the code formatted not pretty well!
--- End Message ---
--- Begin Message ---
2007. 10. 17, szerda keltezéssel 15.10-kor Holografix ezt írta:
> Many thanks Zoltn.
>
> It's clear now
> One more thing: session.cookie_lifetime defaults to 0 (until browser is
> closed).
> if setting session.cookie_lifetime to 60 can I look for
> $_SESSION[session_name()] in every request ?
why $_SESSION[session_name()]?
I never bother with session_name and stuff like that, just put whatever
I want to store in $_SESSION and voila it's there :)
about session.cookie_lifetime: if the cookie expires on the client
computer, the browser would not send it, so the server side would not
receive the session ID, so the session data would be lost. that's good
in some cases, but if you leave cookie_lifetime at its default, cookies
expire when the browser is closed. that, combined with a lasttime value
stored in the session, should be enough.
greets
Zoltán Németh
>
> best regards
> holo
>
>
> ""Zoltn Nmeth"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > 2007. 10. 17, szerda keltezssel 11.58-kor Holografix ezt rta:
> >> I have some questions about sessions timeout and sessions ini settings.
> >>
> >> In php.ini I have session.gc_maxlifetime = 30 (for testing purpose only)
> >> ,
> >> session.gc_probability = 1 and session.gc_divisor = 100 (didn't touch
> >> this
> >> values)
> >>
> >> I have two simple pages
> >>
> >>
> >> page1.php
> >> ---------
> >> session_start();
> >> $_SESSION["test"] = "TEST";
> >> <a href="page2.php">test timeout</a>
> >>
> >>
> >> page2.php
> >> =========
> >> session_start();
> >> if (!isset($_SESSION["test"]) ) {
> >> echo "no session"; die();
> >> }
> >> print_r($_SESSION);
> >>
> >>
> >> I open page1.php in the browser and only click in the link after waiting
> >> more than 30 seconds (session.gc_maxlifetime).
> >> After this period what should happen with $_SESSION["test"] in page2.php?
> >>
> >> In php, session.gc_maxlifetime: ; After this number of seconds, stored
> >> data
> >> will be seen as 'garbage' and
> >> ; cleaned up by the garbage collection process.
> >>
> >> I need to understand this and get a way to automaticly logout a user
> >> after n
> >> minutes of inactivity.
> >
> > session.gc_maxlifetime is not what you are looking for. it works like at
> > every request there is a 1/100 chance
> > (session.gc_probability/session.gc_divisor) that the garbage collector
> > will run. if it runs, and finds session data older than
> > session.gc_maxlifetime, that is cleaned up.
> >
> > in order to achieve what you want you should store a 'last action'
> > timestamp or something like that in the session, and upon each request
> > check how many seconds passed since that timestamp and decide session
> > validity based on that. eg:
> >
> > session_start();
> > if ($_SESSION['last_action_timestamp'] - time() > $max_lifetime)
> > {
> > // session expired
> > }
> > else
> > {
> > $_SESSION['last_action_timestamp'] = time();
> > }
> >
> > greets
> > Zoltn Nmeth
> >
> >>
> >> My environment:
> >> Windows XP PRO SP2, apache 2.2.4, php 5.2.4 (apache module), mysql 5.4.5
> >>
> >>
> >> Best regards
> >> holo
> >>
>
--- End Message ---
--- Begin Message ---
<?
$a="1+1"; //variables(string)
//how can arithmetic variables(string) ??
//N ROW................
//output
echo $a //i need output "2" not "1+1"
//Please Help, Thank You Very Much !!
?>
--- End Message ---
--- Begin Message ---
On 10/18/07, LKSunny <[EMAIL PROTECTED]> wrote:
>
> <?
> $a="1+1"; //variables(string)
>
> //how can arithmetic variables(string) ??
> //N ROW................
>
> //output
> echo $a //i need output "2" not "1+1"
> //Please Help, Thank You Very Much !!
> ?>
$a = 1+1;
echo $a;
-nathan
--- End Message ---
--- Begin Message ---
LKSunny wrote:
> <?
> $a="1+1"; //variables(string)
>
> //how can arithmetic variables(string) ??
> //N ROW................
>
> //output
> echo $a //i need output "2" not "1+1"
> //Please Help, Thank You Very Much !!
> ?>
>
You can do:
eval("echo $a;");
But be warned, this has "Injection Attack" written all over it!
Col
--- End Message ---
--- Begin Message ---
Is there a simple way to display all session variables? Like the code
below I use in debug for all posted variables:
echo "<h3>posted variables</h3>";
while (list($name, $value) = each($HTTP_POST_VARS)) {
echo "$name = $value<br>\n";
}
bye
Ronald
--- End Message ---
--- Begin Message ---
On 10/18/07, Ronald Wiplinger <[EMAIL PROTECTED]> wrote:
>
> Is there a simple way to display all session variables? Like the code
> below I use in debug for all posted variables:
>
> echo "<h3>posted variables</h3>";
> while (list($name, $value) = each($HTTP_POST_VARS)) {
> echo "$name = $value<br>\n";
> }
>
echo '<pre>';
var_dump($_SESSION);
echo '</pre>';
-nathan
--- End Message ---
--- Begin Message ---
2007/10/18, Nathan Nobbe <[EMAIL PROTECTED]>:
>
> On 10/18/07, Ronald Wiplinger <[EMAIL PROTECTED]> wrote:
> >
> > Is there a simple way to display all session variables? Like the code
> > below I use in debug for all posted variables:
> >
> > echo "<h3>posted variables</h3>";
> > while (list($name, $value) = each($HTTP_POST_VARS)) {
> > echo "$name = $value<br>\n";
> > }
> >
>
> echo '<pre>';
> var_dump($_SESSION);
> echo '</pre>';
>
> -nathan
or use print_r($_SESSION);
--- End Message ---
--- Begin Message ---
this is a nice little tool as well;
it would be pretty decent for spitting out the session;
http://dbug.ospinto.com/
new dBug($_SESSION);
-nathan
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
2007/10/18, Nathan Nobbe <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>:
On 10/18/07, Ronald Wiplinger <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
>
> Is there a simple way to display all session variables? Like the
code
> below I use in debug for all posted variables:
>
echo '<pre>';
var_dump($_SESSION);
echo '</pre>';
-nathan
or use print_r($_SESSION);
I tried:
<?php
echo '<pre>';
var_dump($_SESSION);
echo '</pre>';
echo '<p>above as var_dump(D_SESSION) - below as print_r(D_SESSION)';
print_r($_SESSION);
...
However, I only see:
above as var_dump(D_SESSION) - below as print_r(D_SESSION)
What is the obviously part I am missing?
bye
Ronald
--- End Message ---
--- Begin Message ---
On 10/18/07, Ronald Wiplinger <[EMAIL PROTECTED]> wrote:
>
> [EMAIL PROTECTED] wrote:
> >
> >
> > 2007/10/18, Nathan Nobbe <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>>:
> >
> > On 10/18/07, Ronald Wiplinger <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> > >
> > > Is there a simple way to display all session variables? Like the
> > code
> > > below I use in debug for all posted variables:
> > >
> >
> > echo '<pre>';
> > var_dump($_SESSION);
> > echo '</pre>';
> >
> > -nathan
> >
> >
> > or use print_r($_SESSION);
> >
> >
>
> I tried:
> <?php
> echo '<pre>';
> var_dump($_SESSION);
> echo '</pre>';
> echo '<p>above as var_dump(D_SESSION) - below as print_r(D_SESSION)';
> print_r($_SESSION);
>
> ...
>
> However, I only see:
>
> above as var_dump(D_SESSION) - below as print_r(D_SESSION)
>
> What is the obviously part I am missing?
>
unless you have session_auto_start set to 1 in php.ini
make sure to call session_start() at the top of your script you want to view
the session from.
-nathan
--- End Message ---
--- Begin Message ---
Ronald Wiplinger wrote:
[EMAIL PROTECTED] wrote:
2007/10/18, Nathan Nobbe <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>:
On 10/18/07, Ronald Wiplinger <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
>
> Is there a simple way to display all session variables? Like the
code
> below I use in debug for all posted variables:
>
echo '<pre>';
var_dump($_SESSION);
echo '</pre>';
-nathan
or use print_r($_SESSION);
I tried:
<?php
echo '<pre>';
var_dump($_SESSION);
echo '</pre>';
echo '<p>above as var_dump(D_SESSION) - below as print_r(D_SESSION)';
print_r($_SESSION);
...
However, I only see:
above as var_dump(D_SESSION) - below as print_r(D_SESSION)
What is the obviously part I am missing?
Found it: The session was at that moment not open!
bye
Ronald
--- End Message ---
--- Begin Message ---
Hi all,
i faced the following problem.
i am using a API. This API has a class that looks like following:
<snip>
class foo{
public function bar(){
static $foobar=false;
if ($foobar === False){
$foobar='FUBeyondAllR';
echo "$foobar\n";
}else{echo "already defined\n";}
}
}
</snip>
if you call the method of this class twice it will first print
FUBeyondAllR and at the second time it will echo 'already defined'.
(examples at the next and the last snippet)
thats fine but what if you have some processing in the first if case? it
would make sense then to unset this variable, right? No way, you can't
acces it:
<snip>
$f=new foo();
$f->bar();
$f->bar();
foo::$foobar=false;
$f->bar();
</snip>
will lead to the following (called by `php5 fubar.php`):
<snip>
FUBeyondAllR
already defined
Fatal error: Access to undeclared static property: foo::$foobar in xxxxx on
line 14
</snip>
I need to recall the expressions encapsulated in the if-statement, but this
fu variable behaves like it is protected, right? Does that make sense? Is there
any way to unset this variable?
I can't touch the API.
Thanks for your suggestions and your time.
josh
--
--------------------------------
joshua bacher
Max Planck Institute for Evolutionary Anthropology
Deutscher Platz 6
04103 LEIPZIG
Germany
web: http://bacher.bash-it.de
--------------------------------
--- End Message ---