Re: [PHP] Apache segmentation faults

2004-10-18 Thread Curt Zirzow
* Thus wrote Bostjan Skufca @ domenca.com:
 Hello,
 
 every now and then I notice in apache logs there were few segmentation faults 
 (on a daily basis) and all I am stuck with is PID of that process (which is 
 of course dead by then) and nothing about what it was doing. Is there any way 
 to figure out what request that apache process was serving when SIGSEGV 
 occured? Is there any reading about this?
 
 I believe the request is not logged at all because (I think) every child 
 writes to log files himself and not through parent. (+ log files usually 
 provide outgoing bytes value, which is not available in such a situation - if 
 it was logging through parent)
 
 Again, does anybody know how could I trace out what is causing this?

There should be a core file of the dump (httpd.core) generated from
the seg fault.  If apache is installed in /usr/local/apache, you
should find one at:
  /usr/local/apache/httpd.core


You can use gdb to obtain a backtrace to find out exactly where
apache died by issuing something like:

 gdb /usr/local/apache/bin/httpd /usr/local/apache/httpd.core


Then type 'bt'


Curt
-- 
Quoth the Raven, Nevermore.

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



[PHP] strip out wierd characters in a string

2004-10-18 Thread Brent Clements
Hi Guys,
 I think that a string that I'm grabbing from a website was actually created using 
ms-word. If I echo the string out, it has a question mark in it.

If you look at the website, the text is fine
iestring some more text

but when I grab it from the website, and then echo the string, I get.

string? some more text

I have tried doing this

echo str_replace(?,  , $text);

but it still print's out the ?. I think it's because the string itself has a wierd 
binary character in it or something.

Anyone know how to fix this?

Thanks,
Brent



Re: [PHP] strip out wierd characters in a string

2004-10-18 Thread Brent Clements
Solved my own problem.

I ran the script itself from the unix prompt and forced it's output to a
text file
I then viewed the text file and saw the actual wierd character. I then used
strtr to replace the wierd character with a single space.

Pretty simple and clean way to fix this.

-Brent

- Original Message - 
From: Brent Clements [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, October 18, 2004 1:22 AM
Subject: [PHP] strip out wierd characters in a string


Hi Guys,
 I think that a string that I'm grabbing from a website was actually created
using ms-word. If I echo the string out, it has a question mark in it.

If you look at the website, the text is fine
iestring some more text

but when I grab it from the website, and then echo the string, I get.

string? some more text

I have tried doing this

echo str_replace(?,  , $text);

but it still print's out the ?. I think it's because the string itself has a
wierd binary character in it or something.

Anyone know how to fix this?

Thanks,
Brent

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



[PHP] [NOT FIXED] Re: [PHP] strip out wierd characters in a string

2004-10-18 Thread Brent Clements
Ok, I still have the problem.

If I echo the string to a webpage, it still contains the ?

So I viewed the source in a notepad, and the thing that shows up next to
string is a TM.

I tried using htmlentities on the string that I'm echoing but the question
mark/tm is still there.

Anybody know how to fix this?

-Brent
- Original Message - 
From: Brent Clements [EMAIL PROTECTED]
To: Brent Clements [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Monday, October 18, 2004 1:42 AM
Subject: Re: [PHP] strip out wierd characters in a string


 Solved my own problem.

 I ran the script itself from the unix prompt and forced it's output to a
 text file
 I then viewed the text file and saw the actual wierd character. I then
used
 strtr to replace the wierd character with a single space.

 Pretty simple and clean way to fix this.

 -Brent

 - Original Message - 
 From: Brent Clements [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, October 18, 2004 1:22 AM
 Subject: [PHP] strip out wierd characters in a string


 Hi Guys,
  I think that a string that I'm grabbing from a website was actually
created
 using ms-word. If I echo the string out, it has a question mark in it.

 If you look at the website, the text is fine
 iestring some more text

 but when I grab it from the website, and then echo the string, I get.

 string? some more text

 I have tried doing this

 echo str_replace(?,  , $text);

 but it still print's out the ?. I think it's because the string itself has
a
 wierd binary character in it or something.

 Anyone know how to fix this?

 Thanks,
 Brent



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



Re: [PHP] Apache segmentation faults

2004-10-18 Thread Bostjan Skufca @ domenca.com
Is there any special apache/php compile option needed to generate core files 
on linux? 

I have seen few segfaults and i have set CoreDumpDirectory to /tmp/httpd.core 
which has correct permissions but no core file gets generated. Are core files 
generated only when apache parent process segfaults?


On Monday 18 of October 2004 08:03, Curt Zirzow wrote:
 * Thus wrote Bostjan Skufca @ domenca.com:
  Hello,
 
  every now and then I notice in apache logs there were few segmentation
  faults (on a daily basis) and all I am stuck with is PID of that process
  (which is of course dead by then) and nothing about what it was doing. Is
  there any way to figure out what request that apache process was serving
  when SIGSEGV occured? Is there any reading about this?
 
  I believe the request is not logged at all because (I think) every child
  writes to log files himself and not through parent. (+ log files usually
  provide outgoing bytes value, which is not available in such a situation
  - if it was logging through parent)
 
  Again, does anybody know how could I trace out what is causing this?

 There should be a core file of the dump (httpd.core) generated from
 the seg fault.  If apache is installed in /usr/local/apache, you
 should find one at:
   /usr/local/apache/httpd.core


 You can use gdb to obtain a backtrace to find out exactly where
 apache died by issuing something like:

  gdb /usr/local/apache/bin/httpd /usr/local/apache/httpd.core


 Then type 'bt'


 Curt
 --
 Quoth the Raven, Nevermore.

-- 
Best regards,

Bostjan Skufca
system administrator

Domenca d.o.o. 
Phone: +386 4 5835444
Fax: +386 4 5831999
http://www.domenca.com

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



Re: [PHP] Nested foreach ?

2004-10-18 Thread Stuart Felenstein
Not working.

 foreach($_SESSION['skills'] as $key = $skill)
 {
$query = INSERT INTO table (skill, sky, sku)
 VALUES ('$skill', 

{$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
//run query
 }
The foreach is generating an invalid argument. 
I'm just going to show again what I have set up:

There are five for each of these:
input name=skill[] type=text id=skill[]/td
select name=sky[] id=sky[]
select name=slu[] id=slu[]

Then I post the session variables as:
$_SESSION['skills'] = $_POST['skill'];
$_SESSION['skys'] = $_POST['sky']; 
$_SESSION['slus'] = $_POST['slu'];

It looks like the loop above is using the $skills
array to advance through the other arrays ? 

Stuart

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



[PHP] Mail interface: Unread mails and server-side filtering?

2004-10-18 Thread Christer Enfors
I'm making a web-based email system using imap. This is part of the
feature set I'm planning on implementing:

1) Multiple folder support.
2) When viewing a folder, unread mails should be marked as such.
3) Server-side filtering into different folders using procmail.

But I can't figure out how do combine these requirements. The mail server
can tell me which mails are unread because those mails are still in
/var/spool/mail. But I want to filter incoming mail on arrival using
procmail into various files under my ~/incoming-mail directory. That means
the mail server can no longer tell which mails are read and which aren't.
If I make my mail interface keep track of which mails are read and which
are unread on its own, then it won't be compatible with other mail
programs. Then if I start another mail program, it will think all mails
are read, even if they aren't.

Am I going to have to drop procmail, and put my mail-sorting filters into
my mail interface instead?

Any help appreciated.

=
-- 
Christer Enfors



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



RE: [PHP] Nested foreach ?

2004-10-18 Thread Graham Cossey
How about this:

// Doing this makes the code below easier to read
$skills = $_SESSION['skills'];
$skys = $_SESSION['skys'];
$slus = $_SESSION['slus'];

// Set up the fixed part of teh query
$query = INSERT INTO table (skill, sky, sku) VALUES (;

// Loop through each set of form elements
foreach($skills as $key = $skill)
{
   $query .= '$skill','{$skys[$key]}','{$slus[$key]}',;
}
$query = rtrim($query, ','); // Remove any comma from end of $query
$query .= ')';  // Close VALUES (

echo $query;  // What do you get?

// RUN QUERY HERE

Graham

 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
 Sent: 18 October 2004 08:24
 To: John Holmes; [EMAIL PROTECTED]
 Subject: Re: [PHP] Nested foreach ?
 
 
 Not working.
 
  foreach($_SESSION['skills'] as $key = $skill)
  {
 $query = INSERT INTO table (skill, sky, sku)
  VALUES ('$skill', 
 
 {$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]});
 //run query
  }
 The foreach is generating an invalid argument. 
 I'm just going to show again what I have set up:
 
 There are five for each of these:
 input name=skill[] type=text id=skill[]/td
 select name=sky[] id=sky[]
 select name=slu[] id=slu[]
 
 Then I post the session variables as:
 $_SESSION['skills'] = $_POST['skill'];
 $_SESSION['skys'] = $_POST['sky']; 
 $_SESSION['slus'] = $_POST['slu'];
 
 It looks like the loop above is using the $skills
 array to advance through the other arrays ? 
 
 Stuart
 
 -- 
 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] Nested foreach ?

2004-10-18 Thread Stuart Felenstein
Wish I had better news.

Warning: Invalid argument supplied for foreach() in
/home/lurkkcom/public_html/TestMultiTrans2.php on line
90
INSERT INTO LurkProfiles_Skicerts (ProfileID,
SkilCerts, NumYear, Lused) VALUES ()


line 90: foreach($skills as $key = $skill)

To confirm : 

I changed to this:
 // Doing this makes the code below easier to read
 $skills = $_SESSION['skills'];
 $skys = $_SESSION['skys'];
 $slus = $_SESSION['slus'];

From this : 
I changed the $_SESSION['skills'] = $_POST['skill']; 
$_SESSION['skys'] = $_POST['sky']; 
$_SESSION['slus'] = $_POST['slu'];

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



RE: [PHP] Nested foreach ?

2004-10-18 Thread Graham Cossey
These lines store the FORM's posted values (arrays)
into your SESSION:
$_SESSION['skills'] = $_POST['skill']; 
$_SESSION['skys'] = $_POST['sky']; 
$_SESSION['slus'] = $_POST['slu'];

These lines get your SESSION variables (arrays) and
put them into 'local' script array variables.
If you are doing these then you MUST have done the above
in the previous script.
$skills = $_SESSION['skills'];
$skys = $_SESSION['skys'];
$slus = $_SESSION['slus'];

If you are doing it all in one script just use:
$skills = $_POST['skills'];
$skys = $_POST['skys'];
$slus = $_POST['slus'];

Make sense?
If not, may I suggest you do a bit of reading on
PHP and form processing before proceeding. 
I have found the PHP manual extremely useful. 
With it (and some googling) I have gone from zero 
PHP knowledge 10 months ago to being able to 
develop and maintain an entire PHP/MySQL based
web application subscribed to by several clients. 


HTH
Graham

 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED]
 Sent: 18 October 2004 09:37
 To: Graham Cossey; [EMAIL PROTECTED]
 Subject: RE: [PHP] Nested foreach ?
 
 
 Wish I had better news.
 
 Warning: Invalid argument supplied for foreach() in
 /home/lurkkcom/public_html/TestMultiTrans2.php on line
 90
 INSERT INTO LurkProfiles_Skicerts (ProfileID,
 SkilCerts, NumYear, Lused) VALUES ()
 
 
 line 90: foreach($skills as $key = $skill)
 
 To confirm : 
 
 I changed to this:
  // Doing this makes the code below easier to read
  $skills = $_SESSION['skills'];
  $skys = $_SESSION['skys'];
  $slus = $_SESSION['slus'];
 
 From this : 
 I changed the $_SESSION['skills'] = $_POST['skill']; 
 $_SESSION['skys'] = $_POST['sky']; 
 $_SESSION['slus'] = $_POST['slu'];
 

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



