Re: [PHP] ftp_put() problem??

2007-05-24 Thread Tom Chubb

On 24/05/07, Al [EMAIL PROTECTED] wrote:


Can anyone help with this.  On a Linux/Apache server.

I want to simply copy a file with ftp_put() from one dir to another.

To make certain I'm pointing to the correct dirs, I'm using this:
print_r(ftp_nlist($conn_id, FTP_EP_DIR)); //It is the correct dir
print_r(ftp_nlist($conn_id, $rpdir));   //It is the correct dir

Then I'm:
ftp_put($conn_id, FTP_EP_DIR .'/' . $file, $rpdir. '/' . $file,
FTP_ASCII);

Error msg:
Warning: ftp_put(/home/x/public_html/test/EditPageIndexer.php) [
function.ftp-put]: failed to open stream: No such
file or directory in /home/x/public_html/EditPage/ep_functions.inc on
line 227

And the files are not copied.

Owner and permissions are correct.  I can make a new dir [mkdir()] in the
destination dir without a problem.

Manual is confusing when it calls the files remote and local.

Thanks

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



Are you using the correct syntax?
Make sure you are specifying the remote file first, then the local file.

ftp_put($conn_id, $remote_file, $file, FTP_ASCII)

--
Tom Chubb
[EMAIL PROTECTED]


Re: [PHP] Database error: Invalid SQL:

2007-05-24 Thread Christian Haensel
Usually you need to specify the type: inner join, left join, right join, 
straight join etc.




OTThat sounds like the good old times when we did air-to-air refueling :oP 
/OT


Sorry, had to :P


- Original Message - 
From: Chris [EMAIL PROTECTED]

To: wisuttorn [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Thursday, May 24, 2007 7:34 AM
Subject: Re: [PHP] Database error: Invalid SQL:



wisuttorn wrote:

I have a problem  please help me
when i loged in to egroup this show 
Database error: Invalid SQL: SELECT DISTINCT
egw_cal_repeats.*,egw_cal.*,cal_start,cal_end,cal_recur_date FROM egw_cal
JOIN egw_cal_dates ON egw_cal.cal_id=egw_cal_dates.cal_id JOIN 
egw_cal_user

ON egw_cal.cal_id=egw_cal_user.cal_id LEFT JOIN egw_cal_repeats ON
egw_cal.cal_id=egw_cal_repeats.cal_id WHERE (cal_user_type='u' AND
cal_user_id IN (6,-1)) AND cal_status != 'R' AND 1179939600  cal_end AND
cal_start  1180025999 AND (recur_type IS NULL AND cal_recur_date=0 OR
cal_recur_date=cal_start) ORDER BY cal_start
mysql Error: 1064 (You have an error in your SQL syntax near 'ON
egw_cal.cal_id=egw_cal_dates.cal_id JOIN egw_cal_user ON
egw_cal.cal_id=egw_c' at line 1)


I guess that whatever database you are using doesn't allow 'JOIN' as a 
join type.


Usually you need to specify the type: inner join, left join, right join, 
straight join etc.


Ask your specific database list about it.

--
Postgresql  php tutorials
http://www.designmagick.com/

--
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: Help with php server and sockets

2007-05-24 Thread Darren Whitlen

Adz07 wrote:

i want to set up a php server that can communicate with a client (CLI PHP
Script). I can setup the server socket fine. What i need to know is whether
it is possible for the client to call a function in the servers php code and
the server return the data ready for the client to process??

To start, if anyone could tell me how to use a socket connection from a CLI
client to a CLI server to retreive an array (it'll do for now :)  if its
even possible that is!

Sorry if thats not the best explanation! 


Take a look at XML-RPC (www.xmlrpc.com). As Robert mentions, it is a 
standard protocol for communicating between languages/servers.


Altho very bloated IMO, it should work fine within a CLI app.

Darren

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



[PHP] instant messenger php + ajax

2007-05-24 Thread Marco Sottana
hi i am looking for an instant messenger for my web site
i would like to enable also not register user to chat to the other not register 
user in my web site..

where i can find a source code like this ?

[PHP] Re: instant messenger php + ajax

2007-05-24 Thread Darren Whitlen

Marco Sottana wrote:

hi i am looking for an instant messenger for my web site
i would like to enable also not register user to chat to the other not register 
user in my web site..

where i can find a source code like this ?


Lots of the them out there.. google php ajax chat
My personal favourite though has to be http://yurivish.com/yshout/

Bare in mind though, any PHP webserver based chat, will have a HUGE 
demand on the server. Check your bandwidth constantly, it's gonna increase.


Darren

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



Re: [PHP] Re: instant messenger php + ajax

2007-05-24 Thread Marco Sottana

i would like a one to one chat .. no one to everybody
- Original Message - 
From: Darren Whitlen [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, May 24, 2007 10:05 AM
Subject: [PHP] Re: instant messenger php + ajax



Marco Sottana wrote:

hi i am looking for an instant messenger for my web site
i would like to enable also not register user to chat to the other not 
register user in my web site..


where i can find a source code like this ?


Lots of the them out there.. google php ajax chat
My personal favourite though has to be http://yurivish.com/yshout/

Bare in mind though, any PHP webserver based chat, will have a HUGE demand 
on the server. Check your bandwidth constantly, it's gonna increase.


Darren

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





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



Re: [PHP] Re: instant messenger php + ajax

2007-05-24 Thread Darren Whitlen

Marco Sottana wrote:

i would like a one to one chat .. no one to everybody
- Original Message - From: Darren Whitlen [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thursday, May 24, 2007 10:05 AM
Subject: [PHP] Re: instant messenger php + ajax



Marco Sottana wrote:

hi i am looking for an instant messenger for my web site
i would like to enable also not register user to chat to the other 
not register user in my web site..


where i can find a source code like this ?


Lots of the them out there.. google php ajax chat
My personal favourite though has to be http://yurivish.com/yshout/

Bare in mind though, any PHP webserver based chat, will have a HUGE 
demand on the server. Check your bandwidth constantly, it's gonna 
increase.


Darren

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






So let me get the idea..
User comes onto the website, User talks to webmaster. Does the webmaster 
want to talk to everybody at the same time? Or just to one user at a time?


Darren

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



Re: [PHP] help with multi dimensional arrays

2007-05-24 Thread Zoltán Németh
2007. 05. 23, szerda keltezéssel 22.59-kor James Lockie ezt írta:
 I get a syntax error on strlen.
 
 
 $newTypes = array();
 $newTypes[0] = array();
 $newTypes[0][0] = Starting with

you missed the ending ; on that line

greets
Zoltán Németh

 $newTypes[0][1] = strlen( $newTypes[0][0] );
 

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



Re: [PHP] Include file questions

2007-05-24 Thread Miguel J. Jiménez

Stephen escribió:

1) Does the filename extension matter? I prefer *.inc? It seems to work fine, 
but I only see others using *.php
   
  2) Does the include file need an opening ?php and ending ? ?
   
  Not big issues, but I am curious.
   
  Thanks

  Stephen

  

If you use .inc extension you will have to modify the apache so they do
not show:

RedirectMatch 404 /^.*\.(inc)$/

Thus, if you try to access the file using the navigator it will show a
Page not found error :-D

--
Miguel J. Jiménez
Programador Senior
Área de Internet/XSL/PHP
[EMAIL PROTECTED]



ISOTROL
Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta.
Parque Tecnológico Cartuja '93, 41092 Sevilla (ESP).
Teléfono: +34 955 036 800 - Fax: +34 955 036 849
http://www.isotrol.com

You let a political fight  come between you and your best friend you 
have in all the world. Do you realize how foolish that is? How ominous? 
How can this country survive if friends can't rise above the quarrel.

Constance Hazard, North  South (book I)



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

Re: [PHP] Form Processing Question - Empty Fields

2007-05-24 Thread Stut

Tijnema wrote:

On 5/23/07, Stephen [EMAIL PROTECTED] wrote:

I have a script to process the post from a form.

 The form is used to upload photos and has fields for the filename, 
alt text, caption and a checkbox to indicate if this photo is the main 
page image rotation.


 I wanted to build a general routine to build the form to allow for a 
varying number of photos to upload.


 I use main_image[] for the various checkboxes for each photo.

 I see that the checkbox is *not* set, I get nothing back, and if the 
second photo is checked (and the first not checked), I get 
main_image[0] = 'on'.


 And I see this happens for the caption[] array as well.

 This seems to me to be pretty ugly.

 Am I understanding this properly?

 Do I really have to use main_image1, main_image2

 Thanks
 Stephen



No, you don't need to, it's the way you write your HTML form.

Again, this is Off topic, as this has nothing to do with PHP, but
well, we are here to help people in general.


Worryingly I agree with Greg here - this is on-topic because it relates 
to the way PHP processes GET and POST vars.



As you didn't provided your code, I'm giving a general example which
worked for my photo site, and should work for your example too. You
should replace foto_id_here with the ID of the photo you want to be
checked.

input type='checkbox' name='photos[]' value=photo_id_here/

And now $_POST['photos'] will be an array with the values being the
IDs of the checked photos.


That is indeed the solution, but I think it's important to explain why 
this is happening.


Take the example where you have 3 checkboxes, named photo1, photo2 and 
photo3. Say photo2 and photo3 are checked, the POST data will look like 
this...


photo2=onphoto3=on

Now consider the same 3 checkboxes, but all named photos[]. Since the 
browser knows nothing about the square brackets, it creates the POST 
data in the same way...


photos[]=onphotos[]=on

Now you see the problem. Nothing in that data indicates which checkboxes 
were checked. By doing what Tijnema suggests you would end up with...


photos[]=2photos[]=3

Hopefully that explains why what you've implemented is doing what it's 
doing and will help you avoid problems like this in future.


-Stut

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



[PHP] Project Management

2007-05-24 Thread Christian Haensel

Morning guys,

this is not exactly a PHP question, but as I am sure that I am talking to 
more or less professional developers, I thought I might ask you.


As I am working on some... well, for my standards... huge project, I thought 
that some kind of project management software would / could be helpful to 
keep track of my ideas, tasks and so on. Right now I am using a huge chunk 
of papers to keep track (as good as I can).


Has any of you any experience with good project management software? Best 
would be OpenSource, of course :o) My boss doesn't want to spend a lot of 
money ;o)


Cheers guys,

Chris from sunny germany 


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



Re: [PHP] Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Stut

Rahul Sitaram Johari wrote:

Apache 2.2, PHP5  mySQL 5 on Windows 2003.
I have some files sitting on a Network Drive accessible on the Windows 2003
Server. But my php script is not able to open the files.

Let¹s say there¹s a database on X:\Transfer\test.dbf
If I use:

$db = dbase_open(³X:\Transfer\test.dbf², 0);

It is not able to open the database. The X: Drive is a network drive.
Any clues on how to make this happen?


I assume you've mapped drive X to the network share for the user that 
Apache runs as? If not are you really surprised that it can't find that 
file?


Try using the UNC path (server\\share\\Transfer\\test.dbf) [note 
double backslashes]. If that still doesn't work then it's likely a 
permissions issue.


-Stut

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



Re: [PHP] Project Management

2007-05-24 Thread eoghan

On 24 May 2007, at 10:26, Christian Haensel wrote:


Morning guys,

this is not exactly a PHP question, but as I am sure that I am  
talking to more or less professional developers, I thought I might  
ask you.


As I am working on some... well, for my standards... huge project,  
I thought that some kind of project management software would /  
could be helpful to keep track of my ideas, tasks and so on. Right  
now I am using a huge chunk of papers to keep track (as good as I  
can).


Has any of you any experience with good project management  
software? Best would be OpenSource, of course :o) My boss doesn't  
want to spend a lot of money ;o)


Cheers guys,

Chris from sunny germany


Hi Chris
You could try basecamp... one project is free I believe.
http://basecamphq.com/

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



Re: [PHP] Re: instant messenger php + ajax

2007-05-24 Thread Marco Sottana


- Original Message - 
From: Darren Whitlen [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, May 24, 2007 10:19 AM
Subject: Re: [PHP] Re: instant messenger php + ajax



Marco Sottana wrote:

i would like a one to one chat .. no one to everybody
- Original Message - From: Darren Whitlen [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thursday, May 24, 2007 10:05 AM
Subject: [PHP] Re: instant messenger php + ajax



Marco Sottana wrote:

hi i am looking for an instant messenger for my web site
i would like to enable also not register user to chat to the other not 
register user in my web site..


where i can find a source code like this ?


Lots of the them out there.. google php ajax chat
My personal favourite though has to be http://yurivish.com/yshout/

Bare in mind though, any PHP webserver based chat, will have a HUGE 
demand on the server. Check your bandwidth constantly, it's gonna 
increase.


Darren

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






So let me get the idea..
User comes onto the website, User talks to webmaster. Does the webmaster 
want to talk to everybody at the same time? Or just to one user at a time?


1)User come onto the website ..
2)website give at the user a name like guest.rand(1,1000);
3)website show a list with all user into the website
4)user can click over a name of over user .. website open a popup






Darren

--
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] Project Management

2007-05-24 Thread Stut

Christian Haensel wrote:
this is not exactly a PHP question, but as I am sure that I am talking 
to more or less professional developers, I thought I might ask you.


As I am working on some... well, for my standards... huge project, I 
thought that some kind of project management software would / could be 
helpful to keep track of my ideas, tasks and so on. Right now I am using 
a huge chunk of papers to keep track (as good as I can).


Has any of you any experience with good project management software? 
Best would be OpenSource, of course :o) My boss doesn't want to spend a 
lot of money ;o)


So very much not on-topic, and you knew that. Did you Google? At all? 
There are lots of project management systems out there, and the best 
ones will usually bubble up to the surface when you Google for open 
source project management.


Personally I use Trac because it integrates very nicely with subversion 
and provides the primary functionality I need (Wiki, tickets and 
milestone tracking). It also has great extensibility if you need 
something it doesn't provide by default.


But, like I said, off-topic. Now please Google your arse off.

-Stut


Cheers guys,

Chris from sunny germany


Oh, right, sorry...

Stut from Woyal Windsor!

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



[PHP] [CSS] help with a orizzotal menu

