[PHP] Re: question about linux editor

2008-03-25 Thread Nilesh Govindrajan

Sudhakar wrote:

i need to connect to the linux server using an editor. can anyone suggest
which would be an ideal linux editor to connect to the server.
apart from the ip address, username and password are there any other details
i would need to connect to the server.

please advice.

thanks.



gedit

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



[PHP] Re: question about linux editor

2008-03-25 Thread Ross McKay
On Tue, 25 Mar 2008 11:28:07 +0900, Sudhakar wrote:

>i need to connect to the linux server using an editor. can anyone suggest
>which would be an ideal linux editor to connect to the server.

Geany - http://geany.uvena.de/

Also look at:

Quanta Plus - http://quanta.kdewebdev.org/
Bluefish - http://bluefish.openoffice.nl/
Zend Studio (not free) - http://www.zend.com/en/products/studio/

>apart from the ip address, username and password are there any other details
>i would need to connect to the server.

How are you proposing to connect? e.g.

* FTP down the files, edit them, FTP them up again
* mount the remote server via NFS
* mount the remote server locally via SFTP
* run the editor remotely: ssh -Y [EMAIL PROTECTED] 

etc.

A conventional way would be to have a development environment locally,
into which you transfer the files from the Linux server, edit them,
TEST! them, and transfer back the changes (e.g. via FTP).
--
Ross McKay, Toronto, NSW Australia
"Let the laddie play wi the knife - he'll learn"
- The Wee Book of Calvin

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



[PHP] mysql joins

2008-03-25 Thread Steven Macintyre
 I have three tables, namely;

User 
- UID 
- Firstname
- Surname
- Tel
- Cell
- Email

Tracker 
- UID
- Points

Winners
- UID
- Datetime (-00-00 00:00:00)

I need to get the following information from the above tables (in my logical 
sense)

All users from user with sum(points) as points and datetime > datetime + 14 days

In English, the all users must be selected, excluding the ones that have won in 
the last 14 days and return all the information and the sum of points

I suspect I would need to use joins here ... but have no clue how to do so ... 
I have read up a bit and can work out inner joins from three tables, but not 
coping with this problem above

Can someone help me out with this please?

Many thanks 

Steven



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



Re: [PHP] mysql joins

2008-03-25 Thread Andrew Ballard
On Tue, Mar 25, 2008 at 8:20 AM, Steven Macintyre
<[EMAIL PROTECTED]> wrote:
>  I have three tables, namely;
>
>  User
>  - UID
>  - Firstname
>  - Surname
>  - Tel
>  - Cell
>  - Email
>
>  Tracker
>  - UID
>  - Points
>
>  Winners
>  - UID
>  - Datetime (-00-00 00:00:00)
>
>  I need to get the following information from the above tables (in my logical 
> sense)
>
>  All users from user with sum(points) as points and datetime > datetime + 14 
> days
>
>  In English, the all users must be selected, excluding the ones that have won 
> in the last 14 days and return all the information and the sum of points
>
>  I suspect I would need to use joins here ... but have no clue how to do so 
> ... I have read up a bit and can work out inner joins from three tables, but 
> not coping with this problem above
>
>  Can someone help me out with this please?
>
>  Many thanks
>
>  Steven

See what mileage this gets you.

SELECT   User.UID, FirstName, Surname, Tel, Cell, Email, SUM(Points)
AS TotalPoints
FROM User INNER JOIN
 Tracker
 ON  User.UID = Tracker.UID
 LEFT OUTER JOIN
 Winners
 ON  User.UID = Winners.UID
WHERE`Datetime` < DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL -14 DAY)
   OR`Datetime` IS NULL
GROUP BY User.UID, FirstName, Surname, Tel, Cell, Email


The OUTER JOIN and the last line (OR `Datetime` IS NULL) is there so
that your query will include results for users who have never won. I
don't think it this is optimized (or how you could do so if needed)
since the IS NULL condition will probably make the query use a table
scan rather than an index.

Andrew

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



RES: [PHP] mysql joins

2008-03-25 Thread Thiago Pojda
not sure how timestamps work in MySQL, but I've written this in Oracle:

CREATE TABLE USaR (
  UsID char(255) null,
  Firstname char(255) NULL,
  Surname char(255) NULL,
  Tel char(255) NULL,
  Cell char(255) NULL,
  Email char(255) NULL
)
/
CREATE TABLE Tracker(
  UsID  CHAR(255) NULL,
  Points CHAR(255) NULL
)
/
CREATE TABLE Winners(
  UsiD CHAR(255) NULL,
  DateTime DATE NULL
)
/

/* Inserted some values in those tables and then executed: */ 

select
  us.usid, --I couldn't get the Firstname as it's not a group by element (?)
  Sum(tr.points) 
from
  usar us, --in mysql you'll have to do 'usar as us'
  tracker tr, --tracker as tr
  winners wn --winners as wn
where
us.usid = tr.usid --here is the join magic
and us.usid = wn.usid --and here
AND wn.datetime < (SYSDATE - 14) --winner date has to be less than 14 days
from today
GROUP BY us.usid  --separate per user;


I hope this helps :)