[PHP] Re: ' (Single Quotes) in user inputs

2004-10-18 Thread Christian Jul Jensen
[EMAIL PROTECTED] (Ben) writes:

 Any ideas on dealing with this would be greatly appreciated.

Disable magic_quotes, and handle all escaping of characters yourself,
I would absolutely prefer that. But beware of sql-injection.

Leave magic_quotes on, and use stripslashes() on your input.

--
Christian Jul Jensen

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



RE: [PHP] Nested foreach ?

2004-10-18 Thread Stuart Felenstein
Guess what , it's working !
The key (after yours and John's iteration lines)
was adding these into the script:

 $skills = $_SESSION['skills'];
 $skys = $_SESSION['skys'];
 $slus = $_SESSION['slus'];

A big thank you! to all who helped out here and for
hanging in. 
Graham, thank you for continuing to help me on this
issue.  You are right about manual, and I have been
reading the manual along with some PHP / MySQL books.
I actually have solved a few things on my own.  ;)
More reading is in order!

Stuart

 
--- Graham Cossey [EMAIL PROTECTED] wrote:

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



[PHP] Floating values

2004-10-18 Thread Nunners
Simple question. 

 

I'm writing an accounting package, and have setup the MySQL database with
decimal(6,2) types for the amount of transactions etc.

 

Is there a way I can reproduce this in the php output?

 

i.e. the number sorted is 8.70 and when you output the value it comes out as
8.7

 

The question is how do I add the .00?

 

Cheers

Nunners



Re: [PHP] Floating values

2004-10-18 Thread bbonkosk
http://us2.php.net/manual/en/function.number-format.php

- Original Message -
From: Nunners [EMAIL PROTECTED]
Date: Monday, October 18, 2004 7:03 am
Subject: [PHP] Floating values

 Simple question. 
 
 
 
 I'm writing an accounting package, and have setup the MySQL 
 database with
 decimal(6,2) types for the amount of transactions etc.
 
 
 
 Is there a way I can reproduce this in the php output?
 
 
 
 i.e. the number sorted is 8.70 and when you output the value it 
 comes out as
 8.7
 
 
 
 The question is how do I add the .00?
 
 
 
 Cheers
 
 Nunners
 
 

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



RE: [PHP] Floating values

2004-10-18 Thread Graham Cossey
How about this?

http://uk2.php.net/manual/en/function.number-format.php

HTH
Graham

 -Original Message-
 From: Nunners [mailto:[EMAIL PROTECTED]
 Sent: 18 October 2004 12:03
 To: [EMAIL PROTECTED]
 Subject: [PHP] Floating values
 
 
 Simple question. 
 
  
 
 I'm writing an accounting package, and have setup the MySQL database with
 decimal(6,2) types for the amount of transactions etc.
 
  
 
 Is there a way I can reproduce this in the php output?
 
  
 
 i.e. the number sorted is 8.70 and when you output the value it 
 comes out as
 8.7
 
  
 
 The question is how do I add the .00?
 
  
 
 Cheers
 
 Nunners
 
 

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



[PHP] Nesting level too deep - recursive dependency?

2004-10-18 Thread Francisco M. Marzoa Alonso
This code:
?php
class TestClass {
public $myself;
function __construct () {
$this-myself = $this;
}
}
$TestObj = new TestClass ();
if ( $TestObj-myself == $TestObj ) {
echo They are same.\n;
}
?
Gives me a Fatal error: Nesting level too deep - recursive dependency?
on line #13: if ( $TestObj-myself == ...)
Could this be a PHP bug or I'm doing something wrong?
FYI:
PHP Version 5.0.2
PHP API 20031224
PHP Extension 20040412
Zend Extension 220040412
Server API Apache 2.0 Handler
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] IMAP: imap_listmailbox() returns all files in my home dir!

2004-10-18 Thread Christer Enfors
I'm calling imap_listmailbox() like this:

$folders = imap_listmailbox($mbox, {my.server:143}, *);

And as a return value, I get a list of all files in my home directory,
which I find very odd. It means I have to replace * with mail/*
because mail/ is the directory where I happen to store my mail folders.

How is an imap client supposed to know in which directory the mail folders
are stored on the server? Is it just my imap server that's misconfigured?

=
-- 
Christer Enfors



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: [PHP] dirty words

2004-10-18 Thread Philip Thompson
  $badwords = array('poo', 'bum', 'perl');
Perl. Laf!
~P
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [NOT FIXED] Re: [PHP] strip out wierd characters in a string

2004-10-18 Thread Brian
Note:  The below function will also strip out tabs and newline characters.

function str_clean($str) 
{
  for($i = 0; $i  strlen($str); $i++) 
{ 
$tmp=ord($str[$i]))
if ($tmp31  $tmp 127)
  {
  $new_str .= $str[$i];
  }
} 
  return($new_str); 
}


On Mon, 18 Oct 2004 01:51:22 -0500, Brent Clements
[EMAIL PROTECTED] wrote:
 Ok, I still have the problem.
 
 If I echo the string to a webpage, it still contains the ?
 
 So I viewed the source in a notepad, and the thing that shows up next to
 string is a TM.
 
 I tried using htmlentities on the string that I'm echoing but the question
 mark/tm is still there.
 
 Anybody know how to fix this?
 
 
 
 -Brent
 - Original Message -
 From: Brent Clements [EMAIL PROTECTED]
 To: Brent Clements [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Monday, October 18, 2004 1:42 AM
 Subject: Re: [PHP] strip out wierd characters in a string
 
  Solved my own problem.
 
  I ran the script itself from the unix prompt and forced it's output to a
  text file
  I then viewed the text file and saw the actual wierd character. I then
 used
  strtr to replace the wierd character with a single space.
 
  Pretty simple and clean way to fix this.
 
  -Brent
 
  - Original Message -
  From: Brent Clements [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, October 18, 2004 1:22 AM
  Subject: [PHP] strip out wierd characters in a string
 
 
  Hi Guys,
   I think that a string that I'm grabbing from a website was actually
 created
  using ms-word. If I echo the string out, it has a question mark in it.
 
  If you look at the website, the text is fine
  iestring some more text
 
  but when I grab it from the website, and then echo the string, I get.
 
  string? some more text
 
  I have tried doing this
 
  echo str_replace(?,  , $text);
 
  but it still print's out the ?. I think it's because the string itself has
 a
  wierd binary character in it or something.
 
  Anyone know how to fix this?
 
  Thanks,
  Brent
 
 
 
 --
 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] Fwd:

2004-10-18 Thread Brian
Could the list admin please track down the address causing this and
remove it, I get this everytime I post to the list.  Thanks.

Note:  Mail headers below message.


-- Forwarded message --
From: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Mon Oct 18 06:18:35 PDT 2004
Subject: 
To: [EMAIL PROTECTED]


Sorry, but you have attempted to send mail to an invalid email address
at ABCG.com.

Please consult our web-site for valid addresses.

Thanks.


---HEADERS---

X-Gmail-Received: 54029d1dbbd279f1cfe6ffa95bb04f8fd567a17d
Delivered-To: [EMAIL PROTECTED]
Received: by 10.38.24.16 with SMTP id 16cs6474rnx;
Mon, 18 Oct 2004 06:18:35 -0700 (PDT)
Received: by 10.38.78.23 with SMTP id a23mr1499914rnb;
Mon, 18 Oct 2004 06:18:35 -0700 (PDT)
Return-Path: [EMAIL PROTECTED]
Received: from mail19a.g19.rapidsite.net (mail19a.g19.rapidsite.net
[198.170.241.2])
by mx.gmail.com with SMTP id 57si2754538rnc;
Mon, 18 Oct 2004 06:18:35 -0700 (PDT)
Received-SPF: none
X-Auto: [EMAIL PROTECTED]
X-Loop-Detect: 1
To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
Original-Recipient: rfc822;[EMAIL PROTECTED]
Final-Recipient: rfc822;[EMAIL PROTECTED]

Sorry, but you have attempted to send mail to an invalid email address
at ABCG.com.

Please consult our web-site for valid addresses.

Thanks.

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



RE: [PHP] probs generating multiple drop down select lists within a single form

2004-10-18 Thread bruce
the code is pretty much as i provided. the issue is that the query seems to
insert a value into the query string for the select lists, even though i
don't actually select an item.

i'm trying to figure out what has to happen to allow the select vars to be
'' if the user hasn't selected anything.

this should be pretty straight forward, but i'm missing something...

thanks

-bruce


-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED]
Sent: Sunday, October 17, 2004 6:14 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] probs generating multiple drop down select lists
within a single form


On Sun, 17 Oct 2004 17:23:14 -0700, bruce [EMAIL PROTECTED] wrote:
 i have a prob/issue that i can't see.. i'm trying to geneate a page with
 multiple lists so that the user has to select an item from all 3 lists in
 order to access the next page...

 the 1st select/list allows the user to select either one or more items.
the
 2nd/3rd select lists require the user to select only a single item from
the
 lists.

 ie:
list1  list2list3  submitBTN

 the user would select the items from all three lists, and hit the
selectBTN,
 to go to the next page...

 the prob that i'm having is that if i simply select item(s) from the 1st
 list, then the code allows the user to continue...in other words, the app
 looks as though the user has selected an item from the 2nd/3rd even though
 they haven't been selected... in examining the code, it appears that the
 last item in the 2nd/3rd lists is being somehow read/inserted into the
 items, and are somehow included in the querystring...

 my code is:

   /*
  generate the state list
   */
   echo
  div style='position:absolute; top:320px; left:50px; width:400px;'
  form name='test' method='get' action='$foo.php'

Why $foo here?  Maybe not enough context for me to understand the
reason, I dunno.

  div style='position:relative; top:10px; left:10px;'
  select multiple size=10 name='state[]'
   ;

  $state_query = select * from stateTBL;
  $res = mysqli_query($link, $state_query);
  //$res = mysql_query($query);

  //go ahead and process/populate the drop down
  //menu
  echo option value ='*'All States/option\n;
  while($row = mysqli_fetch_array($res, MYSQL_ASSOC))
  {
 echo option value
 ='.$row['val'].'.$row['name']./option\n;

  }

   echo
  /select
  /div
   ;

   /*
  generate the year list
   */
   echo
  div style='position:absolute; top:10px; left:240px; width:100px;'
  select  multiple size=1 name= 'year'
   ;