2007-05-24 Thread Marco Sottana
hi i have this

div id=navullia href=/item1.phpemMenu item 1/em/aullia 
href=/item1.1.phpMenu item 1.1/a/lilia href=/item1.2.phpemMenu 
item 1.2/em/aullia href=/item1.2.1.phpMenu item 
1.2.1/a/lilistrongMenu item 1.2.2/strongullia 
href=/item1.2.2.1.phpMenu item 1.2.2.1/a/lilia 
href=/item1.2.2.2.phpMenu item 1.2.2.2/a/li/ul/lilia 
href=/item1.2.3.phpMenu item 1.2.3/a/li/ul/lilia 
href=/item1.3.phpMenu item 1.3/a/li/ul/lilia 
href=/item2.phpMenu item 2/a/lilia href=/item3.phpMenu item 
3/a/lilia href=/item4.phpMenu item 4/a/li/ul/div

i would like to add a css and/or a javascript to skin this menu as a orizzontal 
menu with submenu orizzontal under menu.. and subsubmenu orizzontal and under 
submenu..

thanks a lot

Re: [PHP] Project Management

2007-05-24 Thread Christian Haensel

Hi Edward,

thanks for your comment. I use a lab book too... And already fille two of 
them in the last 8 weeks  I just wanna use the project management thing 
to collect my ideas, and write a howto for future generation developers 
who may have to deal with this thing once I am gone.


Stut,

yes sir, I've used google and had a look at those things. What I wanted was 
to know what you guys use. There is nothing more valuable than the opinions 
of other developers and to know what they use in their day to day job.


Anyhow, my arse is still on... so I better bugger off :oP

Cheers for your comments!

Chris



- Original Message - 
From: Edward Kay [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, May 24, 2007 12:00 PM
Subject: RE: [PHP] Project Management






-Original Message-
From: Christian Haensel [mailto:[EMAIL PROTECTED]
Sent: 24 May 2007 10:27
To: php-general@lists.php.net
Subject: [PHP] Project Management


Morning guys,

this is not exactly a PHP question, but as I am sure that I am talking to
more or less professional developers, I thought I might ask you.

As I am working on some... well, for my standards... huge
project, I thought
that some kind of project management software would / could be helpful to
keep track of my ideas, tasks and so on. Right now I am using a
huge chunk
of papers to keep track (as good as I can).

Has any of you any experience with good project management software? Best
would be OpenSource, of course :o) My boss doesn't want to spend a lot of
money ;o)

Cheers guys,

Chris from sunny germany



If you're working on your own, I would think realistically about how much
you would use such software. I've used Basecamp, Trac, MS Project and 
others
in the past and find them a waste of time. My favourite tool is simply an 
A4

lab book. (I know this doesn't scale, but it fits the bill perfectly for
now).

For initial brainstorming/idea tracking, I do use FreeMind though.
http://freemind.sf.net

HTH, Edward

--
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] [CSS] help with a orizzotal menu

2007-05-24 Thread Edward Kay


 -Original Message-
 From: Marco Sottana [mailto:[EMAIL PROTECTED]
 Sent: 24 May 2007 11:32
 To: php-general@lists.php.net
 Subject: [PHP] [CSS] help with a orizzotal menu


 hi i have this

 div id=navullia href=/item1.phpemMenu item
 1/em/aullia href=/item1.1.phpMenu item
 1.1/a/lilia href=/item1.2.phpemMenu item
 1.2/em/aullia href=/item1.2.1.phpMenu item
 1.2.1/a/lilistrongMenu item 1.2.2/strongullia
 href=/item1.2.2.1.phpMenu item 1.2.2.1/a/lilia
 href=/item1.2.2.2.phpMenu item
 1.2.2.2/a/li/ul/lilia href=/item1.2.3.phpMenu item
 1.2.3/a/li/ul/lilia href=/item1.3.phpMenu item
 1.3/a/li/ul/lilia href=/item2.phpMenu item
 2/a/lilia href=/item3.phpMenu item 3/a/lilia
 href=/item4.phpMenu item 4/a/li/ul/div

 i would like to add a css and/or a javascript to skin this menu
 as a orizzontal menu with submenu orizzontal under menu.. and
 subsubmenu orizzontal and under submenu..

 thanks a lot


This is a PHP list. Your question has nothing to do with PHP. STFW.

Edward

PS: I think you mean 'horizontal' not 'orizzontal'. This is not a criticism,
but it may help you use better search terms.

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



RE: [PHP] Project Management

2007-05-24 Thread Edward Kay


 -Original Message-
 From: Christian Haensel [mailto:[EMAIL PROTECTED]
 Sent: 24 May 2007 10:27
 To: php-general@lists.php.net
 Subject: [PHP] Project Management


 Morning guys,

 this is not exactly a PHP question, but as I am sure that I am talking to
 more or less professional developers, I thought I might ask you.

 As I am working on some... well, for my standards... huge
 project, I thought
 that some kind of project management software would / could be helpful to
 keep track of my ideas, tasks and so on. Right now I am using a
 huge chunk
 of papers to keep track (as good as I can).

 Has any of you any experience with good project management software? Best
 would be OpenSource, of course :o) My boss doesn't want to spend a lot of
 money ;o)

 Cheers guys,

 Chris from sunny germany


If you're working on your own, I would think realistically about how much
you would use such software. I've used Basecamp, Trac, MS Project and others
in the past and find them a waste of time. My favourite tool is simply an A4
lab book. (I know this doesn't scale, but it fits the bill perfectly for
now).

For initial brainstorming/idea tracking, I do use FreeMind though.
http://freemind.sf.net

HTH, Edward

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



Re: [PHP] RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Stut

Rahul Sitaram Johari wrote:

I use a Mac OS X Server generally, where I mount network drives to a share
point. Everything works therein. Recently I had a need to setup Apache Web
Server, PHP  mySQL on a Windows 2003 Server we have in the office.

There I used the same scripts I was running on Mac OS X to access files on a
network drive. But in Windows 2003, I¹m not mounting anything on a share
point, I¹m simply referring to the files using actual paths. Whether it¹s a
direct X:\ kind of path, or a network path \\servername ... With or without
backslashes. 


This is the first application I setup on the Windows Server to access files
on a network drive.


Does the user Apache is running as have permission to access the network 
at all? It's fairly common for services to lack that access for 
(shockingly for Windows) security reasons. The easiest way to test it is 
to stop the Apache service and run it manually as your user. If it works 
like that then your problem is definitely permissions-related and you 
should consult your sysadmin (or Google if you don't have one).


-Stut


On 5/23/07 4:33 PM, Jared Farrish [EMAIL PROTECTED] wrote:


So you haven't been able to actually access the drive yet? Are you using any
other shared content on network drives that does currently work?

On 5/23/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote:

I've been trying to run various entry level functions on the file, like
file_exists(), isreadable() etcetera But no matter what I do, I pretty
much get the cannot open warnings without much specification as to Why
cannot open.

So when I do the dbase_open() function, and I've tried all different
combinations of paths, backslashes and all, I always get this:

Warning: dbase_open() [function.dbase-open]: unable to open database
test.dbf in ... *followed by whatever path I put in*.

I'm still going to try some more testing using text files, but this is what
I'm really get at.







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



Re: [PHP] [CSS] help with a orizzotal menu

2007-05-24 Thread Stut

Marco Sottana wrote:

hi i have this

div id=navullia href=/item1.phpemMenu item
1/em/aullia href=/item1.1.phpMenu item 1.1/a/lilia
href=/item1.2.phpemMenu item 1.2/em/aullia
href=/item1.2.1.phpMenu item 1.2.1/a/lilistrongMenu item
1.2.2/strongullia href=/item1.2.2.1.phpMenu item
1.2.2.1/a/lilia href=/item1.2.2.2.phpMenu item
1.2.2.2/a/li/ul/lilia href=/item1.2.3.phpMenu item
1.2.3/a/li/ul/lilia href=/item1.3.phpMenu item
1.3/a/li/ul/lilia href=/item2.phpMenu item
2/a/lilia href=/item3.phpMenu item 3/a/lilia
href=/item4.phpMenu item 4/a/li/ul/div

i would like to add a css and/or a javascript to skin this menu as a
orizzontal menu with submenu orizzontal under menu.. and subsubmenu
orizzontal and under submenu..


Adding [CSS] to the subject does not make this on-topic. Please try a
CSS mailing list.

-Stut

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



[PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Jean-Christophe Roux
Hello,
I have folder A with the following php script:
?php
session_start();
$_SESSION['dummy']=10;
echo $_SESSION['dummy'];
?
in folder B (same level as A), there is
?php
session_start();
echo $_SESSION['dummy'];
?
when running the script in B, in can see the value 10. How can I make sure that 
the $_SESSION['dummy'] is not shared between the two scripts? I could change 
the name but that would not be convenient.

Thank you







 

We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 

Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Stut

Jean-Christophe Roux wrote:

I have folder A with the following php script:
?php
session_start();
$_SESSION['dummy']=10;
echo $_SESSION['dummy'];
?
in folder B (same level as A), there is
?php
session_start();
echo $_SESSION['dummy'];
?
when running the script in B, in can see the value 10. How can I make sure that 
the $_SESSION['dummy'] is not shared between the two scripts? I could change 
the name but that would not be convenient.


You'll have to change the name. The whole point of sessions is to allow 
scripts to share variables between requests.


-Stut

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



[PHP] Re: two php scripts with same $_SESSION variables

2007-05-24 Thread Darren Whitlen

Jean-Christophe Roux wrote:

Hello,
I have folder A with the following php script:
?php
session_start();
$_SESSION['dummy']=10;
echo $_SESSION['dummy'];
?
in folder B (same level as A), there is
?php
session_start();
echo $_SESSION['dummy'];
?
when running the script in B, in can see the value 10. How can I make sure that 
the $_SESSION['dummy'] is not shared between the two scripts? I could change 
the name but that would not be convenient.

Thank you







 

We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 


Session vars are available for every script that is run after the 
session has started. If you want to stop the session for te remainder of 
the script, you can use session_write_close().


http://uk2.php.net/session

Darren

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



Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Paul Scott

On Thu, 2007-05-24 at 04:23 -0700, Jean-Christophe Roux wrote:
 when running the script in B, in can see the value 10. How can I make sure 
 that the $_SESSION['dummy'] is not shared between the two scripts? I could 
 change the name but that would not be convenient.
 

I think you are missing the point of using sessions completely.
There is a way, however, and that would be to set the dummy session
variable to an empty array and then kill off the session.

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Jean-Christophe Roux
Hello,

Thank you for the answers. The issue is that the same codes are in folders A 
and B. When they are run from two different browsers, I am getting the behavior 
I 'd like to see with two session ids being created and therefore no sharing of 
$_SESSION variables.  But when the two apps are opened inside the same browser, 
the $_SESSION variables are shared and that makes sense because session_id() 
returns the same value. It would be be nice that when the app in A is running 
and the user starts the app in B, in the same browser widow, the server and php 
are instructed to realize that this is a brand new session and assign a new 
session_id() which would solve my problem. Is there  a way to achieve that?

Regards,




- Original Message 
From: Stut [EMAIL PROTECTED]
To: Jean-Christophe Roux [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Thursday, May 24, 2007 7:34:24 AM
Subject: Re: [PHP] two php scripts with same $_SESSION variables

Jean-Christophe Roux wrote:
 I have folder A with the following php script:
 ?php
 session_start();
 $_SESSION['dummy']=10;
 echo $_SESSION['dummy'];
 ?
 in folder B (same level as A), there is
 ?php
 session_start();
 echo $_SESSION['dummy'];
 ?
 when running the script in B, in can see the value 10. How can I make sure 
 that the $_SESSION['dummy'] is not shared between the two scripts? I could 
 change the name but that would not be convenient.

You'll have to change the name. The whole point of sessions is to allow 
scripts to share variables between requests.

-Stut

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








 

8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Darren Whitlen

Jean-Christophe Roux wrote:

Hello,

Thank you for the answers. The issue is that the same codes are in folders A 
and B. When they are run from two different browsers, I am getting the behavior 
I 'd like to see with two session ids being created and therefore no sharing of 
$_SESSION variables.  But when the two apps are opened inside the same browser, 
the $_SESSION variables are shared and that makes sense because session_id() 
returns the same value. It would be be nice that when the app in A is running 
and the user starts the app in B, in the same browser widow, the server and php 
are instructed to realize that this is a brand new session and assign a new 
session_id() which would solve my problem. Is there  a way to achieve that?

Regards,




- Original Message 
From: Stut [EMAIL PROTECTED]
To: Jean-Christophe Roux [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Thursday, May 24, 2007 7:34:24 AM
Subject: Re: [PHP] two php scripts with same $_SESSION variables

Jean-Christophe Roux wrote:

I have folder A with the following php script:
?php
session_start();
$_SESSION['dummy']=10;
echo $_SESSION['dummy'];
?
in folder B (same level as A), there is
?php
session_start();
echo $_SESSION['dummy'];
?
when running the script in B, in can see the value 10. How can I make sure that 
the $_SESSION['dummy'] is not shared between the two scripts? I could change 
the name but that would not be convenient.


You'll have to change the name. The whole point of sessions is to allow 
scripts to share variables between requests.


-Stut



So what your saying, is that.. you want a webpage open twice but with 
different session_id? The only way to do that would be to create a 
session_id yourself, eg. session_id(time().rand(0,1000));
Then pass that id through your scripts via POST or GET, start the 
session using that ID. You can then start as many sessions as you like.


Darren

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



Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Darren Whitlen

Stut wrote:

Jean-Christophe Roux wrote:
Thank you for the answers. The issue is that the same codes are in 
folders A and B. When they are run from two different browsers, I am 
getting the behavior I 'd like to see with two session ids being 
created and therefore no sharing of $_SESSION variables.  But when the 
two apps are opened inside the same browser, the $_SESSION variables 
are shared and that makes sense because session_id() returns the same 
value. It would be be nice that when the app in A is running and the 
user starts the app in B, in the same browser widow, the server and 
php are instructed to realize that this is a brand new session and 
assign a new session_id() which would solve my problem. Is there  a 
way to achieve that?


It's frickin' annoying!
Why?
Please don't top post!

What you're wanting to do can be achieved by setting the path on the 
session cookies. You may be able to do this by calling ini_set to change 
session.cookie_path before calling session_start.


-Stut


- Original Message 
From: Stut [EMAIL PROTECTED]
To: Jean-Christophe Roux [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Thursday, May 24, 2007 7:34:24 AM
Subject: Re: [PHP] two php scripts with same $_SESSION variables

Jean-Christophe Roux wrote:
  I have folder A with the following php script:
  ?php
  session_start();
  $_SESSION['dummy']=10;
  echo $_SESSION['dummy'];
  ?
  in folder B (same level as A), there is
  ?php
  session_start();
  echo $_SESSION['dummy'];
  ?
  when running the script in B, in can see the value 10. How can I 
make sure that the $_SESSION['dummy'] is not shared between the two 
scripts? I could change the name but that would not be convenient.


You'll have to change the name. The whole point of sessions is to allow
scripts to share variables between requests.

-Stut

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




Get your own web address. 
http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL 

Have a HUGE year through Yahoo! Small Business.  
http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL 



Stut..
I've only been here one day, and I think I'm right in saying that your 
the one around here that gets annoyed really easy ;)


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



Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Stut

Darren Whitlen wrote:

Stut..
I've only been here one day, and I think I'm right in saying that your 
the one around here that gets annoyed really easy ;)


Not really, I just tend to be a bit more vocal about it.

-Stut

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



Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Stut

Jean-Christophe Roux wrote:
Thank you for the answers. The issue is that the same codes are in 
folders A and B. When they are run from two different browsers, I am 
getting the behavior I 'd like to see with two session ids being created 
and therefore no sharing of $_SESSION variables.  But when the two apps 
are opened inside the same browser, the $_SESSION variables are shared 
and that makes sense because session_id() returns the same value. It 
would be be nice that when the app in A is running and the user starts 
the app in B, in the same browser widow, the server and php are 
instructed to realize that this is a brand new session and assign a new 
session_id() which would solve my problem. Is there  a way to achieve that?


It's frickin' annoying!
Why?
Please don't top post!

What you're wanting to do can be achieved by setting the path on the 
session cookies. You may be able to do this by calling ini_set to change 
session.cookie_path before calling session_start.


-Stut


- Original Message 
From: Stut [EMAIL PROTECTED]
To: Jean-Christophe Roux [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Thursday, May 24, 2007 7:34:24 AM
Subject: Re: [PHP] two php scripts with same $_SESSION variables

Jean-Christophe Roux wrote:
  I have folder A with the following php script:
  ?php
  session_start();
  $_SESSION['dummy']=10;
  echo $_SESSION['dummy'];
  ?
  in folder B (same level as A), there is
  ?php
  session_start();
  echo $_SESSION['dummy'];
  ?
  when running the script in B, in can see the value 10. How can I make 
sure that the $_SESSION['dummy'] is not shared between the two scripts? 
I could change the name but that would not be convenient.


You'll have to change the name. The whole point of sessions is to allow
scripts to share variables between requests.

-Stut

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




Get your own web address. 
http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL
Have a HUGE year through Yahoo! Small Business.  
http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL


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



[PHP] php hosting-mediatemple/dreamhost

2007-05-24 Thread blackwater dev

Forgive me if this is a bit off topic but I currenly have several sites
hosted with dreamhost, it's cheap and well prone to be slow.  Does anyone
have experience with mediatemple?  I would just be running php/mysql sites.

Thanks!


Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Jochem Maas
Darren Whitlen wrote:
 Stut wrote:

...

 
 Stut..
 I've only been here one day, and I think I'm right in saying that your
 the one around here that gets annoyed really easy ;)

when he goes quiet - that's when it's time to worry ;-)

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



Re: [PHP] Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Rahul Sitaram Johari

Ave,

UNC paths didn't work, i.e., (server\\share\\Transfer\\test.dbf).
I have no clue how to Run Apache as a particular User on Windows! I
installed Apache using the Installer available - but I really don't know
anything else 'user' related about Apache.

Both SYSTEM and the Computer I'm running all this on have Full Control
Permissions to the Network Share.


On 5/24/07 5:28 AM, Stut [EMAIL PROTECTED] wrote:

 I assume you've mapped drive X to the network share for the user that
 Apache runs as? If not are you really surprised that it can't find that
 file?
 
 Try using the UNC path (server\\share\\Transfer\\test.dbf) [note
 double backslashes]. If that still doesn't work then it's likely a
 permissions issue.
 
 -Stut

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



Re: [PHP] RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Rahul Sitaram Johari

How exactly do you run Apache manually as your own user on Windows 2003?


On 5/24/07 5:32 AM, Stut [EMAIL PROTECTED] wrote:

 Does the user Apache is running as have permission to access the network
 at all? It's fairly common for services to lack that access for
 (shockingly for Windows) security reasons. The easiest way to test it is
 to stop the Apache service and run it manually as your user. If it works
 like that then your problem is definitely permissions-related and you
 should consult your sysadmin (or Google if you don't have one).
 
 -Stut

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



RE: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Edward Kay
 Stut..
 I've only been here one day, and I think I'm right in saying that your
 the one around here that gets annoyed really easy ;)

I don't think Stut gets annoyed more than any of the others on this list.
Please remember though that

a) Stut's answers tend to be very high quality and
b) Top posting is damn annoying. (Maybe this should be point (a)...)