This will *NOT* bring you users that never won or have no points (since they
don't have any record in winners table)

Regards,
Thiago

-Mensagem original-
De: Steven Macintyre [mailto:[EMAIL PROTECTED] 
Enviada em: terça-feira, 25 de março de 2008 09:21
Para: php-general@lists.php.net
Assunto: [PHP] mysql joins

 I have three tables, namely;

User
- UID
- Firstname
- Surname
- Tel
- Cell
- Email

Tracker
- UID
- Points

Winners
- UID
- Datetime (-00-00 00:00:00)

I need to get the following information from the above tables 
(in my logical sense)

All users from user with sum(points) as points and datetime > 
datetime + 14 days

In English, the all users must be selected, excluding the ones 
that have won in the last 14 days and return all the 
information and the sum of points

I suspect I would need to use joins here ... but have no clue 
how to do so ... I have read up a bit and can work out inner 
joins from three tables, but not coping with this problem above

Can someone help me out with this please?

Many thanks 

Steven



--
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] question about linux editor

2008-03-25 Thread Daniel Brown
On Mon, Mar 24, 2008 at 10:28 PM, Sudhakar <[EMAIL PROTECTED]> wrote:
> i need to connect to the linux server using an editor. can anyone suggest
>  which would be an ideal linux editor to connect to the server.
>  apart from the ip address, username and password are there any other details
>  i would need to connect to the server.

An editor would be what you would use once you're already
connected to the server (or once you've synchronized files with your
local machine).

I'm a command-line junkie, and a full-time Linux user (with the
exception of my PDA and half of my laptop).  So I SSH into the remote
server and use 'vi' to edit the files.  From the command line on an
SSH connection, some of the editors you'll have available to you in
almost all cases are vi/vim, pico/nano, and ed, among others.

-- 

Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

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



Re: [PHP] Date math

2008-03-25 Thread Ron Piggott

Could someone then help me modify the PHP script so I won't have this
timezone issue?  I don't understand from looking at the date page on the
PHP web site the change(s) I need to make.  Thanks, Ron

 Ron Piggott wrote:
> > I have this math equation this list helped me generate a few weeks ago.
> > The purpose is to calculate how many days have passed between 2 dates.  
> > 
> > Right now my output ($difference) is 93.958333 days.  
> > 
> > I am finding this a little weird.  Does anyone see anything wrong with
> > the way this is calculated:
> > 
> > $date1 = strtotime($date1); (March 21st 2008)
> > $date2 = strtotime($date2); (December 18th 2007)
> > 
> > echo $date1 => 1206072000
> > echo $date2 => 1197954000
> > 
> > #86400 is 60 seconds x 60 minutes x 24 hours (in other words 1 days
> > worth of seconds)
> > 
> > $factor = 86400;
> > 
> > $difference = (($date1 - $date2) / $factor);
> > 
> > 
> > 
> 
> As Casey suggested, it is a timestamp issue.
> 
> Checkout my test script.
> 
> http://www.cmsws.com/examples/php/testscripts/[EMAIL PROTECTED]/0001.php
> 
>  
> $date1 = strtotime('March 21st 2008'); //(March 21st 2008)
> echo "date1 = {$date1}\n";
> 
> $date2 = strtotime('December 18th 2007'); //(December 18th 2007)
> echo "date2 = {$date2}\n";
> 
> $date1 = 1206072000;
> echo date('c', $date1)."\n";
> 
> $date2 = 1197954000;
> 
> echo date('c', $date2)."\n";
> 
> 
> #86400 is 60 seconds x 60 minutes x 24 hours (in other words 1 days worth of 
> seconds)
> 
> $factor = 86400;
> 
> $difference = (($date1 - $date2) / $factor);
> 
> echo $difference."\n";
> 


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



RE: [PHP] question about linux editor

2008-03-25 Thread Jay Blanchard
[snip]
> i need to connect to the linux server using an editor. can anyone
suggest
[/snip]

I use Putty to connect and then call all sorts of command line editors.
I may have Putty windows open to many servers at once.

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



Re: [PHP] Why won't this query work?

2008-03-25 Thread Zoltán Németh
2008. 03. 24, hétfő keltezéssel 14.40-kor Daniel Brown ezt írta:
> On Mon, Mar 24, 2008 at 2:29 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
> >
> >  It's already been escaped, $business is pulled out of the database
> >  after they log in. :)
> 
> I don't care, Prune.
> 
> (I still get a kick out of knowing that.  Who was it, Jochem or
> Zoltan who said that?  ;-P)

/me points at Jochem ;)

greets
Zoltán Németh

> 
> NEVER trust that the data is escaped regardless of where it
> originated.  Supposed someone else writes a script to tie into your
> database and doesn't escape it, and Hagar The Horrible's
> great-great(^15) grandson, Hacker The Horndog comes in and finds the
> vulnerability, and enters the company name as "';DELETE FROM current
> WHERE 1;SELECT * FROM current WHERE 1 "?
> 
> Bye, data.
> 
> Learn: http://xkcd.com/327/
> 
> -- 
> 
> Forensic Services, Senior Unix Engineer
> 1+ (570-) 362-0283
> 


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



Re: [PHP] Manipulating PDF