Did you mean year[] here?  Otherwise why multiple?

  $year_query = select * from yearTBL;
  $res = mysqli_query($link, $year_query);
  //$res = mysql_query($query);

  //go ahead and process/populate the drop down
  //menu
  while($row = mysqli_fetch_array($res, MYSQL_ASSOC))
  {
 echo option value
 ='.$row['year'].'.$row['year']./option\n;
  }

   echo
  /select
  /div
   ;

   /*
  generate the terms list
   */
   echo
  div style='position:absolute; top:10px; left:325px; width:100px;'
  select name= 'term'
   ;

  $term_query = select * from termTBL;
  $res = mysqli_query($link, $term_query);
  //$res = mysql_query($query);

  //go ahead and process/populate the drop down
  //menu
  while($row = mysqli_fetch_array($res, MYSQL_ASSOC))
  {
 echo option value
='.$row['ID'].'.$row['term']./option\n;
  }

   echo
  /select
  /div
   ;

   $blah = $userdata['session_id'];

   echo
  div style='position:relative; top:-150px; left:475px;'
  input type='submit' name='sub1' value='submit'
  /div
  input type ='hidden' name='sid' value='$blah'
  input type='hidden' name='display' value='state'
  /form
  /div
   ;

 in foo.php, i simply display the $_GET['state'],
$_GET['year'],$_GET['term']
 vars to see what they are...

 if i make all the select vars for the query terms arrays, it works as it
 should, in that if all three lists aren't selected, then the user can't
 proceed. however, if i use the select select name = 'foo' for the
2nd/3rd
 lists, then the logic screws up...

 any idea why this is occuring

 is there a better way/example of using multiple drop down lists within a
 single form.

Possibly.  I'd recommend using print_r($_GET) to see your form
submissions.  To make sure your actually getting what you want to be
getting.

 any thoughts/comments/pointers would be helpful.. i'm pretty sure that the
 issue/prob is rather straight forward/simple, but i can't see it right
 now

Not sure exactly what is broken, is that your entire script as posted?


--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
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: 

[PHP] how to create multiple selects within php

2004-10-18 Thread bruce
hi...

i can create a form with a single select by something like:

form
select name='foo'
option val='1'fff/option
option val='2'aaa/option
/select
input 
/form

however, i need to know how to create a multiple menu/list within a single
form.

i've tried a few different approaches, but i'm doing something wrong, in
that the querystring is being populated with a value for the select list var
even though i don't select the item.

if someone can point me to an actual working example of php code that
generates multiple lists/menus within a form, i'd appreciate it!!

thanks

-bruce

ps. if needed, i can supply the actual test code i've used to create the
condition i'm describing...

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



Re: [PHP] how to create multiple selects within php

2004-10-18 Thread John Nichel
bruce wrote:
hi...
i can create a form with a single select by something like:
form
select name='foo'
option val='1'fff/option
option val='2'aaa/option
/select
input 
/form
however, i need to know how to create a multiple menu/list within a single
form.
Not sure exactly what you're asking here, but I think this may be it...
If you want multiple select, you need your select tag to look as such...
select name=foo[] multiple
On the page that the form is submitted too, the selections will be in an 
array ($_POST['foo']).

--
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] how to create multiple selects within php

2004-10-18 Thread bruce
ok...

it appears to be a case of user err.. the spec seems to state that if the
user doesn't select/specify an item, the select should return the 1st item
within the list... arrrgggh!! this is what's happening...

so my question is still, how can i implement some logic that requires the
user to actually select an item? or, how can i detect when a user has
actually selected a list item??

thanks...

-bruce