Edward

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



Re: [PHP] RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Stut

Rahul Sitaram Johari wrote:

How exactly do you run Apache manually as your own user on Windows 2003?


You read the Apache documentation for the version your're using on 
Windows at http://httpd.apache.org/


-Stut


On 5/24/07 5:32 AM, Stut [EMAIL PROTECTED] wrote:


Does the user Apache is running as have permission to access the network
at all? It's fairly common for services to lack that access for
(shockingly for Windows) security reasons. The easiest way to test it is
to stop the Apache service and run it manually as your user. If it works
like that then your problem is definitely permissions-related and you
should consult your sysadmin (or Google if you don't have one).

-Stut





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



RE: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Ford, Mike
On 24 May 2007 13:22, Jean-Christophe Roux wrote:

 Hello,
 
 Thank you for the answers. The issue is that the same codes
 are in folders A and B. When they are run from two different
 browsers, I am getting the behavior I 'd like to see with two
 session ids being created and therefore no sharing of
 $_SESSION variables.  But when the two apps are opened inside
 the same browser, the $_SESSION variables are shared and that
 makes sense because session_id() returns the same value. It
 would be be nice that when the app in A is running and the
 user starts the app in B, in the same browser widow, the
 server and php are instructed to realize that this is a brand
 new session and assign a new session_id() which would solve
 my problem. Is there  a way to achieve that?

I think that what you want is a different session *name* for each application.

To get this, just call session_name() with the appropriate value immediately 
before every session_start().  For example, for the files in A you could use:

   session_name('SESSID_A');
   session_start();

whilst those in B would have:

   session_name('SESSID_B');
   session_start();

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730  Fax:  +44 113 812 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] php hosting-mediatemple/dreamhost

2007-05-24 Thread Tijnema

On 5/24/07, blackwater dev [EMAIL PROTECTED] wrote:

Forgive me if this is a bit off topic but I currenly have several sites
hosted with dreamhost, it's cheap and well prone to be slow.  Does anyone
have experience with mediatemple?  I would just be running php/mysql sites.

Thanks!


I don't have experience with both, but I can recommend dapx.com, fast
and cheap. Buying the hosting itself is sometimes a little bit slow,
but it's worth.
It has a very nice PHP configuration, safe_mode off, open_basedir on, etc.

Tijnema

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



Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Jean-Christophe Roux
Stut wrote
What you're wanting to do can be achieved by setting the path on the 
session cookies. You may be able to do this by calling ini_set to change 
session.cookie_path before calling session_start.

ini_set('session.cookie_path', '/A/');
session_start();
That's a good solution; it works fine. Thank you

Mike wrote
To get this, just call session_name() with the appropriate value immediately 
before every session_start(). 

session_name('SESSID_A');
session_start();
That's a good solution; it works fine. Thank you


Are those two solutions equivalent or are there circumstances where one would 
be better than the other?
Regards,
JCR 
who will never top post again





 

Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html

Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Stut

Jean-Christophe Roux wrote:

Stut wrote
 What you're wanting to do can be achieved by setting the path on the
 session cookies. You may be able to do this by calling ini_set to change
 session.cookie_path before calling session_start.

ini_set('session.cookie_path', '/A/');
session_start();
That's a good solution; it works fine. Thank you

Mike wrote
 To get this, just call session_name() with the appropriate value 
immediately before every session_start().


session_name('SESSID_A');
session_start();
That's a good solution; it works fine. Thank you

Are those two solutions equivalent or are there circumstances where one 
would be better than the other?


Changing the session name is better, and I'm kicking myself for not 
thinking of it. It's more portable because you won't have to change the 
code if you move it to another location.


-Stut

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



Re: [PHP] Re: Form Validation Issues

2007-05-24 Thread Tijnema

On 5/23/07, Crayon Shin Chan [EMAIL PROTECTED] wrote:

On Thursday 24 May 2007 00:51, Greg Donald wrote:

 As I watch PHP de-evolve into Java, I find myself wanting something
 lighter weight and with a smaller syntax.

PHP has long since spawned into something uncontrollable. Compare the
number of functions (and its aliases) to eg Ruby. The string functions in
particular are absolutely bloated, eg ltrim, trim  rtrim - WTF. Why not
just have trim() and have the option of specifying whether
left/right/both? The same goes for the case-sensitive and
case-insensitive versions of functions.

--
Crayon


Yeah, for case-insensitive functions would a bool be a lot better,
like the strstr function, the current syntax is (also for the
case-insensitive function stristr):
string strstr ( string $haystack, string $needle )
It would be a lot better to have it like this:
string strstr ( string $haystack, string $needle, bool $case_sensitive )

The trim functions are fine for me..

Tijnema

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



Re: [PHP] Project Management

2007-05-24 Thread Dan McCullough

On 5/24/07, Christian Haensel [EMAIL PROTECTED] wrote:

Hi Edward,

thanks for your comment. I use a lab book too... And already fille two of
them in the last 8 weeks  I just wanna use the project management thing
to collect my ideas, and write a howto for future generation developers
who may have to deal with this thing once I am gone.

Stut,

yes sir, I've used google and had a look at those things. What I wanted was
to know what you guys use. There is nothing more valuable than the opinions
of other developers and to know what they use in their day to day job.

Anyhow, my arse is still on... so I better bugger off :oP

Cheers for your comments!

Chris



- Original Message -
From: Edward Kay [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thursday, May 24, 2007 12:00 PM
Subject: RE: [PHP] Project Management




 -Original Message-
 From: Christian Haensel [mailto:[EMAIL PROTECTED]
 Sent: 24 May 2007 10:27
 To: php-general@lists.php.net
 Subject: [PHP] Project Management


 Morning guys,

 this is not exactly a PHP question, but as I am sure that I am talking to
 more or less professional developers, I thought I might ask you.

 As I am working on some... well, for my standards... huge
 project, I thought
 that some kind of project management software would / could be helpful to
 keep track of my ideas, tasks and so on. Right now I am using a
 huge chunk
 of papers to keep track (as good as I can).

 Has any of you any experience with good project management software? Best
 would be OpenSource, of course :o) My boss doesn't want to spend a lot of
 money ;o)

 Cheers guys,

 Chris from sunny germany


 If you're working on your own, I would think realistically about how much
 you would use such software. I've used Basecamp, Trac, MS Project and
 others
 in the past and find them a waste of time. My favourite tool is simply an
 A4
 lab book. (I know this doesn't scale, but it fits the bill perfectly for
 now).

 For initial brainstorming/idea tracking, I do use FreeMind though.
 http://freemind.sf.net

 HTH, Edward

 --
 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



[PHP] Creating an executer

2007-05-24 Thread lists

Hi,

Summary:

1. I execute script1 that will run in the background (daemon)
2. script1 needs to execute script2 and capture STDERR, STDOUT and  
exitcode from script2 if script2 exits before SIGTERM is received.
3. If I send SIGTERM to script1 it should kill script2, and write to  
DB (or log  file some information that it was stopped)


Simple, isn't it? But I cannot seam to get it to work. Anyone with  
some example code that does the same thing?



=

More complex description

I have some scripts (perl, c, php, or anything else) that simple  
independent scripts that do some stuff and output STDOUT and STDERR  
and exit with an exitcode. There scripts will be kept like this, and  
will not change their behavior.


Now I need to control them and also log their STDOUT, STDERR and  
exitcode. Ok, that far I have come, so that I am logging the STDOUT,  
STDERR and exitcode. What I am doing is that I have created an  
executer that takes care of this and writing it to DB.