2008-03-25 Thread Zoltán Németh
2008. 03. 23, vasárnap keltezéssel 11.57-kor tedd ezt írta:
> At 4:36 PM +0100 3/23/08, Aschwin Wesselius wrote:
> >Again, I'm not after PHPLib or FPDF, since these libraries are 
> >either old or insufficient for what I want.
> 
> Hey, don't discount old things. :-)
> 
> I can do just about anything I want with those old files.
> 
> http://webbytedd.com/bb/pdf/
> 

where's the source for that?

greets,
Zoltán Németh

> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 


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



Re: [PHP] Date math

2008-03-25 Thread Casey

(top-posting!)

Add either the round function or ceil function.

On Mar 25, 2008, at 6:47 AM, Ron Piggott <[EMAIL PROTECTED]>  
wrote:




Could someone then help me modify the PHP script so I won't have this
timezone issue?  I don't understand from looking at the date page on  
the

PHP web site the change(s) I need to make.  Thanks, Ron


Ron Piggott wrote:
I have this math equation this list helped me generate a few weeks  
ago.
The purpose is to calculate how many days have passed between 2  
dates.


Right now my output ($difference) is 93.958333 days.

I am finding this a little weird.  Does anyone see anything wrong  
with

the way this is calculated:

$date1 = strtotime($date1); (March 21st 2008)
$date2 = strtotime($date2); (December 18th 2007)

echo $date1 => 1206072000
echo $date2 => 1197954000

#86400 is 60 seconds x 60 minutes x 24 hours (in other words 1 days
worth of seconds)

$factor = 86400;

$difference = (($date1 - $date2) / $factor);





As Casey suggested, it is a timestamp issue.

Checkout my test script.

http://www.cmsws.com/examples/php/testscripts/[EMAIL PROTECTED]/0001.php

#86400 is 60 seconds x 60 minutes x 24 hours (in other words 1 days  
worth of

seconds)

$factor = 86400;

$difference = (($date1 - $date2) / $factor);

echo $difference."\n";




--
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] question about linux editor

2008-03-25 Thread Wolf

 Sudhakar <[EMAIL PROTECTED]> wrote: 
> i need to connect to the linux server using an editor. can anyone suggest
> which would be an ideal linux editor to connect to the server.
> apart from the ip address, username and password are there any other details
> i would need to connect to the server.
> 
> please advice.
> 
> thanks.

ssh and putty, depending on what OS you are going to start the connection from.

I personally use vi after connection, though others I know use nano.

But then, this is a PHP list  

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



[PHP] tidy configuration disabled still html is generated

2008-03-25 Thread Nilesh Govindrajan

I have tried everything.

setting tidy.clean_output = Off or 0 in php.ini OR using ini_set

but still tidy makes a plaintext file html.

help.

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



Re: [PHP] mysql joins

2008-03-25 Thread Wolf

 Steven Macintyre <[EMAIL PROTECTED]> wrote: 
>  I have three tables, namely;
> 
> User 
> - UID 
> - Firstname
> - Surname
> - Tel
> - Cell
> - Email
> 
> Tracker 
> - UID
> - Points
> 
> Winners
> - UID
> - Datetime (-00-00 00:00:00)
> 
> I need to get the following information from the above tables (in my logical 
> sense)
> 
> All users from user with sum(points) as points and datetime > datetime + 14 
> days
> 
> In English, the all users must be selected, excluding the ones that have won 
> in the last 14 days and return all the information and the sum of points
> 
> I suspect I would need to use joins here ... but have no clue how to do so 
> ... I have read up a bit and can work out inner joins from three tables, but 
> not coping with this problem above
> 
> Can someone help me out with this please?
> 
> Many thanks 
> 
> Steven

What PHP code have you written so far?

I personally would do a query on one table then use the results to grab the 
information from the other table.  Some use joins, but I haven't seen a ton of 
time loss between the multi-short calls versus a join..

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



[PHP] tidy configuration disabled still html is generated

2008-03-25 Thread Nilesh Govindrajan

Nilesh Govindrajan wrote:

I have tried everything.

setting tidy.clean_output = Off or 0 in php.ini OR using ini_set

but still tidy makes a plaintext file html.

help.


I am sorry. :) It was a silly problem. FIXED. :)

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



Re: [PHP] tidy configuration disabled still html is generated

2008-03-25 Thread Wolf

 Nilesh Govindrajan <[EMAIL PROTECTED]> wrote: 
> I have tried everything.
> 
> setting tidy.clean_output = Off or 0 in php.ini OR using ini_set
> 
> but still tidy makes a plaintext file html.
> 
> help.

Contact the creators of Tidy

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



Re: [PHP] tidy configuration disabled still html is generated

2008-03-25 Thread Nilesh Govindrajan

Wolf wrote:
 Nilesh Govindrajan <[EMAIL PROTECTED]> wrote: 
  

I have tried everything.

setting tidy.clean_output = Off or 0 in php.ini OR using ini_set

but still tidy makes a plaintext file html.

help.



Contact the creators of Tidy
  
I told na it was a silly problem. didn't you get it ? the fault was 
found and fixed. it was a hard-link of php.ini in the scan-dir.


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



