php-general Digest 20 Aug 2009 09:28:55 -0000 Issue 6295

2009-08-20 Thread php-general-digest-help

php-general Digest 20 Aug 2009 09:28:55 - Issue 6295

Topics (messages 296985 through 297002):

Re: How to make sure that the target file to read is notunder writing 
by others?
296985 by: Clancy

Re: PHP/Ajax Framework - Call for Developers  Testers
296986 by: Raymond Irving

Re: daemon without pcntl_fork
296987 by: Lars Torben Wilson

How to download and configure php mvc website locally
296988 by: Sumit Sharma
296991 by: Sudheer Satyanarayana
297000 by: Sumit Sharma

Re: SESSIONS lost sometimes
296989 by: Angelo Zanetti
296990 by: Leon du Plessis
296993 by: Arno Kuhl
296994 by: Leon du Plessis
296995 by: Nitebirdz
296996 by: Peter Ford
296997 by: Nitebirdz
296998 by: Leon du Plessis
296999 by: Leon du Plessis
297002 by: Leon du Plessis

Re: DB Question | A hotel reservation scenario
296992 by: Behzad

Re: PDF Width
297001 by: Nitebirdz

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


--
---BeginMessage---
On Wed, 19 Aug 2009 08:13:56 -0400, kyle.sm...@inforonics.com (Kyle Smith) 
wrote:

