[PHP] Re: error checking a null array

2005-08-01 Thread g.gill
>From what I understand the simplest solution here would be to check to see 
if you have $_POST['cb'] in the first place.  That would indicate if 
checkbox was selected or not.  After, you have posted the form just do the 
following test.

$check_box_exits = ((isset($_POST['cb']))? true:false);

hope this helps...

-sonu

"Jack Jackson" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> hi,
> I have checkboxes beging dynamically generated. to seperate tasks in error 
> checking I have added he arrays not just to $_POST but to $_POST[cb]  so 
> names (derived from question numbers) are for example:
>
> $_POST[cb][7]
>
> A dump of $_POST would therefore include something like
>
> ["cb"]=>  array(1) { [7]=>  array(1) { [0]=>  string(3) "124" } }
>
>  So I did this:
>
> //error checking for checkboxes foreach ($cb as $cbkey => $cbvalue)
>{
>   foreach($cbvalue as $cbkey2=>$cb_answers)
>   {
>  if( !array_key_exists($_POST[$cbkey], $cb));
>  {
>  $message[$cbkey]=1;
>  }
>}
>}
>
> This almost works. The problem is that if someone doesn't check a 
> checkbox, NOTHING related to the checkbox gets sent to $_POST; if I insert 
> a hidden value of something, then that hidden value gets passed whether 
> the user inputs something or not, since I need an entirely server-side 
> solution. Is there a way to send something to tell the error checker 
> whether for example $_POST[cb][7] is empty or null, so I can set the error 
> message to one if it's empty?
>
> Dump of $_POST with no checkboxes checked
> $_POST:
> array(4) { ["action"]=> string(7) "process" ["cat"]=> string(1) "2" 
> ["rs"]=> array(3) { [5]=> string(0) "" [6]=> string(0) "" [9]=> string(0) 
> "" } ["b"]=> string(8) "Continue" }
>
> Dump of $_POST with checkboxes checked
>
> array(5) { ["action"]=>  string(7) "process" ["cat"]=>  string(1) "2" 
> ["cb"]=>  array(2) { [7]=>  array(5) { [0]=>  string(1) "3" [1]=> 
> string(3) "124" [2]=>  string(3) "125" [3]=>  string(3) "127" [4]=> 
> string(3) "131" } [8]=>  array(3) { [0]=>  string(3) "141" [1]=> string(3) 
> "145" [2]=>  string(1) "4" } } ["rs"]=>  array(3) { [5]=> string(0) "" 
> [6]=>  string(0) "" [9]=>  string(0) "" } ["b"]=> string(8) "Continue" }
>
>
> Thanks so much In advance 

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



Re: [PHP] Sessions Issue

2005-08-01 Thread Burhan Khalid


On Jul 29, 2005, at 8:07 PM, Tom Ray [Lists] wrote:

We built a box about 7 months or so ago using the SuSE 9.1 cd's,  
straight install from the CDs. While I've read that sessions are  
turned on by default, when we try to call on the sessions functions  
(like with phpOpenChat or start_session()) we get calls to  
undefined function errors. This is leading me to belive that  
sessions are disabled for some reason. I need to enable the  
sessions so I have a few questions


1) Can I do this without recompiling?
2) If I can't, how do I recompile this since I used the SuSE cds?

It's SuSE 9.1 running Php 4.3.4 with APache 2.0.49


I don't *think* there is a separate module/rpm for sessions, so you  
are off to a recompile job.


While you are it, upgrade your PHP to the latest stable version.  
4.3.4 is quite old.  Maybe there is a new package for SuSE that does  
it? (not really familiar with SuSE).


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



Re: [PHP] what is this: dirname(__FILE__)?

2005-08-01 Thread Burhan Khalid


On Aug 1, 2005, at 3:18 AM, Robert Cummings wrote:


On Sun, 2005-07-31 at 20:04, Sam Smith wrote:

I don't recognize this something(__SOMETHING__) format. I know  
what it's

doing but I don't know how it's doing it.



Constants of the type __SOMETHING__ are historical constants for
retrieving contextual information about the source code in which the
constant is found. For instance __FILE__ indicates the name of the
source file in which the __FILE__ constant is found. This nomenclature
dates back to at least C and is probably kept for historical reasons
since everyone knows C is da bomb!



Not that C is not 'da bomb' or any less hip, but here is the short  
version : http://www.php.net/manual/en/language.constants.predefined.php


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



Re: [PHP] Running a PHP script everyday

2005-08-01 Thread André Medeiros
Shit shit shit!!! I completelly forgot!

#!/usr/local/bin/php -q

Notice the -q, it's important.

Sorry :(

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



Re: [PHP] Calendar program like on php.net

2005-08-01 Thread Burhan Khalid


On Aug 1, 2005, at 5:45 AM, Roger Thomas wrote:


Quoting Jim Moseby <[EMAIL PROTECTED]>:


I'd repost the link for you, but I've already deleted it.  Sorry.  
Look back through the archives.


JM




I searched for 'Jim Moseby calendar' in the general and Dev mailing  
list but no go. Anty clue?


"It was a plane hack of mine from a couple of years ago with a couple of
additions since.  You are welcome to grab it from CVS.  See
http://cvs.php.net/phpweb/ and look at cal.php

-Rasmus
"

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



[PHP] MYSQL translator

2005-08-01 Thread Alessandro Rosa
Dear All subscribers,

I wish to submit to you a PHP class I coded to translate native language
parsed queries into SQL syntax ones.

The main goal of this class is the implementation into web-based
applications
for letting final users/customers input their own defined queries without
knowing
sql syntax strictly. This goes into the direction of giving wider
flexibility to sql users.

Native language queries really look like everyday input requests.

Class still supports French and Italian, but I look forward to find helpers
to
supply other languages. So you are invited to visit this link

http://www.phpclasses.org/browse/package/2449.html

for further infos, as well as the class code, examples, shots to preview how
it
works and a short tutorial.

For those who would like helping me to provide new language, I'm going
to write down a PDF document for listing the general features, the
properties
of all entries to lessen the creation of new related dictionaries.

Thanks,

Alessandro Rosa

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



[PHP] Re: dynamic two column table

2005-08-01 Thread Mark Rees
> i know how to break up db results into two tables but im having a hard
> problem with this:
>
> db structure
>
> ---
> | id | cid | title
> ---
> | 1  | 2  | hardware
> | 2  | 3  | software
> | 3  | 3  | software
> | 4  | 2  | hardware
>
>
> how can i have hardware on column 1 and software on column 2 using 1
> query? i thought a simple if statement on cid might do it but regardless
> it spreads the results on both columns.


Can you give an example of what you want the output to look like?


>
> thanx.
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005

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



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Jack Jackson


g.gill wrote:
From what I understand the simplest solution here would be to check to see 
if you have $_POST['cb'] in the first place.  That would indicate if 
checkbox was selected or not.  After, you have posted the form just do the 
following test.


$check_box_exits = ((isset($_POST['cb']))? true:false);



That helped, sonu, thank you. The problem now is that, how can I pass 
through $_POST the names of each specific checkbox, whether filled in or 
not, and then parse each to see if they have any answer? I need to do 
that or else I can only tell the ones which *have* been filled in but 
not those which have not.


Thanks

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



Re: [PHP] Help with a Parse Error

2005-08-01 Thread Edward Vermillion

Tom Chubb wrote:

I have changed it a bit, and don't have the old code now!!!
I saw a post which identified a problem using isset when $var = ""; as
it returns true, so I changed my code to use...

if ($_GET['id'] != "")
{   $article="$id.php";
		if (file_exists($article)) { include $article; } 
		else 	{ echo "The article you've requested does not exist!"; }

}
else {
echo "No article selected"; 
}


This works fine, except that when the url is www.mysite.com/index.php
I get the following error...

Notice: Undefined index: id in
/home/5217/tomchubb/public_html/index.php on line 14
No article selected 


I kmow this will disappear when I turn off error reporting, but how
can I suppress it properly?


On 31/07/05, Edward Vermillion <[EMAIL PROTECTED]> wrote:


Tom Chubb wrote:


I am trying to create my own news system and to start with I'm using
static news pages until I get the db working properly.
I'm using the following code:



I am testing using the following links...

www.myurl.co.uk/index.php
www.myurl.co.uk/index.php?id=1
www.myurl.co.uk/index.php?id=2

When I try the first one, I'd expect it to say you did not select an
article, but it says


Notice: Undefined variable: id in
/home/5217/tomchubb/public_html/index.php on line 15
The article you've requested does not exist


When I try the third link, I would expect it to say  The article
you've requested does not exist! but it says:

Parse error: parse error in /home/5217/tomchubb/public_html/index.php on line 16

Lines 15 & 16 are:
if (file_exists($article)) { include $article; }
else  { echo "The article you've requested does not exist!"; }

I don't understand why this isn't working and I've tried looking into
this for 2 hours!
Can anyone tell me where I'm going wrong please?

Thanks,

Tom


What I notice is that the first error says it's on line 15, then you
give lines 15 and 16 in the second example but line 15 doesn't have "id"
in it. Are you sure your looking at the right lines? Try posting the
whole script and maybe someone can catch the problem.






I always use

if(!empty(...)) {

it takes care of empty variables and variables that haven't been set at 
the same time. :)


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



[PHP] Limit emails from servers & recommend a control panel (most prolly 0T)

2005-08-01 Thread Ryan A
Hi,
A client of mine wants to offer freehosting to tech companies in Sweden.
(He plans to take a dedicated *unix server)

1)
The main problem with offering hosting is there are some SOBs who will
use that account to spam, so he asked me if it is possible to limit the
amount
of emails from each account?

eg:
Max 1 email every 10 or 20 seconds from each account

by doing this it would be easier to shut down the spamming account before
any real damage is done and it also wont be too attractive to spammers to
host with him.

Any ideas how this can be done?


2)
 The server will be given to us without any control panel, cpanel costs a
bit
every month, can anyone recommend a good control panel that is free and
would
give us control to offer hosting to others (eg Plesk/WHM)

Thanks,
Ryan

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



Re: [PHP] Date confusion

2005-08-01 Thread Burhan Khalid


On Jul 28, 2005, at 9:28 AM, Linda H wrote:


Hi,

I must admit I am surprised at the paucity of date and time  
functions in PHP.


I have a date stored in a MySQL database in field of datatype date.  
PHP doesn't seem to have a function I can use to format it for  
print. I tried the following but regardless of the value in the  
date field, it displays as 'Wednesday December 31, 1969'  (I know  
this is the day before the UNIX epoch.).


echo ''.date('l F j, Y',$start_date).'';

I tried casting the field to datetime, but it didn't pass the  
parser. Finally I did the following, which seems to work, but is  
awfully convoluted:


echo 'Date: '.date('l F j, Y',strtotime($start_date).'';

The other thing I'm concerned about is that strtotime takes the  
locale into consideration. I don't want it adjusting the date - I  
just want it printed out.


Is there a better way to do this?


SELECT DATE_FORMAT(myfield, '%W %M %e, %Y') as 'formatted_date'  
FROM 


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



Re: [PHP] Limit emails from servers & recommend a control panel (most prolly 0T)

2005-08-01 Thread Jochem Maas

'prolly' is not a member of the english language.
and yes it's completely off topic but you knew that...



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



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Jochem Maas

Jack Jackson wrote:


g.gill wrote:

From what I understand the simplest solution here would be to check 
to see 


if you have $_POST['cb'] in the first place.  That would indicate if 
checkbox was selected or not.  After, you have posted the form just do 
the following test.


$check_box_exits = ((isset($_POST['cb']))? true:false);




That helped, sonu, thank you. The problem now is that, how can I pass 
through $_POST the names of each specific checkbox, whether filled in or 
not, and then parse each to see if they have any answer? I need to do 
that or else I can only tell the ones which *have* been filled in but 
not those which have not.


wtf are you smoking Jack? every checkbox that was checked will exist in the
$_POST array set with the value you gave it (I alway set a chekcboxes value to 1
because the values mere existance in the submitted data indicates it's chevckbox
 was checked), if a checkbox does not exist in the $_POST array it wasn't 
checked!!!

imagine you have 10 checkboxes named 'cb1' thru 'cb10' each with a value of '1',
upon submitting the form they are in, your script sees the following in the 
$_POST
array...

$_POST = array('cb1' => '1', 'cb9' => '1', 'cb10' => '1');

which tells you 3 checkboxes were checked... namely 'cb1', 'cb9' and 'cb10'
now how hard is it to determine which we're not checked?

maybe I'm not seeing the problem but I get the impression that you are
over complicating things regarding checkbox.



Thanks



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




Re: [PHP] Limit emails from servers & recommend a control panel (most prolly 0T)

2005-08-01 Thread Ryan A
Hey,

> 'prolly' is not a member of the english language.
> and yes it's completely off topic but you knew that...

Yep, I prolly did :-)

Should have taken out the "most prolly" and just had OT, my apoligies.

Cheers,
Ryan

P.S Join me in my campaign to get "PROLLY" as a member of the
English langauge...

If enough people use it, it will prolly get into the dictionary in a few
years.

:-D

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



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Mark Rees
>
> g.gill wrote:
> >>From what I understand the simplest solution here would be to check to
see
> > if you have $_POST['cb'] in the first place.  That would indicate if
> > checkbox was selected or not.  After, you have posted the form just do
the
> > following test.
> >
> > $check_box_exits = ((isset($_POST['cb']))? true:false);
>
>
> That helped, sonu, thank you. The problem now is that, how can I pass
> through $_POST the names of each specific checkbox, whether filled in or
> not, and then parse each to see if they have any answer? I need to do
> that or else I can only tell the ones which *have* been filled in but
> not those which have not.


It's about this time that I usually say, "forget the checkbox, let's use a
radio button instead" :-)


>
> Thanks

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



RE: [PHP] Limit emails from servers & recommend a control panel O T

2005-08-01 Thread Jay Blanchard
[/snip]
P.S Join me in my campaign to get "PROLLY" as a member of the
English langauge...

If enough people use it, it will prolly get into the dictionary in a few
years.
[snip]

I ceriusly dowt it.

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



Re: [PHP] Limit emails from servers & recommend a control panel (most prolly 0T)

2005-08-01 Thread Edward Vermillion

Ryan A wrote:

Hey,



'prolly' is not a member of the english language.
and yes it's completely off topic but you knew that...



Yep, I prolly did :-)

Should have taken out the "most prolly" and just had OT, my apoligies.

Cheers,
Ryan

P.S Join me in my campaign to get "PROLLY" as a member of the
English langauge...

If enough people use it, it will prolly get into the dictionary in a few
years.

:-D


Here in Texas it's already there... :D

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



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Jack Jackson


Jochem Maas wrote:



wtf are you smoking Jack? every checkbox that was checked will exist in the
$_POST array set with the value you gave it (I alway set a chekcboxes 
value to 1
because the values mere existance in the submitted data indicates it's 
chevckbox
 was checked), if a checkbox does not exist in the $_POST array it 
wasn't checked!!!


Oh, how I wish I were smoking something :) !

imagine you have 10 checkboxes named 'cb1' thru 'cb10' each with a value 
of '1',
upon submitting the form they are in, your script sees the following in 
the $_POST

array...

$_POST = array('cb1' => '1', 'cb9' => '1', 'cb10' => '1');

which tells you 3 checkboxes were checked... namely 'cb1', 'cb9' and 'cb10'
now how hard is it to determine which we're not checked?



Well, for me, it is - because I don't know the names of the other check 
boxes which were not checked because they were dynamically created, and 
I don't have the knowledge sufficient to pass the NAMES of all 
checkboxes through to $_POST so that I can search through and see which 
have been answered and which ones not.





maybe I'm not seeing the problem but I get the impression that you are
over complicating things regarding checkbox.


As always this is hugely possible.


JJ

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



RE: [PHP] Limit emails from servers & recommend a control panel O T

2005-08-01 Thread Ryan A

> [/snip]
> P.S Join me in my campaign to get "PROLLY" as a member of the
> English langauge...
> 
> If enough people use it, it will prolly get into the dictionary in a few
> years.
> [snip]
> 
> I ceriusly dowt it.


Hahahahah good one 

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



Re: [PHP] Limit emails from servers & recommend a control panel (most prolly 0T)

2005-08-01 Thread Ryan A
> > P.S Join me in my campaign to get "PROLLY" as a member of the
> > English langauge...
> >
> > If enough people use it, it will prolly get into the dictionary in a few
> > years.
> >
> > :-D
> >
> Here in Texas it's
> already there... :D


Good! That means my works already done there :-p

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



Re: [PHP] MYSQL translator

2005-08-01 Thread Dotan Cohen
On 8/1/05, Alessandro Rosa <[EMAIL PROTECTED]> wrote:
> Dear All subscribers,
> 
> I wish to submit to you a PHP class I coded to translate native language
> parsed queries into SQL syntax ones.
> 
> The main goal of this class is the implementation into web-based
> applications
> for letting final users/customers input their own defined queries without
> knowing
> sql syntax strictly. This goes into the direction of giving wider
> flexibility to sql users.
> 
> Native language queries really look like everyday input requests.
> 
> Class still supports French and Italian, but I look forward to find helpers
> to
> supply other languages. So you are invited to visit this link
> 
> http://www.phpclasses.org/browse/package/2449.html
> 
> for further infos, as well as the class code, examples, shots to preview how
> it
> works and a short tutorial.
> 
> For those who would like helping me to provide new language, I'm going
> to write down a PDF document for listing the general features, the
> properties
> of all entries to lessen the creation of new related dictionaries.
> 
> Thanks,
> 
> Alessandro Rosa

Do you have a website with a working example? I'd love to see this.

Dotan Cohen
http://lyricslist.com
Song Lyrics

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



Re: [PHP] Re: dynamic two column table

2005-08-01 Thread Dotan Cohen
On 8/1/05, Mark Rees <[EMAIL PROTECTED]> wrote:
> > i know how to break up db results into two tables but im having a hard
> > problem with this:
> >
> > db structure
> >
> > ---
> > | id | cid | title
> > ---
> > | 1  | 2  | hardware
> > | 2  | 3  | software
> > | 3  | 3  | software
> > | 4  | 2  | hardware
> >
> >
> > how can i have hardware on column 1 and software on column 2 using 1
> > query? i thought a simple if statement on cid might do it but regardless
> > it spreads the results on both columns.
> 
> 
> Can you give an example of what you want the output to look like?
> 
> 
> >
> > thanx.
> >

Use an array for each, and in each row of the table output another
field of each array (with a while loop). I do that on
http://lyricslist.com

Dotan Cohen
http://IE-only.com

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



Re: [PHP] Limit emails from servers & recommend a control panel (most prolly 0T)

2005-08-01 Thread Dotan Cohen
On 8/1/05, Ryan A <[EMAIL PROTECTED]> wrote:
> > > P.S Join me in my campaign to get "PROLLY" as a member of the
> > > English langauge...
> > >
> > > If enough people use it, it will prolly get into the dictionary in a few
> > > years.
> > >
> > > :-D
> > >
> > Here in Texas it's
> > already there... :D
> 
> 
> Good! That means my works already done there :-p
> 


And in a lot of other places! Google found about 762,000 of them...
And my name shows up in 21 of those... I should move to Texas.

Dotan
http://lyricslist.com

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



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Dotan Cohen
On 8/1/05, Jack Jackson <[EMAIL PROTECTED]> wrote:
> 
> Jochem Maas wrote:
> 
> >
> > wtf are you smoking Jack? every checkbox that was checked will exist in the
> > $_POST array set with the value you gave it (I alway set a chekcboxes
> > value to 1
> > because the values mere existance in the submitted data indicates it's
> > chevckbox
> >  was checked), if a checkbox does not exist in the $_POST array it
> > wasn't checked!!!
> 
> Oh, how I wish I were smoking something :) !
> 
> > imagine you have 10 checkboxes named 'cb1' thru 'cb10' each with a value
> > of '1',
> > upon submitting the form they are in, your script sees the following in
> > the $_POST
> > array...
> >
> > $_POST = array('cb1' => '1', 'cb9' => '1', 'cb10' => '1');
> >
> > which tells you 3 checkboxes were checked... namely 'cb1', 'cb9' and 'cb10'
> > now how hard is it to determine which we're not checked?
> >
> 
> Well, for me, it is - because I don't know the names of the other check
> boxes which were not checked because they were dynamically created, and
> I don't have the knowledge sufficient to pass the NAMES of all
> checkboxes through to $_POST so that I can search through and see which
> have been answered and which ones not.
> 
> 
> 
> > maybe I'm not seeing the problem but I get the impression that you are
> > over complicating things regarding checkbox.
> 
> As always this is hugely possible.
> 
> 
> JJ
> 


You can pass those names in a hidden input field in the form,
something like this:


Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/12/aaliyah.php 
Aaliyah Song Lyrics

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



Re: [PHP] error checking woes

2005-08-01 Thread Kristen G. Thorson

Jack,

Read below:



Jack Jackson wrote:


Hi,
Now that the drop down is working properly (thanks!!), I am trying to 
validate, and having LOTS of trouble. After being ceaselessly derided 
last night on an irc channel for my dimwitedness, I am still not any 
closer.


The code which works is this:

function GetQuestionsDropdown($cat){
//first get all the questions

$sql = "SELECT * FROM questions WHERE questions.q_cat=$cat AND 
questions.q_style=1";


$result = mysql_query($sql);
//now one-by-one go through the questions
while($row = mysql_fetch_assoc($result)) {
   //if the form has been submitted, and the question 
unanswered

//highlight this whole question and answer block in red.
if ($message[$row['q_name']] == 1){





How does this funtion have access to $message?  You need to a) make it 
global or b) pass it in.




echo "";
}
   //Make a question set div wrapper
echo "\n";
//State the question
echo "";
echo $row['q_text'] . "";
echo "\n\n";
echo " ";
echo "\n";
   //Create the dropdown for the answers