-Original Message-
From: bruce [mailto:[EMAIL PROTECTED]
Sent: Monday, October 18, 2004 7:07 AM
To: [EMAIL PROTECTED]
Subject: [PHP] how to create multiple selects within php


hi...

i can create a form with a single select by something like:

form
select name='foo'
option val='1'fff/option
option val='2'aaa/option
/select
input 
/form

however, i need to know how to create a multiple menu/list within a single
form.

i've tried a few different approaches, but i'm doing something wrong, in
that the querystring is being populated with a value for the select list var
even though i don't select the item.

if someone can point me to an actual working example of php code that
generates multiple lists/menus within a form, i'd appreciate it!!

thanks

-bruce

ps. if needed, i can supply the actual test code i've used to create the
condition i'm describing...

--
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: Determine variable with the lowest value?

2004-10-18 Thread Paul Fine
Than you very much Matt.

Does what I needed. Now I will have to read up on as and the function
key.



-Original Message-
From: Matt M. [mailto:[EMAIL PROTECTED] 
Sent: October 14, 2004 11:27 AM
To: BOOT
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Determine variable with the lowest value?

On Thu, 14 Oct 2004 10:52:20 -0500, BOOT [EMAIL PROTECTED] wrote:
 OK thanks but I guess I didn't explain what I am trying to do properly.
 
 I need to be able to identify the variable name as well as pick the
variable
 with the lowest value.
 
 Something like this:
 
 Whose turn is it to take out the garbage?
 
 Mike has done it 3 times
 Bob has done it 2 times
 Jane has done it 5 times
 etc...
 
 Therefore its Bob's turn.


$arr['Mike'] = 3;
$arr['Bob'] = 2;
$arr['Jane'] = 5;

foreach ($arr as $key = $value) {
echo $key.' has done it '.$value.' timesbr /';
}
asort($arr);
print 'It is '.key($arr).'\'s turn';

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



Re: [PHP] how to create multiple selects within php

2004-10-18 Thread John Nichel
bruce wrote:
ok...
it appears to be a case of user err.. the spec seems to state that if the
user doesn't select/specify an item, the select should return the 1st item
within the list... arrrgggh!! this is what's happening...
Not true.  If the user doesn't select anything, nothing will be 
submitted (unless you have one or more of your option tags like this 
option value=bar selected /)

so my question is still, how can i implement some logic that requires the
user to actually select an item? or, how can i detect when a user has
actually selected a list item??
Test to see if anything has been submitted.  If your select tag is as 
such...

select name=foo[] multiple
When you submit the form, you can check it like this...
if ( isset ( $_POST['foo'] ) ) {
//user has selected something
do stuff
} else {
//user did not select anything
do other stuff
}
--
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] probs generating multiple drop down select lists within a single form

2004-10-18 Thread Brian
Year shouldn't be a multiple

At the beginning of the second two selects:
option value='blank'/option

in your check:
if ( isset($_GET['state']  $_GET['year']'blank'  $_GET['term']'blank')
   {
   //ok, they selected something in all three of those so lets run
some code here
   } else {
   //they didn't populate all three selects, spit an error message at them
   }




On Mon, 18 Oct 2004 07:00:36 -0700, bruce [EMAIL PROTECTED] wrote:
 the code is pretty much as i provided. the issue is that the query seems to
 insert a value into the query string for the select lists, even though i
 don't actually select an item.
 
 i'm trying to figure out what has to happen to allow the select vars to be
 '' if the user hasn't selected anything.
 
 this should be pretty straight forward, but i'm missing something...
 
 thanks
 
 -bruce
 
 
 
 
 -Original Message-
 From: Greg Donald [mailto:[EMAIL PROTECTED]
 Sent: Sunday, October 17, 2004 6:14 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] probs generating multiple drop down select lists
 within a single form
 
 On Sun, 17 Oct 2004 17:23:14 -0700, bruce [EMAIL PROTECTED] wrote:
  i have a prob/issue that i can't see.. i'm trying to geneate a page with
  multiple lists so that the user has to select an item from all 3 lists in
  order to access the next page...
 
  the 1st select/list allows the user to select either one or more items.
 the
  2nd/3rd select lists require the user to select only a single item from
 the
  lists.
 
  ie:
 list1  list2list3  submitBTN
 
  the user would select the items from all three lists, and hit the
 selectBTN,
  to go to the next page...
 
  the prob that i'm having is that if i simply select item(s) from the 1st
  list, then the code allows the user to continue...in other words, the app
  looks as though the user has selected an item from the 2nd/3rd even though
  they haven't been selected... in examining the code, it appears that the
  last item in the 2nd/3rd lists is being somehow read/inserted into the
  items, and are somehow included in the querystring...
 
  my code is:
 
/*
   generate the state list
*/
echo
   div style='position:absolute; top:320px; left:50px; width:400px;'
   form name='test' method='get' action='$foo.php'
 
 Why $foo here?  Maybe not enough context for me to understand the
 reason, I dunno.
 
   div style='position:relative; top:10px; left:10px;'
   select multiple size=10 name='state[]'
;
 
   $state_query = select * from stateTBL;
   $res = mysqli_query($link, $state_query);
   //$res = mysql_query($query);
 
   //go ahead and process/populate the drop down
   //menu
   echo option value ='*'All States/option\n;
   while($row = mysqli_fetch_array($res, MYSQL_ASSOC))
   {
  echo option value
  ='.$row['val'].'.$row['name']./option\n;
 
   }
 
echo
   /select
   /div
;
 
/*
   generate the year list
*/
echo
   div style='position:absolute; top:10px; left:240px; width:100px;'
   select  multiple size=1 name= 'year'
;
 
 Did you mean year[] here?  Otherwise why multiple?
 
   $year_query = select * from yearTBL;
   $res = mysqli_query($link, $year_query);
   //$res = mysql_query($query);
 
   //go ahead and process/populate the drop down
   //menu
   while($row = mysqli_fetch_array($res, MYSQL_ASSOC))
   {
  echo option value
  ='.$row['year'].'.$row['year']./option\n;
   }
 
echo
   /select
   /div
;
 
/*
   generate the terms list
*/
echo
   div style='position:absolute; top:10px; left:325px; width:100px;'
   select name= 'term'
;
 
   $term_query = select * from termTBL;
   $res = mysqli_query($link, $term_query);
   //$res = mysql_query($query);
 
   //go ahead and process/populate the drop down
   //menu
   while($row = mysqli_fetch_array($res, MYSQL_ASSOC))
   {
  echo option value
 ='.$row['ID'].'.$row['term']./option\n;
   }
 
echo
   /select
   /div
;
 
$blah = $userdata['session_id'];
 
echo
   div style='position:relative; top:-150px; left:475px;'
   input type='submit' name='sub1' value='submit'
   /div
   input type ='hidden' name='sid' value='$blah'
   input type='hidden' name='display' value='state'
   /form
   /div
;
 
  in foo.php, i simply display the $_GET['state'],
 $_GET['year'],$_GET['term']
  vars to see what they are...
 
  if i make all the select vars for the query terms arrays, it works as it
  should, in that if all three lists aren't selected, then the user can't
  proceed. however, if i use the select select name = 'foo' for the
 2nd/3rd
  lists, then the logic screws up...
 
  any idea why this is occuring
 
  is there a better way/example of using multiple drop down lists within a
  single form.
 
 Possibly.  I'd recommend using 

Re: [PHP] how to create multiple selects within php

2004-10-18 Thread Brian
with your code above the first option is going to be the default, so
just make the default nothing:

option value='blank'/option

then check with:
if ( $_GET['foo']  'blank' )



On Mon, 18 Oct 2004 07:22:30 -0700, bruce [EMAIL PROTECTED] wrote:
 ok...
 
 it appears to be a case of user err.. the spec seems to state that if the
 user doesn't select/specify an item, the select should return the 1st item
 within the list... arrrgggh!! this is what's happening...
 
 so my question is still, how can i implement some logic that requires the
 user to actually select an item? or, how can i detect when a user has
 actually selected a list item??
 
 thanks...
 
 -bruce
 
 
 
 
 -Original Message-
 From: bruce [mailto:[EMAIL PROTECTED]
 Sent: Monday, October 18, 2004 7:07 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] how to create multiple selects within php
 
 hi...
 
 i can create a form with a single select by something like:
 
 form
 select name='foo'
 option val='1'fff/option
 option val='2'aaa/option
 /select
 input 
 /form
 
 however, i need to know how to create a multiple menu/list within a single
 form.
 
 i've tried a few different approaches, but i'm doing something wrong, in
 that the querystring is being populated with a value for the select list var
 even though i don't select the item.
 
 if someone can point me to an actual working example of php code that
 generates multiple lists/menus within a form, i'd appreciate it!!
 
 thanks
 
 -bruce
 
 ps. if needed, i can supply the actual test code i've used to create the
 condition i'm describing...
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] how to create multiple selects within php

2004-10-18 Thread John Nichel
Please reply to the list.
bruce wrote:
john..
thanks for the response...
but i don't need a multiple select.. what i need are multiple select/menu
lists...
list1list2   list3
however, the issue i'm really facing is how to detect that a user has
actually selected an item in a given list, as opposed to the app simply
returning the 1st item of a list, as the default if the list is not
selected this is consistent with what the rfc/spec states the behavior
should be...
Athen just do your select like this...
select name=foo
option /
option val=1 /fff
option val=2 /aaa
So on and so forth.  Leave the first option empty, and on the 
resulting page, if the user didn't select anything, $_POST['foo'] will 
not have a value.

if ( $_POST['foo'] ==  ) {
//user didn't select anything
}
--
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


[PHP] Enable exec() and system() for a directory only

2004-10-18 Thread David Garcia Aristegui
Hello, newbie question: how can i enable exec() and system() for a 
certain directory only? Thank you in advanced.

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


Re: [PHP] how to create multiple selects within php

2004-10-18 Thread Silvio Porcellana
You can do something like this:
HTML
select name='foo'
option value='' - - choose one - -/option
option value='1'fff/option
option value='2'aaa/option
.
/select
/HTML
and then in your PHP:
?php
if ($_POST['foo'] != '') {
# do something
} else {
# Ops, user didn't choose a valure from the 'foo' select!!!
}
?
Anyway, you can catch this only *after* the form is submitted: in case you want to block 
the user from submitting the form if the 'foo' select is empty you need to use some 
javascript:
script language=JavaScript
	function check_form(form) {
		if (form.foo.value == '') {
			alert(C'mon!!!);
			return false;
		}
	}
/script

and in your HTML you need to add something like this to the form tag:
HTML
form action=pippo.php method=post onSubmit=return check_form(this);
select ...

/select
/form
/HTML
Anyway, this has more to do with HTML and JavaScript than PHP...
HTH, cheers
Silvio Porcellana
bruce wrote:
ok...
it appears to be a case of user err.. the spec seems to state that if the
user doesn't select/specify an item, the select should return the 1st item
within the list... arrrgggh!! this is what's happening...
so my question is still, how can i implement some logic that requires the
user to actually select an item? or, how can i detect when a user has
actually selected a list item??
thanks...
-bruce
-Original Message-
From: bruce [mailto:[EMAIL PROTECTED]
Sent: Monday, October 18, 2004 7:07 AM
To: [EMAIL PROTECTED]
Subject: [PHP] how to create multiple selects within php
hi...
i can create a form with a single select by something like:
form
select name='foo'
option val='1'fff/option
option val='2'aaa/option
/select
input 
/form
however, i need to know how to create a multiple menu/list within a single
form.
i've tried a few different approaches, but i'm doing something wrong, in
that the querystring is being populated with a value for the select list var
even though i don't select the item.
if someone can point me to an actual working example of php code that
generates multiple lists/menus within a form, i'd appreciate it!!
thanks
-bruce
ps. if needed, i can supply the actual test code i've used to create the
condition i'm describing...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] how to create multiple selects within php

2004-10-18 Thread bruce
john...

the code (and the rfc) seems to suggest otherwise. personally, i would have
thought, if the user doesn't select a menu, then the 'menu item' should not
have anything with regards to the querystring...

however, the spec implies something different:
http://www.w3.org/TR/REC-html40/interact/forms.html#edef-OPTION


17.6.1 Pre-selected options
Zero or more choices may be pre-selected for the user. User agents should
determine which choices are pre-selected as follows:

If no OPTION element has the selected attribute set, user agent behavior for
choosing which option is initially selected is undefined. Note. Since
existing implementations handle this case differently, the current
specification differs from RFC 1866 ([RFC1866] section 8.1.3), which states:
The initial state has the first option selected, unless a SELECTED attribute
is present on any of the OPTION elements.
Since user agent behavior differs, authors should ensure that each menu
includes a default pre-selected OPTION.
-

if you can manage to create a sample that has 2 menu lists, each with a few
items that has the behavior you say should occur, i'd like to take a look.

i currently have code which lists 3 menus, each of which has a few items in
the list...

all the menu/lists are within a single form, with a single inputBTN.

if the user selects the menu/list for states that has a multiple select,
then the other two lists return their 1st items, even though they haven't
been selected

thanks

-bruce



-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED]
Sent: Monday, October 18, 2004 7:31 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] how to create multiple selects within php


bruce wrote:
 ok...

 it appears to be a case of user err.. the spec seems to state that if the
 user doesn't select/specify an item, the select should return the 1st item
 within the list... arrrgggh!! this is what's happening...

Not true.  If the user doesn't select anything, nothing will be
submitted (unless you have one or more of your option tags like this
option value=bar selected /)

 so my question is still, how can i implement some logic that requires the
 user to actually select an item? or, how can i detect when a user has
 actually selected a list item??

Test to see if anything has been submitted.  If your select tag is as
such...

select name=foo[] multiple

When you submit the form, you can check it like this...

if ( isset ( $_POST['foo'] ) ) {
//user has selected something
do stuff
} else {
//user did not select anything
do other stuff
}

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

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



Re: [PHP] Enable exec() and system() for a directory only

2004-10-18 Thread Mike
on 10/18/04 10:40 AM, David Garcia Aristegui at [EMAIL PROTECTED] wrote:

 Hello, newbie question: how can i enable exec() and system() for a
 certain directory only? Thank you in advanced.


I think this would require you to use the 'php_admin_flag' command in the
virtual host's config file.

Kinda like this:

php_admin_flag safe_mode off
php_admin_flag register_globals on
php_admin_flag allow_url_fopen off




++
Mike Yrabedra 
[EMAIL PROTECTED] 
Your Mac Intelligence Resource
++
W: http://www.macagent.com/
E: [EMAIL PROTECTED]

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



Re: [PHP] how to create multiple selects within php

2004-10-18 Thread Brian
With most any browser nowadays, on a non-multiple select the first
option will be selected unless you specifically setup a default.  With
a multiple select, it will not default to anything and will not even
post/get a variable for it at all unless the user specifically selects
something, which is why a isset($var) will work for a multiple.


On Mon, 18 Oct 2004 07:59:47 -0700, bruce [EMAIL PROTECTED] wrote:
 john...
 
 the code (and the rfc) seems to suggest otherwise. personally, i would have
 thought, if the user doesn't select a menu, then the 'menu item' should not
 have anything with regards to the querystring...
 
 however, the spec implies something different:
 http://www.w3.org/TR/REC-html40/interact/forms.html#edef-OPTION
 
 
 17.6.1 Pre-selected options
 Zero or more choices may be pre-selected for the user. User agents should
 determine which choices are pre-selected as follows:
 
 If no OPTION element has the selected attribute set, user agent behavior for
 choosing which option is initially selected is undefined. Note. Since
 existing implementations handle this case differently, the current
 specification differs from RFC 1866 ([RFC1866] section 8.1.3), which states:
 The initial state has the first option selected, unless a SELECTED attribute
 is present on any of the OPTION elements.
 Since user agent behavior differs, authors should ensure that each menu
 includes a default pre-selected OPTION.
 -
 
 if you can manage to create a sample that has 2 menu lists, each with a few
 items that has the behavior you say should occur, i'd like to take a look.
 
 i currently have code which lists 3 menus, each of which has a few items in
 the list...
 
 all the menu/lists are within a single form, with a single inputBTN.
 
 if the user selects the menu/list for states that has a multiple select,
 then the other two lists return their 1st items, even though they haven't
 been selected
 
 
 
 thanks
 
 -bruce
 
 -Original Message-
 From: John Nichel [mailto:[EMAIL PROTECTED]
 Sent: Monday, October 18, 2004 7:31 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] how to create multiple selects within php
 
 bruce wrote:
  ok...
 
  it appears to be a case of user err.. the spec seems to state that if the
  user doesn't select/specify an item, the select should return the 1st item
  within the list... arrrgggh!! this is what's happening...
 
 Not true.  If the user doesn't select anything, nothing will be
 submitted (unless you have one or more of your option tags like this
 option value=bar selected /)
 
  so my question is still, how can i implement some logic that requires the
  user to actually select an item? or, how can i detect when a user has
  actually selected a list item??
 
 Test to see if anything has been submitted.  If your select tag is as
 such...
 
 select name=foo[] multiple
 
 When you submit the form, you can check it like this...
 
 if ( isset ( $_POST['foo'] ) ) {
//user has selected something
do stuff
 } else {
//user did not select anything
do other stuff
 }
 
 --
 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
 
 --
 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] Nesting level too deep - recursive dependency?

2004-10-18 Thread Francisco M. Marzoa Alonso
Can someone tell me if I should fill a bug report about this or is it my 
fault???

Francisco M. Marzoa Alonso wrote:
This code:
?php
class TestClass {
public $myself;
function __construct () {
$this-myself = $this;
}
}
$TestObj = new TestClass ();
if ( $TestObj-myself == $TestObj ) {
echo They are same.\n;
}
?
Gives me a Fatal error: Nesting level too deep - recursive dependency?
on line #13: if ( $TestObj-myself == ...)
Could this be a PHP bug or I'm doing something wrong?
FYI:
PHP Version 5.0.2
PHP API 20031224
PHP Extension 20040412
Zend Extension 220040412
Server API Apache 2.0 Handler
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Nesting level too deep - recursive dependency?