Nitebirdz wrote:
 On Wed, Aug 19, 2009 at 11:59:39AM +0100, Ashley Sheridan wrote:
   
  
 No, what you're saying is 'use a log file in order to know when to look
 at another log file'. What would happen if you tried to access the
 control log file whilst it was in the process of being written to?
 Admittedly, you reduce your chances of failure because there is less
 data being written to the control log than the actual log, but the
 chance of reading incomplete data is still there!

 

 WARNING: total newbie here.

 If I understood Arno correctly, he was recommending to implement
 something like the old /var/run/*pid files in UNIX.  That way, you can
 control whether or not the previous run is already done with the file
 before you move on. 
That is definitely the correct approach.  Have the script which copies 
the log file touch a file called 'log_file.write' or some such.  When 
it's done, remove the file.  Your PHP script should exit if that file 
exists.  Of course, given the 30 minute cron cycle, it would then have 
to wait until the next cycle.  Maybe run it more often.

I gather from this discussion that PHP allows two users to open a file for R/W? 
I had
assumed it wouldn't.

Anyway, how about:

$user = 'Fred'; $try_again = true;
If (!file_exists('Busy.txt'))
{
File_put_contents ('Busy.txt', $user);
If ($user == File_get_contents ('Busy.txt')
{
// Do what you have to
Unlink ('Busy.txt');
$try_again = false;
}
}
if ($try_again)
{
// Come back in 5 minutes
}

This has a theoretical weakness, in that Joe could check for Busy.txt in the 
interval
between your checking and writing it, and then write his copy after you had 
read your
copy. A moments delay between writing and re-reading would fix this.

---End Message---
---BeginMessage---
Hi Nathan,

Many thanks for the feedback. There many other useful features built into the 
API but my favorite is the embedded feature.

You can see a live example here:
http://raxanpdi.com/shoutbox-embedded-example.html

Best regards,
__
Raymond Irving


--- On Wed, 8/19/09, Nathan Nobbe quickshif...@gmail.com wrote:

From: Nathan Nobbe quickshif...@gmail.com
Subject: Re: [PHP] PHP/Ajax Framework - Call for Developers  Testers
To: Raymond Irving xwis...@yahoo.com
Cc: php-gene...@lists.php.net
Date: Wednesday, August 19, 2009, 11:56 AM

On Wed, Aug 19, 2009 at 7:06 AM, Raymond Irving xwis...@yahoo.com wrote:

 Hello,

 I've just released Raxan Beta 2 with lots for features for both PHP and
 Ajax developers.

 I'm looking for persons to help me test and improve the framework. If
 you're interested, then please download the framework , join the community
 and share your thoughts and ideas. Feel free to send me an email if you have
 any questions.

 You can check out the new features here:
 http://raxanpdi.com/new-in-beta-2.html


you have a neat feature list here Raymond, thanks for sharing.

-nathan
---End Message---
---BeginMessage---
2009/8/19 Per Jessen p...@computer.org:
 Jim Lucas wrote:

[snip]

 I probably wouldn't have chosen PHP for the first one, but there's no
 reason it shouldn't work.  For the second one, did you mean to
 write serial port?  That's a bit of a different animal, I'm not sure
 how far you'll get with php.

 Here is what I have come up with so far.  Looks to satisfying my
 needs:

 tms_daemon
 [snip]
 # END 

Re: [PHP] daemon without pcntl_fork

2009-08-20 Thread Lars Torben Wilson
2009/8/19 Per Jessen p...@computer.org:
 Jim Lucas wrote:

[snip]

 I probably wouldn't have chosen PHP for the first one, but there's no
 reason it shouldn't work.  For the second one, did you mean to
 write serial port?  That's a bit of a different animal, I'm not sure
 how far you'll get with php.

 Here is what I have come up with so far.  Looks to satisfying my
 needs:

 tms_daemon
 [snip]
 # END OF SCRIPT

 Looks good to me. It'll certainly do the job.


 /Per

I agree with Per on all points--I probably wouldn't choose PHP as a
first choice for the first task, but the startup script you have shown
looks like a bog-standard startup script and should serve you well. I
haven't really gone over it with a fine-toothed comb though. Typos
etc. are still up to to you. :) Of course, the whole thing depends on
how tms_daemon behaves, but the startup script looks OK.

Can you explain in a bit more detail exactly what the second part (the
serial-network data logger) needs to do? I've written similar daemons
in C but not PHP--when I've needed to get something like that going
with a PHP script, I've used ser2net (which I linked to in an earlier
post) and been quite happy. Maybe you don't even have to do the hard
work yourself (or buy extra hardware to do it for you).


Cheers,

Torben

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



[PHP] How to download and configure php mvc website locally

2009-08-20 Thread Sumit Sharma
Hi,
Please help as I have downloaded a php website for my client which is
developed using model view controller pattern. Now when I am accessing this
site locally it is not showing any thing. Please tell me the what's the
problem

Thanks,
  Sumit Sharma


RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Angelo Zanetti


-Original Message-
From: Ben Dunlap [mailto:bdun...@agentintellect.com] 
Sent: 19 August 2009 08:18 PM
To: Angelo Zanetti
Cc: php-general@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

 We have a server with a site that does some XML calls. After lots of
testing
 I have found that the server is losing session variables.
[8]
 Also the site goes from HTTP to HTTPS at some point but this isn't the
issue
 as it loses the sessions as soon as they are set sometimes.

 Therefore I would like to know what I could check. I have read in other

Can you clarify what you mean by losing sessions? Have you taken a
network trace to see whether the client is consistently sending the
session ID with every request?

When the problem happens, is $_SESSION completely empty or is it only
missing some variables? Does it seem to happen on any page, or only
certain ones?

Thanks,

Ben


Hi Ben, 

When the problem happens the $_SESSION is partially empty. It only has the
some of the variables set.

It happens on a certain page only, but the strange thing is that it never
happened before its only happening now. But the code hasn't changed so is it
safe to assume that it's a server issue?

Thanks
Angelo

-- 
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] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis

Since we are on the subject: I have the following similar problem:

When testing page on internet explorer, I find that one tab's variables can
affect another tab's variables. Thus when having the same web-site open and
using SESSION variables but for different users, Internet explorer can
become disorientated. This also sometimes happen when I have two
separate browsing windows open with Internet Explorer for the same site.

I have yet to determine if this is an internet explorer, or PHP or
combination of the two that is causing this condition. 

To my understanding _SESSION variables should be maintained per session, tab
or window. If this has been addressed already, my apologies, but thought it
worthwhile to mention.  

If someone perhaps have a solution or can confirm this as a known issue and
maybe is the same or related to Angelo's problem?


-Original Message-
From: Angelo Zanetti [mailto:ang...@zlogic.co.za] 
Sent: 20 August 2009 08:53 AM
To: 'Ben Dunlap'
Cc: php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes



-Original Message-
From: Ben Dunlap [mailto:bdun...@agentintellect.com] 
Sent: 19 August 2009 08:18 PM
To: Angelo Zanetti
Cc: php-general@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

 We have a server with a site that does some XML calls. After lots of
testing
 I have found that the server is losing session variables.
[8]
 Also the site goes from HTTP to HTTPS at some point but this isn't the
issue
 as it loses the sessions as soon as they are set sometimes.

 Therefore I would like to know what I could check. I have read in other

Can you clarify what you mean by losing sessions? Have you taken a
network trace to see whether the client is consistently sending the
session ID with every request?

When the problem happens, is $_SESSION completely empty or is it only
missing some variables? Does it seem to happen on any page, or only
certain ones?

Thanks,

Ben


Hi Ben, 

When the problem happens the $_SESSION is partially empty. It only has the
some of the variables set.

It happens on a certain page only, but the strange thing is that it never
happened before its only happening now. But the code hasn't changed so is it
safe to assume that it's a server issue?

Thanks
Angelo

-- 
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to download and configure php mvc website locally

2009-08-20 Thread Sudheer Satyanarayana

Sumit Sharma wrote:

Hi,
Please help as I have downloaded a php website for my client which is
developed using model view controller pattern. Now when I am accessing this
site locally it is not showing any thing. Please tell me the what's the
problem

Thanks,
  Sumit Sharma

  
It should at least show some error messages. Look into the logs of your 
web server and try to fix them.


We will be able to help you if you provide us more information about 
your application.




--

With warm regards,
Sudheer. S
Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, 
Personal: http://sudheer.net


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



Re: [PHP] DB Question | A hotel reservation scenario

2009-08-20 Thread Behzad
Good questions, I need to talk to the client to determine the exact
requirements and
specifications. Thank you every one for helping me to figure out the
potential db-scheme
and for opening my view with your answers :)

On Wed, Aug 19, 2009 at 10:39 PM, Bob McConnell r...@cbord.com wrote:

 From: Ashley Sheridan
  On Tue, 2009-08-18 at 19:15 +0430, Behzad wrote:
 
  I'm faced with an interesting and challenging problem.
 
  Consider a database, designed for a hotel.
  At any given time, each room has a different status: It's Busy or
 Reserved,
  or Free.
 
  It's easy to retrieve number of Free rooms at the current time.
  But how can I count the number of rooms that were busy during the
 last week
  ?
 
  I would appreciate if you take a brief moment of your time and share
 your
  opinion.
 
  Keep a table that lists all the rooms along with their current status
 
  Keep another table that has these fields:
* room_id (the id from above table)
* status (enumerated value - 'busy','reserved')
* start_date
* end_date
 
  Then you perform your query using a join of these two tables, within a
  particular date range. I've left out 'free' from the second table
  because there's no point updating the table for a period if a room is
  not being used.
 
  You could also have start_date and end_date as datetime fields, as
 every
  hotel i've ever been in has a set time for check-in and another for
  check-out.

 It would be easier if you kept a record of the status changes to and
 from busy (check-in and check-out) as a transaction log. Then you can
 scan the log to see the status changes for any time period. But you
 still have to deal with a room that stayed busy for the entire period.

 First question, does busy include the time needed by housekeeping to
 clean the room after checkout? You might want to consider a separate
 status for that.

 Second question, does the system keep track of when each room is
 reserved? If one is reserved for three nights beginning Friday, can it
 still be used Wednesday for a one or two night stay?

 Bob McConnell




-- 
Kind regards,
-behzad


RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Arno Kuhl
-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 09:44 AM
To: php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Since we are on the subject: I have the following similar problem:

When testing page on internet explorer, I find that one tab's variables can
affect another tab's variables. Thus when having the same web-site open and
using SESSION variables but for different users, Internet explorer can
become disorientated. This also sometimes happen when I have two
separate browsing windows open with Internet Explorer for the same site.

I have yet to determine if this is an internet explorer, or PHP or
combination of the two that is causing this condition. 

To my understanding _SESSION variables should be maintained per session, tab
or window. If this has been addressed already, my apologies, but thought it
worthwhile to mention.  

If someone perhaps have a solution or can confirm this as a known issue and
maybe is the same or related to Angelo's problem?



If different browser windows/tabs on the same client-side computer didn't
share session info then you'd get the effect of being able to log onto a
site with one browser window, but find in a second browser window that you
were not yet logged on. Experience will tell you that you're logged on in
both browser windows (try it with your online bank). It's not an issue, it's
a feature. If you want to be able to use different browser windows as though
they were different users then use different browsers e.g. IE and FF on the
same client-side computer will look like two separate end users to the
server, and they don't share session info or cookies.

Cheers
Arno


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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
 It's not an issue, it's a feature.

Thanks Arno...but it is a pain also.
If I work with user A in Tab1 (window1), I want to work with user B
separately in Tab2. When user in Tab2 logs off, I still want user A to work,
and not suddenly have to re-login. Same with bank. If I work with my company
account, then my personal account must not become an issue because I am on
the same machine and site. 

I have no issue with using FF and IE to do testing as that takes care of
browser compatibility testing at the same time :-), but I think when you
start a new session with new values, it should be kept under that window/tab
alone. Cookies can take care of more details, but my opinion is data should
never be affected across windows/tabs unless the same user is logged in on
botheven then I would expect PHP to keep data per session. Maybe it goes
beyond being an IE or FF issue..the questiojn is...will PHP allow variables
from session A become corrupted when session B is in progress when they
should actually be handled seperately?

In the end I think it is something I do wrong in PHP with the SESSION
variables and how I clear themif so...I don't think PHP should allow
clearing SESSION variables from other sessions.
 
-Original Message-
From: Arno Kuhl [mailto:ak...@telkomsa.net] 
Sent: 20 August 2009 10:03 AM
To: 'Leon du Plessis'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 09:44 AM
To: php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Since we are on the subject: I have the following similar problem:

When testing page on internet explorer, I find that one tab's variables can
affect another tab's variables. Thus when having the same web-site open and
using SESSION variables but for different users, Internet explorer can
become disorientated. This also sometimes happen when I have two
separate browsing windows open with Internet Explorer for the same site.

I have yet to determine if this is an internet explorer, or PHP or
combination of the two that is causing this condition. 

To my understanding _SESSION variables should be maintained per session, tab
or window. If this has been addressed already, my apologies, but thought it
worthwhile to mention.  

If someone perhaps have a solution or can confirm this as a known issue and
maybe is the same or related to Angelo's problem?



If different browser windows/tabs on the same client-side computer didn't
share session info then you'd get the effect of being able to log onto a
site with one browser window, but find in a second browser window that you
were not yet logged on. Experience will tell you that you're logged on in
both browser windows (try it with your online bank). It's not an issue, it's
a feature. If you want to be able to use different browser windows as though
they were different users then use different browsers e.g. IE and FF on the
same client-side computer will look like two separate end users to the
server, and they don't share session info or cookies.

Cheers
Arno


-- 
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] SESSIONS lost sometimes

2009-08-20 Thread Nitebirdz
On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
 
 Since we are on the subject: I have the following similar problem:
 
 When testing page on internet explorer, I find that one tab's variables can
 affect another tab's variables. Thus when having the same web-site open and
 using SESSION variables but for different users, Internet explorer can
 become disorientated. This also sometimes happen when I have two
 separate browsing windows open with Internet Explorer for the same site.
 
 I have yet to determine if this is an internet explorer, or PHP or
 combination of the two that is causing this condition. 
 
 To my understanding _SESSION variables should be maintained per session, tab
 or window. If this has been addressed already, my apologies, but thought it
 worthwhile to mention.  
 

I'm a total newbie when it comes to these issues, but it seems to me
that Firefox behaves in the very same manner.  It's not limited to PHP
sessions either.  It's always been my experience on any website that
requires authentication, including the likes of Google Mail, etc.  When
I want to run multiple sessions for different GMail accounts, for
example, I just create a different user profile in Firefox. 

It'd make sense for things to run this way, I think.  After all, I'd
find it quite confusing if I log into Google Docs, open a document (by
default, it opens in a new tab) and I had to log in yet again to be able
to edit it.  


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



Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Peter Ford
Leon du Plessis wrote:
  It's not an issue, it's a feature.
 
 Thanks Arno...but it is a pain also.
 If I work with user A in Tab1 (window1), I want to work with user B
 separately in Tab2. When user in Tab2 logs off, I still want user A to work,
 and not suddenly have to re-login. Same with bank. If I work with my company
 account, then my personal account must not become an issue because I am on
 the same machine and site. 
 
 I have no issue with using FF and IE to do testing as that takes care of
 browser compatibility testing at the same time :-), but I think when you
 start a new session with new values, it should be kept under that window/tab
 alone. Cookies can take care of more details, but my opinion is data should
 never be affected across windows/tabs unless the same user is logged in on
 botheven then I would expect PHP to keep data per session. Maybe it goes
 beyond being an IE or FF issue..the questiojn is...will PHP allow variables
 from session A become corrupted when session B is in progress when they
 should actually be handled seperately?
 
 In the end I think it is something I do wrong in PHP with the SESSION
 variables and how I clear themif so...I don't think PHP should allow
 clearing SESSION variables from other sessions.
  
 -Original Message-
 From: Arno Kuhl [mailto:ak...@telkomsa.net] 
 Sent: 20 August 2009 10:03 AM
 To: 'Leon du Plessis'; php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 -Original Message-
 From: Leon du Plessis [mailto:l...@dsgnit.com] 
 Sent: 20 August 2009 09:44 AM
 To: php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 Since we are on the subject: I have the following similar problem:
 
 When testing page on internet explorer, I find that one tab's variables can
 affect another tab's variables. Thus when having the same web-site open and
 using SESSION variables but for different users, Internet explorer can
 become disorientated. This also sometimes happen when I have two
 separate browsing windows open with Internet Explorer for the same site.
 
 I have yet to determine if this is an internet explorer, or PHP or
 combination of the two that is causing this condition. 
 
 To my understanding _SESSION variables should be maintained per session, tab
 or window. If this has been addressed already, my apologies, but thought it
 worthwhile to mention.  
 
 If someone perhaps have a solution or can confirm this as a known issue and
 maybe is the same or related to Angelo's problem?
 
 
 
 If different browser windows/tabs on the same client-side computer didn't
 share session info then you'd get the effect of being able to log onto a
 site with one browser window, but find in a second browser window that you
 were not yet logged on. Experience will tell you that you're logged on in
 both browser windows (try it with your online bank). It's not an issue, it's
 a feature. If you want to be able to use different browser windows as though
 they were different users then use different browsers e.g. IE and FF on the
 same client-side computer will look like two separate end users to the
 server, and they don't share session info or cookies.
 
 Cheers
 Arno
 
 

The key thing is that both tabs (or windows) from the same browser are in the
*same* session - they send the *same* PHPID cookie. PHP is essentially stateless
- it doesn't care where the request comes from, and ties a session to the PHPID
cookie if it gets one. As far as PHP knows, requests from different tabs with
the same PHPID cookie are requests from the same place in the same session.

To get a different session you need a different instance of the browser - that's
the way browsers have been coded to work. It's not too hard with Firefox, since
you can set up multiple profiles to have independent Firefox windows on the same
screen.

-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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



Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Nitebirdz
On Thu, Aug 20, 2009 at 10:26:35AM +0200, Leon du Plessis wrote:
  It's not an issue, it's a feature.
 
 Thanks Arno...but it is a pain also.
 If I work with user A in Tab1 (window1), I want to work with user B
 separately in Tab2. When user in Tab2 logs off, I still want user A to work,
 and not suddenly have to re-login. Same with bank. If I work with my company
 account, then my personal account must not become an issue because I am on
 the same machine and site. 
 

As mentioned in my other email, I've only been able to get this to work
by using different user profiles under Firefox.  If you need to run them
both at the same time, the following document helps explaining how to
accomplish it:

http://lifehacker.com/software/firefox/geek-to-live--manage-multiple-firefox-profiles-231646.php


I never tested it because I don't run Windows, but a similar setup works
just fine for Linux. 



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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
 It'd make sense for things to run this way, I think.  After all, I'd
find it quite confusing if I log into Google Docs, open a document (by
default, it opens in a new tab) and I had to log in yet again to be able to
edit it.

Yes. I agree. But in this case the Tab being opened is used with the same
authentication details either via POST, GET or Cookie variables. The problem
comes in when a totally different set of login credentials are being used
(for the same tab/window).  Other user's login particulars should not affect
your login variables.

-Original Message-
From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
Sent: 20 August 2009 10:40 AM
To: php-general@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
 
 Since we are on the subject: I have the following similar problem:
 
 When testing page on internet explorer, I find that one tab's variables
can
 affect another tab's variables. Thus when having the same web-site open
and
 using SESSION variables but for different users, Internet explorer can
 become disorientated. This also sometimes happen when I have two
 separate browsing windows open with Internet Explorer for the same site.
 
 I have yet to determine if this is an internet explorer, or PHP or
 combination of the two that is causing this condition. 
 
 To my understanding _SESSION variables should be maintained per session,
tab
 or window. If this has been addressed already, my apologies, but thought
it
 worthwhile to mention.  
 

I'm a total newbie when it comes to these issues, but it seems to me
that Firefox behaves in the very same manner.  It's not limited to PHP
sessions either.  It's always been my experience on any website that
requires authentication, including the likes of Google Mail, etc.  When
I want to run multiple sessions for different GMail accounts, for
example, I just create a different user profile in Firefox. 

It'd make sense for things to run this way, I think.  After all, I'd
find it quite confusing if I log into Google Docs, open a document (by
default, it opens in a new tab) and I had to log in yet again to be able
to edit it.  


-- 
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] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis


That is how I know browsers to work, yet for a while the bahaviour has
changed. The question in light of this then is, should a new browser or tab
not open a new PHP SESSION ID. Session ID's should be kept if called from
existing pages or ID's? But new pages has no parent? Just wondering.

-Original Message-
From: Peter Ford [mailto:p...@justcroft.com] 
Sent: 20 August 2009 10:47 AM
To: php-general@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

Leon du Plessis wrote:
  It's not an issue, it's a feature.
 
 Thanks Arno...but it is a pain also.
 If I work with user A in Tab1 (window1), I want to work with user B
 separately in Tab2. When user in Tab2 logs off, I still want user A to
work,
 and not suddenly have to re-login. Same with bank. If I work with my
company
 account, then my personal account must not become an issue because I am on
 the same machine and site. 
 
 I have no issue with using FF and IE to do testing as that takes care of
 browser compatibility testing at the same time :-), but I think when you
 start a new session with new values, it should be kept under that
window/tab
 alone. Cookies can take care of more details, but my opinion is data
should
 never be affected across windows/tabs unless the same user is logged in on
 botheven then I would expect PHP to keep data per session. Maybe it
goes
 beyond being an IE or FF issue..the questiojn is...will PHP allow
variables
 from session A become corrupted when session B is in progress when they
 should actually be handled seperately?
 
 In the end I think it is something I do wrong in PHP with the SESSION
 variables and how I clear themif so...I don't think PHP should allow
 clearing SESSION variables from other sessions.
  
 -Original Message-
 From: Arno Kuhl [mailto:ak...@telkomsa.net] 
 Sent: 20 August 2009 10:03 AM
 To: 'Leon du Plessis'; php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 -Original Message-
 From: Leon du Plessis [mailto:l...@dsgnit.com] 
 Sent: 20 August 2009 09:44 AM
 To: php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 Since we are on the subject: I have the following similar problem:
 
 When testing page on internet explorer, I find that one tab's variables
can
 affect another tab's variables. Thus when having the same web-site open
and
 using SESSION variables but for different users, Internet explorer can
 become disorientated. This also sometimes happen when I have two
 separate browsing windows open with Internet Explorer for the same site.
 
 I have yet to determine if this is an internet explorer, or PHP or
 combination of the two that is causing this condition. 
 
 To my understanding _SESSION variables should be maintained per session,
tab
 or window. If this has been addressed already, my apologies, but thought
it
 worthwhile to mention.  
 
 If someone perhaps have a solution or can confirm this as a known issue
and
 maybe is the same or related to Angelo's problem?
 
 
 
 If different browser windows/tabs on the same client-side computer didn't
 share session info then you'd get the effect of being able to log onto a
 site with one browser window, but find in a second browser window that you
 were not yet logged on. Experience will tell you that you're logged on in
 both browser windows (try it with your online bank). It's not an issue,
it's
 a feature. If you want to be able to use different browser windows as
though
 they were different users then use different browsers e.g. IE and FF on
the
 same client-side computer will look like two separate end users to the
 server, and they don't share session info or cookies.
 
 Cheers
 Arno
 
 

The key thing is that both tabs (or windows) from the same browser are in
the
*same* session - they send the *same* PHPID cookie. PHP is essentially
stateless
- it doesn't care where the request comes from, and ties a session to the
PHPID
cookie if it gets one. As far as PHP knows, requests from different tabs
with
the same PHPID cookie are requests from the same place in the same session.

To get a different session you need a different instance of the browser -
that's
the way browsers have been coded to work. It's not too hard with Firefox,
since
you can set up multiple profiles to have independent Firefox windows on the
same
screen.

-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

-- 
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] Re: How to download and configure php mvc website locally

2009-08-20 Thread Sumit Sharma
Hi all,
The site I have download was developed using cake php. Now when trying to
access the website it is showing a blank page. As Sudheer suggested I went
to error log and noted down the errors there, which are as follows:

[Thu Aug 20 14:10:16 2009] [error] [client 127.0.0.1] File does not exist:
F:/Rabin/xampp/htdocs/favicon.ico

I think there is no file called favicon.ico but how to create this file. Is
this something related to cakephp configuration.

Regards,
Sumit



On Wed, Aug 19, 2009 at 8:25 PM, Sumit Sharma sumitp...@gmail.com wrote:

 Hi,
 Please help as I have downloaded a php website for my client which is
 developed using model view controller pattern. Now when I am accessing this
 site locally it is not showing any thing. Please tell me the what's the
 problem

 Thanks,
   Sumit Sharma



Re: [PHP] PDF Width

2009-08-20 Thread Nitebirdz
On Wed, Aug 19, 2009 at 02:59:43PM -0400, Floyd Resler wrote:

 Does anyone know how I can find the width of a PDF in PHP?


Would this help?  Search for width within the page. 

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



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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
Hi, 

Just a re-iteration on the problem:

Browser 1 has user A details 

Browser 2 has user B details

User B logs off, then user A is suddenly in logged of status also.

The method used to destroy the session is:
// Unset all of the session variables.
$_SESSION = array();

// Finally, destroy the session.
session_destroy();

Problem. User's A session is also destroyed. The concern is, that this
should not be the case. User A must happily continue to work.

So, should PHP destroy the whole browser's session id's variables? My answer
is No.

User A and user B should have different session ids, if not, then it is
wrong. A new window should have PHP to spawn a new session id (that is, the
request does not come from an existing page where an id has been created
already. If the ids are different, then session_destroy should only clear
variables for relevant session_id, ie only User B's details In this example.


The problem then probably lies in the session_ids being either the same for
the two different logins (although they are on different browser) or
session_destroy clearing data across sessions. (I will test that later). It
would then seem that session ids is setup per location/machine by MS Windows
as per Peter's explanation. Setting up profiles is the the resolution as
suggested. Otherwise, it would be nice if Windows/IE/FF/PHP could identify
when a BRAND NEW page is being opened and then create a brand new session id
for that window/tab.

It is not a huge issue, I was just wondering if someone else had the same
annoying condition. I am happy with the responses and the functionality
somewhere on a wish-list. 

Now Back to Angelo's SESSION problem which sounded like it could be related.

Greetings!
Leon

-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 10:57 AM
To: 'Peter Ford'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes



That is how I know browsers to work, yet for a while the bahaviour has
changed. The question in light of this then is, should a new browser or tab
not open a new PHP SESSION ID. Session ID's should be kept if called from
existing pages or ID's? But new pages has no parent? Just wondering.

-Original Message-
From: Peter Ford [mailto:p...@justcroft.com] 
Sent: 20 August 2009 10:47 AM
To: php-general@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

Leon du Plessis wrote:
  It's not an issue, it's a feature.
 
 Thanks Arno...but it is a pain also.
 If I work with user A in Tab1 (window1), I want to work with user B
 separately in Tab2. When user in Tab2 logs off, I still want user A to
work,
 and not suddenly have to re-login. Same with bank. If I work with my
company
 account, then my personal account must not become an issue because I am on
 the same machine and site. 
 
 I have no issue with using FF and IE to do testing as that takes care of
 browser compatibility testing at the same time :-), but I think when you
 start a new session with new values, it should be kept under that
window/tab
 alone. Cookies can take care of more details, but my opinion is data
should
 never be affected across windows/tabs unless the same user is logged in on
 botheven then I would expect PHP to keep data per session. Maybe it
goes
 beyond being an IE or FF issue..the questiojn is...will PHP allow
variables
 from session A become corrupted when session B is in progress when they
 should actually be handled seperately?
 
 In the end I think it is something I do wrong in PHP with the SESSION
 variables and how I clear themif so...I don't think PHP should allow
 clearing SESSION variables from other sessions.
  
 -Original Message-
 From: Arno Kuhl [mailto:ak...@telkomsa.net] 
 Sent: 20 August 2009 10:03 AM
 To: 'Leon du Plessis'; php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 -Original Message-
 From: Leon du Plessis [mailto:l...@dsgnit.com] 
 Sent: 20 August 2009 09:44 AM
 To: php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 Since we are on the subject: I have the following similar problem:
 
 When testing page on internet explorer, I find that one tab's variables
can
 affect another tab's variables. Thus when having the same web-site open
and
 using SESSION variables but for different users, Internet explorer can
 become disorientated. This also sometimes happen when I have two
 separate browsing windows open with Internet Explorer for the same site.
 
 I have yet to determine if this is an internet explorer, or PHP or
 combination of the two that is causing this condition. 
 
 To my understanding _SESSION variables should be maintained per session,
tab
 or window. If this has been addressed already, my apologies, but thought
it
 worthwhile to mention.  
 
 If someone perhaps have a solution or can confirm this as a known issue
and
 maybe is the same or related to Angelo's problem?
 
 
 
 If different browser 

Re: [PHP] Sanitizing mysql inserts of user data

2009-08-20 Thread Dotan Cohen
  That said, I would recommend binding parameters if you can. It's a
  cleaner way of separating the logic of a query from its data, and
  theoretically more reliable than mysql_real_escape_string():
 
  http://en.wikipedia.org/wiki/SQL_injection#Parameterized_statements
 

 I fail to understand what is happening here. For the sake of context,
 here is the PHP code in TFA:
 $db = new PDO('pgsql:dbname=database');
 $stmt = $db-prepare(SELECT priv FROM testUsers WHERE
 username=:username AND password=:password);
 $stmt-bindParam(':username', $user);
 $stmt-bindParam(':password', $pass);
 $stmt-execute();

 What exactly does bindParam do? I read these pages in TFM but I still
 do not understand what exactly is being sent to the database:
 http://il2.php.net/manual/en/function.db2-bind-param.php
 http://il2.php.net/manual/en/function.maxdb-stmt-bind-param.php
 http://il2.php.net/manual/en/mysqli-stmt.bind-param.php

 I do not see how there could possibly be a prepared statement for a
 user comment. I am not a programmer by trade, so I may be missing
 something obvious. If so, a link and a friendly RTFM would be great.

 Typically, prepared statements do a couple of things. First, they ensure
 that values sent to the DBMS are properly quoted. You'd be surprised
 how difficult a problem that is. Date and string values must be
 surrounded by quotes, but numerics shouldn't be. And how they're quoted
 depends on the DBMS you're using. So prepared statements take care of
 this for you.


Apparently, I missunderstood the meaning of the term prepared
statements. I thought that it meant using values that only came from
my code, and no user-entered values. For instance, if the user had to
choose between the windows, linux, and mac forums, the code would look
like this:
switch ($userForum){
  case (linux):
$sqlForum=linux;
break;
  case (windows):
$sqlForum=windows;
break;
  case (mac):
$sqlForum=mac;
break;

This is what I currently do. However, that approach would not work for comments.


 The second thing they do is examine the values you're attempting to pass
 into the database, and ensure they don't contain SQL injection type
 code. This is hard to explain, but it's relatively simple to insert
 code in place of an actual value, and do malicious things to your
 database, or obtain information you don't want users to see (like credit
 card numbers). If you're curious, search for SQL injection to get more
 information and see examples.


I am familiar with SQL injection, I wrote about it here:
http://what-is-what.com/what_is/sql_injection.html

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

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



Re: [PHP] Sanitizing mysql inserts of user data

2009-08-20 Thread Dotan Cohen
 Thanks Paul, that was a much better explanation than the one I was
 attempting. I'm guessing the OP was being thrown off by the colons in
 the SELECT statement above. I can see how those could look like
 comments to someone not familiar with PDO and named parameters.


It wasn't the colons being mistaken for comments that threw me off, I
realized that they were not comments. But being unfamiliar with PDO
and named parameters I did not understand exactly what was happening.
I will try to google some more information on PDO now. Thanks.


-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Ashley Sheridan
On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
  It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able to
 edit it.
 
 Yes. I agree. But in this case the Tab being opened is used with the same
 authentication details either via POST, GET or Cookie variables. The problem
 comes in when a totally different set of login credentials are being used
 (for the same tab/window).  Other user's login particulars should not affect
 your login variables.
 
 -Original Message-
 From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
 Sent: 20 August 2009 10:40 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
  
  Since we are on the subject: I have the following similar problem:
  
  When testing page on internet explorer, I find that one tab's variables
 can
  affect another tab's variables. Thus when having the same web-site open
 and
  using SESSION variables but for different users, Internet explorer can
  become disorientated. This also sometimes happen when I have two
  separate browsing windows open with Internet Explorer for the same site.
  
  I have yet to determine if this is an internet explorer, or PHP or
  combination of the two that is causing this condition. 
  
  To my understanding _SESSION variables should be maintained per session,
 tab
  or window. If this has been addressed already, my apologies, but thought
 it
  worthwhile to mention.  
  
 
 I'm a total newbie when it comes to these issues, but it seems to me
 that Firefox behaves in the very same manner.  It's not limited to PHP
 sessions either.  It's always been my experience on any website that
 requires authentication, including the likes of Google Mail, etc.  When
 I want to run multiple sessions for different GMail accounts, for
 example, I just create a different user profile in Firefox. 
 
 It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
 to edit it.  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
The point is you are misunderstanding how browsers work. What the server
app is seeing is a new login that replaces the first. This is the way
browsers work, and if it changed to the idea you have for it, then
millions of sites would suddenly fail to work; i.e. any site that
requires a new tab or window to be opened in order to function, like
banks, etc.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re: [PHP] Re: How to download and configure php mvc website locally

2009-08-20 Thread Ashley Sheridan
On Wed, 2009-08-19 at 23:00 -1000, Sumit Sharma wrote:
 Hi all,
 The site I have download was developed using cake php. Now when trying to
 access the website it is showing a blank page. As Sudheer suggested I went
 to error log and noted down the errors there, which are as follows:
 
 [Thu Aug 20 14:10:16 2009] [error] [client 127.0.0.1] File does not exist:
 F:/Rabin/xampp/htdocs/favicon.ico
 
 I think there is no file called favicon.ico but how to create this file. Is
 this something related to cakephp configuration.
 
 Regards,
 Sumit
 
 
 
 On Wed, Aug 19, 2009 at 8:25 PM, Sumit Sharma sumitp...@gmail.com wrote:
 
  Hi,
  Please help as I have downloaded a php website for my client which is
  developed using model view controller pattern. Now when I am accessing this
  site locally it is not showing any thing. Please tell me the what's the
  problem
 
  Thanks,
Sumit Sharma
 
This is not related to Cake whatsoever, and a 5 second Google search
would have told you that. Is the app perhaps using a database that
you've not set up? Are the permissions on the files exactly as they are
on the remote app? Is the server set up in the same general way? Are
there any missing web server modules that the app requires that you need
to add in locally?

There are a lot of questions here, but in order for anyone to help, we
need a bit more information. A blank screen could be caused by any
number of issues. What other messages are in your error log?

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re: [PHP] Re: How to download and configure php mvc website locally

2009-08-20 Thread Nitebirdz
On Wed, Aug 19, 2009 at 11:00:46PM -1000, Sumit Sharma wrote:
 Hi all,
 The site I have download was developed using cake php. Now when trying to
 access the website it is showing a blank page. As Sudheer suggested I went
 to error log and noted down the errors there, which are as follows:
 
 [Thu Aug 20 14:10:16 2009] [error] [client 127.0.0.1] File does not exist:
 F:/Rabin/xampp/htdocs/favicon.ico
 
 I think there is no file called favicon.ico but how to create this file. Is
 this something related to cakephp configuration.
 

As far as I know, this shouldn't cause the problem you are describing
here.  The favicon.ico file only contains the small icon you see to
the left of the URL in your browser.  If it doesn't exist, the browser
will just use a generic one.  

I'd suggest proceeding as follows:

  o Within the browser window displaying the page you are having 
problems with, check the source code.  This way you can see what the 
server returns to the client (the browser, in this case) and rule 
out possible issues caused by the browser itself while rendering a 
page. 

  o Continue searching the web server logs for other more meaningful 
errors.  


Are you sure you don't see any other errors in the browser window?
Also, are you sure you simulated the very same environment from the
original system?  Same directories, databases, etc.?  I'm not familiar
with CakePHP, but perhaps you need to set certain config options to get
it to work.  


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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
Thanks Ashley, 

I just want to iterate again that when a new page is opened by another
existing page in a new browser or Tab, the session_id is already created and
therefore the current way browsers work is in no way compremised. The new
browser/tab would receive the session id along with GET or POST variables.

What I am suggesting/hoping is that when a new browser is opened or a new
tab is opened via the application, the protocols would reckognize that this
is the first time the page is served and is not being called from another
page. That is, a new page is loaded by the user entering it, and NOT by
clicking login or some other link from an existing page.

Yes, I know..that creates other scenarios, so is happy to not meddle with
the way browsers work. It is just a limitation I will live with and can get
by with it.

Regards
Leon

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 20 August 2009 11:39 AM
To: Leon du Plessis
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
  It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
to
 edit it.
 
 Yes. I agree. But in this case the Tab being opened is used with the same
 authentication details either via POST, GET or Cookie variables. The
problem
 comes in when a totally different set of login credentials are being used
 (for the same tab/window).  Other user's login particulars should not
affect
 your login variables.
 
 -Original Message-
 From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
 Sent: 20 August 2009 10:40 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
  
  Since we are on the subject: I have the following similar problem:
  
  When testing page on internet explorer, I find that one tab's variables
 can
  affect another tab's variables. Thus when having the same web-site open
 and
  using SESSION variables but for different users, Internet explorer can
  become disorientated. This also sometimes happen when I have two
  separate browsing windows open with Internet Explorer for the same site.
  
  I have yet to determine if this is an internet explorer, or PHP or
  combination of the two that is causing this condition. 
  
  To my understanding _SESSION variables should be maintained per session,
 tab
  or window. If this has been addressed already, my apologies, but thought
 it
  worthwhile to mention.  
  
 
 I'm a total newbie when it comes to these issues, but it seems to me
 that Firefox behaves in the very same manner.  It's not limited to PHP
 sessions either.  It's always been my experience on any website that
 requires authentication, including the likes of Google Mail, etc.  When
 I want to run multiple sessions for different GMail accounts, for
 example, I just create a different user profile in Firefox. 
 
 It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
 to edit it.  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
The point is you are misunderstanding how browsers work. What the server
app is seeing is a new login that replaces the first. This is the way
browsers work, and if it changed to the idea you have for it, then
millions of sites would suddenly fail to work; i.e. any site that
requires a new tab or window to be opened in order to function, like
banks, etc.

Thanks,
Ash
http://www.ashleysheridan.co.uk




-- 
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] SESSIONS lost sometimes

2009-08-20 Thread Ashley Sheridan
On Thu, 2009-08-20 at 12:04 +0200, Leon du Plessis wrote:
 Thanks Ashley, 
 
 I just want to iterate again that when a new page is opened by another
 existing page in a new browser or Tab, the session_id is already created and
 therefore the current way browsers work is in no way compremised. The new
 browser/tab would receive the session id along with GET or POST variables.
 
 What I am suggesting/hoping is that when a new browser is opened or a new
 tab is opened via the application, the protocols would reckognize that this
 is the first time the page is served and is not being called from another
 page. That is, a new page is loaded by the user entering it, and NOT by
 clicking login or some other link from an existing page.
 
 Yes, I know..that creates other scenarios, so is happy to not meddle with
 the way browsers work. It is just a limitation I will live with and can get
 by with it.
 
 Regards
 Leon
 
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
 Sent: 20 August 2009 11:39 AM
 To: Leon du Plessis
 Cc: 'Nitebirdz'; php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
   It'd make sense for things to run this way, I think.  After all, I'd
  find it quite confusing if I log into Google Docs, open a document (by
  default, it opens in a new tab) and I had to log in yet again to be able
 to
  edit it.
  
  Yes. I agree. But in this case the Tab being opened is used with the same
  authentication details either via POST, GET or Cookie variables. The
 problem
  comes in when a totally different set of login credentials are being used
  (for the same tab/window).  Other user's login particulars should not
 affect
  your login variables.
  
  -Original Message-
  From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
  Sent: 20 August 2009 10:40 AM
  To: php-general@lists.php.net
  Subject: Re: [PHP] SESSIONS lost sometimes
  
  On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
   
   Since we are on the subject: I have the following similar problem:
   
   When testing page on internet explorer, I find that one tab's variables
  can
   affect another tab's variables. Thus when having the same web-site open
  and
   using SESSION variables but for different users, Internet explorer can
   become disorientated. This also sometimes happen when I have two
   separate browsing windows open with Internet Explorer for the same site.
   
   I have yet to determine if this is an internet explorer, or PHP or
   combination of the two that is causing this condition. 
   
   To my understanding _SESSION variables should be maintained per session,
  tab
   or window. If this has been addressed already, my apologies, but thought
  it
   worthwhile to mention.  
   
  
  I'm a total newbie when it comes to these issues, but it seems to me
  that Firefox behaves in the very same manner.  It's not limited to PHP
  sessions either.  It's always been my experience on any website that
  requires authentication, including the likes of Google Mail, etc.  When
  I want to run multiple sessions for different GMail accounts, for
  example, I just create a different user profile in Firefox. 
  
  It'd make sense for things to run this way, I think.  After all, I'd
  find it quite confusing if I log into Google Docs, open a document (by
  default, it opens in a new tab) and I had to log in yet again to be able
  to edit it.  
  
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 The point is you are misunderstanding how browsers work. What the server
 app is seeing is a new login that replaces the first. This is the way
 browsers work, and if it changed to the idea you have for it, then
 millions of sites would suddenly fail to work; i.e. any site that
 requires a new tab or window to be opened in order to function, like
 banks, etc.
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 
 
 
 -- 
 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
 
There is one way to get around it, and that is to use arrays within your
session variables. So for example, it might look something like this:

$_SESSION['your_app_name']['username']['some_value']

This way, if the username doesn't exist, you know there is no session
for them. It's ugly, but it will get around what you see as a
limitation.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
Thanks Ashley. Will implement if the need arise again..
By limitation I actually meant annoyance. 
Limitation was the wrong word to use.
(I think all browsers has something great and something not so great)

:-)
Greetings

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 20 August 2009 12:05 PM
To: Leon du Plessis
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

On Thu, 2009-08-20 at 12:04 +0200, Leon du Plessis wrote:
 Thanks Ashley, 
 
 I just want to iterate again that when a new page is opened by another
 existing page in a new browser or Tab, the session_id is already created
and
 therefore the current way browsers work is in no way compremised. The new
 browser/tab would receive the session id along with GET or POST variables.
 
 What I am suggesting/hoping is that when a new browser is opened or a new
 tab is opened via the application, the protocols would reckognize that
this
 is the first time the page is served and is not being called from another
 page. That is, a new page is loaded by the user entering it, and NOT by
 clicking login or some other link from an existing page.
 
 Yes, I know..that creates other scenarios, so is happy to not meddle with
 the way browsers work. It is just a limitation I will live with and can
get
 by with it.
 
 Regards
 Leon
 
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
 Sent: 20 August 2009 11:39 AM
 To: Leon du Plessis
 Cc: 'Nitebirdz'; php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
   It'd make sense for things to run this way, I think.  After all, I'd
  find it quite confusing if I log into Google Docs, open a document (by
  default, it opens in a new tab) and I had to log in yet again to be able
 to
  edit it.
  
  Yes. I agree. But in this case the Tab being opened is used with the
same
  authentication details either via POST, GET or Cookie variables. The
 problem
  comes in when a totally different set of login credentials are being
used
  (for the same tab/window).  Other user's login particulars should not
 affect
  your login variables.
  
  -Original Message-
  From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
  Sent: 20 August 2009 10:40 AM
  To: php-general@lists.php.net
  Subject: Re: [PHP] SESSIONS lost sometimes
  
  On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
   
   Since we are on the subject: I have the following similar problem:
   
   When testing page on internet explorer, I find that one tab's
variables
  can
   affect another tab's variables. Thus when having the same web-site
open
  and
   using SESSION variables but for different users, Internet explorer can
   become disorientated. This also sometimes happen when I have two
   separate browsing windows open with Internet Explorer for the same
site.
   
   I have yet to determine if this is an internet explorer, or PHP or
   combination of the two that is causing this condition. 
   
   To my understanding _SESSION variables should be maintained per
session,
  tab
   or window. If this has been addressed already, my apologies, but
thought
  it
   worthwhile to mention.  
   
  
  I'm a total newbie when it comes to these issues, but it seems to me
  that Firefox behaves in the very same manner.  It's not limited to PHP
  sessions either.  It's always been my experience on any website that
  requires authentication, including the likes of Google Mail, etc.  When
  I want to run multiple sessions for different GMail accounts, for
  example, I just create a different user profile in Firefox. 
  
  It'd make sense for things to run this way, I think.  After all, I'd
  find it quite confusing if I log into Google Docs, open a document (by
  default, it opens in a new tab) and I had to log in yet again to be able
  to edit it.  
  
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 The point is you are misunderstanding how browsers work. What the server
 app is seeing is a new login that replaces the first. This is the way
 browsers work, and if it changed to the idea you have for it, then
 millions of sites would suddenly fail to work; i.e. any site that
 requires a new tab or window to be opened in order to function, like
 banks, etc.
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 
 
 
 -- 
 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
 
There is one way to get around it, and that is to use arrays within your
session variables. So for example, it might look something like this:

$_SESSION['your_app_name']['username']['some_value']

This way, if the username doesn't exist, you know there is no session
for them. It's ugly, but 

RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Angelo Zanetti
Hi Leon and all.

LEON you are misunderstanding how the sessions work. Also please start your
own thread and don't hijack mine.

To the rest that replied. Thanks, I am still stuck with the problem I have
asked the hosting company to check the storage capacity and also any other
issues with the SESSIONS on the server.

However if anyone has other things they think I can look at, I'd appreciate
that very much.

Thanks
Angelo
http://www.elemental.co.za


-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 12:04 PM
To: a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Thanks Ashley, 

I just want to iterate again that when a new page is opened by another
existing page in a new browser or Tab, the session_id is already created and
therefore the current way browsers work is in no way compremised. The new
browser/tab would receive the session id along with GET or POST variables.

What I am suggesting/hoping is that when a new browser is opened or a new
tab is opened via the application, the protocols would reckognize that this
is the first time the page is served and is not being called from another
page. That is, a new page is loaded by the user entering it, and NOT by
clicking login or some other link from an existing page.

Yes, I know..that creates other scenarios, so is happy to not meddle with
the way browsers work. It is just a limitation I will live with and can get
by with it.

Regards
Leon

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 20 August 2009 11:39 AM
To: Leon du Plessis
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
  It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
to
 edit it.
 
 Yes. I agree. But in this case the Tab being opened is used with the same
 authentication details either via POST, GET or Cookie variables. The
problem
 comes in when a totally different set of login credentials are being used
 (for the same tab/window).  Other user's login particulars should not
affect
 your login variables.
 
 -Original Message-
 From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
 Sent: 20 August 2009 10:40 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
  
  Since we are on the subject: I have the following similar problem:
  
  When testing page on internet explorer, I find that one tab's variables
 can
  affect another tab's variables. Thus when having the same web-site open
 and
  using SESSION variables but for different users, Internet explorer can
  become disorientated. This also sometimes happen when I have two
  separate browsing windows open with Internet Explorer for the same site.
  
  I have yet to determine if this is an internet explorer, or PHP or
  combination of the two that is causing this condition. 
  
  To my understanding _SESSION variables should be maintained per session,
 tab
  or window. If this has been addressed already, my apologies, but thought
 it
  worthwhile to mention.  
  
 
 I'm a total newbie when it comes to these issues, but it seems to me
 that Firefox behaves in the very same manner.  It's not limited to PHP
 sessions either.  It's always been my experience on any website that
 requires authentication, including the likes of Google Mail, etc.  When
 I want to run multiple sessions for different GMail accounts, for
 example, I just create a different user profile in Firefox. 
 
 It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
 to edit it.  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
The point is you are misunderstanding how browsers work. What the server
app is seeing is a new login that replaces the first. This is the way
browsers work, and if it changed to the idea you have for it, then
millions of sites would suddenly fail to work; i.e. any site that
requires a new tab or window to be opened in order to function, like
banks, etc.

Thanks,
Ash
http://www.ashleysheridan.co.uk




-- 
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Nitebirdz
On Thu, Aug 20, 2009 at 12:04:08PM +0200, Leon du Plessis wrote:
 Thanks Ashley, 
 
 I just want to iterate again that when a new page is opened by another
 existing page in a new browser or Tab, the session_id is already created and
 therefore the current way browsers work is in no way compremised. The new
 browser/tab would receive the session id along with GET or POST variables.
 
 What I am suggesting/hoping is that when a new browser is opened or a new
 tab is opened via the application, the protocols would reckognize that this
 is the first time the page is served and is not being called from another
 page. That is, a new page is loaded by the user entering it, and NOT by
 clicking login or some other link from an existing page.
 

Out of curiosity.  Did you test it under Google Chrome?  I believe each
tab is a separate process in the case of that browser.  I wonder how
that might affect something like this.  


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



Re: [PHP] How to make sure that the target file to read is not under writing by others?

2009-08-20 Thread Tom Worster
On 8/19/09 9:56 PM, Clancy clanc...@cybec.com.au wrote:

 I gather from this discussion that PHP allows two users to open a file for
 R/W? I had assumed it wouldn't.

i think php does allow this. but i'm not sure all file systems do.



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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
Hi Angelo, 

No need to be nasty and touchy. If you have done trouble to read I have
closed the discussion in a prior listing and referred back to your original
thread. thanks

-Original Message-
From: Angelo Zanetti [mailto:ang...@zlogic.co.za] 
Sent: 20 August 2009 01:21 PM
To: 'Leon du Plessis'; a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Hi Leon and all.

LEON you are misunderstanding how the sessions work. Also please start your
own thread and don't hijack mine.

To the rest that replied. Thanks, I am still stuck with the problem I have
asked the hosting company to check the storage capacity and also any other
issues with the SESSIONS on the server.

However if anyone has other things they think I can look at, I'd appreciate
that very much.

Thanks
Angelo
http://www.elemental.co.za


-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 12:04 PM
To: a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Thanks Ashley, 

I just want to iterate again that when a new page is opened by another
existing page in a new browser or Tab, the session_id is already created and
therefore the current way browsers work is in no way compremised. The new
browser/tab would receive the session id along with GET or POST variables.

What I am suggesting/hoping is that when a new browser is opened or a new
tab is opened via the application, the protocols would reckognize that this
is the first time the page is served and is not being called from another
page. That is, a new page is loaded by the user entering it, and NOT by
clicking login or some other link from an existing page.

Yes, I know..that creates other scenarios, so is happy to not meddle with
the way browsers work. It is just a limitation I will live with and can get
by with it.

Regards
Leon

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 20 August 2009 11:39 AM
To: Leon du Plessis
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
  It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
to
 edit it.
 
 Yes. I agree. But in this case the Tab being opened is used with the same
 authentication details either via POST, GET or Cookie variables. The
problem
 comes in when a totally different set of login credentials are being used
 (for the same tab/window).  Other user's login particulars should not
affect
 your login variables.
 
 -Original Message-
 From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
 Sent: 20 August 2009 10:40 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
  
  Since we are on the subject: I have the following similar problem:
  
  When testing page on internet explorer, I find that one tab's variables
 can
  affect another tab's variables. Thus when having the same web-site open
 and
  using SESSION variables but for different users, Internet explorer can
  become disorientated. This also sometimes happen when I have two
  separate browsing windows open with Internet Explorer for the same site.
  
  I have yet to determine if this is an internet explorer, or PHP or
  combination of the two that is causing this condition. 
  
  To my understanding _SESSION variables should be maintained per session,
 tab
  or window. If this has been addressed already, my apologies, but thought
 it
  worthwhile to mention.  
  
 
 I'm a total newbie when it comes to these issues, but it seems to me
 that Firefox behaves in the very same manner.  It's not limited to PHP
 sessions either.  It's always been my experience on any website that
 requires authentication, including the likes of Google Mail, etc.  When
 I want to run multiple sessions for different GMail accounts, for
 example, I just create a different user profile in Firefox. 
 
 It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
 to edit it.  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
The point is you are misunderstanding how browsers work. What the server
app is seeing is a new login that replaces the first. This is the way
browsers work, and if it changed to the idea you have for it, then
millions of sites would suddenly fail to work; i.e. any site that
requires a new tab or window to be opened in order to function, like
banks, etc.

Thanks,
Ash
http://www.ashleysheridan.co.uk




-- 
PHP General 

Re: [PHP] php get rss tag using DOM

2009-08-20 Thread Rodgerr

Getting RSS Feeds is going really good right now, what amazing technology :)
http://www.msnnick.net  Nickname Msn 

Morris-25 wrote:
 
 Hi,
 
 I am trying to write a programme to read a rss xml file.
 
 ...
 media:content url=*exampe.jpg* ...
 ...
 
 scan anyone tell me how to get the url attribute? I wrote some codes
 similar:
 
 
  $doc = new DOMDocument;
  $doc-load($myFlickrRss);
 
  $r = $doc-getElementsByTagName('media:content');
  for($i=0;$i=$r-length;$i++)  {
 
   // help here
 
  }
 
 

-- 
View this message in context: 
http://www.nabble.com/php-get-rss-tag-using-DOM-tp21901033p25060811.html
Sent from the PHP - General mailing list archive at Nabble.com.


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



Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Floyd Resler

Leon,
	Sessions are used on a per-domain basis.  So, no matter how many  
windows or tabs you have open for mydomain.com it will be the same  
session for all.  Having a different session start up for each window  
or tab would be a major pain.  If you needed to keep track of a user  
ID, for example, you wouldn't be able to.  As already mentioned you  
can use different browsers.  You can also set up sub-domains which  
would each have their own sessions.


Take care,
Floyd

On Aug 20, 2009, at 4:26 AM, Leon du Plessis wrote:


 It's not an issue, it's a feature.

Thanks Arno...but it is a pain also.
If I work with user A in Tab1 (window1), I want to work with user B
separately in Tab2. When user in Tab2 logs off, I still want user A  
to work,
and not suddenly have to re-login. Same with bank. If I work with my  
company
account, then my personal account must not become an issue because I  
am on

the same machine and site.

I have no issue with using FF and IE to do testing as that takes  
care of
browser compatibility testing at the same time :-), but I think when  
you
start a new session with new values, it should be kept under that  
window/tab
alone. Cookies can take care of more details, but my opinion is data  
should
never be affected across windows/tabs unless the same user is logged  
in on
botheven then I would expect PHP to keep data per session. Maybe  
it goes
beyond being an IE or FF issue..the questiojn is...will PHP allow  
variables
from session A become corrupted when session B is in progress when  
they

should actually be handled seperately?

In the end I think it is something I do wrong in PHP with the SESSION
variables and how I clear themif so...I don't think PHP should  
allow

clearing SESSION variables from other sessions.

-Original Message-
From: Arno Kuhl [mailto:ak...@telkomsa.net]
Sent: 20 August 2009 10:03 AM
To: 'Leon du Plessis'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com]
Sent: 20 August 2009 09:44 AM
To: php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Since we are on the subject: I have the following similar problem:

When testing page on internet explorer, I find that one tab's  
variables can
affect another tab's variables. Thus when having the same web-site  
open and

using SESSION variables but for different users, Internet explorer can
become disorientated. This also sometimes happen when I have two
separate browsing windows open with Internet Explorer for the same  
site.


I have yet to determine if this is an internet explorer, or PHP or
combination of the two that is causing this condition.

To my understanding _SESSION variables should be maintained per  
session, tab
or window. If this has been addressed already, my apologies, but  
thought it

worthwhile to mention.

If someone perhaps have a solution or can confirm this as a known  
issue and

maybe is the same or related to Angelo's problem?



If different browser windows/tabs on the same client-side computer  
didn't
share session info then you'd get the effect of being able to log  
onto a
site with one browser window, but find in a second browser window  
that you
were not yet logged on. Experience will tell you that you're logged  
on in
both browser windows (try it with your online bank). It's not an  
issue, it's
a feature. If you want to be able to use different browser windows  
as though
they were different users then use different browsers e.g. IE and FF  
on the

same client-side computer will look like two separate end users to the
server, and they don't share session info or cookies.

Cheers
Arno


--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] How to make sure that the target file to read is not under writing by others?

2009-08-20 Thread Arno Kuhl
-Original Message-
From: Tom Worster [mailto:f...@thefsb.org] 
Sent: 20 August 2009 01:28 PM
To: Clancy; php-general@lists.php.net
Subject: Re: [PHP] How to make sure that the target file to read is not
under writing by others?

On 8/19/09 9:56 PM, Clancy clanc...@cybec.com.au wrote:

 I gather from this discussion that PHP allows two users to open a file 
 for R/W? I had assumed it wouldn't.

i think php does allow this. but i'm not sure all file systems do.

--

PHP does allow more than one process to open a file for read-write, as does
every other filesystem I know of (PHP doesn't have a filesystem, it
implements a subset of file commands common to all OS's [some differences
between *nix and Windows] that it uses to communicate with the underlying OS
filesystem). If there's a need to ensure that multiple processes don't step
on each others toes the file can be locked. The two most common file
accesses are read and append, where a lock is mostly not required. It's only
in special cases where you want to write or update something and want to be
sure that another process isn't trying to update the same data or trying to
read data that may no longer be consistent (until you finish your update)
that you'd want to lock it.

Cheers
Arno


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



Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Nitebirdz
On Thu, Aug 20, 2009 at 02:34:54PM +0200, Angelo Zanetti wrote:
 Hi Leon, 
 
 No harm intended :) Just thought that people were missing my post now and
 only answering yours.
 

Angelo, excuse me if I'm bringing up something very basic, but I'm new
to this.  Just trying to help.  

I imagine redirects couldn't be the cause of the problem, right?  

http://www.oscarm.org/news/detail/1877-avoiding_frustration_with_php_sessions

http://www.webmasterworld.com/forum88/8486.htm



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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Angelo Zanetti
Hi Leon, 

No harm intended :) Just thought that people were missing my post now and
only answering yours.

Anyways hope your issue got resolved.

Angelo


-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 01:46 PM
To: php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Hi Angelo, 

No need to be nasty and touchy. If you have done trouble to read I have
closed the discussion in a prior listing and referred back to your original
thread. thanks

-Original Message-
From: Angelo Zanetti [mailto:ang...@zlogic.co.za] 
Sent: 20 August 2009 01:21 PM
To: 'Leon du Plessis'; a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Hi Leon and all.

LEON you are misunderstanding how the sessions work. Also please start your
own thread and don't hijack mine.

To the rest that replied. Thanks, I am still stuck with the problem I have
asked the hosting company to check the storage capacity and also any other
issues with the SESSIONS on the server.

However if anyone has other things they think I can look at, I'd appreciate
that very much.

Thanks
Angelo
http://www.elemental.co.za


-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 12:04 PM
To: a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Thanks Ashley, 

I just want to iterate again that when a new page is opened by another
existing page in a new browser or Tab, the session_id is already created and
therefore the current way browsers work is in no way compremised. The new
browser/tab would receive the session id along with GET or POST variables.

What I am suggesting/hoping is that when a new browser is opened or a new
tab is opened via the application, the protocols would reckognize that this
is the first time the page is served and is not being called from another
page. That is, a new page is loaded by the user entering it, and NOT by
clicking login or some other link from an existing page.

Yes, I know..that creates other scenarios, so is happy to not meddle with
the way browsers work. It is just a limitation I will live with and can get
by with it.

Regards
Leon

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 20 August 2009 11:39 AM
To: Leon du Plessis
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
  It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
to
 edit it.
 
 Yes. I agree. But in this case the Tab being opened is used with the same
 authentication details either via POST, GET or Cookie variables. The
problem
 comes in when a totally different set of login credentials are being used
 (for the same tab/window).  Other user's login particulars should not
affect
 your login variables.
 
 -Original Message-
 From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
 Sent: 20 August 2009 10:40 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
  
  Since we are on the subject: I have the following similar problem:
  
  When testing page on internet explorer, I find that one tab's variables
 can
  affect another tab's variables. Thus when having the same web-site open
 and
  using SESSION variables but for different users, Internet explorer can
  become disorientated. This also sometimes happen when I have two
  separate browsing windows open with Internet Explorer for the same site.
  
  I have yet to determine if this is an internet explorer, or PHP or
  combination of the two that is causing this condition. 
  
  To my understanding _SESSION variables should be maintained per session,
 tab
  or window. If this has been addressed already, my apologies, but thought
 it
  worthwhile to mention.  
  
 
 I'm a total newbie when it comes to these issues, but it seems to me
 that Firefox behaves in the very same manner.  It's not limited to PHP
 sessions either.  It's always been my experience on any website that
 requires authentication, including the likes of Google Mail, etc.  When
 I want to run multiple sessions for different GMail accounts, for
 example, I just create a different user profile in Firefox. 
 
 It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
 to edit it.  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
The point is you are misunderstanding how browsers work. What the server
app is seeing 

RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
No problem! Thx

-Original Message-
From: Angelo Zanetti [mailto:ang...@zlogic.co.za] 
Sent: 20 August 2009 02:35 PM
To: 'Leon du Plessis'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Hi Leon, 

No harm intended :) Just thought that people were missing my post now and
only answering yours.

Anyways hope your issue got resolved.

Angelo


-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 01:46 PM
To: php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Hi Angelo, 

No need to be nasty and touchy. If you have done trouble to read I have
closed the discussion in a prior listing and referred back to your original
thread. thanks

-Original Message-
From: Angelo Zanetti [mailto:ang...@zlogic.co.za] 
Sent: 20 August 2009 01:21 PM
To: 'Leon du Plessis'; a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Hi Leon and all.

LEON you are misunderstanding how the sessions work. Also please start your
own thread and don't hijack mine.

To the rest that replied. Thanks, I am still stuck with the problem I have
asked the hosting company to check the storage capacity and also any other
issues with the SESSIONS on the server.

However if anyone has other things they think I can look at, I'd appreciate
that very much.

Thanks
Angelo
http://www.elemental.co.za


-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 12:04 PM
To: a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Thanks Ashley, 

I just want to iterate again that when a new page is opened by another
existing page in a new browser or Tab, the session_id is already created and
therefore the current way browsers work is in no way compremised. The new
browser/tab would receive the session id along with GET or POST variables.

What I am suggesting/hoping is that when a new browser is opened or a new
tab is opened via the application, the protocols would reckognize that this
is the first time the page is served and is not being called from another
page. That is, a new page is loaded by the user entering it, and NOT by
clicking login or some other link from an existing page.

Yes, I know..that creates other scenarios, so is happy to not meddle with
the way browsers work. It is just a limitation I will live with and can get
by with it.

Regards
Leon

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 20 August 2009 11:39 AM
To: Leon du Plessis
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
  It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
to
 edit it.
 
 Yes. I agree. But in this case the Tab being opened is used with the same
 authentication details either via POST, GET or Cookie variables. The
problem
 comes in when a totally different set of login credentials are being used
 (for the same tab/window).  Other user's login particulars should not
affect
 your login variables.
 
 -Original Message-
 From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
 Sent: 20 August 2009 10:40 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
  
  Since we are on the subject: I have the following similar problem:
  
  When testing page on internet explorer, I find that one tab's variables
 can
  affect another tab's variables. Thus when having the same web-site open
 and
  using SESSION variables but for different users, Internet explorer can
  become disorientated. This also sometimes happen when I have two
  separate browsing windows open with Internet Explorer for the same site.
  
  I have yet to determine if this is an internet explorer, or PHP or
  combination of the two that is causing this condition. 
  
  To my understanding _SESSION variables should be maintained per session,
 tab
  or window. If this has been addressed already, my apologies, but thought
 it
  worthwhile to mention.  
  
 
 I'm a total newbie when it comes to these issues, but it seems to me
 that Firefox behaves in the very same manner.  It's not limited to PHP
 sessions either.  It's always been my experience on any website that
 requires authentication, including the likes of Google Mail, etc.  When
 I want to run multiple sessions for different GMail accounts, for
 example, I just create a different user profile in Firefox. 
 
 It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be 

Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread kranthi
The original problem..

 server is losing session variables.
I dont think PHP is not good at unset() ing variables while the script
is executing.

general logger will be of use in this case (especially when cant
reproduce the problem every time). PEAR, Zend, FirePHP, files... any
thing will do...

try to log every thing related to sessions at the start of the page...
session_id, $_SESSION super global, _SERVER['PHP_SELF']
do the same thing after the script exists...

i had a similar problem earlier...
a page in my app used to change $_SESSION['id']. It took me ages to
find out the source... even grep was of no use... at last  i was able
to isolate the page that was causing this, with the help of logging.
Of course, the main problem was that my production server has
register_globals on, while my development server has them off.

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



Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Ashley Sheridan
On Thu, 2009-08-20 at 18:38 +0530, kranthi wrote:
 The original problem..
 
  server is losing session variables.
 I dont think PHP is not good at unset() ing variables while the script
 is executing.
 
 general logger will be of use in this case (especially when cant
 reproduce the problem every time). PEAR, Zend, FirePHP, files... any
 thing will do...
 
 try to log every thing related to sessions at the start of the page...
 session_id, $_SESSION super global, _SERVER['PHP_SELF']
 do the same thing after the script exists...
 
 i had a similar problem earlier...
 a page in my app used to change $_SESSION['id']. It took me ages to
 find out the source... even grep was of no use... at last  i was able
 to isolate the page that was causing this, with the help of logging.
 Of course, the main problem was that my production server has
 register_globals on, while my development server has them off.
 
Register globals is really not a good thing to use for modern setups. It
makes it a little easier for people to exploit holes in weaker PHP
scripts.


Thanks,
Ash
http://www.ashleysheridan.co.uk




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



[PHP] Form Spam

2009-08-20 Thread Gary
I have a client with a form on his site and he is getting spammed.  It 
appears not to be from bots but human generated.  While they are coming from 
India, they do not all have the same IP address, but they all have gmail 
addresses, New York  addresses are used in the input field and they all 
offer SEO services.  It is not overwhleming, but about 5 a month.

What is the best way to stop this.

Thanks

Gary 



__ Information from ESET Smart Security, version of virus signature 
database 4351 (20090820) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



[PHP] SESSION VARIABLES ACROSS DIFFERENT WINDOWS/TABS

2009-08-20 Thread Leon du Plessis
It is just strange that I have this condition now...maybe I missed it a
year ago ? 

 Having a different session start up for each window for tab would be a
major pain.

Why? 

People must please try and understand what I mean by NEW. It does not apply
to windows/tabs being opened from a link or request.

Imho, keeping the session per domain sounds wrong, it does not mean it is.
It would have been nice if:

Browser/tab one - my login detail container A.
Browser/tab two - my admin login container B.
(tabs/windows opened from browser one, then inherits container A naturally)
(Closing browser one, then destroys container A then naturally only)

NOT

Domain.com - one session container only.

Heck, I am surprised it works that way at all cause it sounds like the
domain can then only handle one user a time if arrays are not used or
profiles not created on FF no matter where the request come from, but, then
I am obviously missing something in this respect as stated. When I have time
I will reconstruct this concept again.

Thanks anyway guys. I received some helpful advise for future reference.

But please..I do not, like many others, want to start a war. I am ok with
things how they are. We can put this thing to rest.

-Original Message-
From: Floyd Resler [mailto:fres...@adex-intl.com] 
Sent: 20 August 2009 02:25 PM
To: Leon du Plessis
Cc: a...@dotcontent.net; php-general@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

Leon,
Sessions are used on a per-domain basis.  So, no matter how many  
windows or tabs you have open for mydomain.com it will be the same  
session for all.  Having a different session start up for each window  
or tab would be a major pain.  If you needed to keep track of a user  
ID, for example, you wouldn't be able to.  As already mentioned you  
can use different browsers.  You can also set up sub-domains which  
would each have their own sessions.

Take care,
Floyd

On Aug 20, 2009, at 4:26 AM, Leon du Plessis wrote:

  It's not an issue, it's a feature.

 Thanks Arno...but it is a pain also.
 If I work with user A in Tab1 (window1), I want to work with user B
 separately in Tab2. When user in Tab2 logs off, I still want user A  
 to work,
 and not suddenly have to re-login. Same with bank. If I work with my  
 company
 account, then my personal account must not become an issue because I  
 am on
 the same machine and site.

 I have no issue with using FF and IE to do testing as that takes  
 care of
 browser compatibility testing at the same time :-), but I think when  
 you
 start a new session with new values, it should be kept under that  
 window/tab
 alone. Cookies can take care of more details, but my opinion is data  
 should
 never be affected across windows/tabs unless the same user is logged  
 in on
 botheven then I would expect PHP to keep data per session. Maybe  
 it goes
 beyond being an IE or FF issue..the questiojn is...will PHP allow  
 variables
 from session A become corrupted when session B is in progress when  
 they
 should actually be handled seperately?

 In the end I think it is something I do wrong in PHP with the SESSION
 variables and how I clear themif so...I don't think PHP should  
 allow
 clearing SESSION variables from other sessions.

 -Original Message-
 From: Arno Kuhl [mailto:ak...@telkomsa.net]
 Sent: 20 August 2009 10:03 AM
 To: 'Leon du Plessis'; php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes

 -Original Message-
 From: Leon du Plessis [mailto:l...@dsgnit.com]
 Sent: 20 August 2009 09:44 AM
 To: php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes

 Since we are on the subject: I have the following similar problem:

 When testing page on internet explorer, I find that one tab's  
 variables can
 affect another tab's variables. Thus when having the same web-site  
 open and
 using SESSION variables but for different users, Internet explorer can
 become disorientated. This also sometimes happen when I have two
 separate browsing windows open with Internet Explorer for the same  
 site.

 I have yet to determine if this is an internet explorer, or PHP or
 combination of the two that is causing this condition.

 To my understanding _SESSION variables should be maintained per  
 session, tab
 or window. If this has been addressed already, my apologies, but  
 thought it
 worthwhile to mention.

 If someone perhaps have a solution or can confirm this as a known  
 issue and
 maybe is the same or related to Angelo's problem?

 

 If different browser windows/tabs on the same client-side computer  
 didn't
 share session info then you'd get the effect of being able to log  
 onto a
 site with one browser window, but find in a second browser window  
 that you
 were not yet logged on. Experience will tell you that you're logged  
 on in
 both browser windows (try it with your online bank). It's not an  
 issue, it's
 a feature. If you want to be 

Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread kranthi
 I imagine redirects couldn't be the cause of the problem, right?
Thanks, this is really a life saver.. I never used
session_write_close() before any redirects...

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



Re: [PHP] SESSION VARIABLES ACROSS DIFFERENT WINDOWS/TABS

2009-08-20 Thread Ashley Sheridan
On Thu, 2009-08-20 at 15:16 +0200, Leon du Plessis wrote:
 It is just strange that I have this condition now...maybe I missed it a
 year ago ? 
 
  Having a different session start up for each window for tab would be a
 major pain.
 
 Why? 
 
 People must please try and understand what I mean by NEW. It does not apply
 to windows/tabs being opened from a link or request.
 
 Imho, keeping the session per domain sounds wrong, it does not mean it is.
 It would have been nice if:
 
 Browser/tab one - my login detail container A.
 Browser/tab two - my admin login container B.
 (tabs/windows opened from browser one, then inherits container A naturally)
 (Closing browser one, then destroys container A then naturally only)
 
 NOT
 
 Domain.com - one session container only.
 
 Heck, I am surprised it works that way at all cause it sounds like the
 domain can then only handle one user a time if arrays are not used or
 profiles not created on FF no matter where the request come from, but, then
 I am obviously missing something in this respect as stated. When I have time
 I will reconstruct this concept again.
 
 Thanks anyway guys. I received some helpful advise for future reference.
 
 But please..I do not, like many others, want to start a war. I am ok with
 things how they are. We can put this thing to rest.
 
 -Original Message-
 From: Floyd Resler [mailto:fres...@adex-intl.com] 
 Sent: 20 August 2009 02:25 PM
 To: Leon du Plessis
 Cc: a...@dotcontent.net; php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 Leon,
   Sessions are used on a per-domain basis.  So, no matter how many  
 windows or tabs you have open for mydomain.com it will be the same  
 session for all.  Having a different session start up for each window  
 or tab would be a major pain.  If you needed to keep track of a user  
 ID, for example, you wouldn't be able to.  As already mentioned you  
 can use different browsers.  You can also set up sub-domains which  
 would each have their own sessions.
 
 Take care,
 Floyd
 
 On Aug 20, 2009, at 4:26 AM, Leon du Plessis wrote:
 
   It's not an issue, it's a feature.
 
  Thanks Arno...but it is a pain also.
  If I work with user A in Tab1 (window1), I want to work with user B
  separately in Tab2. When user in Tab2 logs off, I still want user A  
  to work,
  and not suddenly have to re-login. Same with bank. If I work with my  
  company
  account, then my personal account must not become an issue because I  
  am on
  the same machine and site.
 
  I have no issue with using FF and IE to do testing as that takes  
  care of
  browser compatibility testing at the same time :-), but I think when  
  you
  start a new session with new values, it should be kept under that  
  window/tab
  alone. Cookies can take care of more details, but my opinion is data  
  should
  never be affected across windows/tabs unless the same user is logged  
  in on
  botheven then I would expect PHP to keep data per session. Maybe  
  it goes
  beyond being an IE or FF issue..the questiojn is...will PHP allow  
  variables
  from session A become corrupted when session B is in progress when  
  they
  should actually be handled seperately?
 
  In the end I think it is something I do wrong in PHP with the SESSION
  variables and how I clear themif so...I don't think PHP should  
  allow
  clearing SESSION variables from other sessions.
 
  -Original Message-
  From: Arno Kuhl [mailto:ak...@telkomsa.net]
  Sent: 20 August 2009 10:03 AM
  To: 'Leon du Plessis'; php-general@lists.php.net
  Subject: RE: [PHP] SESSIONS lost sometimes
 
  -Original Message-
  From: Leon du Plessis [mailto:l...@dsgnit.com]
  Sent: 20 August 2009 09:44 AM
  To: php-general@lists.php.net
  Subject: RE: [PHP] SESSIONS lost sometimes
 
  Since we are on the subject: I have the following similar problem:
 
  When testing page on internet explorer, I find that one tab's  
  variables can
  affect another tab's variables. Thus when having the same web-site  
  open and
  using SESSION variables but for different users, Internet explorer can
  become disorientated. This also sometimes happen when I have two
  separate browsing windows open with Internet Explorer for the same  
  site.
 
  I have yet to determine if this is an internet explorer, or PHP or
  combination of the two that is causing this condition.
 
  To my understanding _SESSION variables should be maintained per  
  session, tab
  or window. If this has been addressed already, my apologies, but  
  thought it
  worthwhile to mention.
 
  If someone perhaps have a solution or can confirm this as a known  
  issue and
  maybe is the same or related to Angelo's problem?
 
  
 
  If different browser windows/tabs on the same client-side computer  
  didn't
  share session info then you'd get the effect of being able to log  
  onto a
  site with one browser window, but find in a second browser window  
  that you
  

Re: [PHP] Form Spam

2009-08-20 Thread Ashley Sheridan
On Thu, 2009-08-20 at 09:11 -0400, Gary wrote:
 I have a client with a form on his site and he is getting spammed.  It 
 appears not to be from bots but human generated.  While they are coming from 
 India, they do not all have the same IP address, but they all have gmail 
 addresses, New York  addresses are used in the input field and they all 
 offer SEO services.  It is not overwhleming, but about 5 a month.
 
 What is the best way to stop this.
 
 Thanks
 
 Gary 
 
 
 
 __ Information from ESET Smart Security, version of virus signature 
 database 4351 (20090820) __
 
 The message was checked by ESET Smart Security.
 
 http://www.eset.com
 
 
 
 
 

To ensure that it isn't bots, maybe look at adding some sort captcha.

As it is quite infrequent, the chances are that it is a human scumbag.
Is there anything common to the spam posts that you can see? What about
looking for that prior to the post being added. If you find it, then set
a flag in the database next to that post and record the IP address of
whoever made it. Then, if someone visits with that IP address, show them
the post as if there was no problem, but only to that IP, giving you a
chance of verifying the legitimacy of the post before it goes live to
everyone.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



[PHP] Re: Form Spam

2009-08-20 Thread Ralph Deffke
may be a better afvice could be given if we would know more about the
application. However u mentioend that these little amonut is HUMAN driven.
then its very much dependent on the application itself and can not be done
with putting some retrictions which would be against the internationality of
the web.

However a common practice is thst u give a human only readable image that
shows hard readable character stuff to put in a input field for verification
on the server.

however human driven spam is almost not avoidable, bots yes.

The problem is that people in the third world work for 2 bugs a day. I would
wonder if u don't talk about the nigeria conection by the way.

hope it helps
ralph_def...@yahoo.de

Gary gwp...@ptd.net wrote in message
news:e8.c5.10097.1ab4d...@pb1.pair.com...
 I have a client with a form on his site and he is getting spammed.  It
 appears not to be from bots but human generated.  While they are coming
from
 India, they do not all have the same IP address, but they all have gmail
 addresses, New York  addresses are used in the input field and they all
 offer SEO services.  It is not overwhleming, but about 5 a month.

 What is the best way to stop this.

 Thanks

 Gary



 __ Information from ESET Smart Security, version of virus
signature database 4351 (20090820) __

 The message was checked by ESET Smart Security.

 http://www.eset.com







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



Re: [PHP] Extract column names from a (my)SQL query

2009-08-20 Thread kranthi
this might be some help...
http://stackoverflow.com/questions/283087/php-mysql-sql-parser-insert-and-update

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



Re: [PHP] Form Spam

2009-08-20 Thread Gary
There is plenty of commonaltiy in the submissions, all ip addresses start 
with an 122.  They all offer SEO services, but change the wording, so if I 
tried to bannish any submissions with Search Engine, Ranking, Google etc, 
they would probably just shift messages. There are also special charactors 
in the messages, although I am not sure if that is just a foreign charactor 
that is being translated.

I also noticed that one of the messages start with \ and end with \, which 
I assume is put in to beat system.

I did find on stopforumspam.com this ip address and they had whois 
information, it points to india.  There is also a report abuse to the ISP, 
but I wonder if that is just another trap.

Any thoughts would be appriciated.

Gary


Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1250774581.10895.54.ca...@localhost...
 On Thu, 2009-08-20 at 09:11 -0400, Gary wrote:
 I have a client with a form on his site and he is getting spammed.  It
 appears not to be from bots but human generated.  While they are coming 
 from
 India, they do not all have the same IP address, but they all have gmail
 addresses, New York  addresses are used in the input field and they all
 offer SEO services.  It is not overwhleming, but about 5 a month.

 What is the best way to stop this.

 Thanks

 Gary



 __ Information from ESET Smart Security, version of virus 
 signature database 4351 (20090820) __

 The message was checked by ESET Smart Security.

 http://www.eset.com






 To ensure that it isn't bots, maybe look at adding some sort captcha.

 As it is quite infrequent, the chances are that it is a human scumbag.
 Is there anything common to the spam posts that you can see? What about
 looking for that prior to the post being added. If you find it, then set
 a flag in the database next to that post and record the IP address of
 whoever made it. Then, if someone visits with that IP address, show them
 the post as if there was no problem, but only to that IP, giving you a
 chance of verifying the legitimacy of the post before it goes live to
 everyone.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk




 __ Information from ESET Smart Security, version of virus 
 signature database 4351 (20090820) __

 The message was checked by ESET Smart Security.

 http://www.eset.com


 



__ Information from ESET Smart Security, version of virus signature 
database 4351 (20090820) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Form Spam

2009-08-20 Thread Paul M Foster
On Thu, Aug 20, 2009 at 10:25:15AM -0400, Gary wrote:

 There is plenty of commonaltiy in the submissions, all ip addresses start
 with an 122.  They all offer SEO services, but change the wording, so if I
 tried to bannish any submissions with Search Engine, Ranking, Google etc,
 they would probably just shift messages. There are also special charactors
 in the messages, although I am not sure if that is just a foreign charactor
 that is being translated.
 
 I also noticed that one of the messages start with \ and end with \, which
 I assume is put in to beat system.
 
 I did find on stopforumspam.com this ip address and they had whois
 information, it points to india.  There is also a report abuse to the ISP,
 but I wonder if that is just another trap.
 
 Any thoughts would be appriciated.

I wouldn't spend a lot of time on this. If this is the worst your
customer has to deal with, they're doing okay. They could simply block
these at their mail client on their local machine.

Ashley's suggestion is the best solution. If I ever see spam on any form
of mine or my customers', I immediately implement CAPTCHA to block it.
This may not block human-generated spam, but human-generated spam is a
huge minority because it's so labor-intensive.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Form Spam

2009-08-20 Thread Peter van der Does
On Thu, 20 Aug 2009 09:11:47 -0400
Gary gwp...@ptd.net wrote:

 I have a client with a form on his site and he is getting spammed.
 It appears not to be from bots but human generated.  While they are
 coming from India, they do not all have the same IP address, but they
 all have gmail addresses, New York  addresses are used in the input
 field and they all offer SEO services.  It is not overwhleming, but
 about 5 a month.
 
 What is the best way to stop this.
 
 Thanks
 
 Gary 
 

One of the things you could check is if they do direct posting.
What I mean by that if that sometimes a POST URL only is send. They
figured out the fields you have in your form and directly send a POST
with the appropriate fields.
You could check this in the webserver logs. Just look for the IP and
see if it only has a POST URL.

If this is the case you could implement a nonce on your form and check
it during the processing of the post.

A second idea is to check the IP of the visitor during the POST
process, with something like stopforumspam or project honey pot.

If you want more info let me know.


-- 
Peter van der Does

GPG key: E77E8E98
IRC: Ganseki on irc.freenode.net
Blog: http://blog.avirtualhome.com
Forums: http://forums.avirtualhome.com
Jabber ID: pvanderd...@gmail.com


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



Re: [PHP] daemon without pcntl_fork

2009-08-20 Thread Jim Lucas
Lars Torben Wilson wrote:
 2009/8/19 Per Jessen p...@computer.org:
 Jim Lucas wrote:
 
 [snip]
 
 I probably wouldn't have chosen PHP for the first one, but there's no
 reason it shouldn't work.  For the second one, did you mean to
 write serial port?  That's a bit of a different animal, I'm not sure
 how far you'll get with php.

 Here is what I have come up with so far.  Looks to satisfying my
 needs:

 tms_daemon
 [snip]
 # END OF SCRIPT
 Looks good to me. It'll certainly do the job.


 /Per
 
 I agree with Per on all points--I probably wouldn't choose PHP as a
 first choice for the first task, but the startup script you have shown
 looks like a bog-standard startup script and should serve you well. I
 haven't really gone over it with a fine-toothed comb though. Typos
 etc. are still up to to you. :) Of course, the whole thing depends on
 how tms_daemon behaves, but the startup script looks OK.
 
 Can you explain in a bit more detail exactly what the second part (the
 serial-network data logger) needs to do? I've written similar daemons
 in C but not PHP--when I've needed to get something like that going
 with a PHP script, I've used ser2net (which I linked to in an earlier
 post) and been quite happy. Maybe you don't even have to do the hard
 work yourself (or buy extra hardware to do it for you).
 
 
 Cheers,
 
 Torben
 

As for the second project, I asked about it in the previous thread about
the SMDR/CDR processor.

http://www.nabble.com/SMDR-CDR-daemon-processor-td25014822.html

Basically, I need to have a process that collects data via serial
(USB|RS323), connects to a remote port, or listens and receives data
from the PBX pushing it.

The most common is the RS232 serial connection.  Thats why I need to be
able to listen on the local RS232 port for data coming from the PBX system.

What I have built so far can connect to a remote machine, via a TCP/IP
connection, and wait for data to be push out the specified TCP port.

I haven't done it yet, but I know that I can easily build, using a
different project as a base, the version that would connect to a local
TCP/IP IP:PORT and wait for a PBX to send the data to that IP:PORT.

After the data has been received, the process flow will be the same with
all three methods.  Parse it, sanitize it, store it.

Hopefully that explains a little more.

Jim


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



Re: [PHP] Form Spam

2009-08-20 Thread Adam Randall
I was getting those as well on my website's form, so I added a
honeypot field and a math question (I'm not overly fond of captchas
for my own stuff, but anyway). The field itself is hidden, so bots
will fill it out causing the e-mail sending routine to bail out
(though they don't know that since it looks like it was sent :) That's
assuming that they were able to figure out the math question before
hand. Maybe not fort knox, but it does help out for me at least.

Adam.

On Thu, Aug 20, 2009 at 6:11 AM, Garygwp...@ptd.net wrote:
 I have a client with a form on his site and he is getting spammed.  It
 appears not to be from bots but human generated.  While they are coming from
 India, they do not all have the same IP address, but they all have gmail
 addresses, New York  addresses are used in the input field and they all
 offer SEO services.  It is not overwhleming, but about 5 a month.

 What is the best way to stop this.

 Thanks

 Gary



 __ Information from ESET Smart Security, version of virus signature 
 database 4351 (20090820) __

 The message was checked by ESET Smart Security.

 http://www.eset.com





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





-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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



Re: [PHP] PHP/Ajax Framework - Call for Developers Testers

2009-08-20 Thread Nathan Nobbe
On Wed, Aug 19, 2009 at 8:57 PM, Raymond Irving xwis...@yahoo.com wrote:

 Hi Nathan,

 Many thanks for the feedback. There many other useful features built into
 the API but my favorite is the embedded feature.

 You can see a live example here:
 http://raxanpdi.com/shoutbox-embedded-example.html



ive seen lots of third parties selling components in this manor.  now that
ajax has hit the scene there are some really weird things going on.

i was just on a call yesterday where this company told us about their
service, which is delivered as one of these 'embedded' applications.  this
thing would have its own navigation and display of content on our site in
order to keep folks clicking.

if you ask me, that just feels weird; having some other company like own a
piece of your app...  however, it would be foolish not to admit that this is
the way things are trending and that there will only be more of it to come.

-nathan


Re: [PHP] Form Spam

2009-08-20 Thread Gary
I have a honey pot on their already. Plus all the fields are correctly 
matched (first name to first name, comments to comments), which is what 
makes me think this is some .45 @ hour spammer just hunting and pecking from 
a hut in india.


Adam Randall randa...@gmail.com wrote in message 
news:b6d6f8360908200953s7b68ed13xe05fa7ab7ad1c...@mail.gmail.com...
I was getting those as well on my website's form, so I added a
honeypot field and a math question (I'm not overly fond of captchas
for my own stuff, but anyway). The field itself is hidden, so bots
will fill it out causing the e-mail sending routine to bail out
(though they don't know that since it looks like it was sent :) That's
assuming that they were able to figure out the math question before
hand. Maybe not fort knox, but it does help out for me at least.

Adam.

On Thu, Aug 20, 2009 at 6:11 AM, Garygwp...@ptd.net wrote:
 I have a client with a form on his site and he is getting spammed. It
 appears not to be from bots but human generated. While they are coming 
 from
 India, they do not all have the same IP address, but they all have gmail
 addresses, New York addresses are used in the input field and they all
 offer SEO services. It is not overwhleming, but about 5 a month.

 What is the best way to stop this.

 Thanks

 Gary



 __ Information from ESET Smart Security, version of virus 
 signature database 4351 (20090820) __

 The message was checked by ESET Smart Security.

 http://www.eset.com





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





-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

__ Information from ESET Smart Security, version of virus signature 
database 4351 (20090820) __

The message was checked by ESET Smart Security.

http://www.eset.com





__ Information from ESET Smart Security, version of virus signature 
database 4351 (20090820) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



RE: [PHP] SESSION VARIABLES ACROSS DIFFERENT WINDOWS/TABS

2009-08-20 Thread Jaime Bozza
Leon,

This is really just a function of the browser.   When a session cookie is 
created, if the browser is setup for a single instance, that's the session 
cookie it'll use for *any* request to that domain.  This functions differently 
depending on what browser you're using.

For example:
Firefox - All windows, tabs, etc, under the same profile will use the same 
session.   If you create profiles, you can have different sessions.
IE7, IE6 - All tabs or windows opened from clicks will share the same 
instance/session.  Starting IE from the icon will open up a new 
instance/session.  This worked great if you wanted to run two different 
sessions at the same site/domain.  Just start IE up from the icon again and 
you'd have a new session.
IE8 - IE8 model changed, so that all browser windows, tabs, etc., run under the 
same frame/session, much like Firefox.  Clicking the IE icon again now just 
keeps the same frame and thus the same session.  Originally, this sounded like 
a big problem, but IE8 introduced a new feature - File Menu - New Session.   
This will open up a new window that will be a separate frame that will not use 
current session cookies.

Here's just one of many links, but gives some helpful hints on the IE side:
http://blogs.msdn.com/ie/archive/2009/05/06/session-cookies-sessionstorage-and-ie8.aspx

And another:
http://blogs.msdn.com/askie/archive/2009/05/08/session-management-within-internet-explorer-8-0.aspx

One of the issues now is that if you close IE, your session does not disappear. 
 In the past (IE7/IE6), your session would disappear if you closed a browser 
window that you opened yourself, but it *wouldn't* disappear if you closed a 
browser window that was opened by a click from Outlook or another program.  
This was a bit inconsistent.  I won't argue whether or not their fix was the 
best way to go, but now it's at least consistent.

Note - In Firefox, not even Private Browsing separates the session cookies.  
If you start Private Browsing (Firefox 3.5), log into a site, then start a new 
browser window from the icon (that isn't in Private Browsing mode), it shares 
the session cookies. (Before you ask, I just checked this to be sure.)

IE8 InPrivate Mode is a totally separate session, cookies and all.  This 
could possibly be another way for you to run multiple sessions against the same 
domain.  OTOH, multiple InPrivate sessions running at the same time share the 
same frame, so they share the same session, so it would only be good for a 
single new session.  If you need more, just use File - New Session.

Jaime 


 -Original Message-
 From: Leon du Plessis [mailto:l...@dsgnit.com]
 Sent: Thursday, August 20, 2009 8:16 AM
 To: 'Floyd Resler'
 Cc: a...@dotcontent.net; php-general@lists.php.net
 Subject: [PHP] SESSION VARIABLES ACROSS DIFFERENT WINDOWS/TABS
 
 It is just strange that I have this condition now...maybe I missed it
 a
 year ago ?
 
  Having a different session start up for each window for tab would
 be a
 major pain.
 
 Why?
 
 People must please try and understand what I mean by NEW. It does not
 apply
 to windows/tabs being opened from a link or request.
 
 Imho, keeping the session per domain sounds wrong, it does not mean
 it is.
 It would have been nice if:
 
 Browser/tab one - my login detail container A.
 Browser/tab two - my admin login container B.
 (tabs/windows opened from browser one, then inherits container A
 naturally)
 (Closing browser one, then destroys container A then naturally only)
 
 NOT
 
 Domain.com - one session container only.
 
 Heck, I am surprised it works that way at all cause it sounds like
 the
 domain can then only handle one user a time if arrays are not used or
 profiles not created on FF no matter where the request come from, but,
 then
 I am obviously missing something in this respect as stated. When I have
 time
 I will reconstruct this concept again.
 
 Thanks anyway guys. I received some helpful advise for future
 reference.
 
 But please..I do not, like many others, want to start a war. I am ok
 with
 things how they are. We can put this thing to rest.
 
 -Original Message-
 From: Floyd Resler [mailto:fres...@adex-intl.com]
 Sent: 20 August 2009 02:25 PM
 To: Leon du Plessis
 Cc: a...@dotcontent.net; php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 Leon,
   Sessions are used on a per-domain basis.  So, no matter how many
 windows or tabs you have open for mydomain.com it will be the same
 session for all.  Having a different session start up for each window
 or tab would be a major pain.  If you needed to keep track of a user
 ID, for example, you wouldn't be able to.  As already mentioned you
 can use different browsers.  You can also set up sub-domains which
 would each have their own sessions.
 
 Take care,
 Floyd
 
 On Aug 20, 2009, at 4:26 AM, Leon du Plessis wrote:
 
   It's not an issue, it's a feature.
 
  Thanks Arno...but it is a pain also.
  If I work with user A in Tab1 

Re: [PHP] PHP and CGI

2009-08-20 Thread sono-io

Hi Tedd,


In your .htacess file add this:

# handler for phpsuexec. -- makes following prefixes considered for  
php

FilesMatch \.(htm|html|pl)$
SetHandler application/x-httpd-php
/FilesMatch



	Thanks for the code.  I placed it in the .htaccess file for the  
output templates, but unfortunately it didn't work.  It just prints  
out part of the PHP code on the template:


 / '; for ($year = date(Y) ; $year = date(Y) + 9 ; $year++)  
{ echo $year\n; } echo ''; ?


	Thanks also to everyone else who responded as well.  I'm off to find  
a PHP shopping cart!


Frank

Re: [PHP] Extract column names from a (my)SQL query

2009-08-20 Thread דניאל דנון
I haven't finished reading it yet - but this looks great - Thank you so
much!
On Thu, Aug 20, 2009 at 4:36 PM, kranthi kranthi...@gmail.com wrote:

 this might be some help...

 http://stackoverflow.com/questions/283087/php-mysql-sql-parser-insert-and-update




-- 
Use ROT26 for best security


[PHP] Displaying 2 digit minutes/seconds

2009-08-20 Thread sono-io

Hi all,

	I'm using this code to display the current time for our location on  
our website:


?php
date_default_timezone_set('America/Los_Angeles');
$theTimeIs = getdate(time());
$theHour = $theTimeIs['hours'];
$theMinute = $theTimeIs['minutes'];  // make minutes  
under 10 show two digits

$theSecond = $theTimeIs['seconds'];
if($theHour  12){
$theHour = $theHour - 12;
$dn = PM;
} else {
$dn = AM;
}

echo $theHour:$theMinute:$theSecond $dn;
?

	It works great except for one small detail.  If the time is 3:04:02,  
it is displayed as 3:4:2 which, of course, is very odd looking.  So I  
corrected it as follows:


?php
date_default_timezone_set('America/Los_Angeles');
$theTimeIs = getdate(time());
$theHour = $theTimeIs['hours'];
if (strlen ($theTimeIs['minutes'])  2) {
$theMinute = 0 . $theTimeIs['minutes'];
} else {
$theMinute = $theTimeIs['minutes'];
}
if (strlen ($theTimeIs['seconds'])  2) {
$theSecond = 0 . $theTimeIs['seconds'];
} else {
$theSecond = $theTimeIs['seconds'];
}
if($theHour  12){
$theHour = $theHour - 12;
$dn = PM;
} else {
$dn = AM;
}

echo $theHour:$theMinute:$theSecond $dn;
?

It works, but is there a better way to do it?

Thanks,
Frank

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



Re: [PHP] Displaying 2 digit minutes/seconds

2009-08-20 Thread Jonathan Tapicer
You can use sprintf or str_pad to fill in with zeros, with sprintf you
can do this:

echo sprintf('%02d', 5);

That will print the string 05.

Jonathan

On Thu, Aug 20, 2009 at 6:27 PM, sono...@fannullone.us wrote:
 Hi all,

        I'm using this code to display the current time for our location on
 our website:

 ?php
        date_default_timezone_set('America/Los_Angeles');
        $theTimeIs = getdate(time());
            $theHour = $theTimeIs['hours'];
            $theMinute = $theTimeIs['minutes'];  // make minutes under 10
 show two digits
            $theSecond = $theTimeIs['seconds'];
        if($theHour  12){
            $theHour = $theHour - 12;
            $dn = PM;
        } else {
            $dn = AM;
        }

 echo $theHour:$theMinute:$theSecond $dn;
 ?

        It works great except for one small detail.  If the time is 3:04:02,
 it is displayed as 3:4:2 which, of course, is very odd looking.  So I
 corrected it as follows:

 ?php
        date_default_timezone_set('America/Los_Angeles');
        $theTimeIs = getdate(time());
            $theHour = $theTimeIs['hours'];
            if (strlen ($theTimeIs['minutes'])  2) {
                                $theMinute = 0 . $theTimeIs['minutes'];
                                } else {
                                $theMinute = $theTimeIs['minutes'];
                                }
            if (strlen ($theTimeIs['seconds'])  2) {
                                $theSecond = 0 . $theTimeIs['seconds'];
                                } else {
                                $theSecond = $theTimeIs['seconds'];
                                }
        if($theHour  12){
            $theHour = $theHour - 12;
            $dn = PM;
        } else {
            $dn = AM;
        }

 echo $theHour:$theMinute:$theSecond $dn;
 ?

        It works, but is there a better way to do it?

 Thanks,
 Frank

 --
 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] Displaying 2 digit minutes/seconds

2009-08-20 Thread Ashley Sheridan
On Thu, 2009-08-20 at 14:27 -0700, sono...@fannullone.us wrote:
 Hi all,
 
   I'm using this code to display the current time for our location on  
 our website:
 
 ?php
   date_default_timezone_set('America/Los_Angeles');
  $theTimeIs = getdate(time());
  $theHour = $theTimeIs['hours'];
  $theMinute = $theTimeIs['minutes'];  // make minutes  
 under 10 show two digits
  $theSecond = $theTimeIs['seconds'];
  if($theHour  12){
  $theHour = $theHour - 12;
  $dn = PM;
  } else {
  $dn = AM;
  }
 
 echo $theHour:$theMinute:$theSecond $dn;
 ?
 
   It works great except for one small detail.  If the time is 3:04:02,  
 it is displayed as 3:4:2 which, of course, is very odd looking.  So I  
 corrected it as follows:
 
 ?php
   date_default_timezone_set('America/Los_Angeles');
  $theTimeIs = getdate(time());
  $theHour = $theTimeIs['hours'];
  if (strlen ($theTimeIs['minutes'])  2) {
   $theMinute = 0 . $theTimeIs['minutes'];
   } else {
   $theMinute = $theTimeIs['minutes'];
   }
  if (strlen ($theTimeIs['seconds'])  2) {
   $theSecond = 0 . $theTimeIs['seconds'];
   } else {
   $theSecond = $theTimeIs['seconds'];
   }
  if($theHour  12){
  $theHour = $theHour - 12;
  $dn = PM;
  } else {
  $dn = AM;
  }
 
 echo $theHour:$theMinute:$theSecond $dn;
 ?
 
   It works, but is there a better way to do it?
 
 Thanks,
 Frank
 

What's wrong with using the date() function? You can have it output any
sort of format you wish. So, getting a 2 digit time in
hours:minutes:seconds you would put:

date(H:i:s);

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re: [PHP] Displaying 2 digit minutes/seconds

2009-08-20 Thread sono-io


On Aug 20, 2009, at 2:38 PM, Ashley Sheridan wrote:

What's wrong with using the date() function? You can have it output  
any

sort of format you wish. So, getting a 2 digit time in
hours:minutes:seconds you would put:

date(H:i:s);


	Thanks, Ash.  I had tried that before but I couldn't find a way to  
make it display in 12 hour time, so I went with the other method.  I  
guess I didn't look hard enough. =;)


This works:

echo (date(g:i A));

Frank

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



Re: [PHP] Displaying 2 digit minutes/seconds

2009-08-20 Thread sono-io


On Aug 20, 2009, at 2:34 PM, Jonathan Tapicer wrote:

You can use sprintf or str_pad to fill in with zeros, with sprintf  
you can do this:


echo sprintf('%02d', 5);


	Thanks, Jonathan!  I learned two new functions today!  Both work  
great but I think I like sprintf for this application better since  
it's more succinct.


echo sprintf('%02d', $theMinute);

echo (str_pad($theMinute,2,0,STR_PAD_LEFT));

Frank

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



[PHP] Submit login form using HTTP AUTH

2009-08-20 Thread LinuxManMikeC
Anybody know of any tricks to make an HTML login form that sends the
credentials via HTTP AUTH?

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



RE: [PHP] Displaying 2 digit minutes/seconds

2009-08-20 Thread Daevid Vincent
 

 -Original Message-
 From: sono...@fannullone.us [mailto:sono...@fannullone.us] 
 Sent: Thursday, August 20, 2009 3:53 PM
 To: Jonathan Tapicer; PHP General List
 Subject: Re: [PHP] Displaying 2 digit minutes/seconds
 
 
 On Aug 20, 2009, at 2:34 PM, Jonathan Tapicer wrote:
 
  You can use sprintf or str_pad to fill in with zeros, with sprintf  
  you can do this:
 
  echo sprintf('%02d', 5);
 
   Thanks, Jonathan!  I learned two new functions today!  
 Both work  
 great but I think I like sprintf for this application better since  
 it's more succinct.
 
 echo sprintf('%02d', $theMinute);

Uh. If you MUST do this nonsense, then at least do this instead and not
echo sprintf:

printf('%02d', $theMinute);


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



[PHP] Tidy on a shared host

2009-08-20 Thread Al
I've written an application that depends heavily on Tidy for cleaning up user 
inputed text.


Unfortunately, some shared hosts won't install the extension for my clients.

Is there a way I can install a stand alone version using FTP with access only in 
a directory where my program resides.  The hosts have given me restricted FTP to 
the dir.


Or, does anyone know of a stand-alone php class that emulates the tidy 
extension. I've looked; but, not found any.


Al..



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



Re: [PHP] PHP/Ajax Framework - Call for Developers Testers

2009-08-20 Thread Raymond Irving
Hi Nathan,

I agree with you, and I believe that there are many persons who don't like the 
idea of hosting all their applications on a third party server. IMO there are 
some advantages and disadvantages to doing so but that's a discussion in itself.

The good thing about Raxan's Embeddable Apps is that you have control over the 
source code.  With the ShoutBox example you can download the framwork along 
with the application and copy it to your own servers. No need to host the apps 
on third party servers.

Some benefits of Raxan Embeddable Apps:

1. Works in just about any web page 
2. Easy to deploy and configure
3. Reusable and Shareable

I believe that one day we will see apps like Photo Galleries, Media players, 
File Managers, Catalogs, etc that users can easily download and add to the 
their web pages.

PS. I would like to invite everyone to download the framework, try the examples 
and take a look at the source code. You will be amaze at what you can do with 
Raxan PDI. - You can download it here: 
http://code.google.com/p/raxan/downloads/detail?name=raxan-pdi.1.0.0b2.zipcan=2q=


Best regards
__
Raymond Irving



--- On Thu, 8/20/09, Nathan Nobbe quickshif...@gmail.com wrote:

From: Nathan Nobbe quickshif...@gmail.com
Subject: Re: [PHP] PHP/Ajax Framework - Call for Developers  Testers
To: Raymond Irving xwis...@yahoo.com
Cc: php-general@lists.php.net
Date: Thursday, August 20, 2009, 1:31 PM

ive seen lots of third parties selling components in this manor.  now that ajax 
has hit the scene there are some really weird things going on.

i was just on a call yesterday where this company told us about their service, 
which is delivered as one of these 'embedded' applications.  this thing would 
have its own navigation and display of content on our site in order to keep 
folks clicking.

if you ask me, that just feels weird; having some other company like own a 
piece of your app...  however, it would be foolish not to admit that this is 
the way things are trending and that there will only be more of it to come.

-nathan


[PHP] Is there limitation for switch case: argument's value?

2009-08-20 Thread Keith

Hi,
I encounter a funny limitation here with switch case as below:
The value for $sum is worked as expected for 1 to 8, but not for 0.
When the $sum=0, the first case will be return, which is sum=8.
Is there any limitation / rules for switch case? Thanks for advice!

Keith

$sum=0; 
switch($sum)
{
   case ($sum==8):
   echo sum=8;
   break;
   case ($sum==7 || $sum==6):
   echo sum=7 or 6;
   break;
   case ($sum==2 || $sum==1):
   echo sum=2 or 1;
   break;
   case 0:
   echo sum=0;
   break;
   default:
   echo sum=3/4/5;
   break;   
} 


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