echo '  ';
echo "\n";
   //get all of the answers for THIS question
$ans_sql = "select * from answers where answers.q_id=" . 
$row['q_id'];

$ans_result = mysql_query($ans_sql);

echo "Select from this list\n";
while($ans_row = mysql_fetch_assoc($ans_result)) {
   //list the answers for THIS question
echo "" . $ans_row['a_answer'] . "";
echo "\n";
}
echo '  ' . "\n" . ' ' . "\n";
echo "\n\n";
//If there *was* an error div, close it
if (sizeof($message[$row['q_name']])){
echo "";
}
}
}//function GetQuestionsDropdown


NOW I have to validate after it's submitted. I am trying to look and 
see, if $_POST[$row['q_name']] is empty then make message of the same 
name = 1, so if


   if(empty($_POST['partners'])) {
   $message['partners'] = '1'
}

Then when I restate the dropdown function, and it shows the questions 
again,  those error checking things I built in will

a) show a div class=error around questions with a message
b) pre-select the previously selected answers (because I have put 
in the thing in the dropdown which says


 if ($row['q_name'] == $ans_row['a_id']) { echo " selected";}


The validate code I was trying, the subject of such howling on IRC 
(and I know it doesn't work, but not why) was:


function ValidatePost($cat){
//first get the q_names
$sql = "SELECT * FROM questions WHERE q_cat=$cat";
$result = mysql_query($sql);

//go through the question set
while($row = mysql_fetch_assoc($result)) {
  if(empty($_POST[$row['q_name']])){
  $message[$row['q_name']] == "1";





You want $message = "1" here.  = = is for comparison.

You're setting $message inside a function.  This means it doesn't exist 
outside this scope!




  }
}
}//function ValidatePost

Can anyone tell me what I am doing wrong?

Thanks!
JJ





Hope this helps you get somewhere,

kgt



Re: [PHP] error checking woes

2005-08-01 Thread Jack Jackson



Kristen G. Thorson wrote:

Thanks for the  ==  !

But I had set $message global within the buld-checkbox function, so that 
part of it does work. . . .







Jack,

Read below:



Jack Jackson wrote:


Hi,
Now that the drop down is working properly (thanks!!), I am trying to 
validate, and having LOTS of trouble. After being ceaselessly derided 
last night on an irc channel for my dimwitedness, I am still not any 
closer.


The code which works is this:

function GetQuestionsDropdown($cat){
//first get all the questions

$sql = "SELECT * FROM questions WHERE questions.q_cat=$cat AND 
questions.q_style=1";


$result = mysql_query($sql);
//now one-by-one go through the questions
while($row = mysql_fetch_assoc($result)) {
   //if the form has been submitted, and the question 
unanswered

//highlight this whole question and answer block in red.
if ($message[$row['q_name']] == 1){






How does this funtion have access to $message?  You need to a) make it 
global or b) pass it in.




echo "";
}
   //Make a question set div wrapper
echo "\n";
//State the question
echo "";
echo $row['q_text'] . "";
echo "\n\n";
echo " ";
echo "\n";
   //Create the dropdown for the answers
echo '  ';
echo "\n";
   //get all of the answers for THIS question
$ans_sql = "select * from answers where answers.q_id=" . 
$row['q_id'];

$ans_result = mysql_query($ans_sql);

echo "Select from this list\n";
while($ans_row = mysql_fetch_assoc($ans_result)) {
   //list the answers for THIS question
echo "" . $ans_row['a_answer'] . "";
echo "\n";
}
echo '  ' . "\n" . ' ' . "\n";
echo "\n\n";
//If there *was* an error div, close it
if (sizeof($message[$row['q_name']])){
echo "";
}
}
}//function GetQuestionsDropdown


NOW I have to validate after it's submitted. I am trying to look and 
see, if $_POST[$row['q_name']] is empty then make message of the same 
name = 1, so if


   if(empty($_POST['partners'])) {
   $message['partners'] = '1'
}

Then when I restate the dropdown function, and it shows the questions 
again,  those error checking things I built in will

a) show a div class=error around questions with a message
b) pre-select the previously selected answers (because I have put 
in the thing in the dropdown which says


 if ($row['q_name'] == $ans_row['a_id']) { echo " selected";}


The validate code I was trying, the subject of such howling on IRC 
(and I know it doesn't work, but not why) was:


function ValidatePost($cat){
//first get the q_names
$sql = "SELECT * FROM questions WHERE q_cat=$cat";
$result = mysql_query($sql);

//go through the question set
while($row = mysql_fetch_assoc($result)) {
  if(empty($_POST[$row['q_name']])){
  $message[$row['q_name']] == "1";






You want $message = "1" here.  = = is for comparison.

You're setting $message inside a function.  This means it doesn't exist 
outside this scope!




  }
}
}//function ValidatePost

Can anyone tell me what I am doing wrong?

Thanks!
JJ





Hope this helps you get somewhere,

kgt




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



Re: [PHP] Running a PHP script everyday

2005-08-01 Thread Steve Buehler

At 04:54 AM 8/1/2005, you wrote:

Shit shit shit!!! I completelly forgot!

#!/usr/local/bin/php -q

Notice the -q, it's important.

Sorry :(


What is the "-q" for?  I can't find any documentation on it.  If I do 
a "php -h" or "man php", it is not listed.  I am running php 5.0.3 on RHEL ES 4


Thanks
Steve

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



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Mark Rees
On 8/1/05, Jack Jackson <[EMAIL PROTECTED]> wrote:
>
> Jochem Maas wrote:
> 
> >
> > wtf are you smoking Jack? every checkbox that was checked will exist in
the
> > $_POST array set with the value you gave it (I alway set a chekcboxes
> > value to 1
> > because the values mere existance in the submitted data indicates it's
> > chevckbox
> >  was checked), if a checkbox does not exist in the $_POST array it
> > wasn't checked!!!
>
> Oh, how I wish I were smoking something :) !
>
> > imagine you have 10 checkboxes named 'cb1' thru 'cb10' each with a value
> > of '1',
> > upon submitting the form they are in, your script sees the following in
> > the $_POST
> > array...
> >
> > $_POST = array('cb1' => '1', 'cb9' => '1', 'cb10' => '1');
> >
> > which tells you 3 checkboxes were checked... namely 'cb1', 'cb9' and
'cb10'
> > now how hard is it to determine which we're not checked?
> >
>
> Well, for me, it is - because I don't know the names of the other check
> boxes which were not checked because they were dynamically created, and
> I don't have the knowledge sufficient to pass the NAMES of all
> checkboxes through to $_POST so that I can search through and see which
> have been answered and which ones not.
>
>
>
> > maybe I'm not seeing the problem but I get the impression that you are
> > over complicating things regarding checkbox.
>
> As always this is hugely possible.
>
>
> JJ
>


You can pass those names in a hidden input field in the form,
something like this:


--

Yes, or you can make your life easier and use radio buttons instead - the
name:value is always passed without any need for the messing about which
checkboxes bring. However, if you wish to use checkboxes, Jochem and Dotan
are showing you the way.

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



RE: [PHP] Running a PHP script everyday

2005-08-01 Thread Jay Blanchard
[snip]
What is the "-q" for?  I can't find any documentation on it.  If I do 
a "php -h" or "man php", it is not listed.  I am running php 5.0.3 on
RHEL ES 4
[/snip]

It means 'quiet'...in other words do not send anything to standard out.

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



Re: [PHP] Running a PHP script everyday

2005-08-01 Thread John Nichel

Steve Buehler wrote:

At 04:54 AM 8/1/2005, you wrote:


Shit shit shit!!! I completelly forgot!

#!/usr/local/bin/php -q

Notice the -q, it's important.

Sorry :(



What is the "-q" for?  I can't find any documentation on it.  If I do a 
"php -h" or "man php", it is not listed.  I am running php 5.0.3 on RHEL 
ES 4


It tells it to run quietly.  Output nothing to STDOUT.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Limit emails from servers & recommend a control panel (most prolly 0T)

2005-08-01 Thread Jochem Maas

Edward Vermillion wrote:

Ryan A wrote:


Hey,



'prolly' is not a member of the english language.
and yes it's completely off topic but you knew that...




Yep, I prolly did :-)

Should have taken out the "most prolly" and just had OT, my apoligies.

Cheers,
Ryan

P.S Join me in my campaign to get "PROLLY" as a member of the
English langauge...

If enough people use it, it will prolly get into the dictionary in a few
years.


the Oxford English Dictionary is very forthcoming liek I believe, you are 
probably correct.
heck just ask Lewis Carol - he invented quite a lot of words in his books that 
became
official.

but I don't like 'prolly' so I have to pass on your offer :-)



:-D


Here in Texas it's already there... :D


please 'explainify' ;-/

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



Re: [PHP] Running a PHP script everyday

2005-08-01 Thread tg-php
Don't forget also that if you're running on a Windows platform, you can use the 
php-win.exe to avoid having any console window appear at all.

-TG

= = = Original message = = =

Steve Buehler wrote:
> At 04:54 AM 8/1/2005, you wrote:
> 
>> Shit shit shit!!! I completelly forgot!
>>
>> #!/usr/local/bin/php -q
>>
>> Notice the -q, it's important.
>>
>> Sorry :(
> 
> 
> What is the "-q" for?  I can't find any documentation on it.  If I do a 
> "php -h" or "man php", it is not listed.  I am running php 5.0.3 on RHEL 
> ES 4

It tells it to run quietly.  Output nothing to STDOUT.


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Jochem Maas

Jack Jackson wrote:


Jochem Maas wrote:




wtf are you smoking Jack? every checkbox that was checked will exist 
in the
$_POST array set with the value you gave it (I alway set a chekcboxes 
value to 1
because the values mere existance in the submitted data indicates it's 
chevckbox
 was checked), if a checkbox does not exist in the $_POST array it 
wasn't checked!!!



Oh, how I wish I were smoking something :) !


no you don't, you want to go home and rethink your life ;-)



imagine you have 10 checkboxes named 'cb1' thru 'cb10' each with a 
value of '1',
upon submitting the form they are in, your script sees the following 
in the $_POST

array...

$_POST = array('cb1' => '1', 'cb9' => '1', 'cb10' => '1');

which tells you 3 checkboxes were checked... namely 'cb1', 'cb9' and 
'cb10'

now how hard is it to determine which we're not checked?



Well, for me, it is - because I don't know the names of the other check 
boxes which were not checked because they were dynamically created, and 


you wouldn't be the one who wrote the script that creates them dynamically 
would you?

and if you hit the same URL 100 times you get the same checkboxes? (i.e. its
checkbox output is reproducable) ... of so you have the basis for dynamically 
checking which
checkboxes where presented to the user by using the same logic/algorithm to
check for there exist on submit as you use to generate them in the first place.

if your smart/able (and it's posible) you will wrap this logic up in some kind
of function in order to not duplicate code/logic...

in fact you could just store all the names of these checkboxes in a 
multidimensional
array in the session when you create them and use that as the basis to check
for [non]existance.

I don't have the knowledge sufficient to pass the NAMES of all 


???

checkboxes through to $_POST so that I can search through and see which 
have been answered and which ones not.




why is it important to know what was not checked?





maybe I'm not seeing the problem but I get the impression that you are
over complicating things regarding checkbox.



As always this is hugely possible.


:-)




JJ



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



[PHP] Timezone date/time conversion

2005-08-01 Thread Chris Boget

I'm sure something like this has already been written and I'd
hate to redesign the wheel.  I've searched google but came up
empty and am wondering if any of you guys have what I am
looking for.  
Basically I need a function that will convert a time from one

time zone to another.  Such that if I passed in a timestamp and
specified that the conversion be made from CST to EST, it 
would perform the requisite calculation.  Or if I specified CST

to GMT, etc.
Does anyone have something like that?

thnx,
Chris

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



[PHP] encoding a + sign

2005-08-01 Thread Diana Castillo
what type of encoding should I use to send a "+" sign via XML?


-- 
Diana Castillo
Destinia.com
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039 Ext 216
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com

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



Re: [PHP] encoding a + sign

2005-08-01 Thread Rory Browne
use +

check out www.asciitable.com



On 8/1/05, Diana Castillo <[EMAIL PROTECTED]> wrote:
> what type of encoding should I use to send a "+" sign via XML?
> 
> 
> --
> Diana Castillo
> Destinia.com
> C/Granvia 22 dcdo 4-dcha
> 28013 Madrid-Spain
> Tel : 00-34-913604039 Ext 216
> Fax : 00-34-915228673
> email: [EMAIL PROTECTED]
> Web : http://www.hotelkey.com
>  http://www.destinia.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



Re: [PHP] encoding a + sign

2005-08-01 Thread Rory Browne
On 8/1/05, Diana Castillo <[EMAIL PROTECTED]> wrote:
> I used this "%2B" instead of the + sign and it works, what type of encoding
> is that?

%2B looks like something that would appear in a URL, usually in the
QUERY_STRING(which is part of the URL).

+ is the format you would use in an XML document itself.

If you're using php check out www.php.net/urlencode and
www.php.net/htmlspecialchars and www.php.net/htmlentities those urls
are from memory, so may not be completely accurate. Let me know if
they're not, and I'll find the right ones for you.

> - Original Message -
> From: "Rory Browne" <[EMAIL PROTECTED]>
> To: "Diana Castillo" <[EMAIL PROTECTED]>
> Cc: 
> Sent: Monday, August 01, 2005 6:43 PM
> Subject: Re: [PHP] encoding a + sign
> 
> 
> > use +
> >
> > check out www.asciitable.com
> >
> >
> >
> > On 8/1/05, Diana Castillo <[EMAIL PROTECTED]> wrote:
> >> what type of encoding should I use to send a "+" sign via XML?
> >>
> >>
> >> --
> >> Diana Castillo
> >> Destinia.com
> >> C/Granvia 22 dcdo 4-dcha
> >> 28013 Madrid-Spain
> >> Tel : 00-34-913604039 Ext 216
> >> Fax : 00-34-915228673
> >> email: [EMAIL PROTECTED]
> >> Web : http://www.hotelkey.com
> >>  http://www.destinia.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



Re: [PHP] Running a PHP script everyday [SOLVED]

2005-08-01 Thread Jochem Maas

[EMAIL PROTECTED] wrote:

What a convoluted mess.

Rather than using the shebang at the begging of the PHP file I had to put it
in the cron command


the shebang only works if you make the file executable...
do something _like_:

$> chmod ug+x /path/to/your/php/file


"/usr/local/bin/php public_html/wap/mailer/dailylist.php"

It will now run.

But then I had to slightly redesign the HTMLMimeMail code. I had to define
some of it as functions and include the file as a function definition rather
than include the direct code. I also had to change my include statements to
this "include "public_html/wap/mailer/sending.php";" With this type of
include I can no longer run it from a browser, but I really didn't want to


exactly what 'kind' of include is that then - looks normal to me.

maybe you need to learn a bit about how include works, what the 'current working
directory' is (and how this differs between CLI and SAPI versions), and how
the include_path ini setting affects the use of [include|require](_once)?

that said I've sometimes had to have script that runs off the cmdline and via a 
browser
and it can be a bit of PITA to get to work flawlessly in both envs :-)

... as long as it works heh! :-)