2004-10-18 Thread Chris Dowell
Francisco
You really need to post this to [EMAIL PROTECTED] - this list is 
for us lowly users of PHP, the developers and maintainers of the 
language have their own list.

Cheers
Chris
Francisco M. Marzoa Alonso wrote:
Can someone tell me if I should fill a bug report about this or is it my 
fault???

Francisco M. Marzoa Alonso wrote:
This code:
?php
class TestClass {
public $myself;
function __construct () {
$this-myself = $this;
}
}
$TestObj = new TestClass ();
if ( $TestObj-myself == $TestObj ) {
echo They are same.\n;
}
?
Gives me a Fatal error: Nesting level too deep - recursive dependency?
on line #13: if ( $TestObj-myself == ...)
Could this be a PHP bug or I'm doing something wrong?
FYI:
PHP Version 5.0.2
PHP API 20031224
PHP Extension 20040412
Zend Extension 220040412
Server API Apache 2.0 Handler

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


Re: [PHP] Nesting level too deep - recursive dependency?

2004-10-18 Thread Francisco M. Marzoa Alonso
Ah, OK thanks for your advice Chris.
Chris Dowell wrote:
Francisco
You really need to post this to [EMAIL PROTECTED] - this list is 
for us lowly users of PHP, the developers and maintainers of the 
language have their own list.

Cheers
Chris
Francisco M. Marzoa Alonso wrote:
Can someone tell me if I should fill a bug report about this or is it 
my fault???

Francisco M. Marzoa Alonso wrote:
This code:
?php
class TestClass {
public $myself;
function __construct () {
$this-myself = $this;
}
}
$TestObj = new TestClass ();
if ( $TestObj-myself == $TestObj ) {
echo They are same.\n;
}
?
Gives me a Fatal error: Nesting level too deep - recursive 
dependency?
on line #13: if ( $TestObj-myself == ...)

Could this be a PHP bug or I'm doing something wrong?
FYI:
PHP Version 5.0.2
PHP API 20031224
PHP Extension 20040412
Zend Extension 220040412
Server API Apache 2.0 Handler


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


[PHP] Mixing classes

2004-10-18 Thread Tomi Kaistila
Hey!
I've written several general classes, much as tools. One manages 
databases, one authenticates users, etc. I'm trying to bring all of 
these together into one sorta like a CMS, but the problem is that I 
can't find a way to have the different classes take advantage of each 
other; for example, a function in the auth class needs to contact the 
database, so it needs the query() function from the database class, but 
the objects are created on the index.php and as such are not in the 
scope of the functions in the classes.

Would anyone have any ideas or suggestions how to solve this issue? I've 
looked for a solution for some time now, to no result.

My PHP version is 4.3.8.
--
developer  programmer
me tomi kaistila
home http://www.datamike.org
gnupg 0xFA63E4C7
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Mixing classes

2004-10-18 Thread Dan Joseph
 I've written several general classes, much as tools. One manages
 databases, one authenticates users, etc. I'm trying to bring all of
 these together into one sorta like a CMS, but the problem is that I
 can't find a way to have the different classes take advantage of each
 other; for example, a function in the auth class needs to contact the
 database, so it needs the query() function from the database class, but
 the objects are created on the index.php and as such are not in the
 scope of the functions in the classes.
 
 Would anyone have any ideas or suggestions how to solve this issue? I've
 looked for a solution for some time now, to no result.

What about extending the classes?  Have you thought about something
along those lines?

-Dan Joseph

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



Re: [PHP] Mixing classes

2004-10-18 Thread Tomi Kaistila
 What about extending the classes?  Have you thought about something
 along those lines?
Yes, it has crossed my mind. And I've done so, but to keep a class clean 
it's not a good idea to extend them indefinantly and extending a class 
with another class that really has nothing to do with the parent class 
isn't very practical.

I'm, at least trying, to keep them clean and have one class (and any 
child classes) to the topic the class was desinged for.

Like the Core class (which handles layout and such things for the web 
site) has a child class for error handling.

--
developer  programmer
me tomi kaistila
home http://www.datamike.org
gnupg 0xFA63E4C7
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Mixing classes

2004-10-18 Thread Tomi Kaistila
 What about extending the classes?  Have you thought about something
 along those lines?
Yes, it has crossed my mind. And I've done so, but to keep a class clean 
it's not a good idea to extend them indefinantly and extending a class 
with another class that really has nothing to do with the parent class 
isn't very practical.

I'm, at least trying, to keep them clean and have one class (and any 
child classes) to the topic the class was desinged for.

Like the Core class (which handles layout and such things for the web 
site) has a child class for error handling.

P.S Sorry for replying to you Dan, accidentally just went and hit the 
reply button. This is a copy of that message to the mailing list.

--
developer  programmer
me tomi kaistila
home http://www.datamike.org
gnupg 0xFA63E4C7
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] how to create multiple selects within php

2004-10-18 Thread bruce
i've decided to punt...

and do something similar to what i had initially created, which implements
basically what you have below... the user will just have to be satisfied
with seeing the 1st item that's a default/dummy item...

thanks...

-bruce


-Original Message-
From: Silvio Porcellana [mailto:[EMAIL PROTECTED]
Sent: Monday, October 18, 2004 7:44 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] how to create multiple selects within php


You can do something like this:

HTML
select name='foo'
option value='' - - choose one - -/option
option value='1'fff/option
option value='2'aaa/option
.
/select
/HTML

and then in your PHP:
?php
if ($_POST['foo'] != '') {
# do something
} else {
# Ops, user didn't choose a valure from the 'foo' select!!!
}
?

Anyway, you can catch this only *after* the form is submitted: in case you
want to block
the user from submitting the form if the 'foo' select is empty you need to
use some
javascript:
script language=JavaScript
function check_form(form) {
if (form.foo.value == '') {
alert(C'mon!!!);
return false;
}
}
/script

and in your HTML you need to add something like this to the form tag:
HTML
form action=pippo.php method=post onSubmit=return check_form(this);
select ...

/select
/form
/HTML

Anyway, this has more to do with HTML and JavaScript than PHP...


HTH, cheers
Silvio Porcellana

bruce wrote:
 ok...

 it appears to be a case of user err.. the spec seems to state that if the
 user doesn't select/specify an item, the select should return the 1st item
 within the list... arrrgggh!! this is what's happening...

 so my question is still, how can i implement some logic that requires the
 user to actually select an item? or, how can i detect when a user has
 actually selected a list item??

 thanks...

 -bruce


 -Original Message-
 From: bruce [mailto:[EMAIL PROTECTED]
 Sent: Monday, October 18, 2004 7:07 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] how to create multiple selects within php


 hi...

 i can create a form with a single select by something like:

 form
 select name='foo'
 option val='1'fff/option
 option val='2'aaa/option
 /select
 input 
 /form

 however, i need to know how to create a multiple menu/list within a single
 form.

 i've tried a few different approaches, but i'm doing something wrong, in
 that the querystring is being populated with a value for the select list
var
 even though i don't select the item.

 if someone can point me to an actual working example of php code that
 generates multiple lists/menus within a form, i'd appreciate it!!

 thanks

 -bruce

 ps. if needed, i can supply the actual test code i've used to create the
 condition i'm describing...

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


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

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



Re: [PHP] Nesting level too deep - recursive dependency?

2004-10-18 Thread Brent Baisley
I was looking at this before and I'm not even sure what you are trying 
to do.
For one, you are testing to see if the contents of a class variable are 
equal to a class instance:
$TestObj-myself == $TestObj

Which seems a logic equivalent to:
$TestObj-myself == TestClass()   ???
And in your class you are setting a class variable equal to the class 
it is in:
$this-myself = $this

The recursion may actually be occurring in the $this-myself = $this 
line, but PHP isn't throwing an error until the comparison line.

Perhaps the comments posted in this link will help, it seems to explain 
the exact symptom you are getting:
http://php.planetmirror.com/manual/en/language.oop.object-comparison.php

On Oct 18, 2004, at 11:16 AM, Francisco M. Marzoa Alonso wrote:
Can someone tell me if I should fill a bug report about this or is it 
my fault???

Francisco M. Marzoa Alonso wrote:
This code:
?php
class TestClass {
public $myself;
function __construct () {
$this-myself = $this;
}
}
$TestObj = new TestClass ();
if ( $TestObj-myself == $TestObj ) {
echo They are same.\n;
}
?
Gives me a Fatal error: Nesting level too deep - recursive 
dependency?
on line #13: if ( $TestObj-myself == ...)

Could this be a PHP bug or I'm doing something wrong?
FYI:
PHP Version 5.0.2
PHP API 20031224
PHP Extension 20040412
Zend Extension 220040412
Server API Apache 2.0 Handler
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] constant tasks

2004-10-18 Thread Aaron Todd
I'm wondering if it is possible to have some kind of script running all the 
time.  I have a site that collects data that users enter and emails certain 
people and does other various tasks with the data.  Some of the information 
collected contains dates and times that could be up to three months from 
now.  What I am trying to do is have something fire off an email to someone 
when that future date/time comes around so a follow-up can be done.

Anyone know of anything I can look into for this.

Thanks,

Aaron 

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



RE: [PHP] constant tasks

2004-10-18 Thread Jay Blanchard
[snip]
I'm wondering if it is possible to have some kind of script running all
the 
time.  I have a site that collects data that users enter and emails
certain 
people and does other various tasks with the data.  Some of the
information 
collected contains dates and times that could be up to three months from

now.  What I am trying to do is have something fire off an email to
someone 
when that future date/time comes around so a follow-up can be done.

Anyone know of anything I can look into for this.
[/snip]

You could use CRON to periodically run scripts.

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



RE: [PHP] constant tasks

2004-10-18 Thread Gryffyn, Trevor
It's possible to have a script running constantly, but Jay's right.
CRON or some other task scheduler would probably be better.  If you had
something running constantly and there was some problem with your
compile of PHP or something else that's getting used, there can be
memory leaks or other issues that could cause complications.  Running
something periodically rather than constantly is probably better in most
cases.

-TG

 -Original Message-
 From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
 Sent: Monday, October 18, 2004 1:09 PM
 To: Aaron Todd; [EMAIL PROTECTED]
 Subject: RE: [PHP] constant tasks
 
 
 [snip]
 I'm wondering if it is possible to have some kind of script 
 running all the time.  I have a site that collects data that
 users enter and emails certain people and does other various
 tasks with the data.  Some of the information collected contains
 dates and times that could be up to three months from
 now.  What I am trying to do is have something fire off an email to
 someone when that future date/time comes around so a follow-up can be
done.
 
 Anyone know of anything I can look into for this.
 [/snip]
 
 You could use CRON to periodically run scripts.

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



[PHP] setting index of array as 1

