RE: [PHP] Session creation time

2005-09-19 Thread Stanislav Kuhn
session_start();

if (empty($_SESSION['start_time'])
  $_SESSION['start_time']=time();


echo $_SESSION['start_time'];


-Original Message-
From: Eli [mailto:[EMAIL PROTECTED]
Sent: 19 September 2005 13:21
To: php-general@lists.php.net
Subject: [PHP] Session creation time


How can I get the first creation time of a session (the time a session 
was first started)?

-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] comparing references

2005-09-02 Thread Stanislav Kuhn
Hi guys,

quick question

I need to find out if two different variables are pointing to same place...
example:
$var1 = &my_array;
$var2 = &my_array;

I need to do:
if ($var1 === $var2)

but I don't want to compare it by data, array is gonna be quite big and 
condition used in loop quite often.

I need something like
if (&$var1 === &$var2)
but this doesn't work...

any idea how to compare references? or how to get memory place of variable as 
string to be able compare if they are pointing to same place in memory?

Thanks a lot.
Stan.

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



RE: [PHP] getting filenames from dir

2005-04-01 Thread Stanislav Kuhn
HI...

Do you read php manual sometimes? ;o)

just replace
echo "$file\n";
by
$my_file_array[]=$file;


readdir
(PHP 3, PHP 4 , PHP 5)

readdir -- read entry from directory handle
Description
string readdir ( resource dir_handle)


Returns the filename of the next file from the directory. The filenames are
returned in the order in which they are stored by the filesystem.

Please note the fashion in which readdir()'s return value is checked in the
examples below. We are explicitly testing whether the return value is
identical to (equal to and of the same type as--see Comparison Operators for
more information) FALSE since otherwise, any directory entry whose name
evaluates to FALSE will stop the loop (e.g. a directory named "0").

Example  1. List all files in a directory





Note that readdir() will return the . and .. entries. If you don't want
these, simply strip them out: Example 2. List all files in the current
directory and strip out . and ..









-Original Message-
From: Merlin [mailto:[EMAIL PROTECTED]
Sent: 01 April 2005 12:32
To: php-general@lists.php.net
Subject: [PHP] getting filenames from dir


Hi there,

does anybody know how to get all file names from a specified directory into
an
array?

Thanx,

Merlin

--
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] A more ecconomical way with control statements??

2005-03-07 Thread Stanislav Kuhn

in the form:
...


...

in the script
...
foreach($_REQUEST['cookie_vars'] $var_name as $var_val)
  if (!empty($var))
setcookie("cookie[$var_name]", "$var_val");
...

Stan

-Original Message-
From: Ross Hulford [mailto:[EMAIL PROTECTED]
Sent: 07 March 2005 12:59
To: php-general@lists.php.net
Subject: [PHP] A more ecconomical way with control statements??


if (empty($samosa)){
// do nothing

}

else {

setcookie("cookie[samosa]", "$samosa");

}


if (empty($pakora)){
// do nothing

}

else {

setcookie("cookie[pakora]", "$pakora");

}


It goes on like this for the whole menu I am looking for a more effiecient 
way to do this. The inputs are text boxes taking values from 0-9.

Thanks



Ross 

-- 
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: Fatal error: Maximum execution time

2005-02-21 Thread Stanislav Kuhn
Yes, this may cause error like that, but this occours on different places I
mean in different included scripts where are not loops at all. Basically
there is only one main loop over main data and some small foreach and that
can not be infinite. And error happens in different times as well.



-Original Message-
From: Jason Barnett [mailto:[EMAIL PROTECTED]
Sent: 21 February 2005 15:04
To: php-general@lists.php.net
Subject: [PHP] Re: Fatal error: Maximum execution time


Stanislav Kuhn wrote:
...
>
> PHP Fatal error:  Maximum execution time of 30 seconds exceeded in
.php
> on line 130
>
> Has somebody seen something like this or has an idea what's going on
there?

When I get this error it is often because I found myself running into an
infinite loop someplace.  Checking your while loops in your code may
provide an answer...

>
> PHP Version => 4.3.10-2
> Running with apache on Linux..
>
> Thanks a lot.
> Stan


--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plug
ins

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



[PHP] Fatal error: Maximum execution time

2005-02-21 Thread Stanislav Kuhn
Hi guys,

I've got a processing script which takes long time to finish. The script
includes several others and is ran from command line(by cron). I've sent
phpinfo from inside of processing to my email, here is the important part
max_execution_time => 1800 => 0
max_input_time => 120 => 120
memory_limit => 64M => 64M

I'm setting 1800 inside a script and 0 exec time is by default... anyway I
have tried to set it to whatever and wherever ;o) Script always terminates
and that is strange not exactly at same time... it's aprox from 6 to 10
minutes and not in same place (in any of included script). And error message
always displays 30 seconds... I have tried to grep a source for ini_set as
well, nothing important anywhere in the code.

PHP Fatal error:  Maximum execution time of 30 seconds exceeded in .php
on line 130

Has somebody seen something like this or has an idea what's going on there?

PHP Version => 4.3.10-2
Running with apache on Linux..

Thanks a lot.
Stan

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



[PHP] wrapper

2004-10-20 Thread Stanislav Kuhn
Hi everybody,

i'm trying open url by fopen or file_get_content but always receive error
message
failed to open stream: no suitable wrapper could be found
i know only about one php variable has to be set allow_url_fopen = On and it
is.
I run it on two different servers on first it works there is php 4.3.9 and
on second server it doesn't there is php 4.3.4 and configuration looks to me
same.
Does somebody know about any other (se)things?

tnx.
S.

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



Re: [PHP] Sessions vs. IE security

2004-08-25 Thread Stanislav Kuhn
Thanks guys for helps.. I've tried many that things and I found solution.
Solution for me was set up Privacy Policy for our site...
First time it didn't work because i haven't done Compact privacy policy
witch is optional but IE requires it ;o)