do that anyways.

Thanks for all your help.

Andrew Darrow
Kronos1 Productions
www.pudlz.com


- Original Message - 
From: "Miles Thompson" <[EMAIL PROTECTED]>

To: <[EMAIL PROTECTED]>; 
Sent: Saturday, July 30, 2005 5:57 PM
Subject: Re: [PHP] Running a PHP script everyday




If you're on Windows, use Task Manager and have it start an instance of a
web browser, with your URL and script passed to it.
or
Cron job on server, if you have that level of access.

Miles


At 01:17 PM 7/30/2005, [EMAIL PROTECTED] wrote:


I have a PHP script that I need to run once a day.  I have it currently
setup so that I just run it from my cell phone, but I would prefer


something


automated. I'd looked into a cron job, but that just looks like it's for
doing linux command line stuff on my host.

I also thought about writing a never ending while loop with an if


statement


that checks to see if it's time to run the script, then when it is time,


it


runs. Then checks to see if it's time again.

But even assuming I could get it working, do I really want to have a PHP
script that runs all the time. This could be bad if it ate up all the CPU


on


my server. I'm not even sure I have access rights to kill the process


once I


start it.

Any suggestions?

Andrew Darrow
Kronos1 Productions
www.pudlz.com


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





--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005







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



[PHP] [JOB] Need a Developer for PHP-MySQL Project

2005-08-01 Thread Larry E . Ullman
The National Coalition for Dialogue and Deliberation (NCDD) is seeking 
an independent contractor or company to perform some PHP and MySQL Web 
development work. In simplest terms, the Web site is a MySQL-driven 
content management system (CMS), written in PHP, running on a 
Unix/Linux server. The project can be done remotely but must be 
completed by the end of 2005.


A full and descriptive request for proposal can be found at 
http://www.thataway.org/misc/ncdd_rfp.pdf


Questions can be addressed to the contact person named in the RFP or by 
replying to this email (not to the mailing list).


Thanks,
Larry

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



[PHP] php script calling another one (on different machine), session variables

2005-08-01 Thread James

I have two Windows machines.

machine A has apache/mysql/php (main host)
machine B has apache/media server (secondary host for high bandwidth 
media such as video)


I have admin tools (written in PHP and using sesson variables) on A 
which allows for updating of the database with pictures and such. The 
admin tools also allows you to delete records.


When the user deletes a record using the admin tools on machine A, I 
also want to delete some media files on machine B.


At this point, I figured that I should have my admin tools call a PHP 
script on machine B to delete files from the B's filesystem.


I did a search online and it seems that I should use a header() call 
to call the PHP script on machine B.


But what if I want to RETURN the user to the admin tools?  Can I send 
another header() from machine B's script?  What will happen to the 
session variables?  How can I hold onto the session variables while 
moving between web servers?



--
-James

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



Re: [PHP] php script calling another one (on different machine), session variables

2005-08-01 Thread James

I just thought of something...

Will this work...


(machine A) User hits submit in the Admin Tools to delete a record.
(machine A) I send POST variables to a database php script in a NEW 
WINDOW...at the end of the script...it uses a header() to call the 
PHP script on machine B...to delete files from that machine.
(machine B) after the php script runs and deletes the media files, it 
displays a "SUCCESS...please close window" which appears in the new 
window.


The user still has the admin tools, with it's session variables, in 
the parent window.


-James



At 2:43 PM -0400 8/1/05, James wrote:

I have two Windows machines.

machine A has apache/mysql/php (main host)
machine B has apache/media server (secondary host for high bandwidth 
media such as video)


I have admin tools (written in PHP and using sesson variables) on A 
which allows for updating of the database with pictures and such. 
The admin tools also allows you to delete records.


When the user deletes a record using the admin tools on machine A, I 
also want to delete some media files on machine B.


At this point, I figured that I should have my admin tools call a 
PHP script on machine B to delete files from the B's filesystem.


I did a search online and it seems that I should use a header() call 
to call the PHP script on machine B.


But what if I want to RETURN the user to the admin tools?  Can I 
send another header() from machine B's script?  What will happen to 
the session variables?  How can I hold onto the session variables 
while moving between web servers?



--
-James

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



--
-James

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



Re: [PHP] php script calling another one (on different machine), session variables

2005-08-01 Thread Rory Browne
On 8/1/05, James <[EMAIL PROTECTED]> wrote:
> I have two Windows machines.
> 
> machine A has apache/mysql/php (main host)
> machine B has apache/media server (secondary host for high bandwidth
> media such as video)
> 
> I have admin tools (written in PHP and using sesson variables) on A
> which allows for updating of the database with pictures and such. The
> admin tools also allows you to delete records.
> 
> When the user deletes a record using the admin tools on machine A, I
> also want to delete some media files on machine B.
> 
> At this point, I figured that I should have my admin tools call a PHP
> script on machine B to delete files from the B's filesystem.
> 
> I did a search online and it seems that I should use a header() call
> to call the PHP script on machine B.
Um.. No. You use header when you want to pass additional headers to
the browser, that is downloading your content. An example of this
would be when you want to serve up a PNG image, instead of html, you
would use header("Content-type: image/png")

You can use a header to redirect a user to scripts on another system.
To do this you would pass a location header header("Location:
serverb.com/whatever")

If you want to call a script on machine B, then you can either simply
use file handling functions eg: fopen("http://machineb/page.php";), or
www.php.net/curl

> 
> But what if I want to RETURN the user to the admin tools?  Can I send
> another header() from machine B's script?  What will happen to the
> session variables?  How can I hold onto the session variables while
> moving between web servers?
Do the two machines share a common domain name? are your machines for
example boxa.commondomain.com and boxb.commondomain.com if so then you
can have the cookies(which hold the session tracking number) operate
at the commondomain.com level. All you have to do then is configure
one machine to get session files from the other.

Otherwise you can use session.use_trans_sid and add the SID to the url
when you header("Location")

In windows you could do this by setting up a share containing the
session files, and modding your php.ini file to reflect that the
session info is stored in this file.

If you don't have admin access to your boxes, then you could write a
session handler on one of the systems to dl the necessary sesssion
info on demand. For more info see

Having that said, it seems to be a fairly common requirement - so
there may be a cleaner solution to the one I have outlined here. I've
just never needed it  - so therefore I've never come across it.

> 
> 
> --
> -James
> 
> --
> 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] php script calling another one (on different machine), session variables

2005-08-01 Thread Jochem Maas

Rory Browne wrote:

On 8/1/05, James <[EMAIL PROTECTED]> wrote:


...



Do the two machines share a common domain name? are your machines for
example boxa.commondomain.com and boxb.commondomain.com if so then you
can have the cookies(which hold the session tracking number) operate
at the commondomain.com level. All you have to do then is configure
one machine to get session files from the other.