Now I need to add a functionality so that when the executer receives a  
SIGTERM signal it should kill the script (that was started with a  
exec() call, and then log some information to the DB (that the script  
was killed etc).


I have registered the signal SIGTERM with pcntl_signal(SIGTERM,  
sig_handler). When I am testing I just write some info to a file  
when the signal is received. I created a simple testing script with a  
while(true) loop and then send the signal to the script and it  
successfully writes the information to the logflie.


Ok, now I instead of a while(true) loop make an exec() call to a  
script (that is running for ever) and send the signal, then it does  
not write to the file as it is supposed to. I guess it is because the  
script is busy running the exec command.


I tried to then exec() it in the background. The problem there is that  
it becomes a daemon and then I cannot know what that script is doing,  
and it will not send any SIGCHLD to the parent, or it does, but to  
init. Or actually there will be a SIGCHLD sent, as the exec() will  
open its own shell, and then the shell will exit and we get the  
SIGCHLD from the shell instead of the executed script.


Is there any way to get the child process PID when you exec() and  
send it to the background? But then, how can I capture the exitcode?  
The STDERR and STDOUT is fine as I can direct it to a file and get it  
from there.


I have a really ugly workarounds: I could append an dummy variable to  
the execution of the script and then do a grep of the ps -ef to get  
the PID of that script.


/Peter

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



[PHP] Re: ftp_put() problem??

2007-05-24 Thread Al

Can anyone explain what's going on.  This works; but, I don't understand it.

Two folks pointed out I had my $remote and $local files reversed. I fixed that; 
but, it still didn't work.

This does work:

$source_dir is the absolute path i.e., /home/x/public_html/EditPage

ftp_chdir($dist_dir);  //$dist_dir is simply relative to 
$_SERVER[document_root]; i.e., /test

ftp_put($conn_id, $dist, $source, flag];


Al wrote:

Can anyone help with this.  On a Linux/Apache server.

I want to simply copy a file with ftp_put() from one dir to another.

To make certain I'm pointing to the correct dirs, I'm using this:
print_r(ftp_nlist($conn_id, FTP_EP_DIR)); //It is the correct dir
print_r(ftp_nlist($conn_id, $rpdir));   //It is the correct dir

Then I'm:
ftp_put($conn_id, FTP_EP_DIR .'/' . $file, $rpdir. '/' . $file, FTP_ASCII);

Error msg:
Warning: ftp_put(/home/x/public_html/test/EditPageIndexer.php) 
[function.ftp-put]: failed to open stream: No such file or directory in 
/home/x/public_html/EditPage/ep_functions.inc on line 227


And the files are not copied.

Owner and permissions are correct.  I can make a new dir [mkdir()] in 
the destination dir without a problem.


Manual is confusing when it calls the files remote and local.

Thanks


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



Re: [PHP] RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Rahul Sitaram Johari
Ave,

Instead of going back  forth on various function  path tests, I wrote a
small code containing different suggested combinations of PATH and also the
gettype() as Jim had requested. Following is the Code and the Output.

Code:

$filename = 'X:\send\Transfer\LIVE\live.txt';
echo gettype($filename).br;
if (file_exists($filename)) {
echo The file $filename Existsbr;
} else {
echo The file $filename does NOT Existbrbr;
}

$filename1 = 'X:\\send\\Transfer\\LIVE\\live.txt';
echo gettype($filename1).br;
if (file_exists($filename1)) {
echo The file $filename1 Existsbr;
} else {
echo The file $filename1 does NOT Existbrbr;
}

$filename2 = 'X:/send/Transfer/LIVE/live.txt';
echo gettype($filename2).br;
if (file_exists($filename2)) {
echo The file $filename2 Existsbr;
} else {
echo The file $filename2 does NOT Existbrbr;
}

$filename3 = 'X://send//Transfer//LIVE//live.txt';
echo gettype($filename3).br;
if (file_exists($filename3)) {
echo The file $filename3 Existsbr;
} else {
echo The file $filename3 does NOT Existbrbr;
}

$filename4 = '\\Foresight\send\Transfer\LIVE\live.txt';
echo gettype($filename4).br;
if (file_exists($filename4)) {
echo The file $filename4 Existsbr;
} else {
echo The file $filename4 does NOT Existbrbr;
}

$filename5 = 'Foresight\\send\\Transfer\\LIVE\\live.txt';
echo gettype($filename5).br;
if (file_exists($filename5)) {
echo The file $filename5 Existsbr;
} else {
echo The file $filename5 does NOT Existbrbr;
}

$filename6 = '//Foresight/send/Transfer/LIVE/live.txt';
echo gettype($filename6).br;
if (file_exists($filename6)) {
echo The file $filename6 Existsbr;
} else {
echo The file $filename6 does NOT Existbrbr;
}

$filename7 = 'Foresight//send//Transfer//LIVE//live.txt';
echo gettype($filename7).br;
if (file_exists($filename7)) {
echo The file $filename7 Existsbr;
} else {
echo The file $filename7 does NOT Existbrbr;
}


Output:

string
The file X:\send\Transfer\LIVE\live.txt does NOT Exist

string
The file X:\send\Transfer\LIVE\live.txt does NOT Exist

string
The file X:/send/Transfer/LIVE/live.txt does NOT Exist

string
The file X://send//Transfer//LIVE//live.txt does NOT Exist

string
The file \Foresight\send\Transfer\LIVE\live.txt does NOT Exist

string
The file \\Foresight\send\Transfer\LIVE\live.txt does NOT Exist

string
The file //Foresight/send/Transfer/LIVE/live.txt does NOT Exist

string
The file Foresight//send//Transfer//LIVE//live.txt does NOT Exist



~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: [EMAIL PROTECTED]

³I morti non sono piu soli ... The dead are no longer lonely²

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



[PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Jared Farrish

Well, I'll say you've dramatically upped the ante by having an Apache server
on a windows box attempt to mount and read a file on a MacOS machine. Yipes!

So let me get this straight:

* Apache is on Windows Server 2003.

* PHP is running on Apache.

* A folder containing scripts/data/both is on a MacOSX machine.

* A user from frontierland knocks on PHP's front host.com:80 door and says,
Please...

* PHP - Apache: Gimme gimme [resource P]

* Apache says, Ok, let me get the data from location X.

* Apache - location X: Pretty Please, gimme gimme.

* location X - Apache: [barf]

* Apache - PHP: No luck.



Can you, from the Windows 2003 machine, manually access the folder/file that
you're asking PHP (through Apache) to access? Unless the service that Apache
is running under has permissions to communicate with the share resource
(location X), this will always fail.

Steps:
1) From Win2003 box, open My Computer and attempt to physically navigate to
the remote network share you attempting to access. If at all possible, use
the exact user permission set that Apache runs under. To determine this,
right-click on the bottom, right corner of the Win2003 desktop above the
time and select Task Manager, Processes tab, click to sort on Image Name
tab, and look for Apache.exe. The user name associated with this executable
will be the permissions you will need to use.

2) If you cannot connect to the network resource, then at least you have a
permissions issue (it may be others, though). Get this working first.

3) If you can connect, open, read, write, and execute from this permission
set (user/group), then you're at least sure that the machines can talk.
Next, you will need to determine if the Apache UID permissions are acting up
(in Safe Mode, this is entirely possible, and a black art in itself...).

4) Once you've determine Win/Mac communications and Apache server
permissions aren't impeding the process, you can work on the actual script
issues which may be present.

Remember, the computers need to be able to communicate and interact, then
apache/IIS/other, then PHP. Verify the simplest potential problems first,
then work your way up into the place where the problem currently exists.
Getting Macs to be on speaking terms with Win machines, I would think, would
be a MAJOR headache if you've never done it before. One essentially speaks
Polish, while the other speaks Italian.

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


[PHP] Re: SOAP: xsd:choice maxOccurs=unbounded, and element order

2007-05-24 Thread Caroline Maynard

Simon Detheridge wrote:


Incidentally, the full-blown (and rather complicated I'm afraid) 
schema/wsdl for what I'm *actually* trying to do is at 
http://www.widgit.com/cml/symgate.wsdl if that helps.


404

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



Re: [PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Rahul Sitaram Johari

On 5/24/07 11:04 AM, Jared Farrish [EMAIL PROTECTED] wrote:

 Well, I'll say you've dramatically upped the ante by having an Apache server
 on a windows box attempt to mount and read a file on a MacOS machine. Yipes!
 
 So let me get this straight:
 
  * Apache is on Windows Server 2003.
 
  * PHP is running on Apache.
 
  * A folder containing scripts/data/both is on a MacOSX machine.
 
  * A user from frontierland knocks on PHP's front host.com:80 door and says,
 Please...
 
  * PHP - Apache: Gimme gimme [resource P]
 
  * Apache says, Ok, let me get the data from location X.
 
  * Apache - location X: Pretty Please, gimme gimme.
 
  * location X - Apache: [barf]
 
  * Apache - PHP: No luck.
 
 

Jared, 

I think you got a little confused with a previous post of mine. Mac OS X is
Not in this scenario at all!!! So completely Eradicate it from this current
Scenario. 

This is a complete PHP/Apache on Windows 2003 Scenario. That's it!

So what it is supposed to be is:

* PHP5 / Apache2.2 on Windows Server 2003
* Folder on another Windows Machine on the Network contains some files
(mapped as network drive X:\)
* PHP trying to read file on X:\ from Apache on Windows 2003.

There's really nothing else to it.

 Can you, from the Windows 2003 machine, manually access the folder/file that
 you're asking PHP (through Apache) to access? Unless the service that Apache
 is running under has permissions to communicate with the share resource
 (location X), this will always fail.

Yes! Without any problems! I can easily navigate to the X: drive on that
Windows Machine, and do anything I want with files there. I have all
permissions. 



~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: [EMAIL PROTECTED]

³I morti non sono piu soli ... The dead are no longer lonely²



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



[PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Jared Farrish

On 5/24/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote:


I think you got a little confused with a previous post of mine. Mac OS X
is
Not in this scenario at all!!! So completely Eradicate it from this
current
Scenario.

This is a complete PHP/Apache on Windows 2003 Scenario. That's it!

So what it is supposed to be is:

* PHP5 / Apache2.2 on Windows Server 2003
* Folder on another Windows Machine on the Network contains some files
(mapped as network drive X:\)
* PHP trying to read file on X:\ from Apache on Windows 2003.



Ok, I was under the impression this was one Win2003 machine in a Mac
network.

There's really nothing else to it.


Heh.


Can you, from the Windows 2003 machine, manually access the folder/file
that
 you're asking PHP (through Apache) to access? Unless the service that
Apache
 is running under has permissions to communicate with the share resource
 (location X), this will always fail.

Yes! Without any problems! I can easily navigate to the X: drive on that
Windows Machine, and do anything I want with files there. I have all
permissions.



Are you running Apache under a different (non-privileged) account on the
Win2003 machine? If Apache is running as a service with a different username
(with no extended access to network resources), you will need to get Apache
to run as a service under a user that can access the network resource. And I
still think you should use non-mapped addresses instead of mapped addresses,
since a mapping is just a localized version of a resource name alias.

If, after determing that Apache is running with the right permissions for
the owned processes to connect to and use a network shared resource, then
it's probably an Apache UID conflict (is PHP in safe mode?).
--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


Re: [PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Rahul Sitaram Johari

You may have something here.
Problem is, I don¹t know how to mess with how  under what user Apache is
running ­ and no one else here does either so basically I have to figure
this one out! I would like to, as you suggested, try and ³get Apache to run
as a service under a user that can access the network resource².

I definitely agree about using non-mapped addresses and using the actual
Server Name addresses.


On 5/24/07 11:24 AM, Jared Farrish [EMAIL PROTECTED] wrote:
 
Are you running Apache under a different (non-privileged) account on the
Win2003 machine? If Apache is running as a service with a different username
(with no extended access to network resources), you will need to get Apache
to run as a service under a user that can access the network resource. And I
still think you should use non-mapped addresses instead of mapped addresses,
since a mapping is just a localized version of a resource name alias.

If, after determing that Apache is running with the right permissions for
the owned processes to connect to and use a network shared resource, then
it's probably an Apache UID conflict (is PHP in safe mode?).




Re: [PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Jared Farrish

On 5/24/07, Rahul Sitaram Johari [EMAIL PROTECTED] wrote:



You may have something here.
Problem is, I don't know how to mess with how  under what user Apache is
running – and no one else here does either so basically I have to figure
this one out! I would like to, as you suggested, try and get Apache to run
as a service under a user that can access the network resource.



Well, I have already described how to do this two posting ago (and the
advice from another user was to read the Apache documentation...):

1) Go to Win2003 desktop
2) Right-click on bottom, right part of desktop (right on top of the clock).
3) Select 'Task Manager', click Processes Tab, sort Image Name by clicking
tab.
4) Find 'apache.exe' or some variation of.
5) Look at the username associated with the process.

If this is 'System' or something type of special user (or a basic user
without network privileges extended to it), then you will need to modify
this by:

1) Locate the My Computer link on your desktop.
2) Right-click on top of the link, select Manage, choose 'Services and
Applications', and select Services.
3) Find the apache service, double click to open properties, click on the
'Log On' tab, and see what user it is setup to use.

If this is a system account, I would think you would need to change this to
a network account, preferably one for which the password will not expire...
If apache is not running as a service, then you will need to determine how
it is starting up, and modify that to run under a different process with
modified user permissions.

I definitely agree about using non-mapped addresses and using the actual

Server Name addresses.



For ease on the eyes, mappings are great, but they are not reliable for
programming purposes, IMHO.

For the advanced PHP gurus on the list, is it accurate to characterize PHP
as relying on Apache for file manipulation? Is it accurately described as:

Process Request-PHP-Apache-[File System Poof!]-Apache-PHP-Process

??? Just making sure I have this characterization correct.

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


[PHP] Protecting MySQL Injection from PHP form

2007-05-24 Thread Jason Pruim

Hi Everyone,

I think I have found away to prevent SQL code injection into my  
database and just wanted to get everyones comments on my method.


?PHP
include 'defaults.php';

// Setting error message variable to nothing
$errmsg = ;

// Check form info
if (!isset($_POST['FName']) || empty($_POST['FName']))  
$errmsg .=PPlease enter your name/P;
if (!isset($_POST['LName']) || empty($_POST['LName']))  
$errmsg .=PPlease enter your address/P;
if (!isset($_POST['Add1']) || empty($_POST['Add1']))  
$errmsg .=PPlease enter your city/P;
if (!isset($_POST['City']) || empty($_POST['City']))  
$errmsg .=PPlease enter your state/P;
if (!isset($_POST['State']) || empty($_POST['State']))  
$errmsg .=PPlease enter your zip code/P;
if (!isset($_POST['Zip']) || empty($_POST['Zip']))  
$errmsg .=PPlease include your zipe code/P;
if (!isset($_POST['subName']) || empty($_POST['subName']))  
$errmsg .=P Please enter your submitter name/P;



// Tell script what to do if there is a error message
if ($errmsg!= ) {
echo $errmsg;
echo a href=\javascript:history.back();\Please go back and fill  
out the missing fields/a;

exit;
} else {
echo psuccess: all fields were filled out/p;
}