Re: [PHP] tidy configuration disabled still html is generated

2008-03-25 Thread Wolf

 Nilesh Govindrajan <[EMAIL PROTECTED]> wrote: 
> Wolf wrote:
> >  Nilesh Govindrajan <[EMAIL PROTECTED]> wrote: 
> >   
> >> I have tried everything.
> >>
> >> setting tidy.clean_output = Off or 0 in php.ini OR using ini_set
> >>
> >> but still tidy makes a plaintext file html.
> >>
> >> help.
> >> 
> >
> > Contact the creators of Tidy
> >   
> I told na it was a silly problem. didn't you get it ? the fault was 
> found and fixed. it was a hard-link of php.ini in the scan-dir.
> 

It came through slower...  Typically though a specific package you should be 
checking the specific packages FAQ and user forums, though there are some on 
here who might have the specific package and have it played with as well.



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



Re: [PHP] Beware of round() function

2008-03-25 Thread Kirk . Johnson
Thanks for the info, Jeremy. Regardless of the technical details, my code 
still broke. I am little discouraged that an operation that should be so 
simple has these sorts of gotchas.

BTW, I ended up casting to int as my solution.

Kirk

Jeremy Privett <[EMAIL PROTECTED]> wrote on 03/24/2008 02:04:48 PM:

> Jeremy Privett wrote:
> > [EMAIL PROTECTED] wrote:
> >> Beware: round() apparently has changed its behavior from PHP 4.
> > 
> > This is actually a change in the behavior of the float type, not the 
> > round function. Replace your round() with a cast to float and you'll 
> > see the exact same result.
> >
> 
> Also, as a side-note, the only way I've found to get these numbers to 
> print properly is through either printf or sprintf. Also, you could cast 

> back to an integer, if you explicitly don't need floats.

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



Re: [PHP] question about linux editor

2008-03-25 Thread Ray Hauge

Sudhakar wrote:

i need to connect to the linux server using an editor. can anyone suggest
which would be an ideal linux editor to connect to the server.
apart from the ip address, username and password are there any other details
i would need to connect to the server.

please advice.

thanks.



I also will typically use SSH + vi, but Zend Studio (not sure about 
Eclipse) can open an SSH connection and edit files that way.


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] losing session in new window (IE only) [WAS: loosing...]

2008-03-25 Thread Paul Novitski

At 3/25/2008 12:49 PM, Lamp Lists wrote:
i have a list of people on one page. each row, on the end has link 
view details.

it's requested to open detail page in new window.
very few people complained they can't open detail page. all of them use IE.


Try putting the attribute values in double quotes and see if that helps:

view details

How does your page validate?  http://validator.w3.org/

Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 



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



Re: [PHP] losing session in new window (IE only) [WAS: loosing...]

2008-03-25 Thread Lamp Lists
- Original Message 
From: Paul Novitski <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Sent: Tuesday, March 25, 2008 3:05:43 PM
Subject: Re: [PHP] losing session in new window (IE only) [WAS:  loosing...]

At 3/25/2008 12:49 PM, Lamp Lists wrote:
>i have a list of people on one page. each row, on the end has link 
>view details.
>it's requested to open detail page in new window.
>very few people complained they can't open detail page. all of them use IE.

Try putting the attribute values in double quotes and see if that helps:

 view details

How does your page validate?  http://validator.w3.org/

Regards,

Paul


hi paul,
nope. quotes are not an issue.
I'm going to validate the page - I'll post results.

-ll







  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

[PHP] loosing session in new window (IE only)

2008-03-25 Thread Lamp Lists
hi,
i have a list of people on one page. each row, on the end has link view details.
it's requested to open detail page in new window.
very few people complained they can't open detail page. all of them use IE.
I wasn't able to reproduce the error, though using GoToMeeting I was able to 
look while customer was doing it.
I put session info on screen to see what's going on and found that new window 
doesn't have session info from "old" window?!? like, new window - new session.

does anybody knows anything about this?

thanks.

-ll




  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

Re: [PHP] loosing session in new window (IE only)

2008-03-25 Thread Andrew Ballard
On Tue, Mar 25, 2008 at 3:49 PM, Lamp Lists <[EMAIL PROTECTED]> wrote:
> hi,
>  i have a list of people on one page. each row, on the end has link  href=person.php?id=123 target=_blank>view details.
>  it's requested to open detail page in new window.
>  very few people complained they can't open detail page. all of them use IE.
>  I wasn't able to reproduce the error, though using GoToMeeting I was able to 
> look while customer was doing it.
>  I put session info on screen to see what's going on and found that new 
> window doesn't have session info from "old" window?!? like, new window - new 
> session.
>
>  does anybody knows anything about this?
>
>  thanks.
>
>  -ll

If they open a new window by clicking on IE (say, on the desktop, the
QuickLaunch bar, or the Start menu), Windows actually opens a new,
totally separate process of IE along side the first. The new one will
share any persistent cookies with the first, since they are written to
the file system, but sessions do not usually use persistent cookies.
As long as your users are opening the new window by clicking a link or
by pressing  Ctrl+N from the first window, the session information
*should* remain in tact.

Andrew

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