Otherwise you can use session.use_trans_sid and add the SID to the url
when you header("Location")

In windows you could do this by setting up a share containing the
session files, and modding your php.ini file to reflect that the
session info is stored in this file.

If you don't have admin access to your boxes, then you could write a
session handler on one of the systems to dl the necessary sesssion
info on demand. For more info see


purely out of interest, see what? :-)



Having that said, it seems to be a fairly common requirement - so
there may be a cleaner solution to the one I have outlined here. I've
just never needed it  - so therefore I've never come across it.




--
-James

--
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] returning info. from a form selection

2005-08-01 Thread Bruce Gilbert
can anyone give me an idea on how to return info. from a forl pulldown menu

eg:


  Purchase
  Construct Home
  


and return that to an email address.


thanks



-- 
::Bruce::

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



Re: [PHP] php script calling another one (on different machine), session variables

2005-08-01 Thread Rory Browne
On 8/1/05, Jochem Maas <[EMAIL PROTECTED]> wrote:
> Rory Browne wrote:
> > On 8/1/05, James <[EMAIL PROTECTED]> wrote:
> 
> ...
> 
> >
> > Do the two machines share a common domain name? are your machines for
> > example boxa.commondomain.com and boxb.commondomain.com if so then you
> > can have the cookies(which hold the session tracking number) operate
> > at the commondomain.com level. All you have to do then is configure
> > one machine to get session files from the other.
> >
> > Otherwise you can use session.use_trans_sid and add the SID to the url
> > when you header("Location")
> >
> > In windows you could do this by setting up a share containing the
> > session files, and modding your php.ini file to reflect that the
> > session info is stored in this file.
> >
> > If you don't have admin access to your boxes, then you could write a
> > session handler on one of the systems to dl the necessary sesssion
> > info on demand. For more info see
> 
> purely out of interest, see what? :-)

Sorry - but I thought someone of your experience Jochem would know :)

See: http://www.php.net/manual/en/function.session-set-save-handler.php


> 
> >
> > Having that said, it seems to be a fairly common requirement - so
> > there may be a cleaner solution to the one I have outlined here. I've
> > just never needed it  - so therefore I've never come across it.
> >
> >
> >>
> >>--
> >>-James
> >>
> >>--
> >>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] returning info. from a form selection

2005-08-01 Thread Rory Browne
You would give the options a different value(each of them in your case is "")

Try 

 
  Purchase
  Construct Home
  
 


May I also suggest that if you're experimenting try putting "" without the quotes into whatever.php(see form action)


On 8/1/05, Bruce Gilbert <[EMAIL PROTECTED]> wrote:
> can anyone give me an idea on how to return info. from a forl pulldown menu
> 
> eg:
> 
> name="loan_process">
>selected="selected">Purchase
>value="">Construct Home
>  
> 
> 
> and return that to an email address.
> 
> 
> thanks
> 
> 
> 
> --
> ::Bruce::
> 
> --
> 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] returning info. from a form selection

2005-08-01 Thread Jack Jackson
It'd have to be in the form of a form and you'd need to add values to 
the options, wrap it inside form tags, specify a method like $_POST or 
$_GET, error check and then send.





Bruce Gilbert wrote:

can anyone give me an idea on how to return info. from a forl pulldown menu

eg:

name="loan_process">
selected="selected">Purchase
value="">Construct Home

  


and return that to an email address.


thanks





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



Re: [PHP] MYSQL translator

2005-08-01 Thread Rory Browne
>From what I can see it looks a bit like an SQL version of the
strtotime function. Basicly it translates from a less strict syntax,
into the more strict SQL syntax, with the added advantage that the
less strict one can be in a different language(in this case French and
Italian)

Is my understanding correct Alessandro?

On 8/1/05, Alessandro Rosa <[EMAIL PROTECTED]> wrote:
> Dear All subscribers,
> 
> I wish to submit to you a PHP class I coded to translate native language
> parsed queries into SQL syntax ones.
> 
> The main goal of this class is the implementation into web-based
> applications
> for letting final users/customers input their own defined queries without
> knowing
> sql syntax strictly. This goes into the direction of giving wider
> flexibility to sql users.
> 
> Native language queries really look like everyday input requests.
> 
> Class still supports French and Italian, but I look forward to find helpers
> to
> supply other languages. So you are invited to visit this link
> 
> http://www.phpclasses.org/browse/package/2449.html
> 
> for further infos, as well as the class code, examples, shots to preview how
> it
> works and a short tutorial.
> 
> For those who would like helping me to provide new language, I'm going
> to write down a PDF document for listing the general features, the
> properties
> of all entries to lessen the creation of new related dictionaries.
> 
> Thanks,
> 
> Alessandro Rosa
> 
> --
> 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] Running a PHP script everyday

2005-08-01 Thread Steve Buehler

At 09:56 AM 8/1/2005, you wrote:

[snip]
What is the "-q" for?  I can't find any documentation on it.  If I do
a "php -h" or "man php", it is not listed.  I am running php 5.0.3 on
RHEL ES 4
[/snip]

It means 'quiet'...in other words do not send anything to standard out.


Thank You.  I guess they are keeping "quiet" about letting people 
know about it.  I would have thought that a "php -h" or "man php" 
would have given me the answer to that one.  And since the poster 
said that he needed that to run the program, it never occurred to me 
that it was for "quiet" since that should not hinder him from running 
a program.  Just keep him from getting a bunch of output.  Of course, 
I might have total mis-understood him too.  I have to much going on 
right now to remember.  Anyway, thanks.


Thanks
Steve

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



Re: [PHP] returning info. from a form selection

2005-08-01 Thread Rory Browne
On 8/1/05, Jack Jackson <[EMAIL PROTECTED]> wrote:
> It'd have to be in the form of a form and you'd need to add values to
> the options, wrap it inside form tags, specify a method like $_POST or
> $_GET, error check and then send.

You don´t _have_  to specify a method. It defaults to "GET". Although
granted you generally do have to place it inside a  tag.



> 
> 
> 
> 
> Bruce Gilbert wrote:
> > can anyone give me an idea on how to return info. from a forl pulldown menu
> >
> > eg:
> >
> >  > name="loan_process">
> >>   selected="selected">Purchase
> >>   value="">Construct Home
> >   
> > 
> >
> > and return that to an email address.
> >
> >
> > thanks
> >
> >
> >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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



Re: [PHP] returning info. from a form selection

2005-08-01 Thread Edwin Barrios
 Hi . !
 
 what you want it's  recive values from a "select". !!!
 
 First a select input send ( when the form is submitted ), the value of
 the selected item, then
 the php script that  it's the form action recive, a on post  or get a
 variable with the name of  the select input with this value.
 
 Then  you have:
 
 This the html source
 
 
 
  Purchase
  Construct Home
  
 
 
 
 
 On the php source:
 
 
 
 
 That it's all.
> 
> 
> On 8/1/05, Bruce Gilbert <[EMAIL PROTECTED]> wrote:
> > can anyone give me an idea on how to return info. from a forl pulldown menu
> >
> > eg:
> >
> >  > name="loan_process">
> >>   selected="selected">Purchase
> >>   value="">Construct Home
> >   
> > 
> >
> > and return that to an email address.
> >
> >
> > thanks
> >
> >
> >
> > --
> > ::Bruce::
> >
> > --
> > 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: error checking a null array

2005-08-01 Thread Jack Jackson

AAarg.


Okay, thanks to all of you I've decided that any field name I need to 
see will be sent to $_SESSION['required_fields'] and basta.


Then after the submit button is pressed, I am doing this:



reset($_SESSION['required_fields']);
  foreach ($_SESSION['required_fields'] as $fieldname)
{
   if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]))
{
$message[$fieldname]=1;
include_once(QUESTIONS . 'q.inc');
}
}//error check



And this is *almost* working: it seems to crap out after the first loop 
through the $_SESSION['required_field'] array.


The array says:

Array ( [required_fields] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 
[4] => 1 [5] => 2 [6] => 3 [7] => 4 [8] => 1 [9] => 2 [10] => 3 [11] => 
4 ) )


$_POST says:

Array ( [action] => [process]process [1] => [2] => 68 [3] => [4] => )

So you see, there's an answer specified for the value of question [2].

But $messages says only:

$message: array(1) { [1]=>  int(1) }


Why is it dying after the first loop through?

Thanks in advance

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



[PHP] Performace and segfault errors with Php5 + Apache 1.3.x + linux-2.6.x

2005-08-01 Thread Edwin Barrios
i'am developing  a web framework SifEngine (Secure Web Inteface
framework) that implement MVC applaying the security ideas from
http://phpsec.org. I'am using DomXML, Sqlite, Mcrypt and PostgreSql.

After  of post my development on the internet ( i have been thinking
to post on PEAR ), i made simple tests of aplications with my
framework. During the implementation, i used Slackware 10.1 with
kernel 2.4.29 + php5.0.4 + Apache 1.3.2, with no problems. I didn't
detect  performace problems or segfaults by apache.  Then i decided to
do the same test but with kernel 2.6.10, wating that no problems
occur. However my expectation, on this new configuration all the
aplications develped with my framework, had performance issues or in
the worst situation produce apache forks  to be restarted, or a lot of
apache forks.

i don't undestand why this occur, i try to use valigrand to verify
memorie lacks without results.

Someone can help me, with this problem !

On this moment i'm using SIfEngine, to implement my proyects only on
kernel 2.4.x !

Thanks !

Atte:
Edwin Hernan Barrios Nuñez
iBand Networks Ltda.
www.iband.net

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



[PHP] trying to understand PHP unpack();

2005-08-01 Thread Sonia
Hi

In Perl I have a part of a script

# cut..

my $line = '!v2005*08|05+09?04^19*!';

my ( $s_code, $year, $month, $day, $hour, $minute, $second, $e_code ) =
unpack ( "x1 A1 A4 x1 A2 x1 A2 x1 A2 x1 A2 x1 A2 A1", $line );

print $s_code . "\n";
print $year . "\n";
print $month . "\n";
print $day . "\n";
print $hour . "\n";
print $minute . "\n";
print $second . "\n";
print $e_code . "\n";

sleep 10; # so we can see it in the command window



In Perl this runs without trouble, in PHP it does not seem to work the same
way. Can someone explain to me what I need to do differently to
allow PHP to understand what I am trying to do!




Thanks

SD

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



RE: [PHP] returning info. from a form selection

2005-08-01 Thread Jim Moseby
> 
> can anyone give me an idea on how to return info. from a forl 
> pulldown menu
> 
> eg:
> 
>  name="loan_process">
>  selected="selected">Purchase
>  value="">Construct Home
>   
> 
> 
> and return that to an email address.
> 

A most basic question begs a most basic answer:




Dropdown Value to Email





  Purchase
  Construct Home
  




http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Performace and segfault errors with Php5 + Apache 1.3.x + linux-2.6.x