$FName= $_POST['FName'];
$LName= $_POST['LName'];
$Add1= $_POST['Add1'];
$Add2= $_POST['Add2'];
$City= $_POST['City'];
$State= $_POST['State'];
$Zip= $_POST['Zip'];
$Date= $_SERVER['REQUEST_TIME'];
$Record= \t;
$subName= $_POST['subName'];
$subEmail= $_POST['subEmail'];
$subPhone= $_POST['subPhone'];
$chkMember=serialize($_POST['chkMember']);
$chkAdd=serialize($_POST['chkAdd']);
$chkDel=serialize($_POST['chkDel']);



echo $FName First NameBR;
$link = mysqli_connect($server, $username, $password, $database)
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully BR';
//mysqil_select_db('legion') or die('Could not select database' .  
mysql_error());

echo 'DB selected BR';


//Create the statement
$stmt = mysqli_prepare($link, INSERT INTO current VALUES  
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?));
mysqli_stmt_bind_param($stmt, 'sss', $FName, $LName, 
$Add1, $Add2, $City, $State, $Zip, $Date, $Record, $subName,  
$subEmail, $subPhone, $chkMember, $chkAdd, $chkDel);

//Add the record
mysqli_stmt_execute($stmt);
printf(%d Row Inserted.\n, mysqli_stmt_affected_rows($stmt));

//Close the statement
mysqli_stmt_close($stmt);



?

The reason I am echoing $FName just above the link was a debugging  
tool to make sure that it was filling at least SOME of the field  
properly before inserting them into the database.


Also, just for planning purposes, I do plan on adding authentication  
to the form (Which I think I can do and track with sessions) but I  
have alot more reading to do before I can get that right.


One other thing... What I did to test it was in the $FName field I  
typed: Jason; SELECT * FROM table; and it inserted the value, but  
didn't execute the code, Am I correct in thinking that I'm fairly  
safe from the bad people and the stupid users?


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



[PHP] Re: Protecting MySQL Injection from PHP form

2007-05-24 Thread Jared Farrish

I'm not sure exactly what kind of sanitization you think you're doing, but
if all you do is check to see if it's empty (empty() implements isset(),
empty() checks to see if it's set, then if it evaluates to an empty
variable), that's not much sanitization.

What you need to do is check for SQL injections, which means you need to
sanitize GPC (GET, POST, COOKIES) to prevent the following (only a
demonstration):

SELECT `colname` FROM `tablename` WHERE id='$variable' LIMIT 0,10

What happens if $variable is equal to:

$variable = $_POST['somedata'];

And $_POST['somedata'] ~  'INSERT INTO users
VALUES('name','password','AdminGroup')' ;

This is an example of a possible SQL injection (which means unknown SQL code
is running through your script access). The way to prevent this is to escape
single quotes before insert/select, and also turn all html entities into
escaped values (so that someone cannot put a script/script block into
the signature for their user, for example).

The good thing is, there are numerous help sites online that describe how to
do this. Generally, you're better off wrapping your SQL commands into a
class or at least a series of functions, so that you can implement your
sanitization once and use it for all database interactions.

Google: http://www.google.com/search?q=php+sanitize+sql+statement
PHP.net: http://www.php.net/manual/en/security.database.sql-injection.php

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


Re: [PHP] Protecting MySQL Injection from PHP form

2007-05-24 Thread Stephen


Jason Pruim [EMAIL PROTECTED] wrote:  Hi Everyone,

I think I have found away to prevent SQL code injection into my 
database and just wanted to get everyones comments on my method.

  
 Am I correct in thinking that I'm fairly 
safe from the bad people and the stupid users?



   
   
  You need to consider someone entering scripts that could do bad things when 
the data is sent to a web site. You use the function htmlspecialchars() for 
this (or one of its siblings).
   
  You should also use mysql_real_eascape_string() on any data being inserted 
into your database.
   
  But you must deal with magic quotes first. If they are enabled, I remove them 
from my posted variables as the first step.
   
  Cheers
  Stephen



[PHP] Re: Protecting MySQL Injection from PHP form

2007-05-24 Thread Darren Whitlen

Jason Pruim wrote:

Hi Everyone,

I think I have found away to prevent SQL code injection into my database 
and just wanted to get everyones comments on my method.


?PHP
include 'defaults.php';

// Setting error message variable to nothing
$errmsg = ;

// Check form info
if (!isset($_POST['FName']) || empty($_POST['FName'])) $errmsg 
.=PPlease enter your name/P;
if (!isset($_POST['LName']) || empty($_POST['LName'])) $errmsg 
.=PPlease enter your address/P;
if (!isset($_POST['Add1']) || empty($_POST['Add1'])) $errmsg 
.=PPlease enter your city/P;
if (!isset($_POST['City']) || empty($_POST['City'])) $errmsg 
.=PPlease enter your state/P;
if (!isset($_POST['State']) || empty($_POST['State'])) $errmsg 
.=PPlease enter your zip code/P;
if (!isset($_POST['Zip']) || empty($_POST['Zip'])) $errmsg .=PPlease 
include your zipe code/P;
if (!isset($_POST['subName']) || empty($_POST['subName'])) $errmsg 
.=P Please enter your submitter name/P;



// Tell script what to do if there is a error message
if ($errmsg!= ) {
echo $errmsg;
echo a href=\javascript:history.back();\Please go back and fill out 
the missing fields/a;

exit;
} else {
echo psuccess: all fields were filled out/p;
}


$FName= $_POST['FName'];
$LName= $_POST['LName'];
$Add1= $_POST['Add1'];
$Add2= $_POST['Add2'];
$City= $_POST['City'];
$State= $_POST['State'];
$Zip= $_POST['Zip'];
$Date= $_SERVER['REQUEST_TIME'];
$Record= \t;
$subName= $_POST['subName'];
$subEmail= $_POST['subEmail'];
$subPhone= $_POST['subPhone'];
$chkMember=serialize($_POST['chkMember']);
$chkAdd=serialize($_POST['chkAdd']);
$chkDel=serialize($_POST['chkDel']);



echo $FName First NameBR;
$link = mysqli_connect($server, $username, $password, $database)
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully BR';
//mysqil_select_db('legion') or die('Could not select database' . 
mysql_error());

echo 'DB selected BR';


//Create the statement
$stmt = mysqli_prepare($link, INSERT INTO current VALUES 
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?));
mysqli_stmt_bind_param($stmt, 'sss', $FName, $LName,$Add1, 
$Add2, $City, $State, $Zip, $Date, $Record, $subName, $subEmail, 
$subPhone, $chkMember, $chkAdd, $chkDel);

//Add the record
mysqli_stmt_execute($stmt);
printf(%d Row Inserted.\n, mysqli_stmt_affected_rows($stmt));

//Close the statement
mysqli_stmt_close($stmt);



?

The reason I am echoing $FName just above the link was a debugging tool 
to make sure that it was filling at least SOME of the field properly 
before inserting them into the database.


Also, just for planning purposes, I do plan on adding authentication to 
the form (Which I think I can do and track with sessions) but I have 
alot more reading to do before I can get that right.


One other thing... What I did to test it was in the $FName field I 
typed: Jason; SELECT * FROM table; and it inserted the value, but 
didn't execute the code, Am I correct in thinking that I'm fairly safe 
from the bad people and the stupid users?


I cannot see any sql-injection protection in your code anywhere? Seems 
as your using mysqli, take a look at the mysqli_real_escape_string() 
function. You need to run each _POST variable throught it.


$FName = mysqli_real_escape_string($_POST['FName']);

Or if your post data only contains data to be entered into the database, 
you might consider running everything through the function to make 
things easier:


foreach($_POST as $k = $v)
$_POST[$k] = mysqli_real_escape_string($v);


Darren

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



[PHP] Re: Protecting MySQL Injection from PHP form

2007-05-24 Thread Jared Farrish

Also, you should be checking against type (expecting a number? a boolean
value? a string?) and then checking against expected length requirements
(such as firstname can only be 80 characters long max, so maybe check for

code
if (strlen($var)  80) {
   do something;
}
/code

In unit testing, you build your objects first against types and perform
object checks using type verification and expected element attributes (such
as length, non-null values, etc...). If someone is posting a string of 8000
letters into a field that is supposed to contain a number two letters long,
before it is stored, maybe you manage that...

On 5/24/07, Jared Farrish [EMAIL PROTECTED] wrote:


I'm not sure exactly what kind of sanitization you think you're doing, but
if all you do is check to see if it's empty (empty() implements isset(),
empty() checks to see if it's set, then if it evaluates to an empty
variable), that's not much sanitization.

What you need to do is check for SQL injections, which means you need to
sanitize GPC (GET, POST, COOKIES) to prevent the following (only a
demonstration):

SELECT `colname` FROM `tablename` WHERE id='$variable' LIMIT 0,10

What happens if $variable is equal to:

$variable = $_POST['somedata'];

And $_POST['somedata'] ~  'INSERT INTO users
VALUES('name','password','AdminGroup')' ;

This is an example of a possible SQL injection (which means unknown SQL
code is running through your script access). The way to prevent this is to
escape single quotes before insert/select, and also turn all html entities
into escaped values (so that someone cannot put a script/script block
into the signature for their user, for example).

The good thing is, there are numerous help sites online that describe how
to do this. Generally, you're better off wrapping your SQL commands into a
class or at least a series of functions, so that you can implement your
sanitization once and use it for all database interactions.

Google: http://www.google.com/search?q=php+sanitize+sql+statement
PHP.net: http://www.php.net/manual/en/security.database.sql-injection.php

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$





--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


[PHP] Check if Record was Entered Today.

2007-05-24 Thread Rahul Sitaram Johari

Ave,

I have a dbase (dbf) database and I¹m using PHP¹s dbase function to open 
search the database.
Each row in the database contains an Account Number and the Date it was
inserted. 

I want to search this database for to see if the Account number ($thekey)
was inserted today (using date() to find out today¹s date).

Essentially, here¹s the code:

$db = dbase_open(try.dbf, 0);
if ($db) {
  $record_numbers = dbase_numrecords($db);
for ($i = 1; $i = $record_numbers; $i++) {
$row = dbase_get_record_with_names($db, $i);

$thedate = date(mdY);
if(($row['ACC'] == $thekey)  ($row['DATE'] == $thedate)) {
echo The Account Number has already been entered once today;
echo $row['DATE']. : .$thedate;
exit;  
}
else {
echo The Account Number exists but not entered todaybr;
echo $row['DATE']. : .$thedate;
exit;
}
}
}

The problem is ­ the scripts stops at the first entry of the Account Number,
and is not looping through all the rows which contain the Account Number. So
if the Account Number was entered yesterday, it stops and gives ³The Account
Number exists but not entered today² even though the Account Number does
exist in another row with Today¹s Date.

How do I make it loop through all the rows and check if there is any entry
with the Account Number  Today¹s Date?

Thanks,


~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: [EMAIL PROTECTED]

³I morti non sono piu soli ... The dead are no longer lonely²



RE: [PHP] Check if Record was Entered Today.