Re: [PHP] loosing session in new window (IE only)

2008-03-25 Thread Lamp Lists
- Original Message 
From: Andrew Ballard <[EMAIL PROTECTED]>
To: PHP General list 
Sent: Tuesday, March 25, 2008 3:41:35 PM
Subject: Re: [PHP] loosing session in new window (IE only)

On Tue, Mar 25, 2008 at 3:49 PM, Lamp Lists <[EMAIL PROTECTED]> wrote:
> hi,
>  i have a list of people on one page. each row, on the end has link  href=person.php?id=123 target=_blank>view details.
>  it's requested to open detail page in new window.
>  very few people complained they can't open detail page. all of them use IE.
>  I wasn't able to reproduce the error, though using GoToMeeting I was able to 
> look while customer was doing it.
>  I put session info on screen to see what's going on and found that new 
> window doesn't have session info from "old" window?!? like, new window - new 
> session.
>
>  does anybody knows anything about this?
>
>  thanks.
>
>  -ll

If they open a new window by clicking on IE (say, on the desktop, the
QuickLaunch bar, or the Start menu), Windows actually opens a new,
totally separate process of IE along side the first. The new one will
share any persistent cookies with the first, since they are written to
the file system, but sessions do not usually use persistent cookies.
As long as your users are opening the new window by clicking a link or
by pressing  Ctrl+N from the first window, the session information
*should* remain in tact.

Andrew

should - but don't :D
you're right and  I understand opening new window from "desktop" starts new 
process, but this is happening after visitor hits the link "detail view" and 
that is confusing :(







  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

[PHP] testing

2008-03-25 Thread PHP General Users Mailing List
testing






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



Re: [PHP] testing

2008-03-25 Thread Mark Weaver

PHP General Users Mailing List wrote:

testing


so I wasn't imagining things then?

--

Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)

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



[PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Mark Weaver

Hi all,

I suspect I already know part of the answer to this, but I'm not sure 
which way to go with it. I've got a project I'm working on and one of 
the things it's got to do is set cookies and then read them later. When 
the app was first written I was doing everything in PERL and cookies are 
fairly straight-forward, however I'm finding cookies in PHP somewhat 
problematic.


Setting the cookie is a snap, however getting the info back out is, 
well... problematic.


this is basically what I'm doing, what I'm seeing in the cookie, and 
what I'm getting back out.


Setting the cookie
==
$values = "blah|blah|blah";
setcookie("cookiename", $values, time()+$timevalue);


Inside the Cookie
==
Content: blah%7Cblah%7Cblah


Getting info Out Of Cookie
==
list($first,$second,$third) = explode("|", $values);


Cookie Test Page
==
if (isset($_COOKIE["cookiename"])){
list($first,$second,$third) = explode('|',$_COOKIE["cookiename"]);
echo "I found your cookie\n";
echo "The following Values were Contained in the cookie:
  Username: $first
  Password: $second
  Type: $third\n";
}
else{
echo "I wasn't able to find your cookie.\n";
}

Now, I've constructed a cookie_test.php page to check things out and the 
strange behavior I'm seeing is, upon first execution I get the "else" 
block, but if I hit the browser's reload button I get the "if" block. At 
first I thought the cookie wasn't being read at all because of weird 
characters, but then upon reloading the page and seeing the "if" block 
being displayed I'm thoroughly confused. It's gotta something simple I'm 
missing.


and I swear if someone tells me to RTFM I'm gonna shit and go blind 
cause I haven't got a clue as to "which" part of the FM to read 
concerning this. :)


thanks,

--
Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)

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



[PHP] session var not changed if file not found error

2008-03-25 Thread Eric Wood

This has baffled me all day on my FC6 php-5.1.6 based server.

On a normal working page, I set a session variable at the top and 
another session variable in the middle of the page/script.  This page 
has no errors nor missing links.  So everything works great. 

Now, if I cause at least 1 image in the page to become missing on the 
server (ie, by deleting a .jpg file), then Apache logs the error as 
usual, ie: "File does not exist".  But in addition, my two session 
variables seem to get deleted.  If I put the picture(s) back, then no 
apache errors, and my session vars are set fine.  


I've even enabled detailed php error reporting and I get no errors.

Is this normal session behavior?  Please say no.  Any ideas?  I can't 
understand why missing links would cause a session variable's annihilation.


-eric wood





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



Re: [PHP] session var not changed if file not found error

2008-03-25 Thread Daniel Brown
On Tue, Mar 25, 2008 at 9:29 PM, Eric Wood <[EMAIL PROTECTED]> wrote:
> This has baffled me all day on my FC6 php-5.1.6 based server.
>
>  On a normal working page, I set a session variable at the top and
>  another session variable in the middle of the page/script.  This page
>  has no errors nor missing links.  So everything works great.
>
>  Now, if I cause at least 1 image in the page to become missing on the
>  server (ie, by deleting a .jpg file), then Apache logs the error as
>  usual, ie: "File does not exist".  But in addition, my two session
>  variables seem to get deleted.  If I put the picture(s) back, then no
>  apache errors, and my session vars are set fine.
>
>  I've even enabled detailed php error reporting and I get no errors.
>
>  Is this normal session behavior?  Please say no.  Any ideas?  I can't
>  understand why missing links would cause a session variable's annihilation.