2005-08-01 Thread Greg Donald
On 8/1/05, Edwin Barrios <[EMAIL PROTECTED]> wrote:
> i'am developing  a web framework SifEngine (Secure Web Inteface
> framework) that implement MVC applaying the security ideas from
> http://phpsec.org. I'am using DomXML, Sqlite, Mcrypt and PostgreSql.
> 
> After  of post my development on the internet ( i have been thinking
> to post on PEAR ), i made simple tests of aplications with my
> framework. During the implementation, i used Slackware 10.1 with
> kernel 2.4.29 + php5.0.4 + Apache 1.3.2, with no problems. I didn't
> detect  performace problems or segfaults by apache.  Then i decided to
> do the same test but with kernel 2.6.10, wating that no problems
> occur. However my expectation, on this new configuration all the
> aplications develped with my framework, had performance issues or in
> the worst situation produce apache forks  to be restarted, or a lot of
> apache forks.
> 
> i don't undestand why this occur, i try to use valigrand to verify
> memorie lacks without results.
> 
> Someone can help me, with this problem !
> 
> On this moment i'm using SIfEngine, to implement my proyects only on
> kernel 2.4.x !

Any exotic security patches been applied to the kernel that is having issues?

I have PHP5, Apache2 on a 2.6.8 kernel with no issues.  It may be that
you have a non-thread-safe library added to your Apache/PHP setup. 
Apache 1.3.x is still the Apache of choice last I heard.


-- 
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

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



Re: [PHP] Performace and segfault errors with Php5 + Apache 1.3.x + linux-2.6.x

2005-08-01 Thread Edwin Barrios
I compile the vanilla kernel from kernel.org, linux-2.6.10 , and i'am
using apache 1.3.3.  My php  congifigurations are:

'./configure' '--with-apxs' '--with-pgsql' '--with-mysql'
'--with-opennssl' '--with-zlib' '--with-bz2' '--enable-calendar'
'--with-curl' '--with-curlwarppers' '--enable-ftp' '--with-gettext'
'--with-mcrypt' '--enable-pcntl' '--enable-soap' '--enable-sockets'
'--enable-sqlite-utf8' '--enable-sysvmsg' '--enable-sysvsem'
'--enable-sysvshm' '--enable-shmop' '--with-xsl'
'--enable-maintainer-zts' '--with-tsrm-pthreads'

Then, i don't know what it's happing.

On 8/1/05, Greg Donald <[EMAIL PROTECTED]> wrote:
> On 8/1/05, Edwin Barrios <[EMAIL PROTECTED]> wrote:
> > i'am developing  a web framework SifEngine (Secure Web Inteface
> > framework) that implement MVC applaying the security ideas from
> > http://phpsec.org. I'am using DomXML, Sqlite, Mcrypt and PostgreSql.
> >
> > After  of post my development on the internet ( i have been thinking
> > to post on PEAR ), i made simple tests of aplications with my
> > framework. During the implementation, i used Slackware 10.1 with
> > kernel 2.4.29 + php5.0.4 + Apache 1.3.2, with no problems. I didn't
> > detect  performace problems or segfaults by apache.  Then i decided to
> > do the same test but with kernel 2.6.10, wating that no problems
> > occur. However my expectation, on this new configuration all the
> > aplications develped with my framework, had performance issues or in
> > the worst situation produce apache forks  to be restarted, or a lot of
> > apache forks.
> >
> > i don't undestand why this occur, i try to use valigrand to verify
> > memorie lacks without results.
> >
> > Someone can help me, with this problem !
> >
> > On this moment i'm using SIfEngine, to implement my proyects only on
> > kernel 2.4.x !
> 
> Any exotic security patches been applied to the kernel that is having issues?
> 
> I have PHP5, Apache2 on a 2.6.8 kernel with no issues.  It may be that
> you have a non-thread-safe library added to your Apache/PHP setup.
> Apache 1.3.x is still the Apache of choice last I heard.
> 
> 
> --
> Greg Donald
> Zend Certified Engineer
> MySQL Core Certification
> http://destiney.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



Re: [PHP] Performace and segfault errors with Php5 + Apache 1.3.x + linux-2.6.x

2005-08-01 Thread Greg Donald
On 8/1/05, Edwin Barrios <[EMAIL PROTECTED]> wrote:
> I compile the vanilla kernel from kernel.org, linux-2.6.10 , and i'am
> using apache 1.3.3.  My php  congifigurations are:
> 
> './configure' '--with-apxs' '--with-pgsql' '--with-mysql'
> '--with-opennssl' '--with-zlib' '--with-bz2' '--enable-calendar'
> '--with-curl' '--with-curlwarppers' '--enable-ftp' '--with-gettext'

--with-curlwrappers, I doubt that's your segfault issue though.

You could recompile everything with debugging and use gdb.  At least
then you could produce a backtrace to send to the maintainers.


-- 
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

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



Re: [PHP] php script calling another one (on different machine), session variables

2005-08-01 Thread Jochem Maas

Rory Browne wrote:

...



If you don't have admin access to your boxes, then you could write a
session handler on one of the systems to dl the necessary sesssion
info on demand. For more info see


purely out of interest, see what? :-)



Sorry - but I thought someone of your experience Jochem would know :)


experience? me? only the bad kind ;-)



See: http://www.php.net/manual/en/function.session-set-save-handler.php


ah, righty ho. that does look familiar - I just assumed that you were pointing
to some resource/article elsewhere than php.net - didn't cross my mind that you 
might
just have been pointing to OP to the most natural place to start reading about 
sessions
(or anything php for that matter) - which is why I asked, you never you when 
you can learn
something new! :-)

that said I have always been satisfied with the default session handler (and 
given that
(nearly) all my work is published either on my 'own' server (not really mine 
but I have
full control and there are no 'anon' 3rd party running stuff) or on dedicated 
servers belonging
to clients I don't have to worry about all the potential security risks 
involved with (badly setup?)
shared hosting environments. for that reason (and lack of time) I have never 
really dived deep
into to the possibilities of custom session handlers (I have used some 3rd 
party code once that
used a mysql DB to store the session data which was a quite simple affair - 
such a setup would
allow sharing of sessions accross various boxes asumming a shared base 
domain)

rgds,
jochem







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



Re: [PHP] trying to understand PHP unpack();

2005-08-01 Thread Jochem Maas

Sonia wrote:

Hi

In Perl I have a part of a script

# cut..

my $line = '!v2005*08|05+09?04^19*!';

 ^-- note how my email client screws up your 
original
string... something I don't really understand...


my ( $s_code, $year, $month, $day, $hour, $minute, $second, $e_code ) =
unpack ( "x1 A1 A4 x1 A2 x1 A2 x1 A2 x1 A2 x1 A2 A1", $line );

print $s_code . "\n";
print $year . "\n";
print $month . "\n";
print $day . "\n";
print $hour . "\n";
print $minute . "\n";
print $second . "\n";
print $e_code . "\n";

sleep 10; # so we can see it in the command window



In Perl this runs without trouble, in PHP it does not seem to work the same
way. Can someone explain to me what I need to do differently to
allow PHP to understand what I am trying to do!


  ^-- this will cause a parse error



$output = unpack ( "x1 A1 A4 x1 A2 x1 A2 x1 A2 x1 A2 x1 A2 A1", $line );

print_r ( $output );

?>


I have next no knowledge wroth speaking of concerning binary data - and the
string screw problem mentioned above makes it impossible for me to determine 
whether
I am really on the right path here but take a look at the following:

$line = "!v2005*08|05+09?0419*!";
$output  = unpack ( "x1 A1 A4 x1 A2 x1 A2 x1 A2 x1 A2 x1 A2 A1", $line );
$output2 = unpack ( "x1A1A4x1A2x1A2x1A2x1A2x1A2A1", $line );
$output3 = unpack ( "x1/A1/A4/x1/A2/x1/A2/x1/A2/x1/A2/x1/A2/A1", $line );
$output4 = unpack ( 
"x1_a/A1_b/A4_c/x1_d/A2_e/x1_f/A2_g/x1_h/A2_i/x1_j/A2_k/x1_l/A2_m/A1_n", $line 
);
var_dump( $output, $output2, $output3, $output4 );'

this page:
http://nl2.php.net/unpack

... does mention that the php unpack() implementation is somewhat different to 
the perl one
(btw I'm a complete perl luddite! - I don't think my brain can cope with that 
much cryptic crap
;-) - that said thank Larry for PCRE!)

I'd be very grateful if you report back on your progress - I for one can 
definitely learn something
here!

rgds,
jochem

ps - welcome to phpland perlie ;-)




Thanks

SD



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



Re: [PHP] php script calling another one (on different machine), session variables

2005-08-01 Thread James

Thanks Rory:

I tried using fopen() and CURL and they both worked like a  charm!
No need to juggle redirects and session variables.


-James



At 9:21 PM +0200 8/1/05, Rory Browne wrote:

On 8/1/05, Jochem Maas <[EMAIL PROTECTED]> wrote:

 Rory Browne wrote:
 > On 8/1/05, James <[EMAIL PROTECTED]> wrote:

 ...

 >
 > Do the two machines share a common domain name? are your machines for
 > example boxa.commondomain.com and boxb.commondomain.com if so then you
 > can have the cookies(which hold the session tracking number) operate
 > at the commondomain.com level. All you have to do then is configure
 > one machine to get session files from the other.
 >
 > Otherwise you can use session.use_trans_sid and add the SID to the url
 > when you header("Location")
 >
 > In windows you could do this by setting up a share containing the
 > session files, and modding your php.ini file to reflect that the
 > session info is stored in this file.
 >
 > If you don't have admin access to your boxes, then you could write a
 > session handler on one of the systems to dl the necessary sesssion
 > info on demand. For more info see

 purely out of interest, see what? :-)


Sorry - but I thought someone of your experience Jochem would know :)

See: http://www.php.net/manual/en/function.session-set-save-handler.php




 >
 > Having that said, it seems to be a fairly common requirement - so
 > there may be a cleaner solution to the one I have outlined here. I've
 > just never needed it  - so therefore I've never come across it.
 >
 >
 >>
 >>--
 >>-James
 >>
 >>--
 >>PHP General Mailing List (http://www.php.net/)
 >>To unsubscribe, visit: http://www.php.net/unsub.php
 >>
 >>
 >
 >





--
-James

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



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Jochem Maas

Jack Jackson wrote:

AAarg.


Okay, thanks to all of you I've decided that any field name I need to 
see will be sent to $_SESSION['required_fields'] and basta.


Then after the submit button is pressed, I am doing this:



reset($_SESSION['required_fields']);


reset is not required when using foreach. and given that you have probably
not looped that item


  foreach ($_SESSION['required_fields'] as $fieldname)
{
   if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]))
{
$message[$fieldname]=1;
include_once(QUESTIONS . 'q.inc');
}
}//error check




you may be getting into trouble because of php's typecasting - try using
fielnames that are strings that do not auto cast to integers (which can be
used as array keys for indexed arrays) e.g. "cb1" instead of "1"



And this is *almost* working: it seems to crap out after the first loop 
through the $_SESSION['required_field'] array.