2007-05-24 Thread Jim Moseby


 -Original Message-
 From: Rahul Sitaram Johari [mailto:[EMAIL PROTECTED]
 Sent: Thursday, May 24, 2007 1:42 PM
 To: PHP
 Subject: [PHP] Check if Record was Entered Today.
 
 
 
 Ave,
 
 I have a dbase (dbf) database and I¹m using PHP¹s dbase 
 function to open 
 search the database.
 Each row in the database contains an Account Number and the 
 Date it was
 inserted. 
 
 I want to search this database for to see if the Account 
 number ($thekey)
 was inserted today (using date() to find out today¹s date).
 
 Essentially, here¹s the code:
 
 $db = dbase_open(try.dbf, 0);
 if ($db) {
   $record_numbers = dbase_numrecords($db);
 for ($i = 1; $i = $record_numbers; $i++) {
 $row = dbase_get_record_with_names($db, $i);
 
 $thedate = date(mdY);
 if(($row['ACC'] == $thekey)  ($row['DATE'] == 
 $thedate)) {
 echo The Account Number has already been entered 
 once today;
 echo $row['DATE']. : .$thedate;
 exit;  
 }
 else {
 echo The Account Number exists but not entered 
 todaybr;
 echo $row['DATE']. : .$thedate;
 exit;
 }
 }
 }
 
 The problem is ­ the scripts stops at the first entry of the 
 Account Number,
 and is not looping through all the rows which contain the 
 Account Number. So
 if the Account Number was entered yesterday, it stops and 
 gives ³The Account
 Number exists but not entered today² even though the Account 
 Number does
 exist in another row with Today¹s Date.
 
 How do I make it loop through all the rows and check if there 
 is any entry
 with the Account Number  Today¹s Date?
 
 Thanks,



'exit' terminates the script.  You should not be using exit there.

JM

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



Re: [PHP] Check if Record was Entered Today.

2007-05-24 Thread Dan Shirah


Ave,

I have a dbase (dbf) database and I¹m using PHP¹s dbase function to open 
search the database.
Each row in the database contains an Account Number and the Date it was
inserted.

I want to search this database for to see if the Account number ($thekey)
was inserted today (using date() to find out today¹s date).

Essentially, here¹s the code:

   $db = dbase_open(try.dbf, 0);
   if ($db) {
 $record_numbers = dbase_numrecords($db);
   for ($i = 1; $i = $record_numbers; $i++) {
   $row = dbase_get_record_with_names($db, $i);

   $thedate = date(mdY);
   if(($row['ACC'] == $thekey)  ($row['DATE'] == $thedate)) {



I believe you need a while instead of an if.  The if will only run
until the first occurance is true.   Whereas a while will run to find all
results that are true until it goes thru all of the result rows..

  echo The Account Number has already been entered once today;

   echo $row['DATE']. : .$thedate;
   exit;
   }
   else {
   echo The Account Number exists but not entered todaybr;
   echo $row['DATE']. : .$thedate;
   exit;
   }
   }
   }

The problem is ­ the scripts stops at the first entry of the Account
Number,
and is not looping through all the rows which contain the Account Number.
So
if the Account Number was entered yesterday, it stops and gives ³The
Account
Number exists but not entered today² even though the Account Number does
exist in another row with Today¹s Date.

How do I make it loop through all the rows and check if there is any entry
with the Account Number  Today¹s Date?

Thanks,


~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: [EMAIL PROTECTED]

³I morti non sono piu soli ... The dead are no longer lonely²




Re: [PHP] php hosting-mediatemple/dreamhost

2007-05-24 Thread Robert Cummings
On Thu, 2007-05-24 at 09:04 -0400, blackwater dev wrote:
 Forgive me if this is a bit off topic but I currenly have several sites
 hosted with dreamhost, it's cheap and well prone to be slow.  Does anyone
 have experience with mediatemple?  I would just be running php/mysql sites.

One of my customers uses mediatemple. I've had good experience with
their Dedicated Virtual Server solution. I recently migrated their old
MT server to the new setup that uses CentOS 4.4, PHP 4.3.9, and MySQL
4.1.20. It's nice because it's a completely isolated Virtual Server with
root access to configure things as you please. Since they use the free
CentOS it's easy to compile stuff in a VMWare clone and migrate the
binaries over. General admin goes through Plesk which is pretty much
idiot proof.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Question about using ftp_put() for copying files

2007-05-24 Thread Al

Can anyone explain what's going on.

If I assign $source= $source_dir . $file;
$source_dir is the absolute path i.e., /home/x/public_html/EditPage/

And $dist= $dist_dir . $file;
$dist_dir is simply relative to $_SERVER[document_root]; i.e., just plain  /test

To get ftp_put() to work, I must first chdir to the $dist_dir.

ftp_chdir($dist_dir);
ftp_put($conn_id, $dist, $source, flag];

Thanks

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



[PHP] Re: php hosting-mediatemple/dreamhost

2007-05-24 Thread Jared Farrish

I use MediaTemple, and what I like is that it's a company geared towards a
category of developers, and not ANY person who wants a website. So the
services and support are commensurate for a company that offers services
primarily aimed at professional design-oriented firms and/or developers, and
not Joe Schmo Website Author. Service request responses have always been
quick, I've never lost data, had a website disappear altogether, etc...

The GRID server configuration is nice at a $20 pricepoint. With PHP5
supported and safe_mode turned off, I can't wait to get off the shared
server.

Shawn Inman is a modestly-famous web designer/developer who uses MediaTemple
for his website:

http://www.shauninman.com/

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


[PHP] Re: Check if Record was Entered Today.

2007-05-24 Thread Jared Farrish

I believe you need a while instead of an if.  The if will only run
until the first occurance is true.   Whereas a while will run to find

all

results that are true until it goes thru all of the result rows..


No, I think he's checking to make sure that $db contains a resource id and
not a boolean false (meaning the file did not load or contains no data).

Maybe a more descriptive way may be to say:

code
if ($db !== false  is_resource($db)) {
   doStuff();
}
/code

To the next problem:


'exit' terminates the script.  You should not be using exit there.


When you want a loop structure to stop and goto what flows next in the code,
use break:

code
for ($i = 0; $i  count($items); $i++) {
   if ($items[$i] == $arbitraryCondition) {
   echo 'I do not need to doStuff() anymore.';
   break;
   }
   doStuff();
}
/code

When you want a loop structure to skip over something but still continue to
loop, use continue:

code
for ($i = 0; $i  count($items); $i++) {
   if ($items[$i] == $arbitraryCondition) {
   echo 'I do not need to doStuff() on this item.';
   continue;
   }
   doStuff();
}
/code

When reading through values in an array or other structure, you can while or
do/while loop:

code
$db = getDb('location/db.dbf');
while($row = db_fetch_array($result)) {
   if ($row['AcctActivation'] != $date) {
   continue;
   } elseif ($row['AcctActivation'] == $date) {
   break;
   }
   doStuff();
}
/code

Isn't there a way to search for and select only the rows with the account
number though? If you're looking for needles in a (potentially large)
haystack, this sounds like an expensive process for something SQL or other
could do better/faster.



Incidentally, does this mean you solved the file access problems from this
thread:

http://news.php.net/php.general/255542

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


[PHP] Did I find a bug in PHP 5.2.2?

2007-05-24 Thread Patrick Baldwin


First off, I'd like to explain I'm not a PHP programmer, so please
bear with me. I'm trying to configure a Horde/IMP server.  It worked
yesterday.  I installed rsync via packages, rebooted, and now no one
can log into my Horde/IMP install.  Why am I posting here? Well,
when I look in httpd-error.log, I see:

 [Thu May 24 14:05:59 2007] [notice] Apache/1.3.37 (Unix) PHP/5.2.2 with
 Suhosin-
 Patch configured -- resuming normal operations
   [notice] Accept mutex: flock (Default: flock)
 [Thu May 24 14:09:53 2007] [notice] child pid 729 exit signal
 Segmentation fault
   (11)
 [Thu May 24 14:13:30 2007] [notice] child pid 755 exit signal
 Segmentation fault
   (11)
 [Thu May 24 14:13:31 2007] [notice] child pid 759 exit signal
 Segmentation fault
   (11)
 [Thu May 24 14:25:09 2007] [notice] child pid 731 exit signal
 Segmentation fault
   (11)
 [Thu May 24 14:25:10 2007] [notice] child pid 727 exit signal
 Segmentation fault


As well as:


 webmail# tail messages
 May 24 14:09:52 webmail kernel: pid 729 (httpd), uid 80: exited on 
signal 11

 May 24 14:10:11 webmail ntpd[545]: time reset +0.227112 s
 May 24 14:10:11 webmail ntpd[545]: kernel time sync disabled 2041
 May 24 14:13:29 webmail kernel: pid 755 (httpd), uid 80: exited on 
signal 11
 May 24 14:13:30 webmail kernel: pid 759 (httpd), uid 80: exited on 
signal 11
 May 24 14:25:08 webmail kernel: pid 731 (httpd), uid 80: exited on 
signal 11
 May 24 14:25:09 webmail kernel: pid 727 (httpd), uid 80: exited on 
signal 11

 May 24 14:25:17 webmail ntpd[545]: kernel time sync enabled 2001


From http://wiki.horde.org/FAQ/Admin/Troubleshoot/IMP, I got the
impression that the Horde/IMP folks don't think it's very likely
that their software should be able to cause this sort of problem.

I'm using FreeBSD 6.2-RELEASE-p4, horde-base-3.1.4_2, imp-4.1.4_2,
Apache/1.3.37, and PHP 5.2.2 with the Suhosin patch.

If someone else has some idea about this already, that'd be
great.  I'm willing to try and help figure it out if more
experienced (at all experienced, really) PHP people think this
is a worthwhile avenue of inquiry, but I'm afraid I'll need a
little help.  For example, what does must have PHP configured with 
--enable-debug mean I need to do, exactly?  And where should I

be looking for php core files?  I suspect there's probably more
questions I don't even know to ask yet, but you got to start
somewhere.


Regards,

Patrcik Baldwin

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



RE: [PHP] Did I find a bug in PHP 5.2.2?

2007-05-24 Thread Jim Moseby
snip
  It worked yesterday. 
/snip

I don't have any idea what could cause your problem, but with your
permission I think I'll have some t-shirts printed up with this slogan.  ;-)

JM

---
It worked yesterday. - unknown

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



[PHP] Developer / Client Documents

2007-05-24 Thread Anthony Hiscox

First my problem, then a tiny bit of background information.

I am trying to start a small (Read: Tiny) web development company from home,
which will handle only a few light contracts. I have been spending some time
searching Google for common documents used by developers and their clients
to help layout all the goals and features the site might have. Unfortunately
since I have not obtained any formal education, I am experiencing a slight
fish-out-of-water syndrome, and am not even sure of the names of the
documents I am seeking. I would be eternally grateful if some experienced
developers would point me in the right direction; any documents related to
planning the website, contracts, really anything would be considered useful.


Now a little background, I am a stay at home father, with the majority of my
daily duties centralized around wiping feces from the rear end of a young
boy, feeding, and teaching. I don't have the time, money, nor resources to
go to school for this, but am quite happy reading about web development
whenever I get the opportunity  (often  3-6 hours daily).  I have what I
believe to be a solid understanding of PHP, MySQL and Javascript basics, as
well as w3c compliant HTML, and CSS. Currently I am spending some time
studying the CakePHP framework. I also have a (very) basic understanding of
XSS attacks, and SQL injections techniques and am working on improving this.

I welcome ALL advice, even if it is not related to my initial question
(Developer / Client documents) especially if the responder is, or was, a
stay at home parent. However advice from anyone would be greatly welcomed,
regardless of prior experiences.

--
-
Anthony Hiscox

Video Watch Group
Public Site Currently Under Development
Group Members Site Fully Operational
-


Re: [PHP] Did I find a bug in PHP 5.2.2?

2007-05-24 Thread Richard Lynch
On Thu, May 24, 2007 3:15 pm, Patrick Baldwin wrote:

 First off, I'd like to explain I'm not a PHP programmer, so please
 bear with me. I'm trying to configure a Horde/IMP server.  It worked
 yesterday.  I installed rsync via packages, rebooted, and now no one
 can log into my Horde/IMP install.  Why am I posting here? Well,
 when I look in httpd-error.log, I see:

 If someone else has some idea about this already, that'd be
 great.  I'm willing to try and help figure it out if more
 experienced (at all experienced, really) PHP people think this
 is a worthwhile avenue of inquiry, but I'm afraid I'll need a
 little help.  For example, what does must have PHP configured with
 --enable-debug mean I need to do, exactly?  And where should I
 be looking for php core files?  I suspect there's probably more
 questions I don't even know to ask yet, but you got to start
 somewhere.

I believe this site has sufficient info to de-mystify most of this:
http://bugs.php.net

You may have a rather steep learning curve if you've never installed
any Un*x software from source...

To address your specific questions:

--enable-debug is a flag you would pass to ./configure along with
--enable-mysql and --enable-imap and any other fun extensions you use
to compile PHP from source.

A 'core' file is generally dumped into the directory you started in
when you run a program...  When Apache is started up and forks off
children and all that, this becomes a bit murky.  Fortunately, you can
start Apache in single user (?) mode with -S at startup, and then
you can surf to the one and only Apache child, and almost-for-sure,
your core dump will be right there in the directory where you started,
or maybe in Apache's bin directory.  But somewhere where you would
expect to find it.

You may also want to check with the Suhosin folks before you post a
bug to bugs.php.net, as the first response at bugs.php.net is to take
Suhosin out of the picture and see if the segfault still happens --
They really can't do much about it if Suhosin added in code that
broke things...

There may also be others using Horde/IMP who have posted similar
experiences in Horde/IMP forums/lists/etc.

Good luck!

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Question about using ftp_put() for copying files

2007-05-24 Thread Richard Lynch


On Thu, May 24, 2007 2:37 pm, Al wrote:
 Can anyone explain what's going on.

 If I assign $source= $source_dir . $file;
 $source_dir is the absolute path i.e.,
 /home/x/public_html/EditPage/

 And $dist= $dist_dir . $file;
 $dist_dir is simply relative to $_SERVER[document_root]; i.e., just
 plain  /test

 To get ftp_put() to work, I must first chdir to the $dist_dir.

 ftp_chdir($dist_dir);
 ftp_put($conn_id, $dist, $source, flag];

Similar to 'document_root', FTP has its own idea of where a root
directory is for each login/user.

In your case, it would appear by coincidence to match up with
'document_root' -- well, perhaps not coincidence since many webhosts
restrict their users' FTP accounts to only be their own web
directories, so they can't go poking around in other people's stuff
quite as easily.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Check if Record was Entered Today.

2007-05-24 Thread Richard Lynch
On Thu, May 24, 2007 12:42 pm, Rahul Sitaram Johari wrote:

 Ave,

 I have a dbase (dbf) database and I¹m using PHP¹s dbase function to
 open 
 search the database.
 Each row in the database contains an Account Number and the Date it
 was
 inserted.

 I want to search this database for to see if the Account number
 ($thekey)
 was inserted today (using date() to find out today¹s date).

 Essentially, here¹s the code:

 $db = dbase_open(try.dbf, 0);
 if ($db) {

$exists = false;
$today = false;

   $record_numbers = dbase_numrecords($db);
 for ($i = 1; $i = $record_numbers; $i++) {
 $row = dbase_get_record_with_names($db, $i);

 $thedate = date(mdY);
 if(($row['ACC'] == $thekey)  ($row['DATE'] == $thedate))
 {
// echo The Account Number has already been entered once
// today;
// echo $row['DATE']. : .$thedate;
// exit;
$today = true;
 }
 else {
// echo The Account Number exists but not entered
// todaybr;
// echo $row['DATE']. : .$thedate;
// exit;

$exists = true;

 }
 }
 }

if ($today) echo Yes, today.;
elseif ($exists) echo Yes, but not today.;
else echo No.;

 The problem is ­ the scripts stops at the first entry of the Account
 Number,
 and is not looping through all the rows which contain the Account
 Number. So
 if the Account Number was entered yesterday, it stops and gives ³The
 Account
 Number exists but not entered today² even though the Account Number
 does
 exist in another row with Today¹s Date.

exit; completely halts a script and does NOTHING else.

You  maybe thought you wanted 'continue' or 'break' but those wouldn't
work for this either.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



[PHP] Re: Developer / Client Documents

2007-05-24 Thread Jared Farrish


I am trying to start a small (Read: Tiny) web development company from
home,
which will handle only a few light contracts. I have been spending some
time
searching Google for common documents used by developers and their clients
to help layout all the goals and features the site might have.
Unfortunately
since I have not obtained any formal education, I am experiencing a slight
fish-out-of-water syndrome, and am not even sure of the names of the
documents I am seeking. I would be eternally grateful if some experienced
developers would point me in the right direction; any documents related to
planning the website, contracts, really anything would be considered
useful.



What you are looking for are project development and project management
books that describe how projects are organized, documented, etc...

First, google design patterns gang of four
Second, visit
http://trac.seagullproject.org/wiki/Standards/SoftwareBestPractices
Third, look at: http://trac.seagullproject.org/wiki/Standards
Fourth, visit: http://www.oreilly.com/pub/topic/projectmanagement
   and http://www.oreilly.com/pub/topic/designpatterns

Also, I might suggest:

http://www.oreilly.com/catalog/webdbapps2/

This will give you most of what you're looking for. Think XAMPP for a
localhost install to run tests, and MySQL for a database backend (part of
XAMPP):

http://www.apachefriends.org/en/xampp.html

It will take time. Good luck!

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


Re: [PHP] Protecting MySQL Injection from PHP form

2007-05-24 Thread Richard Lynch
Yes, prepared statements protect from SQL injection because the data
is clearly separated from the SQL code, and MySQL knows what to do
with data

The rest of your code has absolutely NOTHING to do with SQL injection,
but with data validation and business logic.

On Thu, May 24, 2007 11:10 am, Jason Pruim wrote:
 I think I have found away to prevent SQL code injection into my
 database and just wanted to get everyones comments on my method.

 //Create the statement
 $stmt = mysqli_prepare($link, INSERT INTO current VALUES
 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?));
 mysqli_stmt_bind_param($stmt, 'sss', $FName, $LName,
 $Add1, $Add2, $City, $State, $Zip, $Date, $Record, $subName,
 $subEmail, $subPhone, $chkMember, $chkAdd, $chkDel);
 //Add the record
 mysqli_stmt_execute($stmt);