While compact policies are entirely optional for P3P-enabled web sites, IE6
relies heavily on them. This browser makes cookie-blocking decisions based
solely on compact policies. By default, IE6 blocks "third-party" cookies
that do not have compact policies.

But anyway I passed page trought w3c validator and with good settings of
privacy policy IE now allows every (inc. third party) cookies in all levels
of security (except level block all cookies of course). And it means i can
use sessions without problems.. And I recommand  to do same as soon as
possible for everyone. Microsoft going to be crazy in security. Today that
are third-party cookies tomorow may be first_party!...

S.

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



[PHP] RE: [SPAM] Re: [PHP] Sessions vs. IE security

2004-08-24 Thread Stanislav Kuhn
Thanks  for help. I have set up p3p policy to my site.. I passed it trouth
validator and IE can find privacy policy but it still doesn't allow me
cookies... I can't find information what exactly to specify in privacy
policy IE allows me third party cookies...
Does somebody idea?

tnx.
S.


-Original Message-
From: Chris Shiflett [mailto:[EMAIL PROTECTED]
Sent: 24 August 2004 16:46
To: Stanislav Kuhn; [EMAIL PROTECTED]
Subject: [SPAM] Re: [PHP] Sessions vs. IE security


--- Stanislav Kuhn <[EMAIL PROTECTED]> wrote:
> But problem is when I want to include my sctipt to a client
> web site. Technically my script is included in frame of html
> page on another server. I know, using frames is . but
> clients are using them very offten and I can do nothing with
> that. Problem with sending session id from IE to server
> becoming in MEDIUM level of security (which is normally used)
> in this case (included in frame on another server) and cookies
> are blocked as well.

This is a bit of a guess, but I seem to recall that IE requires a valid
P3P policy to be in place before it will include third-party cookies in a
request. That's exactly what a URL within a frameset would be considered
if the domain is different.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

--
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] Sessions vs. IE security

2004-08-24 Thread Stanislav Kuhn

Hi there,

I have a problem and i can't find solution. Poblem is with security level of
IE and using session.
Normaly IE sending session id to server automatically, when you lift
security level in IE to HIGH (i'm talking about version 6.x now) IE doesn't
send session id atomatically to server. I can live with this, nobody can
probably use internet with security settings at this level ;o) But problem
is when I want to include my sctipt to a client web site. Technically my
script is included in frame of html page on another server. I know, using
frames is . but clients are using them very offten and I can do nothing
with that. Problem with sending session id from IE to server becoming in
MEDIUM level of security (which is normally used) in this case (included in
frame on another server) and cookies are blocked as well. It's stupid. I
can't send session id by myself because my system has well running caching
system dependant on variables and session_id is allways different. And
probably is possible to solve it somewhere in custom setting in IE but it
has to work with default IE setting of course. I can't understand why IE
does this in medium level of security.. Of course who understand to
micros? ;o) Do somebody has an idea ? May be there is a possibility tell
to IE that my script is secure enough...

Thanks
S.

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