It's by no means normal behavior, but that doesn't mean that
what's happening for you isn't expected.  Are you clicking a link to
the image and getting the 404 error?  If that's the case, it could be
that your session is dying or expiring when you leave the sanctity of
the page.

Also, check and see what is included in the 404 response.  Is it a
custom page?  Right-click the missing image and click "view image" to
view the configured 404 response.  There may be a page that is
instantiating its own session, destroying all sessions, or doing
something else that you really don't like.

-- 

Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

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



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Andrew Ballard
On Tue, Mar 25, 2008 at 9:31 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Tue, Mar 25, 2008 at 9:11 PM, Mark Weaver <[EMAIL PROTECTED]> wrote:
>  > Hi all,
>  [snip!]
>
> >
>  >  Cookie Test Page
>  >  ==
>  >  if (isset($_COOKIE["cookiename"])){
>  > list($first,$second,$third) = explode('|',$_COOKIE["cookiename"]);
>  > echo "I found your cookie\n";
>  > echo "The following Values were Contained in the cookie:
>  >   Username: $first
>  >   Password: $second
>  >   Type: $third\n";
>  >  }
>  >  else{
>  > echo "I wasn't able to find your cookie.\n";
>  >  }
>  >
>  >  Now, I've constructed a cookie_test.php page to check things out and the
>  >  strange behavior I'm seeing is, upon first execution I get the "else"
>  >  block, but if I hit the browser's reload button I get the "if" block. At
>  >  first I thought the cookie wasn't being read at all because of weird
>  >  characters, but then upon reloading the page and seeing the "if" block
>  >  being displayed I'm thoroughly confused. It's gotta something simple I'm
>  >  missing.
>
> Is this block of code executed immediately after the cookie is
>  set?  Sometimes PHP works too fast for its own good and the client
>  doesn't even realize it has a cookie yet.  Try setting it with one
>  page and either sleep()'ing for a bit or forcing a link-click or page
>  refresh before checking for the cookie.
>

Um... Cookie data ISN'T available to the same script that sets it. If
you use setcookie(), all it does is send a header to the browser
immediately ahead of the output of your script telling the browser to
store those values in either memory or on disk. The value will not
appear in the $_COOKIE array until the browser requests the next page
and includes the Cookie: header as part of the request.

The part of the manual that applies is this line:

"Once the cookies have been set, they can be accessed on the next page
load with the $_COOKIE or $HTTP_COOKIE_VARS arrays."

$_SESSION variables are available immediately as soon as you set them.
The session cookie still isn't set on the client until the browser
processes the response headers at the end of the transaction, but the
values are already in the array and, if the session cookie works they
will be accessible on successive requests.

Andrew

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



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Casey

On Mar 25, 2008, at 6:11 PM, Mark Weaver <[EMAIL PROTECTED]> wrote:


Hi all,

I suspect I already know part of the answer to this, but I'm not  
sure which way to go with it. I've got a project I'm working on and  
one of the things it's got to do is set cookies and then read them  
later. When the app was first written I was doing everything in PERL  
and cookies are fairly straight-forward, however I'm finding cookies  
in PHP somewhat problematic.


Setting the cookie is a snap, however getting the info back out is,  
well... problematic.


this is basically what I'm doing, what I'm seeing in the cookie, and  
what I'm getting back out.


Setting the cookie
==
$values = "blah|blah|blah";
setcookie("cookiename", $values, time()+$timevalue);


Inside the Cookie
==
Content: blah%7Cblah%7Cblah


Getting info Out Of Cookie
==
list($first,$second,$third) = explode("|", $values);


Cookie Test Page
==
if (isset($_COOKIE["cookiename"])){
   list($first,$second,$third) = explode('|',$_COOKIE["cookiename"]);
   echo "I found your cookie\n";
   echo "The following Values were Contained in the cookie:
 Username: $first
 Password: $second
 Type: $third\n";
}
else{
   echo "I wasn't able to find your cookie.\n";
}

Now, I've constructed a cookie_test.php page to check things out and  
the strange behavior I'm seeing is, upon first execution I get the  
"else" block, but if I hit the browser's reload button I get the  
"if" block. At first I thought the cookie wasn't being read at all  
because of weird characters, but then upon reloading the page and  
seeing the "if" block being displayed I'm thoroughly confused. It's  
gotta something simple I'm missing.


and I swear if someone tells me to RTFM I'm gonna shit and go blind  
cause I haven't got a clue as to "which" part of the FM to read  
concerning this. :)


thanks,

--
Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)

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



Did you forget the  tags?

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



Re: [PHP] session var not changed if file not found error

2008-03-25 Thread Eric Wood

Daniel Brown wrote:


Also, check and see what is included in the 404 response.  Is it a
custom page?  Right-click the missing image and click "view image" to
view the configured 404 response.  There may be a page that is
instantiating its own session, destroying all sessions, or doing
something else that you really don't like.

  