2004-10-18 Thread Afan Pasalic
when create an array using:
$new_array[] = 'something';
first index of new array is 0
how can I though set that first index is 1 - except reorganize array 
after is created?

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


Re: [PHP] setting index of array as 1

2004-10-18 Thread Matthew Sims
 when create an array using:
 $new_array[] = 'something';
 first index of new array is 0

 how can I though set that first index is 1 - except reorganize array
 after is created?

 thanks

 -afan

$new_array = array(1 = 'first','second','third');

echo $new_array[1];  --- Will echo first

-- 
--Matthew Sims
--http://killermookie.org

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



[PHP] wrong address

2004-10-18 Thread Afan Pasalic
can somebody delete this address? every time I send an email getting this.
-afan
 Original Message 
Date: Mon, 18 Oct 2004 19:18:58 +0200
From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sorry, but you have attempted to send mail to an invalid email address 
at ABCG.com.

Please consult our web-site for valid addresses.
Thanks.

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


Re: [PHP] setting index of array as 1

2004-10-18 Thread bbonkosk
$new_array[1] = 'something';
- or -
$new_array = array(1='something');

- Original Message -
From: Afan Pasalic [EMAIL PROTECTED]
Date: Monday, October 18, 2004 1:14 pm
Subject: [PHP] setting index of array as 1

 when create an array using:
 $new_array[] = 'something';
 first index of new array is 0
 
 how can I though set that first index is 1 - except reorganize 
 array 
 after is created?
 
 thanks
 
 -afan
 
 -- 
 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] Site Search for website

2004-10-18 Thread Rahul S. Johari
Ave,

I¹m working on creating a site search for our company¹s website, and am
looking for some tips. Creating the search code and the results doesn¹t seem
to be a big challenge... Indexing is something I have no clue to. I don¹t
know how to create the Index and how the keywords, summary and link is
generated automatically and goes into the database. I know there are paid
software out there which do the same, but I¹m inclined to believe there has
to be a way for PHP to read keywords off the pages in a folder and index
them. Or I may be wrong.

Any guidance appreciated.

Rahul S. Johari



Re: [PHP] Nesting level too deep - recursive dependency?

2004-10-18 Thread Francisco M. Marzoa
Brent Baisley wrote:
I was looking at this before and I'm not even sure what you are trying 
to do.
For one, you are testing to see if the contents of a class variable 
are equal to a class instance:
$TestObj-myself == $TestObj

Which seems a logic equivalent to:
$TestObj-myself == TestClass()   ???
No, it isn't, or at least it shouldn't. $TestObj and $TestObj-myself
are *both* instances of TestClass.
And in your class you are setting a class variable equal to the class 
it is in:
$this-myself = $this

The recursion may actually be occurring in the $this-myself = $this 
line, but PHP isn't throwing an error until the comparison line.
I don't know PHP internals, so you may be right.
Perhaps the comments posted in this link will help, it seems to 
explain the exact symptom you are getting:
http://php.planetmirror.com/manual/en/language.oop.object-comparison.php
This looks really interesting. Thanks a lot.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Site Search for website

2004-10-18 Thread John Nichel
Rahul S. Johari wrote:
Ave,
I¹m working on creating a site search for our company¹s website, and am
looking for some tips. Creating the search code and the results doesn¹t seem
to be a big challenge... Indexing is something I have no clue to. I don¹t
know how to create the Index and how the keywords, summary and link is
generated automatically and goes into the database. I know there are paid
software out there which do the same, but I¹m inclined to believe there has
to be a way for PHP to read keywords off the pages in a folder and index
them. Or I may be wrong.
Any guidance appreciated.
Rahul S. Johari

http://us4.php.net/mnogosearch
http://www.mnogosearch.org/
--
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] Site Search for website

2004-10-18 Thread Greg Donald
On Mon, 18 Oct 2004 13:31:40 -0400, Rahul S. Johari
[EMAIL PROTECTED] wrote:
 I¹m working on creating a site search for our company¹s website, and am
 looking for some tips. Creating the search code and the results doesn¹t seem
 to be a big challenge... Indexing is something I have no clue to. I don¹t
 know how to create the Index and how the keywords, summary and link is
 generated automatically and goes into the database. I know there are paid
 software out there which do the same, but I¹m inclined to believe there has
 to be a way for PHP to read keywords off the pages in a folder and index
 them. Or I may be wrong.
 
 Any guidance appreciated.

You can use htdig for indexing the site:
http://www.htdig.org/

Then build a PHP wrapper around the results for display:
http://www.devshed.com/c/a/PHP/Search-This/


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



[PHP] 'Intelligently' truncate string?

2004-10-18 Thread Murray @ PlanetThoughtful
Hi All,

 

I'm working on a page where I'm attempting to display article titles in a
relatively narrow area. To save from ugly wrap-arounds in the links, I've
decided to truncate the article title string at 20 chars. This works well
except where the truncate occasionally falls in the middle of a HTML entity
reference (eg nbsp; or copy; etc).

 

I'm wondering if anyone else on the list has worked out a way of
intelligently truncating a string to take these kinds of occurrences into
account? I don't mind, in these situations if the truncation takes place
before or after the entity, since when displayed it will only equate to one
character more or less.

 

Anyone else jumped off this bridge before?

 

Much warmth,

 

Murray



Re: [PHP] setting index of array as 1

2004-10-18 Thread Afan Pasalic
It's not what I was looking for. Looks like I didn't explain very well :)
look at this case:
$query = mysql_query(select name from names order by date desc);
while($result = mysql_fetch_array($query))
{
   $all_names[] = $result['name'];  
}
in this case the array $all_names starts with index 0.
I can't put
   $all_names[1] = $result['name']; 
because every next entry will get index 1 and overwrite old one and on 
the end I'll have an array of just one element :)

-afan
Matthew Sims wrote:
when create an array using:
$new_array[] = 'something';
first index of new array is 0
how can I though set that first index is 1 - except reorganize array
after is created?
thanks
-afan

$new_array = array(1 = 'first','second','third');
echo $new_array[1];  --- Will echo first
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] 'Intelligently' truncate string?

2004-10-18 Thread Greg Donald
On Tue, 19 Oct 2004 04:35:21 +1000, Murray @ PlanetThoughtful
[EMAIL PROTECTED] wrote:
 I'm working on a page where I'm attempting to display article titles in a
 relatively narrow area. To save from ugly wrap-arounds in the links, I've
 decided to truncate the article title string at 20 chars. This works well
 except where the truncate occasionally falls in the middle of a HTML entity
 reference (eg nbsp; or copy; etc).
 
 I'm wondering if anyone else on the list has worked out a way of
 intelligently truncating a string to take these kinds of occurrences into
 account? I don't mind, in these situations if the truncation takes place
 before or after the entity, since when displayed it will only equate to one
 character more or less.

You can use wordwrap() to do intelligent line breaks, then you can
truncate the new string based on a line break.

You can also explode() the string into an array then rebuild a new
string with only so many elements of the array.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] setting index of array as 1

2004-10-18 Thread bbonkosk
for ($i=0; $icount($all_names); $i++)
{
  $new_array[$i+1] = $all_names[$i];
}
// just writting to a new array and incrememnting the subscript by 1

-B

- Original Message -
From: Afan Pasalic [EMAIL PROTECTED]
Date: Monday, October 18, 2004 2:33 pm
Subject: Re: [PHP] setting index of array as 1

 It's not what I was looking for. Looks like I didn't explain very 
 well :)
 
 look at this case:
 
 $query = mysql_query(select name from names order by date desc);
 while($result = mysql_fetch_array($query))
 {
$all_names[] = $result['name'];
 }
 
 in this case the array $all_names starts with index 0.
 
 I can't put
 
$all_names[1] = $result['name'];   
 
 because every next entry will get index 1 and overwrite old one 
 and on 
 the end I'll have an array of just one element :)
 
 -afan
 
 
 Matthew Sims wrote:
 when create an array using:
 $new_array[] = 'something';
 first index of new array is 0
 
 how can I though set that first index is 1 - except reorganize 
 arrayafter is created?
 
 thanks
 
 -afan
  
  
  $new_array = array(1 = 'first','second','third');
  
  echo $new_array[1];  --- Will echo first
  
 
 -- 
 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] setting index of array as 1

2004-10-18 Thread Gryffyn, Trevor
In that case, you could do this:

$x = 1;
$query = mysql_query(select name from names order by date desc);
while($result = mysql_fetch_array($query))
{
$all_names[$x] = $result['name'];   
$x++;
}


-TG

 -Original Message-
 From: Afan Pasalic [mailto:[EMAIL PROTECTED] 
 Sent: Monday, October 18, 2004 2:33 PM
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] setting index of array as 1
 
 
 It's not what I was looking for. Looks like I didn't explain 
 very well :)
 
 look at this case:
 
 $query = mysql_query(select name from names order by date desc);
 while($result = mysql_fetch_array($query))
 {
 $all_names[] = $result['name'];   
 }
 
 in this case the array $all_names starts with index 0.
 
 I can't put
 
 $all_names[1] = $result['name'];  
 
 because every next entry will get index 1 and overwrite old 
 one and on 
 the end I'll have an array of just one element :)
 
 -afan
 
 
 Matthew Sims wrote:
 when create an array using:
 $new_array[] = 'something';
 first index of new array is 0
 
 how can I though set that first index is 1 - except 
 reorganize array
 after is created?
 
 thanks
 
 -afan
  
  
  $new_array = array(1 = 'first','second','third');
  
  echo $new_array[1];  --- Will echo first
  
 
 -- 
 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] setting index of array as 1

2004-10-18 Thread Afan Pasalic
this one fit the best... :)
thanks TG.
thanks to all other too for ideas :)
-afan
Gryffyn, Trevor wrote:
In that case, you could do this:
$x = 1;
$query = mysql_query(select name from names order by date desc);
while($result = mysql_fetch_array($query))
{
$all_names[$x] = $result['name'];   
$x++;
}
-TG

-Original Message-
From: Afan Pasalic [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 18, 2004 2:33 PM
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] setting index of array as 1

It's not what I was looking for. Looks like I didn't explain 
very well :)

look at this case:
$query = mysql_query(select name from names order by date desc);
while($result = mysql_fetch_array($query))
{
   $all_names[] = $result['name'];  
}
in this case the array $all_names starts with index 0.
I can't put
   $all_names[1] = $result['name']; 
because every next entry will get index 1 and overwrite old 
one and on 
the end I'll have an array of just one element :)

-afan
Matthew Sims wrote:
when create an array using:
$new_array[] = 'something';
first index of new array is 0
how can I though set that first index is 1 - except 
reorganize array
after is created?
thanks
-afan

$new_array = array(1 = 'first','second','third');
echo $new_array[1];  --- Will echo first
--
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] setting index of array as 1

2004-10-18 Thread Brian
Why do you want your array to start with 1 so badly?