-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Creating an executer

2007-05-24 Thread Richard Lynch
I only skimmed this, but afaik the only way to get the child PID is to
fork rather than to exec.

On Thu, May 24, 2007 10:10 am, [EMAIL PROTECTED] wrote:
 Hi,

 Summary:

 1. I execute script1 that will run in the background (daemon)
 2. script1 needs to execute script2 and capture STDERR, STDOUT and
 exitcode from script2 if script2 exits before SIGTERM is received.
 3. If I send SIGTERM to script1 it should kill script2, and write to
 DB (or log  file some information that it was stopped)

 Simple, isn't it? But I cannot seam to get it to work. Anyone with
 some example code that does the same thing?


 =

 More complex description

 I have some scripts (perl, c, php, or anything else) that simple
 independent scripts that do some stuff and output STDOUT and STDERR
 and exit with an exitcode. There scripts will be kept like this, and
 will not change their behavior.

 Now I need to control them and also log their STDOUT, STDERR and
 exitcode. Ok, that far I have come, so that I am logging the STDOUT,
 STDERR and exitcode. What I am doing is that I have created an
 executer that takes care of this and writing it to DB.

 Now I need to add a functionality so that when the executer receives a
 SIGTERM signal it should kill the script (that was started with a
 exec() call, and then log some information to the DB (that the script
 was killed etc).

 I have registered the signal SIGTERM with pcntl_signal(SIGTERM,
 sig_handler). When I am testing I just write some info to a file
 when the signal is received. I created a simple testing script with a
 while(true) loop and then send the signal to the script and it
 successfully writes the information to the logflie.

 Ok, now I instead of a while(true) loop make an exec() call to a
 script (that is running for ever) and send the signal, then it does
 not write to the file as it is supposed to. I guess it is because the
 script is busy running the exec command.

 I tried to then exec() it in the background. The problem there is that
 it becomes a daemon and then I cannot know what that script is doing,
 and it will not send any SIGCHLD to the parent, or it does, but to
 init. Or actually there will be a SIGCHLD sent, as the exec() will
 open its own shell, and then the shell will exit and we get the
 SIGCHLD from the shell instead of the executed script.

 Is there any way to get the child process PID when you exec() and
 send it to the background? But then, how can I capture the exitcode?
 The STDERR and STDOUT is fine as I can direct it to a file and get it
 from there.

 I have a really ugly workarounds: I could append an dummy variable to
 the execution of the script and then do a grep of the ps -ef to get
 the PID of that script.

 /Peter

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] php hosting-mediatemple/dreamhost

2007-05-24 Thread Richard Lynch
On Thu, May 24, 2007 8:04 am, blackwater dev wrote:
 Forgive me if this is a bit off topic but I currenly have several
 sites
 hosted with dreamhost, it's cheap and well prone to be slow.  Does
 anyone
 have experience with mediatemple?  I would just be running php/mysql
 sites.

I found Media Temple more annoying than helpful as webhosts.  Getting
SSH access was like pulling teeth.

Dreamhost mostly left me alone to do my job, except for the
stupid/funny newsletter.  There is probably down-time, but I hacked a
fail-safe roll-over to another server elsewhere, so I don't even
notice it being down.

YMMV

I would not consider either one a top notch operation, frankly...

There are a few million other hosts to choose from, fortunately.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Richard Lynch


On Thu, May 24, 2007 6:23 am, Jean-Christophe Roux wrote:
 Hello,
 I have folder A with the following php script:
 ?php
 session_start();
 $_SESSION['dummy']=10;
 echo $_SESSION['dummy'];
 ?
 in folder B (same level as A), there is
 ?php
 session_start();
 echo $_SESSION['dummy'];
 ?
 when running the script in B, in can see the value 10. How can I make
 sure that the $_SESSION['dummy'] is not shared between the two
 scripts? I could change the name but that would not be convenient.

http://php.net/sesssion_set_cookie_params
Second arg can be set to '/A' in folder A and '/B' in folder B and the
session will not cross that border.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Richard Lynch
On Thu, May 24, 2007 7:44 am, Stut wrote:
 Darren Whitlen wrote:
 Stut..
 I've only been here one day, and I think I'm right in saying that
 your
 the one around here that gets annoyed really easy ;)

 Not really, I just tend to be a bit more vocal about it.

I daresay every regular has vented one time or another about their own
pet peeves...

Except me, of course, whose every post is on-topic and not at all biased.
:-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] two php scripts with same $_SESSION variables

2007-05-24 Thread Stut

Richard Lynch wrote:

On Thu, May 24, 2007 7:44 am, Stut wrote:

Darren Whitlen wrote:

Stut..
I've only been here one day, and I think I'm right in saying that
your
the one around here that gets annoyed really easy ;)

Not really, I just tend to be a bit more vocal about it.


I daresay every regular has vented one time or another about their own
pet peeves...

Except me, of course, whose every post is on-topic and not at all biased.
:-)


Nicely contradicted yourself there. Colour me impressed! ;)

-Stut

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



Re: [PHP] Database error: Invalid SQL:

2007-05-24 Thread Richard Lynch
On Wed, May 23, 2007 11:42 pm, wisuttorn wrote:

 I have a problem  please help me
 when i loged in to egroup this show 
 Database error: Invalid SQL: SELECT DISTINCT
 egw_cal_repeats.*,egw_cal.*,cal_start,cal_end,cal_recur_date FROM
 egw_cal
 JOIN egw_cal_dates ON egw_cal.cal_id=egw_cal_dates.cal_id JOIN
 egw_cal_user
 ON egw_cal.cal_id=egw_cal_user.cal_id LEFT JOIN egw_cal_repeats ON
 egw_cal.cal_id=egw_cal_repeats.cal_id WHERE (cal_user_type='u' AND
 cal_user_id IN (6,-1)) AND cal_status != 'R' AND 1179939600  cal_end
 AND
 cal_start  1180025999 AND (recur_type IS NULL AND cal_recur_date=0 OR
 cal_recur_date=cal_start) ORDER BY cal_start
 mysql Error: 1064 (You have an error in your SQL syntax near 'ON
 egw_cal.cal_id=egw_cal_dates.cal_id JOIN egw_cal_user ON
 egw_cal.cal_id=egw_c' at line 1)

This is an SQL error.

Ask an SQL list.

At a guess, I'd say the version of SQL you have doesn't support all
JOIN types.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] help with multi dimensional arrays

2007-05-24 Thread Richard Lynch


On Wed, May 23, 2007 9:59 pm, James Lockie wrote:
 I get a syntax error on strlen.


 $newTypes = array();
 $newTypes[0] = array();
 $newTypes[0][0] = Starting with
 $newTypes[0][1] = strlen( $newTypes[0][0] );

If you are missing the ; in the line before, PHP gets pretty confused
and tries to smush the two lines together, essentially, and then...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



[PHP] System log in problems

2007-05-24 Thread Rich Peterson

Hi All

Let me start by saying I am not 100% sure this
is the correct board to post this to. I hope it is
because as i have watched this list it contains
some very helpful people.

I have search for an answer to this and cannot
seem to find it.  We have a subscription based
site that is developed mainly with php and mysql.
We have one person who each time he attempts
to log in it just rolls back to the login page. With
almost 2000 users this is the only time we have
come across this problem. He is not running your
average system at his home the details are.

Operating system is Ubuntu 7.04 released in April 2007
 also using Firefox Version 2.0.03
Mozilla/5.0 (x11; U; Linusi686; en-US;rv:1.8.13) Gecko/200611201
Firefox/ 2.0.0.3 (Ubuntu-feisty)


I can login using firefox and ie no problem but am running a
more common windows system. Is there something on our
end that could be causing this problem for him?

Thanks in advance
Rich

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



Re: [PHP] Question about using ftp_put() for copying files

2007-05-24 Thread Al
What puzzles me is that one path must be absolute and the other relative to the root. And, I've got chdir to the 
destination dir.


I know about ftp having its own root.  In my code, I have a check to make certain the ftp root is the same as the 
$_SERVER[document_root].


Richard Lynch wrote:


On Thu, May 24, 2007 2:37 pm, Al wrote:

Can anyone explain what's going on.

If I assign $source= $source_dir . $file;
$source_dir is the absolute path i.e.,
/home/x/public_html/EditPage/

And $dist= $dist_dir . $file;
$dist_dir is simply relative to $_SERVER[document_root]; i.e., just
plain  /test

To get ftp_put() to work, I must first chdir to the $dist_dir.

ftp_chdir($dist_dir);
ftp_put($conn_id, $dist, $source, flag];


Similar to 'document_root', FTP has its own idea of where a root
directory is for each login/user.

In your case, it would appear by coincidence to match up with
'document_root' -- well, perhaps not coincidence since many webhosts
restrict their users' FTP accounts to only be their own web
directories, so they can't go poking around in other people's stuff
quite as easily.



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



Re: [PHP] Include file questions

2007-05-24 Thread Richard Lynch
On Wed, May 23, 2007 3:48 pm, Stephen wrote:
 1) Does the filename extension matter? I prefer *.inc? It seems to
 work fine, but I only see others using *.php

From a strictly will it work stand-point, the extension can be
anything you want or none at all.

HOWEVER, there are various security code privacy issues revolving
around the chosen extension.

The point being that you probably don't want your code exposed to the
world, nor executed out of context, most likely.

Some will configure Apache to not serve up .inc files.

Others will add .php on the end, and [try to] make sure that the code
does nothing bad if executed out of context.

I personally think one should just move the include files out of the
web tree and use http://php.net/set_include_path (or similar php.ini
settings) to make it impossible for the code to have any chance at all
of being served up as plain text or getting executed out of sequence.

   2) Does the include file need an opening ?php and ending ? ?

Yes.

PHP jumps back to HTML mode for each include file, because Rasmus
liked it that way back in 1995...  Or he couldn't figure out how to
make it work the other way around...  Or whatever.  It is the way it
is.

And technically, the closing ? is optional, which some consider a
Feature.  YMMV

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] System log in problems

2007-05-24 Thread Stut

Rich Peterson wrote:

Hi All

Let me start by saying I am not 100% sure this
is the correct board to post this to. I hope it is
because as i have watched this list it contains
some very helpful people.

I have search for an answer to this and cannot
seem to find it.  We have a subscription based
site that is developed mainly with php and mysql.
We have one person who each time he attempts
to log in it just rolls back to the login page. With
almost 2000 users this is the only time we have
come across this problem. He is not running your
average system at his home the details are.

Operating system is Ubuntu 7.04 released in April 2007
 also using Firefox Version 2.0.03
Mozilla/5.0 (x11; U; Linusi686; en-US;rv:1.8.13) Gecko/200611201
Firefox/ 2.0.0.3 (Ubuntu-feisty)


I can login using firefox and ie no problem but am running a
more common windows system. Is there something on our
end that could be causing this problem for him?


How does the login work? Is it cookie based? Does this user have cookies 
enabled? Does it do daft things like check the user agent? Have you 
looked for the piece of code that would take the user back to the login 
page and debugged it to see why that's happening?


Etc.

-Stut

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



Re: [PHP] Weird behaviour with move_uploaded_file on CGI version of PHP.

2007-05-24 Thread Richard Lynch
On Wed, May 23, 2007 3:36 pm, Brett Davidson wrote:
 Platform : FreeBSD 6.2 Release with Apache 2.0.59 running PHP 5.2.1_3
 CGI under SuExec in FastCGI mode.

 Issue: move_uploaded_file ALWAYS crfeates uploaded files with Unix
 permissions 600 (read and write for user only) regardless of
 ownership,
 directory or umask settings.

Regardless of all those settings in what context/environment?...

Are you using http://php.net/umask and/or chmod?

PHP runs in the environment you've defined in SuExec and FCGI.  Which
I got NO IDEA how that all works, but presumably there are
configuration settings within those.

 This works fine with php installed as a module.

Well, yeah, as a Module you're in an entirely different
context/environment.  That's kinda the whole POINT of SuExec in the
first place -- to change the user and their environment for the
execution of the script.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Richard Lynch
On Wed, May 23, 2007 1:46 pm, Rahul Sitaram Johari wrote:
 Apache 2.2, PHP5  mySQL 5 on Windows 2003.
 I have some files sitting on a Network Drive accessible on the Windows
 2003
 Server. But my php script is not able to open the files.

 Let¹s say there¹s a database on X:\Transfer\test.dbf
 If I use:

 $db = dbase_open(³X:\Transfer\test.dbf², 0);

 It is not able to open the database. The X: Drive is a network drive.
 Any clues on how to make this happen?

Check permissions on that drive/share/file/directory?...

Google for PHP Network Drive and see if others have the same problem.

For all I know, the dang thing is just broken.  It is Windows, after
all. :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Richard Lynch
On Thu, May 24, 2007 10:29 am, Rahul Sitaram Johari wrote:

 You may have something here.
 Problem is, I don¹t know how to mess with how  under what user Apache
 is
 running ­ and no one else here does either so basically I have to
 figure
 this one out! I would like to, as you suggested, try and ³get Apache
 to run
 as a service under a user that can access the network resource².

http://php.net/phpinfo

This should at least tell you what User PHP thinks it is running as.