The array says:

Array ( [required_fields] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 
[4] => 1 [5] => 2 [6] => 3 [7] => 4 [8] => 1 [9] => 2 [10] => 3 [11] => 
4 ) )


$_POST says:

Array ( [action] => [process]process [1] => [2] => 68 [3] => [4] => )


that does not look like valid output from var_dump() neither does the output you
show for $_SESSION['required_field'].



So you see, there's an answer specified for the value of question [2].

But $messages says only:

$message: array(1) { [1]=>  int(1) }


Why is it dying after the first loop through?


is it? (use print_r() or var_dump() inside the loop to see what is happening)

NOT SO SUBTLE HINT: USE echo, print_r() and var_dump() until either you fingers 
or
your eyes start to bleed ;-) if you still haven't figured it out by then it's
time to see a doctor -



Thanks in advance



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



[PHP] array()

2005-08-01 Thread Sebastian

is it always necessary to call array() when you do something like this:

mysql_query("SELECT ");
while($rows .)
{
   $data[] = $rows;
}

if so, why? i have a habit of never calling array() and someone told me 
i shouldn't do this.



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005

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



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Jack Jackson

I can only swear this to the entire list:

Before I come here for help, each time, I echo and var_dump and print_r 
until, yes, I need a doctor.


So by the time I come here, it's not laziness or lack of looking in the 
manual, it's head-swirling confusion infused with incompetence and a 
complete lack of programming experience at any time before April of this 
year which leads me to come back again and again with relatively foolish 
questions.



My problem before, for example: In my error check function, I placed the 
include file (to return to the form) *within* the foreach loop, and then 
I wondered why it only ran through once.


D'oh.



Jochem Maas wrote:

Jack Jackson wrote:


AAarg.


Okay, thanks to all of you I've decided that any field name I need to 
see will be sent to $_SESSION['required_fields'] and basta.


Then after the submit button is pressed, I am doing this:



reset($_SESSION['required_fields']);



reset is not required when using foreach. and given that you have probably
not looped that item


  foreach ($_SESSION['required_fields'] as $fieldname)
{
   if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]))
{
$message[$fieldname]=1;
include_once(QUESTIONS . 'q.inc');
}
}//error check




you may be getting into trouble because of php's typecasting - try using
fielnames that are strings that do not auto cast to integers (which can be
used as array keys for indexed arrays) e.g. "cb1" instead of "1"



And this is *almost* working: it seems to crap out after the first 
loop through the $_SESSION['required_field'] array.


The array says:

Array ( [required_fields] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 
4 [4] => 1 [5] => 2 [6] => 3 [7] => 4 [8] => 1 [9] => 2 [10] => 3 [11] 
=> 4 ) )


$_POST says:

Array ( [action] => [process]process [1] => [2] => 68 [3] => [4] => )



that does not look like valid output from var_dump() neither does the 
output you

show for $_SESSION['required_field'].



So you see, there's an answer specified for the value of question [2].

But $messages says only:

$message: array(1) { [1]=>  int(1) }


Why is it dying after the first loop through?



is it? (use print_r() or var_dump() inside the loop to see what is 
happening)


NOT SO SUBTLE HINT: USE echo, print_r() and var_dump() until either you 
fingers or
your eyes start to bleed ;-) if you still haven't figured it out by then 
it's

time to see a doctor -












Thanks in advance







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



Re: [PHP] array()

2005-08-01 Thread Edward Vermillion

Sebastian wrote:

is it always necessary to call array() when you do something like this:

mysql_query("SELECT ");
while($rows .)
{
   $data[] = $rows;
}

if so, why? i have a habit of never calling array() and someone told me 
i shouldn't do this.



If that's your first use of $data then it's not necessary, but it's very 
highly recommended to do something like:


$data = array();

mysql_query("SELECT ");
while($rows .)
{
   $data[] = $rows;
}

That way you _know_ that $data is "clean" before you start doing 
anything with it.


It's always a good idea to set any variables you're using to some value, 
either "", array(), 0, or some default value, before you use them to 
help keep the "bad guys" out of your scripts.


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



[PHP] php-mySQL insert problem

2005-08-01 Thread Adi Zebic

Hi,

I'm new in php so like usual I have little problem(s).
I have "DB" clas who connect to database, select database, query 
database and so on.

I have other class "User" with some "members".
exemple:
...
var $firstName;
var $lastName;
...
Then I need to insert created object into mySQL database doing something 
like this:

INSERT into TABLE values ($this -> firstName, $this -> lastName);

I do that this way:

$insertQuery = "Insert into TABLE values (".$this -> firstName.",".$this 
-> lastName)");

$db = new DB;
$db -> query($insertQuery);

this is not working and I have next message:
Parse error: parse error, unexpected T_OBJECT_OPERATOR in 
/Library/Apache2/htdocs/Users.php on line 80


I think that my error is in escape characters and I dont not know hox to 
resolve my problem. Any help is welcome.


Thanks in advance

ADI

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



Re: [PHP] Timezone date/time conversion

2005-08-01 Thread Chris Boget

I'm sure something like this has already been written and I'd
hate to redesign the wheel.  I've searched google but came up
empty and am wondering if any of you guys have what I am
looking for.


I ended up writing my own.  Hopefully to help anyone else out
trying to do the same thing, I've included my function below.
I used the following page as a guide

http://www.timeanddate.com/library/abbreviations/timezones/