On Mon, 18 Oct 2004 13:33:22 -0500, Afan Pasalic [EMAIL PROTECTED] wrote:
 It's not what I was looking for. Looks like I didn't explain very well :)
 
 look at this case:
 
 $query = mysql_query(select name from names order by date desc);
 while($result = mysql_fetch_array($query))
 {
$all_names[] = $result['name'];
 }
 
 in this case the array $all_names starts with index 0.
 
 I can't put
 
$all_names[1] = $result['name'];
 
 because every next entry will get index 1 and overwrite old one and on
 the end I'll have an array of just one element :)
 
 -afan
 
 
 
 
 Matthew Sims wrote:
 when create an array using:
 $new_array[] = 'something';
 first index of new array is 0
 
 how can I though set that first index is 1 - except reorganize array
 after is created?
 
 thanks
 
 -afan
 
 
  $new_array = array(1 = 'first','second','third');
 
  echo $new_array[1];  --- Will echo first
 
 
 --
 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] 'Intelligently' truncate string?

2004-10-18 Thread Robert Cummings
On Mon, 2004-10-18 at 14:35, Murray @ PlanetThoughtful wrote:
 Hi All,
 I'm working on a page where I'm attempting to display article titles in a
 relatively narrow area. To save from ugly wrap-arounds in the links, I've
 decided to truncate the article title string at 20 chars. This works well
 except where the truncate occasionally falls in the middle of a HTML entity
 reference (eg nbsp; or copy; etc).

after you do your usual truncation just add the following:

$truncated = ereg_replace( '[[:alpha:]]*$', '', $truncated );

You may need to replace alpha with alnum since I can't remember if there
are any entities with digits :)

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

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



Re: [PHP] setting index of array as 1

2004-10-18 Thread Afan Pasalic
Because elements of the new array are actually numbers that depend on index.
working on survey and values of offered answers are actually numbers
Question
- input type=radio value=1 offered answer no 1
- input type=radio value=2 offered answer no 2
- input type=radio value=3 offered answer no 3
- input type=radio value=4 offered answer no 4
Qs ans As are pulled from database and I chosen values start with 1 to 
be less confused (value=0 for answer=1, values=1 for answer=2, ...)

And result, which is an array because I set up names of radio buttons 
that way, (after submitting) I stored in database using serialize 
functions.
I have to show some statistics and answers, stored in DB, after 
unserialize() start with 0.
And then was conflict when I pull Qs and As from DB, they start with 1s 
and Results, that start with 0

Hm, pretty complicated, ha?
:)
Now, I have a feeling I didn't go correct way. Because, calculating 
stats from serialize stored results are pain in the neck :)

-afan
Brian wrote:
Why do you want your array to start with 1 so badly?
On Mon, 18 Oct 2004 13:33:22 -0500, Afan Pasalic [EMAIL PROTECTED] wrote:
It's not what I was looking for. Looks like I didn't explain very well :)
look at this case:
$query = mysql_query(select name from names order by date desc);
while($result = mysql_fetch_array($query))
{
  $all_names[] = $result['name'];
}
in this case the array $all_names starts with index 0.
I can't put
  $all_names[1] = $result['name'];
because every next entry will get index 1 and overwrite old one and on
the end I'll have an array of just one element :)
-afan

Matthew Sims wrote:
when create an array using:
$new_array[] = 'something';
first index of new array is 0
how can I though set that first index is 1 - except reorganize array
after is created?
thanks
-afan

$new_array = array(1 = 'first','second','third');
echo $new_array[1];  --- Will echo first
--
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] setting index of array as 1

2004-10-18 Thread Brian
You should just make everything else start with a standard 0, if it's
something you output to the users, just do a +1 on it.


On Mon, 18 Oct 2004 14:35:19 -0500, Afan Pasalic [EMAIL PROTECTED] wrote:
 Because elements of the new array are actually numbers that depend on index.
 
 working on survey and values of offered answers are actually numbers
 
 Question
 - input type=radio value=1 offered answer no 1
 - input type=radio value=2 offered answer no 2
 - input type=radio value=3 offered answer no 3
 - input type=radio value=4 offered answer no 4
 
 Qs ans As are pulled from database and I chosen values start with 1 to
 be less confused (value=0 for answer=1, values=1 for answer=2, ...)
 
 And result, which is an array because I set up names of radio buttons
 that way, (after submitting) I stored in database using serialize
 functions.
 I have to show some statistics and answers, stored in DB, after
 unserialize() start with 0.
 And then was conflict when I pull Qs and As from DB, they start with 1s
 and Results, that start with 0
 
 Hm, pretty complicated, ha?
 :)
 
 Now, I have a feeling I didn't go correct way. Because, calculating
 stats from serialize stored results are pain in the neck :)
 
 -afan
 
 
 
 
 Brian wrote:
  Why do you want your array to start with 1 so badly?
 
 
  On Mon, 18 Oct 2004 13:33:22 -0500, Afan Pasalic [EMAIL PROTECTED] wrote:
 
 It's not what I was looking for. Looks like I didn't explain very well :)
 
 look at this case:
 
 $query = mysql_query(select name from names order by date desc);
 while($result = mysql_fetch_array($query))
 {
$all_names[] = $result['name'];
 }
 
 in this case the array $all_names starts with index 0.
 
 I can't put
 
$all_names[1] = $result['name'];
 
 because every next entry will get index 1 and overwrite old one and on
 the end I'll have an array of just one element :)
 
 -afan
 
 
 
 
 Matthew Sims wrote:
 
 when create an array using:
 $new_array[] = 'something';
 first index of new array is 0
 
 how can I though set that first index is 1 - except reorganize array
 after is created?
 
 thanks
 
 -afan
 
 
 $new_array = array(1 = 'first','second','third');
 
 echo $new_array[1];  --- Will echo first
 
 
 --
 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] File and line that called a function?

2004-10-18 Thread Adrian Madrid
Is there a way to know which file and line called a function youo are 
in? I want to create an error function that can tell me which file and 
line called it. I know __FILE__ and __LINE__ but they will return the 
file and line that my error function is in, and not the originators.

Thanks in advance,
--
Adrian Madrid
HyperX Inc. 
Mobile: 801.815.1870
Office: 801.566.0670 
[EMAIL PROTECTED] 
www.hyperxmedia.com 

9000 S. 45 W.
Sandy, UT 84070

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


Re: [PHP] File and line that called a function?

2004-10-18 Thread Rory Browne
Sorry accidently replied off-list

I basicly said to check out debug_backtrace()

at http://www.php.net/debug-backtrace


On Mon, 18 Oct 2004 13:56:33 -0600, Adrian Madrid
[EMAIL PROTECTED] wrote:
 Is there a way to know which file and line called a function youo are
 in? I want to create an error function that can tell me which file and
 line called it. I know __FILE__ and __LINE__ but they will return the
 file and line that my error function is in, and not the originators.
 
 Thanks in advance,
 
 --
 Adrian Madrid
 HyperX Inc.
 Mobile: 801.815.1870
 Office: 801.566.0670
 [EMAIL PROTECTED]
 www.hyperxmedia.com
 
 9000 S. 45 W.
 Sandy, UT 84070
 
 --
 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] setting index of array as 1

2004-10-18 Thread Afan Pasalic
actually, I just decide to redo DB architecture and not use serialize-ed 
info to store in DB. to much troubles with it.

thanks brian.
-afan

Brian wrote:
You should just make everything else start with a standard 0, if it's
something you output to the users, just do a +1 on it.
On Mon, 18 Oct 2004 14:35:19 -0500, Afan Pasalic [EMAIL PROTECTED] wrote:
Because elements of the new array are actually numbers that depend on index.
working on survey and values of offered answers are actually numbers
Question
- input type=radio value=1 offered answer no 1
- input type=radio value=2 offered answer no 2
- input type=radio value=3 offered answer no 3
- input type=radio value=4 offered answer no 4
Qs ans As are pulled from database and I chosen values start with 1 to
be less confused (value=0 for answer=1, values=1 for answer=2, ...)
And result, which is an array because I set up names of radio buttons
that way, (after submitting) I stored in database using serialize
functions.
I have to show some statistics and answers, stored in DB, after
unserialize() start with 0.
And then was conflict when I pull Qs and As from DB, they start with 1s
and Results, that start with 0
Hm, pretty complicated, ha?
:)
Now, I have a feeling I didn't go correct way. Because, calculating
stats from serialize stored results are pain in the neck :)
-afan

Brian wrote:
Why do you want your array to start with 1 so badly?
On Mon, 18 Oct 2004 13:33:22 -0500, Afan Pasalic [EMAIL PROTECTED] wrote:

It's not what I was looking for. Looks like I didn't explain very well :)
look at this case:
$query = mysql_query(select name from names order by date desc);
while($result = mysql_fetch_array($query))
{
 $all_names[] = $result['name'];
}
in this case the array $all_names starts with index 0.
I can't put
 $all_names[1] = $result['name'];
because every next entry will get index 1 and overwrite old one and on
the end I'll have an array of just one element :)
-afan

Matthew Sims wrote:

when create an array using:
$new_array[] = 'something';
first index of new array is 0
how can I though set that first index is 1 - except reorganize array
after is created?
thanks
-afan

$new_array = array(1 = 'first','second','third');
echo $new_array[1];  --- Will echo first
--
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] dirty words

2004-10-18 Thread Skippy
On Sat, 16 Oct 2004 07:41:11 -0700 (PDT) Mag [EMAIL PROTECTED] wrote:
 I am useing file_get_contents on a remote page then
 using stristr() to make sure there are no bad words
 and its a family site.

May I point out this is a lost battle from the start? If someone really
wants to enter bad words they will, by masking them in various ways;
humans will interpret the bad words correctly in far more cases than you
can filter with software. Additionally, you will end up filtering parts of
legit words that look like bad words.

-- 
Skippy - Romanian Web Developers - http://ROWD.ORG

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



RE: [PHP] dirty words

2004-10-18 Thread Graham Cossey
Skippy does have a point.

If you still receive spam emails you'll know what he means. I must have seen
20 different ways of spelling viagra, using various accented characters etc:
viagra, viagra, viiagra etc etc

As for the legit words, there is the tale of Scunthorpe town council having
ALL its email blocked by filtering. (Scunthorpe is a UK town BTW).

But then again I could be talking total b0llocks, [EMAIL PROTECTED] and shit. (Sorry 
for
any offense caused, but you see the problem)

Graham

 -Original Message-
 From: Skippy [mailto:[EMAIL PROTECTED]
 Sent: 18 October 2004 18:13
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] dirty words


 On Sat, 16 Oct 2004 07:41:11 -0700 (PDT) Mag [EMAIL PROTECTED] wrote:
  I am useing file_get_contents on a remote page then
  using stristr() to make sure there are no bad words
  and its a family site.

 May I point out this is a lost battle from the start? If someone really
 wants to enter bad words they will, by masking them in various ways;
 humans will interpret the bad words correctly in far more cases than you
 can filter with software. Additionally, you will end up filtering parts of
 legit words that look like bad words.

 --
 Skippy - Romanian Web Developers - http://ROWD.ORG

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



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