Thanks Daniel.  I believe you have something.  I have a custom 404 error 
page which starts the same session which is already in progress to show 
the current page.  Now these 404 instances also do session updates in 
the header (because I'm using a template layout, you know).  Therefor, 
the session file is obviously getting trampled on with these custom 
404s.Wow, I would not have figured that out anytime soon.  I just 
need to get less fancy with my 404 page, huh?


Thanks,
-eric wood

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



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Daniel Brown
On Tue, Mar 25, 2008 at 9:11 PM, Mark Weaver <[EMAIL PROTECTED]> wrote:
> Hi all,
[snip!]
>
>  Cookie Test Page
>  ==
>  if (isset($_COOKIE["cookiename"])){
> list($first,$second,$third) = explode('|',$_COOKIE["cookiename"]);
> echo "I found your cookie\n";
> echo "The following Values were Contained in the cookie:
>   Username: $first
>   Password: $second
>   Type: $third\n";
>  }
>  else{
> echo "I wasn't able to find your cookie.\n";
>  }
>
>  Now, I've constructed a cookie_test.php page to check things out and the
>  strange behavior I'm seeing is, upon first execution I get the "else"
>  block, but if I hit the browser's reload button I get the "if" block. At
>  first I thought the cookie wasn't being read at all because of weird
>  characters, but then upon reloading the page and seeing the "if" block
>  being displayed I'm thoroughly confused. It's gotta something simple I'm
>  missing.

Is this block of code executed immediately after the cookie is
set?  Sometimes PHP works too fast for its own good and the client
doesn't even realize it has a cookie yet.  Try setting it with one
page and either sleep()'ing for a bit or forcing a link-click or page
refresh before checking for the cookie.

Conversely, $_SESSION data is much quicker, since the PHPSESSID
cookie is sent as soon as you initialize the session
(session_start()), and you can then immediately access the variables.

Proof-of-concept:
\n";
?>

\n";
?>


-- 

Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

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



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Mark Weaver

Andrew Ballard wrote:

On Tue, Mar 25, 2008 at 9:31 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:

On Tue, Mar 25, 2008 at 9:11 PM, Mark Weaver <[EMAIL PROTECTED]> wrote:
 > Hi all,
 [snip!]

 >  Cookie Test Page
 >  ==
 >  if (isset($_COOKIE["cookiename"])){
 > list($first,$second,$third) = explode('|',$_COOKIE["cookiename"]);
 > echo "I found your cookie\n";
 > echo "The following Values were Contained in the cookie:
 >   Username: $first
 >   Password: $second
 >   Type: $third\n";
 >  }
 >  else{
 > echo "I wasn't able to find your cookie.\n";
 >  }
 >
 >  Now, I've constructed a cookie_test.php page to check things out and the
 >  strange behavior I'm seeing is, upon first execution I get the "else"
 >  block, but if I hit the browser's reload button I get the "if" block. At
 >  first I thought the cookie wasn't being read at all because of weird
 >  characters, but then upon reloading the page and seeing the "if" block
 >  being displayed I'm thoroughly confused. It's gotta something simple I'm
 >  missing.

Is this block of code executed immediately after the cookie is
 set?  Sometimes PHP works too fast for its own good and the client
 doesn't even realize it has a cookie yet.  Try setting it with one
 page and either sleep()'ing for a bit or forcing a link-click or page
 refresh before checking for the cookie.



Um... Cookie data ISN'T available to the same script that sets it. If
you use setcookie(), all it does is send a header to the browser
immediately ahead of the output of your script telling the browser to
store those values in either memory or on disk. The value will not
appear in the $_COOKIE array until the browser requests the next page
and includes the Cookie: header as part of the request.

The part of the manual that applies is this line:

"Once the cookies have been set, they can be accessed on the next page
load with the $_COOKIE or $HTTP_COOKIE_VARS arrays."

$_SESSION variables are available immediately as soon as you set them.
The session cookie still isn't set on the client until the browser
processes the response headers at the end of the transaction, but the
values are already in the array and, if the session cookie works they
will be accessible on successive requests.

Andrew



Thank you Andrew... Now it all makes perfect sense. Good grief! there's 
so much to learn. It seems that Java was easier. ;)


--

Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)

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



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Andrew Ballard
On Tue, Mar 25, 2008 at 9:59 PM, Mark Weaver <[EMAIL PROTECTED]> wrote:
>  Thank you Andrew... Now it all makes perfect sense. Good grief! there's
>  so much to learn. It seems that Java was easier. ;)

That's not specific to PHP. It's just how http works, so it's the same
for ASP, Perl, I suspect Java and most (if not all) other languages.
There might be a language that sets a cookie when you assign a value
to a special cookie variable, but I'm not familiar with any.

Andrew

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



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Casey
On Mar 25, 2008, at 7:12 PM, "Andrew Ballard" <[EMAIL PROTECTED]>  
wrote:


On Tue, Mar 25, 2008 at 9:59 PM, Mark Weaver <[EMAIL PROTECTED]>  
wrote:
Thank you Andrew... Now it all makes perfect sense. Good grief!  
there's

so much to learn. It seems that Java was easier. ;)


That's not specific to PHP. It's just how http works, so it's the same
for ASP, Perl, I suspect Java and most (if not all) other languages.
There might be a language that sets a cookie when you assign a value
to a special cookie variable, but I'm not familiar with any.