function calculateTimeZoneDate( $dateTime, $fromTZ, $toTZ, $fromLocation = 
'North America', $toLocation = 'GMT' ) {


 $retval = $dateTime;
 $timeStamp  = strtotime( $dateTime );

 $timeZonesArray = array( 'GMT' => array( 'GMT' => +0 // GMT
 ),
  'North America'  => array( 'NST' => -3.5, // 
Newfoundland Standard Time
 'NDT' => -2.5, // 
Newfoundland Daylight Time
 'AST' => -4, // 
Atlantic Standard Time
 'ADT' => -3, // 
Atlantic Daylight Time
 'EST' => -5, // 
Eastern Standard Time
 'EDT' => -4, // 
Eastern Daylight Time
 'CST' => -6, // 
Central Standard Time
 'CDT' => -5, // 
Central Daylight Time
 'MST' => -7, // 
Central Daylight Time
 'MDT' => -6, // 
Mountain Daylight Time
 'PST' => -8, // 
Pacific Standard Time
 'PDT' => -7, // 
Pacific Daylight Time
 'AKST' => -9, // 
Alaska Standard Time
 'AKDT' => -8, // 
Alaska Daylight Time
 'HAST' => -10, // 
Hawaii-Aleutian Standard Time
 'HADT' => -9 // 
Hawaii-Aleutian Daylight Time

 ),
  'Australia'  => array( 'NFT' => +11.5, // 
Norfolk (Island) Time
 'EST' => +10, // 
Eastern Standard Time
 'EDT' => +11, // 
Eastern Daylight Time
 'CST' => +9.5, // 
Central Standard Time
 'CDT' => +10.5, // 
Central Daylight Time
 'WST' => +8, // 
Western Standard Time
 'CXT' => +7, // 
Christmas Island Time

 ),
  'Europe' => array( 'GMT' => +0, // 
Greenwich Mean Time
 'BST' => +1, // 
British Summer Time
 'IST' => +1, // Irish 
Summer Time
 'WET' => +0, // 
Western European Time
 'WEST' => +1, // 
Western European Summer Time
 'CET' => +1, // 
Central European Time
 'CEST' => +2, // 
Central European Summer Time
 'EET' => +2, // 
Eastern European Time
 'EEST' => +3 // 
Eastern European Summer Time

 ),
  'Military'   => array( 'Z' => +0, // Zulu 
Time Zone
 'Y' => -12, // Yankee 
Time Zone
 'X' => -11, // X-ray 
Time Zone
 'W' => -10, // Whiskey 
Time Zone
 'V' => -9, // Victor 
Time Zone
 'U' => -8, // Uniform 
Time Zone
 'T' => -7, // Tango 
Time Zone
 'S' => -6, // Sierra 
Time Zone
 'R' => -5, // Romeo 
Time Zone
 'Q' => -4, // Quebec 
Time Zone
 'P' => -3, // Papa 
Time Zone
 'O' => -2, // Oscar 
Time Zone
 'N' => -1, // November 
Time Zon

Re: [PHP] php-mySQL insert problem

2005-08-01 Thread Jack Scott
Try this:
$insertQuery = "Insert into TABLE 
(
col_one,
col_two
)values (
'" . $this -> firstName . "',
'" . $this-> lastName . "'
)";
$db =& new DB;
$res = $db->query($insertQuery);
if(DB::isError($res)){
exit("Insert query failed: ".__FUNCTION__."() in file
".__FILE__."on line ".__LINE__."".$res->getDebugInfo());
}else{
return;
}

you need to have quotes arround your varchar items and you should also
specify which column you want the values to go into.
It is also good practice to check if there is an error and try to get
the most information available.

On Tue, 2005-08-02 at 00:44 +0200, Adi Zebic wrote:
> $insertQuery = "Insert into TABLE values (".$this ->
> firstName.",".$this 
> -> lastName)");
> $db = new DB;
> $db -> query($insertQuery);

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



[PHP] Re: SOLVED - [PHP] php-mySQL insert problem

2005-08-01 Thread Adi Zebic

Jack Scott a écrit :

Try this:
$insertQuery = "Insert into TABLE 
		(

col_one,
col_two
)values (
'" . $this -> firstName . "',
'" . $this-> lastName . "'
)";
$db =& new DB;
$res = $db->query($insertQuery);
if(DB::isError($res)){
exit("Insert query failed: ".__FUNCTION__."() in file
".__FILE__."on line ".__LINE__."".$res->getDebugInfo());
}else{
return;
}

you need to have quotes arround your varchar items and you should also
specify which column you want the values to go into.


Yess! That's the right one :-)


It is also good practice to check if there is an error and try to get
the most information available.


"DB" class do the right thing with try/catch.

THANK YOU VERY VERY MUCH Jack Scott!

ADI

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



Re: [PHP] Re: SOLVED - [PHP] php-mySQL insert problem

2005-08-01 Thread Jack Scott
no prob ;-)

On Tue, 2005-08-02 at 02:27 +0200, Adi Zebic wrote:
> Jack Scott a écrit :
> > Try this:
> > $insertQuery = "Insert into TABLE 
> > (
> > col_one,
> > col_two
> > )values (
> > '" . $this -> firstName . "',
> > '" . $this-> lastName . "'
> > )";
> > $db =& new DB;
> > $res = $db->query($insertQuery);
> > if(DB::isError($res)){
> > exit("Insert query failed: ".__FUNCTION__."() in file
> > ".__FILE__."on line ".__LINE__."".$res->getDebugInfo());
> > }else{
> > return;
> > }
> > 
> > you need to have quotes arround your varchar items and you should also
> > specify which column you want the values to go into.
> 
> Yess! That's the right one :-)
> 
> > It is also good practice to check if there is an error and try to get
> > the most information available.
> 
> "DB" class do the right thing with try/catch.
> 
> THANK YOU VERY VERY MUCH Jack Scott!
> 
> ADI
> 

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



[PHP] very simple, yet can't think how.

2005-08-01 Thread Esteamedpw
Hi everyone, 
 
 Sorry for the n00bie question but I've been racking my brain,  searching 
Google and yes, I have been "RTFM" for over 6 months :-)
 
All I'm trying to do is set up a "User system" that allows a member to  
create their own personal site using an auto_increment type system? This is my  
problem...
 
I've been trying to look through other code trying to figure out where and  
how they do it - but for some reason I can't figure out how to Dynamically  
create something like this:
 
User Joe comes in and creates an account... when he creates his account he  
can give his site a TITLE, DESCRIPTION, ABOUT US INFO (say /aboutus.php),  
CONTACT (./contactus.php), etc. after he clicks "Submit" the system  
automatically 
creates a site such as _http://mydomain.com/0/joe/ _ 
(http://mydomain.com/0/joe/ )   ,   Bob does the same thing and his is 
_http://mydomain.com/0/bob_ 
(http://mydomain.com/0/bob)  
 
I'm sure most of you know how this is done or you've seen it on sites such  
as Soundclick.com (although it's CF) - I've been checking out Jamroom to see if 
 I could figure it out there- but kinda got lost lol... I want to use PHP, 
Smarty  and MySQL to do this - but I'm missing something... I'm not asking 
anybody to  build this - I'm looking for a little guidance, tips, etc. - that's 
all.
 
Would this be done through auto_increment in MySQL or something?
 
Thanks everyone :-)


[PHP] Java - toString() <-> php - ?

2005-08-01 Thread Adi Zebic
To print "state" of object in Java I can define toString() function and 
then I can do something like this:


Java exemple:
*
import java.io.*;
import java.util.*;

public class ReadTextFromFile
{
private static String line;
private static String Fable = new String ("");
private static String NomFable;
private static int cptLine = 0;
private static int nbrPersonnes = 0;
private static String nomPersonnes = new String ("");
private static ArrayList AListe = new ArrayList(nbrPersonnes);

//**
public String toString()
{
return getClass().getName()
+ " [ Nom de la fable: "+  NomFable
+ "  <==>  Nombre de personnes dans dialogue: " + nbrPersonnes
+ " ] "
;
}
***

Is there similar kind of function in php that help us to print the state 
of object in his "life evolution"?


Thanks


ADI

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



[PHP] Re: Java - toString() <-> php - ?

2005-08-01 Thread sonu gill
Hi Adi

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

Check out the link above, and I'm sure you'll find what you are looking for. 
You will find functions there called get_class & get_class_vars that I think 
you will find very helpful.

Hope this helps...

-sonu


"Adi Zebic" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> To print "state" of object in Java I can define toString() function and 
> then I can do something like this:
>
> Java exemple:
> *
> import java.io.*;
> import java.util.*;
>
> public class ReadTextFromFile
> {
> private static String line;
> private static String Fable = new String ("");
> private static String NomFable;
> private static int cptLine = 0;
> private static int nbrPersonnes = 0;
> private static String nomPersonnes = new String ("");
> private static ArrayList AListe = new ArrayList(nbrPersonnes);
>
> //**
> public String toString()
> {
> return getClass().getName()
> + " [ Nom de la fable: "+  NomFable
> + "  <==>  Nombre de personnes dans dialogue: " + nbrPersonnes
> + " ] "
> ;
> }
> ***
>
> Is there similar kind of function in php that help us to print the state 
> of object in his "life evolution"?
>
> Thanks
>
>
> ADI 

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



[PHP] Re: very simple, yet can't think how.

2005-08-01 Thread sonu gill
>From my understanding of what you are trying to do you have templates, 
perhaps, setup for your users that get customized with each individuals 
data.  In that case what you will require to do is first off

1. create a folder for user underneath the corresponding location you want 
the user setup, so if
-web address: www.mydomain.comphysical location: c:\mydomain\
-web address: www.mydomain.com/Joe/ physical location: c:\mydomain\Joe\

2. insert user data into templates
3. copy the template files over to the new folder location for user, so if 
the user has a contactus.php
-web address: www.mydomain.com/Joe/contactus.phpphysical location: 
c:\mydomain\Joe\contactus.php

I'm pretty sure this is probably overkill for what you were looking for. 
Hope it helps..

-sonu

ps-  You will need to look up directory and file manipulation functions. 
They are simple...



<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Hi everyone,
>
> Sorry for the n00bie question but I've been racking my brain,  searching
> Google and yes, I have been "RTFM" for over 6 months :-)
>
> All I'm trying to do is set up a "User system" that allows a member to
> create their own personal site using an auto_increment type system? This 
> is my
> problem...
>
> I've been trying to look through other code trying to figure out where and
> how they do it - but for some reason I can't figure out how to Dynamically
> create something like this:
>
> User Joe comes in and creates an account... when he creates his account he
> can give his site a TITLE, DESCRIPTION, ABOUT US INFO (say /aboutus.php),
> CONTACT (./contactus.php), etc. after he clicks "Submit" the system 
> automatically
> creates a site such as _http://mydomain.com/0/joe/ _
> (http://mydomain.com/0/joe/ )   ,   Bob does the same thing and his is 
> _http://mydomain.com/0/bob_
> (http://mydomain.com/0/bob)
>
> I'm sure most of you know how this is done or you've seen it on sites such
> as Soundclick.com (although it's CF) - I've been checking out Jamroom to 
> see if
> I could figure it out there- but kinda got lost lol... I want to use PHP,
> Smarty  and MySQL to do this - but I'm missing something... I'm not asking
> anybody to  build this - I'm looking for a little guidance, tips, etc. - 
> that's all.
>
> Would this be done through auto_increment in MySQL or something?
>
> Thanks everyone :-)
> 

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



Re: [PHP] Re: very simple, yet can't think how.

2005-08-01 Thread Esteamedpw
 
Thanks, that's actually really close to what I was looking for...
 
so if I wanted, say: _http://mydomain.com/0/joe_ (http://mydomain.com/0/joe)  
  -  you're saying I should have the Directory "/0/" or "/1/" already set 
up...  right? then do I use something such as mkdir and chdir to create joe? 
then 
file  manipulation functions such as fwrite, fread, etc?
 
So basically if I'm reading clearly... I insert the User info into the  
Database, then use that info to write into the Directory "/joe/" ?
 
Thanks a lot man, I feel like I might have been right all along - but this  
is the first big project I've done - so I'm trying to get the Logic down  
correctly before I get started... :-)
 
- Clint
 
p.s. sorry, I meant to do  "reply all" :-(   So, here it is  again!



Re: [PHP] very simple, yet can't think how.

2005-08-01 Thread Mark Cain
I have coded this type of website for many years and have run the gamut of
trying different things -- originally, 8 years ago, I used perl with flat
files and physical folders but in the recent past I have used PHP, MySQL and
dynamic folders.

In my opinion the best way to build this site is with dynamic folders via
custom 404 error handling.  Here how it works:

You build the pages for things like "contact us" "my store" "my stuff" or
whatever.  Then you send someone to the site with an address like:
mydomain.com/joe which doesn't exist.  A custom 404 error handler picks up
the error and parses the URL to identify "joe" as a unique ID.  The 404
script pulls "joe's" info from a database and populates the pages with his
custom contact info then delivers the page.  Joe's ID usually gets stuffed
into a cookie and then when the person comes back to the site at a later
date, they are delivered joe's info.

That's it in a nut shell.  Be sure that you deliver 200 headers and not 404
headers when delivering the dynamic folder.

Now you can do the physical folders and every  time someone "signs up" you
can take the template and populate their pages and store these pages in a
real folder named "joe."  But, be aware using this method.  Success (if
having lots of users is your goal) will be your downfall because this system
is not easily scalable.  Just think what happens if you have 500 folders, or
5,000 or 50,000 folders with every folder having a copy of the files in
them.

Here is a 404 script I use:



And here is the start of the getinfo.php script:



Be sure to code the handling of an actual 404 just in case you don't have a
user named joe or the surfer miss types.

There's a ton of work in getting all of the bases covered - but it's sweet
when it's done and you will know a lot of how a server works.

Hope this helps.

Mark Cain




- Original Message -
From: <[EMAIL PROTECTED]>
To: 
Sent: Monday, August 01, 2005 8:44 PM
Subject: [PHP] very simple, yet can't think how.


> Hi everyone,
>
>  Sorry for the n00bie question but I've been racking my brain,  searching
> Google and yes, I have been "RTFM" for over 6 months :-)
>
> All I'm trying to do is set up a "User system" that allows a member to
> create their own personal site using an auto_increment type system? This
is my
> problem...
>
> I've been trying to look through other code trying to figure out where and
> how they do it - but for some reason I can't figure out how to Dynamically
> create something like this:
>
> User Joe comes in and creates an account... when he creates his account he
> can give his site a TITLE, DESCRIPTION, ABOUT US INFO (say /aboutus.php),
> CONTACT (./contactus.php), etc. after he clicks "Submit" the system
automatically
> creates a site such as _http://mydomain.com/0/joe/ _
> (http://mydomain.com/0/joe/ )   ,   Bob does the same thing and his is
_http://mydomain.com/0/bob_
> (http://mydomain.com/0/bob)
>
> I'm sure most of you know how this is done or you've seen it on sites such
> as Soundclick.com (although it's CF) - I've been checking out Jamroom to
see if
>  I could figure it out there- but kinda got lost lol... I want to use PHP,
> Smarty  and MySQL to do this - but I'm missing something... I'm not asking
> anybody to  build this - I'm looking for a little guidance, tips, etc. -
that's all.
>
> Would this be done through auto_increment in MySQL or something?
>
> Thanks everyone :-)
>

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



Re: [PHP] Re: very simple, yet can't think how.

2005-08-01 Thread sonu gill
Yes, that would be correct.  Make sure all permanent directories such as "0" or 
"1" already exist, and generate all dynamic folders using mkdir function.  
Also, remember the templates you will be using.

-sonu
  - Original Message - 
  From: [EMAIL PROTECTED] 
  To: [EMAIL PROTECTED] ; php-general@lists.php.net 
  Sent: Monday, August 01, 2005 10:12 PM
  Subject: Re: [PHP] Re: very simple, yet can't think how.



  Thanks, that's actually really close to what I was looking for...

  so if I wanted, say: http://mydomain.com/0/joe   - you're saying I should 
have the Directory "/0/" or "/1/" already set up... right? then do I use 
something such as mkdir and chdir to create joe? then file manipulation 
functions such as fwrite, fread, etc?

  So basically if I'm reading clearly... I insert the User info into the 
Database, then use that info to write into the Directory "/joe/" ?

  Thanks a lot man, I feel like I might have been right all along - but this is 
the first big project I've done - so I'm trying to get the Logic down correctly 
before I get started... :-)

  - Clint

  p.s. sorry, I meant to do  "reply all" :-(   So, here it is again!