Re: RE: [PHP] dirty words

2004-10-18 Thread hitek
What I find interesting is that you managed to use 4 variations on the word viagra, 
and your email still made it past my ISP's spam filters :)

Keith
 
 From: Graham Cossey [EMAIL PROTECTED]
 Date: 2004/10/18 Mon PM 06:27:02 EDT
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] dirty words
 
 Skippy does have a point.
 
 If you still receive spam emails you'll know what he means. I must have seen
 20 different ways of spelling viagra, using various accented characters etc:
 viagra, viagra, viiagra etc etc
 
 As for the legit words, there is the tale of Scunthorpe town council having
 ALL its email blocked by filtering. (Scunthorpe is a UK town BTW).
 
 But then again I could be talking total b0llocks, [EMAIL PROTECTED] and shit. (Sorry 
 for
 any offense caused, but you see the problem)

 
 Graham
 
  -Original Message-
  From: Skippy [mailto:[EMAIL PROTECTED]
  Sent: 18 October 2004 18:13
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] dirty words
 
 
  On Sat, 16 Oct 2004 07:41:11 -0700 (PDT) Mag [EMAIL PROTECTED] wrote:
   I am useing file_get_contents on a remote page then
   using stristr() to make sure there are no bad words
   and its a family site.
 
  May I point out this is a lost battle from the start? If someone really
  wants to enter bad words they will, by masking them in various ways;
  humans will interpret the bad words correctly in far more cases than you
  can filter with software. Additionally, you will end up filtering parts of
  legit words that look like bad words.
 
  --
  Skippy - Romanian Web Developers - http://ROWD.ORG
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



[PHP] Open or Save PHP page?

2004-10-18 Thread Chris
Win XP Pro
Apache 1.3.31 - Win MSI
PHP 4.3.8 - Win MSI
 
Followed directions in PHP install.txt to install PHP as a module for
Apache.
Server runs and servers HTML pages fine.
PHP.INI copied to Apache installation folder.
When selecting link to load a PHP file, system asks to open or save the PHP
file with Dreamweaver - associated with PHP.  Server's not interpreting the
script.
 
ideas?
 
-Chris
 
 


Re: [PHP] Open or Save PHP page?

2004-10-18 Thread M Saleh EG
.php files are still not associated with PHP extension on Apache. That
means the php4apache.dll, or php4ts.dll is not associated in Apache to
deal with PHP files.

Check ur Apache conf files. Edit httpd.conf. On the module loading
section and adding module section.Check if the php4apache.dll or
php4ts.dll are loaded.

It's about types and handles as well. 

Your keywords are : AddType, AddModule, LoadModule, php4Apache, and
php4ts.dll. Dig into these!


On Mon, 18 Oct 2004 17:57:33 -0500, Chris [EMAIL PROTECTED] wrote:
 Win XP Pro
 Apache 1.3.31 - Win MSI
 PHP 4.3.8 - Win MSI
 
 Followed directions in PHP install.txt to install PHP as a module for
 Apache.
 Server runs and servers HTML pages fine.
 PHP.INI copied to Apache installation folder.
 When selecting link to load a PHP file, system asks to open or save the PHP
 file with Dreamweaver - associated with PHP.  Server's not interpreting the
 script.
 
 ideas?
 
 -Chris
 
 


-- 
M.Saleh.E.G
97150-4779817

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



Re: [PHP] Re: ' (Single Quotes) in user inputs

2004-10-18 Thread Jerry Swanson
I'm not sure that stripslashes() are used for input. 

addslashes() - to insert data into database
stripslashes() - to get data from database and print it.




On 14 Oct 2004 11:19:14 +0200, Christian Jul Jensen [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] (Ben) writes:
 
  Any ideas on dealing with this would be greatly appreciated.
 
 Disable magic_quotes, and handle all escaping of characters yourself,
 I would absolutely prefer that. But beware of sql-injection.
 
 Leave magic_quotes on, and use stripslashes() on your input.
 
 --
 Christian Jul Jensen
 
 
 
 --
 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: ' (Single Quotes) in user inputs

2004-10-18 Thread John Holmes
Jerry Swanson wrote:
I'm not sure that stripslashes() are used for input. 
If you want to redisplay the input, then it would be used.
addslashes() - to insert data into database
stripslashes() - to get data from database and print it.
You don't need stripslashes when pulling data unless you have 
magic_quotes_runtime enabled. If you find that you need to call 
stripslashes on your data, then you're escaping it twice before you 
insert it.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] people/projects looking for developers...

2004-10-18 Thread bruce
hi...

a question for consideration. are there sites set up for people who have
ideas/projects, who are looking for developers. or vice versa, are there
sites for developers who are looking to be part of projects.

i'm not referring to open source projects, rather projects that are intended
to be revenue generating businesses.

thanks

Bruce Douglas
[EMAIL PROTECTED]

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



Re: [PHP] dirty words

2004-10-18 Thread Mag
Hi,

  I am useing file_get_contents on a remote page
 then
  using stristr() to make sure there are no bad
 words
  and its a family site.
 
 May I point out this is a lost battle from the
 start? If someone really
 wants to enter bad words they will, by masking
 them in various ways;
 humans will interpret the bad words correctly in far
 more cases than you
 can filter with software. Additionally, you will end
 up filtering parts of
 legit words that look like bad words.

True, but only sites that pass the above test get
added to the database on an unconfirmed state, then
I personally look at the site and confirm itthe
aboev is just something of a pre-screen

I got it working though so this is an old problem :-)

Cheers,
Mag


=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



RE: [PHP] people/projects looking for developers...

2004-10-18 Thread Vail, Warren
Check out the following, probably a lot more;

http://www.guru.com/  (used to be itmoonlighter.com)
http://www.sologig.com/ (site written in php)
http://www.prosavvy.com/ 
http://rfq.programmingbids.com/

I have even seen a few on this list, although it is considered a little off
topic, I have yet to see anyone banned from the list for describing a work
requirement (not that I would).  Everyone knows people on this list have
entirely too much time on their hands (and not enough money) ;-).

Now if you are after people who will work for free  Get those kind of
offers every day, including from my current employer from time to time, if
you know what I mean.

Good luck,

Warren Vail


-Original Message-
From: bruce [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 18, 2004 6:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] people/projects looking for developers...


hi...

a question for consideration. are there sites set up for people who have
ideas/projects, who are looking for developers. or vice versa, are there
sites for developers who are looking to be part of projects.

i'm not referring to open source projects, rather projects that are intended
to be revenue generating businesses.

thanks

Bruce Douglas
[EMAIL PROTECTED]

-- 
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] guessing timezone based on country/state/city

2004-10-18 Thread Justin French
On 18/10/2004, at 4:03 PM, Manuel Lemos wrote:
On 10/18/2004 02:23 AM, Justin French wrote:
I was hoping to do this with an educated guess based on user input 
like country, state and town, rather than by asking the user (who 
isn't too technically minded) to decide.
One easy way to do what you want is to use the Javascript Date object 
getTimeZoneOffset() function to fill in some form hidden field to pass 
the timezone offset to the server.

It relies on Javascript but it does exactly what you want.
Manuel, knowing the user's TZ via JS doesn't help me know the TZ of the 
event (which may be in a different zone to the user) unfortunately... 
and I'd rather not trust a client side variable like that regardless.

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


Re: [PHP] people/projects looking for developers...

2004-10-18 Thread Dan Joseph
 a question for consideration. are there sites set up for people who have
 ideas/projects, who are looking for developers. or vice versa, are there
 sites for developers who are looking to be part of projects.
 
 i'm not referring to open source projects, rather projects that are intended
 to be revenue generating businesses.

www.itmoonlighter.com is one that I use to use.  It has both companies
looking to find developers for their projects, and developers looking
for extra work.  I'm sure there are other sites, but I can't think of
'em.

-Dan Joseph

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



Re: [PHP] guessing timezone based on country/state/city

2004-10-18 Thread Manuel Lemos
Hello,
On 10/18/2004 10:35 PM, Justin French wrote:
I was hoping to do this with an educated guess based on user input 
like country, state and town, rather than by asking the user (who 
isn't too technically minded) to decide.

One easy way to do what you want is to use the Javascript Date object 
getTimeZoneOffset() function to fill in some form hidden field to pass 
the timezone offset to the server.

It relies on Javascript but it does exactly what you want.

Manuel, knowing the user's TZ via JS doesn't help me know the TZ of the 
event (which may be in a different zone to the user) unfortunately... 
and I'd rather not trust a client side variable like that regardless.
I was trying to suggest a free solution that may not be accurate but may 
be sufficient for your purposes.

There are also paid solutions:
http://www.worldtimeserver.com/time_zone_guide/ascii-file.aspx
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Add to regex help

2004-10-18 Thread Mag
Hi,
Quite some time back I modified a regex (to the one
below) to work with my script:

if (preg_match_all('/a\s+.*?href=[\\']?([^\\'
]*)[\\']?[^]*.*?\/a/i', $url, $matches))
{
   foreach($matches as $match){$links[] = $match;}
}

Problem is, I dont really know REGEXs properly and
dont remember how I modified it and it completly
ignores the below: 

area shape=rect coords=95,8,242,145
href=2/FIVE.MPG

because its a map and I guess it does not start with
a and does not end with /a

but I need to make sure it catches even the above...

Can someone help me add to the above regex please?

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



RE: [PHP] people/projects looking for developers...

2004-10-18 Thread bruce
interesting...

for the most part, people have responded with contract resource sites...
(guru.com/elance.com/etc)

no one has mentioned any kind of site specifically geared towards people who
want to come together to kind of build applications. ala the old
garage/basement type of process were you get a few guys together with a few
sales guys, and they build/start to sale the app, and create a biz...

so my question i guess, is why the hell isn't there more of an interest in
this kind of atmosphere..

have people just been too dam* burned too many times, or are people really
just satisfied with their jobs

interesting...

thanks

-bruce


-Original Message-
From: Dan Joseph [mailto:[EMAIL PROTECTED]
Sent: Monday, October 18, 2004 6:57 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] people/projects looking for developers...


 a question for consideration. are there sites set up for people who have
 ideas/projects, who are looking for developers. or vice versa, are there
 sites for developers who are looking to be part of projects.

 i'm not referring to open source projects, rather projects that are
intended
 to be revenue generating businesses.

www.itmoonlighter.com is one that I use to use.  It has both companies
looking to find developers for their projects, and developers looking
for extra work.  I'm sure there are other sites, but I can't think of
'em.

-Dan Joseph

--
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] sql trim problem

2004-10-18 Thread Dale Hersowitz
Recently, I had to format my db server and when I re-attached the database,
I noticed some unusal behavior. I have some fields in certain tables with a
width of 60. When I would extract data from the table for that specific
field, the data would contain extra blank chars. As a result, I am forced to
use the trim function to get rid of the extra chars. This problem has never
occured before and I now find it quite annoying. Does anybody have any
ideas?

Thanks,
Dale

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