You would change that in httpd.conf User directive on a Un*x box, and
that may also work on Windows.

There is also that whole Service GUI junk in Windows that may
overlay the httpd.conf settings, or not... That's just a question of
opening up interminible dialogs and clicking around until it works,
like all of Windows.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Richard Lynch
On Thu, May 24, 2007 10:43 am, Jared Farrish wrote:
 For the advanced PHP gurus on the list, is it accurate to characterize
 PHP
 as relying on Apache for file manipulation? Is it accurately described
 as:

 Process Request-PHP-Apache-[File System
 Poof!]-Apache-PHP-Process

This *might* be correct with PHP as an Apache Module, but I doubt it.

I think it's more like:

Whatever - PHP - stdio.h File System calls

Whatever will affect what user is running PHP and thus what
permissions they have, but that's about it.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] format date field

2007-05-24 Thread Richard Lynch
On Wed, May 23, 2007 11:45 am, Mike Ryan wrote:
 I am reading in a date field from a mysql database the field on the
 screen
 shows up as 2007-05-01  on the screen I would like the field to show
 05-01-2007  currently I am issueing the following command  print
 $row['open']; how can I format this field???

 while I am at it how can I accept the date field as 05-01-2007;

http://dev.mysql.com/

Search date_format will answer the first one.

The seocnd is probably a configurable setting at mysql startup, but
I'd be leery of altering that...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread David Giragosian

On 5/24/07, Richard Lynch [EMAIL PROTECTED] wrote:


On Wed, May 23, 2007 1:46 pm, Rahul Sitaram Johari wrote:
 Apache 2.2, PHP5  mySQL 5 on Windows 2003.
 I have some files sitting on a Network Drive accessible on the Windows
 2003
 Server. But my php script is not able to open the files.

 Let¹s say there¹s a database on X:\Transfer\test.dbf
 If I use:

 $db = dbase_open(³X:\Transfer\test.dbf², 0);

 It is not able to open the database. The X: Drive is a network drive.
 Any clues on how to make this happen?

Check permissions on that drive/share/file/directory?...

Google for PHP Network Drive and see if others have the same problem.

For all I know, the dang thing is just broken.  It is Windows, after
all. :-)



I had a similar problem with a mysqldump file that I was trying to copy
over, via a script, to a networked drive. The networked drive was on
a Novell share, and I could see it and copy just fine using windows explorer
but nothing I did ever allowed me to copy via the script. I even had Apache
installed as a service on the windows box and had all permissions as open as
possible on all directories just to test. I finally gave up and did it from
a Linux server using ncpfs to mount the Novell drive.

FWIT,

David


Re: [PHP] Form Processing Question - Empty Fields

2007-05-24 Thread Richard Lynch


On Wed, May 23, 2007 11:40 am, Stephen wrote:
 I have a script to process the post from a form.

   The form is used to upload photos and has fields for the filename,
 alt text, caption and a checkbox to indicate if this photo is the
 main page image rotation.

   I wanted to build a general routine to build the form to allow for a
 varying number of photos to upload.

   I use main_image[] for the various checkboxes for each photo.

   I see that the checkbox is *not* set, I get nothing back, and if the
 second photo is checked (and the first not checked), I get
 main_image[0] = 'on'.

   And I see this happens for the caption[] array as well.

   This seems to me to be pretty ugly.

   Am I understanding this properly?

   Do I really have to use main_image1, main_image2

No.

You can use:
name=main_image[0]
name=main_image[1]
name=caption[0]
name=caption[1]

and the keys will be pre-set by the HTML to make sense of your data
structures.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



[PHP] Re: Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Jared Farrish


This *might* be correct with PHP as an Apache Module, but I doubt it.

I think it's more like:

Whatever - PHP - stdio.h File System calls

Whatever will affect what user is running PHP and thus what
permissions they have, but that's about it.



Is it then:

Whatever['Apache.exe'] (owns) System Process (which) Requests (using)
stdio.h

How/what determines the active process that is requesting the directive (and
matches access privileges)?

If PHP is running in CLI, I could see how this might be seen as a different
process, but I'm fuzzy about file permissions extended through primary
processes (such as Apache using an executable)... The whole apache GUID mess
seems like cryptic middle ages eye gouging...

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


Re: [PHP] zend framework

2007-05-24 Thread Richard Lynch
On Wed, May 23, 2007 9:58 am, Greg Donald wrote:
 Has anyone looked at the Zend Framework lately?

 http://framework.zend.com/manual

 I've been playing with a few parts of it off and on the past couple of
 days.  It seems really heavy overall and there is no Javascript
 integration anywhere.  Nothing on the roadmap about Javascript either:

 http://framework.zend.com/roadmap

 It might be worth using if it actually did something better than my
 current toolset.  Right now it really doesn't.

Has anyone driven a Ford lately?

http://ford.com

I've been test driving a few of them off and on the past couple of
days.  It seems really heavy overall and...

If you don't find anything useful in the Zend stuff, don't use it.

I just use vi but I daresay that doesn't mean you should.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Include???

2007-05-24 Thread Richard Lynch
On Wed, May 23, 2007 9:24 am, Dan Shirah wrote:
 Okay, I think I'm doing everything right, but for whatever reason my
 include
 isn't working.

 ?php
 echo $_POST['status_code'];

Perhaps there is some whitespace before/after the 'C'...

echo '$_POST[status_code]'br /\n;

You should then see some whitespace inside the '' so you'll know it's
there.

This is a VERY good debugging technique to adopt. :-)

 if ($_POST['status_code'] = C) {

echo GOT HERE!br /;


This can distinguish between 2 possible issues: Your business logic
about C or the include not working

   include ('complete_save.php');
  }
 ?

 The echo of my status_code retruns the correct value so the if should
 trigger.

 This is my include page:

 ?php

 echo test;

 ?

 VERY simple, but for some reason is not working

Also be sure you have error_reporting(E_ALL) set, so you are seeing
any errors.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Include???

2007-05-24 Thread Richard Lynch
On Wed, May 23, 2007 10:53 am, Daniel Brown wrote:
 don't need a space in your include command.  Just type it out as if it
 were
 a function: include('complete_save.php');

You don't need the parens either -- It's NOT a function at all.

It's a language construct.

The space should probably be left in there without the parens.

And you'll have to duke it out with a zillion other developers about
whether to have a space or not between function name and paren, as I
don't care enough to argue it.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Re: Re: RE: Cannot access file on Network Drive (Windows 2003)

2007-05-24 Thread Richard Lynch
On Thu, May 24, 2007 5:29 pm, Jared Farrish wrote:

 This *might* be correct with PHP as an Apache Module, but I doubt
 it.

 I think it's more like:

 Whatever - PHP - stdio.h File System calls

 Whatever will affect what user is running PHP and thus what
 permissions they have, but that's about it.


 Is it then:

 Whatever['Apache.exe'] (owns) System Process (which) Requests (using)
 stdio.h

I dunno what the heck is System Process...

If System Process means Operating System then, yes, sort of,
except that Apache doesn't own the OS, so that's not making sense...

 How/what determines the active process that is requesting the
 directive (and
 matches access privileges)?

Does Windows care what PROCESS is accessing the file, or does it care
what USER running that process is accessing the file?...

If Windows denies access to user X running process P, but grants
access to user X running process Q, then it's even more messed up than
I thought, and that was pretty friggin messed up to start with...

 If PHP is running in CLI, I could see how this might be seen as a
 different
 process, but I'm fuzzy about file permissions extended through primary
 processes (such as Apache using an executable)... The whole apache
 GUID mess
 seems like cryptic middle ages eye gouging...

Apache starts up as root process to do some god-like things and then
immediately changes its user-ness to the setting in httpd.conf and
spawns off its children after that.

How that interacts with the goofy Windows Services and settings in
those interminible dialogs about which user runs which Service is
beyond me...

I can only guess that the Services User starts Apache initially, which
then changes itself to the httpd.conf User before PHP enters into the
picture.

So whatever you choose for the Services User only matters for the
first few nano-seconds of Apache's life, and httpd.conf User is what
matters after that...

But that's just a GUESS not really using Windows all that much, and
certainly not understanding the various Windows security (cough
cough) models over the years.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Form Validation Issues

2007-05-24 Thread Richard Lynch
On Wed, May 23, 2007 7:41 am, kvigor wrote:

if($value != 'Alabama' || $value!= 'AL' || $value != 'Alaska' ||

This mess will *ALWAYS* evaluate to TRUE, because the $value is ALWAYS
only one value, and thus the other 99 values are going to evaluate to
TRUE and you have || between them...

So you have:

TRUE || TRUE || TRUE || FALSE || TRUE || TRUE ... || TRUE

which is always gonna boil down to TRUE.

You wanted  instead of ||

Actually, it would be MUCH better imho to set up a couple arrays like:

$states = array('Alabama', 'Alaska', ...);
$sts = array('AL', 'AK', ...);

if (!isset($states[$value])  !isset($sts[$value])){
  echo Bad Dog!;
}

YMMV

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



[PHP] Re: Include???

2007-05-24 Thread Jared Farrish


Perhaps there is some whitespace before/after the 'C'...

echo '$_POST[status_code]'br /\n;

You should then see some whitespace inside the '' so you'll know it's
there.

This is a VERY good debugging technique to adopt. :-)



My own methodology is to use one of the following to peer into an array (of
any sort):

code
echo 'pre';
print_r($_POST);
echo '/pre';

echo 'pre';
var_dump($_POST);
echo '/pre';
/code

Wrap one of those in a function or put it in a static class to call when
needed, and voila!, instant array introspection. Useful for $_GET, $_COOKIE,
$GLOBALS, $_SERVER, etc...

p.s.: Could you use descriptive subjects; include doesn't really say
much...

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


Re: [PHP] zend framework

2007-05-24 Thread Jochem Maas
Richard Lynch wrote:
 On Wed, May 23, 2007 9:58 am, Greg Donald wrote:
 Has anyone looked at the Zend Framework lately?

 http://framework.zend.com/manual

 I've been playing with a few parts of it off and on the past couple of
 days.  It seems really heavy overall and there is no Javascript
 integration anywhere.  Nothing on the roadmap about Javascript either:

 http://framework.zend.com/roadmap

 It might be worth using if it actually did something better than my
 current toolset.  Right now it really doesn't.
 
 Has anyone driven a Ford lately?
 
 http://ford.com
 
 I've been test driving a few of them off and on the past couple of
 days.  It seems really heavy overall and...

one thing Zend Framework has over your average [american] Ford is the
fact that it doesn't come fitted with an earth-destroying, war-inducing
5+ liter power source.

sorry, couldn't help myself.

 
 If you don't find anything useful in the Zend stuff, don't use it.
 
 I just use vi but I daresay that doesn't mean you should.
 

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



Re: [PHP] System wide variable

2007-05-24 Thread Richard Lynch
On Wed, May 23, 2007 3:52 am, Darren Whitlen wrote:
 Hi,
 I have a PHP script that reads and updates either a small file or a
 mysql database. This script is called from several places every .5
 seconds.

Errr.  Okay.

Seems kind of frequent to me...

What/why is going on here?

You may get a MUCH better solution if you post the Big Picture.

 I would like to move this file to a variable for extra speed as the
 file
   is causing a few problems being accessed so many times.
 Is it possible to have a writeable variable that has the scope of
 EVERY
 script that is run through the parser?

Well, you have Sys V shared memory and shmget shared memory and...

http://php.net/shmop
http://php.net/sem
.
.
.



-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] problem with composing URL with GET Variables

2007-05-24 Thread Richard Lynch
On Wed, May 23, 2007 1:39 am, Angelo Zanetti wrote:
 Dear all.

 I have  a script that is called by an AJAX popup. Now I use an image
 file to get the path of an image for an img tag

 eg:

 img border=0 id=middleImage name=middleImage src=? echo
 $getImageURL; ? 


 the $getImageURL is composed as follows:

 $getImageURL = getImage.php?imageid=.
 $imageID.height=275width=375quality=65;

This isn't valid HTML. The  should be changed to amp; before the
browser tries to render them:

echo htmlentities($getImageURL);

 However when I look at the URL that gets sent its as follows:

 getImage.php?imageid=10amp;height=275amp;width=375amp;quality=65

It seems VERY unlikely that this is what actually being requested, and
MUCH more likely that what you are viewing is post-processed to fix
the  to be amp; for a browser output, which is what you should have
done way back when you sent it out...

Though it's POSSIBLE that something is trying to correct your mistake
above, far too late, and just making things worse rather than
better...

 Which is obviously incorrect.

Actually, it's not incorrect, most likely.

 $getImageURL = html_entity_decode(getImage.php?imageid=.
 $imageID.height=275width=375quality=65);

This is most definetly wrong as it's going to try to decode things
that weren't html entities in the first place, and should have been.

So it's going 90 miles an hour in the exact opposite direction of
where it should...

 But that doesn't seem to be working. .  . As the html_entity_decode
 should the amp sign to the  sign?

 Am I going in the right direction or can anyone else let me know if
 there is something I am missing or should be doing?

Exactly what are you using to examing the Request URI which is showing
the amp; bit?

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] System wide variable

2007-05-24 Thread Richard Lynch


On Wed, May 23, 2007 4:08 am, Darren Whitlen wrote:
 Stut wrote:
 Darren Whitlen wrote:
 I have a PHP script that reads and updates either a small file or a
 mysql database. This script is called from several places every .5
 seconds.

 I would like to move this file to a variable for extra speed as the
 file  is causing a few problems being accessed so many times.
 Is it possible to have a writeable variable that has the scope of
 EVERY script that is run through the parser?

 Not really. Your options are basically 1) use the database instead
 of
 the file, or 2) try memcached (Google for it).

 -Stut

 Hmmm caching really isnt an option here as the data is always
 changing.
 Just a wild idea here.. would it cause major overhead if a script was
 to
 start a session, update some session vars, then switch to a common
 session_id that each script can access? Then use that session to store
 to my info.
 Would that cause any obvious problems?

The $_SESSION is coupled to the user/browser sending the ID back n
forth...

If you can hack things that run this script, I guess you could do
that, but all that does is use the file system that's already not
working, so I doubt it will help much.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



  1   2   >