Andrew

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



JavaScript, but that's already on the client. 


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



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Mark Weaver

Andrew Ballard wrote:

On Tue, Mar 25, 2008 at 9:59 PM, Mark Weaver <[EMAIL PROTECTED]> wrote:

 Thank you Andrew... Now it all makes perfect sense. Good grief! there's
 so much to learn. It seems that Java was easier. ;)


That's not specific to PHP. It's just how http works, so it's the same
for ASP, Perl, I suspect Java and most (if not all) other languages.
There might be a language that sets a cookie when you assign a value
to a special cookie variable, but I'm not familiar with any.

Andrew



Unless I was doing something differently when I originally wrote this in 
PERL I don't recall having this issue. At that time I would set the 
cookie and then redirect (load the index with the full menu) if cookie 
existed.


Geez! now my $_SESSION isn't persisting to the next page when the screen 
refreshes. The only thing preventing me from gouging out my eyes right 
now is that I know I'll get this stuff. It's just a matter of time...


--

Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)

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



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Andrew Ballard
On Tue, Mar 25, 2008 at 10:19 PM, Casey <[EMAIL PROTECTED]> wrote:
> On Mar 25, 2008, at 7:12 PM, "Andrew Ballard" <[EMAIL PROTECTED]>
>  wrote:
>
>
>
>  > On Tue, Mar 25, 2008 at 9:59 PM, Mark Weaver <[EMAIL PROTECTED]>
>  > wrote:
>  >> Thank you Andrew... Now it all makes perfect sense. Good grief!
>  >> there's
>  >> so much to learn. It seems that Java was easier. ;)
>  >
>  > That's not specific to PHP. It's just how http works, so it's the same
>  > for ASP, Perl, I suspect Java and most (if not all) other languages.
>  > There might be a language that sets a cookie when you assign a value
>  > to a special cookie variable, but I'm not familiar with any.
>  >
>  > Andrew
>  >
>
>  JavaScript, but that's already on the client.

True, client-side JavaScript would do it. I'm pretty sure that
server-side still would not though.

Andrew

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



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Jim Lucas

Mark Weaver wrote:

Andrew Ballard wrote:

On Tue, Mar 25, 2008 at 9:59 PM, Mark Weaver <[EMAIL PROTECTED]> wrote:

 Thank you Andrew... Now it all makes perfect sense. Good grief! there's
 so much to learn. It seems that Java was easier. ;)


That's not specific to PHP. It's just how http works, so it's the same
for ASP, Perl, I suspect Java and most (if not all) other languages.
There might be a language that sets a cookie when you assign a value
to a special cookie variable, but I'm not familiar with any.

Andrew



Unless I was doing something differently when I originally wrote this in 
PERL I don't recall having this issue. At that time I would set the 
cookie and then redirect (load the index with the full menu) if cookie 
existed.


Geez! now my $_SESSION isn't persisting to the next page when the screen 
refreshes. The only thing preventing me from gouging out my eyes right 
now is that I know I'll get this stuff. It's just a matter of time...




The "problem" that you are encountering is because the $_COOKIE array is 
"populated" when the script is executed.  More then likely the other 
languages that you used, would allow you to set a cookie and then they 
would enter them into the "global" array for you, and not make you wait 
until the next page load.


You could accomplish this yourself by making a wrapper function for the 
setcookie() function and have your function set the data using 
setcookie() and having it enter the data directly into the $_COOKIE array.


Something like this should do the trick



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



Re: [PHP] Cookie Trouble: getting the information back out...

2008-03-25 Thread Mark Weaver

Jim Lucas wrote:

Mark Weaver wrote:

Andrew Ballard wrote:
On Tue, Mar 25, 2008 at 9:59 PM, Mark Weaver <[EMAIL PROTECTED]> 
wrote:
 Thank you Andrew... Now it all makes perfect sense. Good grief! 
there's

 so much to learn. It seems that Java was easier. ;)


That's not specific to PHP. It's just how http works, so it's the same
for ASP, Perl, I suspect Java and most (if not all) other languages.
There might be a language that sets a cookie when you assign a value
to a special cookie variable, but I'm not familiar with any.

Andrew



Unless I was doing something differently when I originally wrote this 
in PERL I don't recall having this issue. At that time I would set the 
cookie and then redirect (load the index with the full menu) if cookie 
existed.


Geez! now my $_SESSION isn't persisting to the next page when the 
screen refreshes. The only thing preventing me from gouging out my 
eyes right now is that I know I'll get this stuff. It's just a matter 
of time...




The "problem" that you are encountering is because the $_COOKIE array is 
"populated" when the script is executed.  More then likely the other 
languages that you used, would allow you to set a cookie and then they 
would enter them into the "global" array for you, and not make you wait 
until the next page load.


You could accomplish this yourself by making a wrapper function for the 
setcookie() function and have your function set the data using 
setcookie() and having it enter the data directly into the $_COOKIE array.


Something like this should do the trick




Wow! very sweet!!

Thank you Jim. I'm getting my brain good and wrinkled today.

--

Mark
-
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==
Powered by CentOS5 (RHEL5)

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