OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 19 Oct 2004 06:17:58 -0000 Issue 3061

php-general-digest-helplists.php.net
Date: Tue Oct 19 2004 - 01:17:58 CDT


php-general Digest 19 Oct 2004 06:17:58 -0000 Issue 3061

Topics (messages 199744 through 199783):

Re: constant tasks
        199744 by: Jay Blanchard
        199745 by: Gryffyn, Trevor

setting index of array as 1
        199746 by: Afan Pasalic
        199747 by: Matthew Sims
        199749 by: bbonkosk.tampabay.rr.com
        199755 by: Afan Pasalic
        199757 by: bbonkosk.tampabay.rr.com
        199758 by: Gryffyn, Trevor
        199759 by: Afan Pasalic
        199760 by: Brian
        199762 by: Afan Pasalic
        199763 by: Brian
        199766 by: Afan Pasalic

wrong address
        199748 by: Afan Pasalic

Site Search for website
        199750 by: Rahul S. Johari
        199752 by: John Nichel
        199753 by: Greg Donald

Re: Nesting level too deep - recursive dependency?
        199751 by: Francisco M. Marzoa

'Intelligently' truncate string?
        199754 by: Murray . PlanetThoughtful
        199756 by: Greg Donald
        199761 by: Robert Cummings

File and line that called a function?
        199764 by: Adrian Madrid
        199765 by: Rory Browne

Re: dirty words
        199767 by: Skippy
        199768 by: Graham Cossey
        199769 by: hitek.cox.net
        199775 by: Mag

Open or Save PHP page?
        199770 by: Chris
        199771 by: M Saleh EG

Re: ' (Single Quotes) in user inputs
        199772 by: Jerry Swanson
        199773 by: John Holmes

people/projects looking for developers...
        199774 by: bruce
        199776 by: Vail, Warren
        199778 by: Dan Joseph
        199779 by: bruce

Re: guessing timezone based on country/state/city
        199777 by: Justin French
        199780 by: Manuel Lemos

Add to regex help
        199781 by: Mag

sql & trim problem
        199782 by: Dale Hersowitz

Re: [NOT FIXED] Re: [PHP] strip out wierd characters in a string
        199783 by: Curt Zirzow

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


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

attached mail follows:


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:jay.blanchardniicommunications.com]
> Sent: Monday, October 18, 2004 1:09 PM
> To: Aaron Todd; php-generallists.php.net
> 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.

attached mail follows:


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

attached mail follows:


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

attached mail follows:


$new_array[1] = 'something';
- or -
$new_array = array(1=>'something');

----- Original Message -----
From: Afan Pasalic <afanafan.net>
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
>
>

attached mail follows:


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
>

attached mail follows:


for ($i=0; $i<count($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 <afanafan.net>
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"
> 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
>
>

attached mail follows:


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:afanafan.net]
> Sent: Monday, October 18, 2004 2:33 PM
> Cc: php-generallists.php.net
> 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
>
>

attached mail follows:


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:afanafan.net]
>>Sent: Monday, October 18, 2004 2:33 PM
>>Cc: php-generallists.php.net
>>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
>>
>>
>
>
>
>

attached mail follows:


Why do you want your array to start with 1 so badly?

On Mon, 18 Oct 2004 13:33:22 -0500, Afan Pasalic <afanafan.net> 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
>
>

attached mail follows:


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 <afanafan.net> 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
>>
>>
>
>
>
>

attached mail follows:


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 <afanafan.net> 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 <afanafan.net> 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
> >>
> >>
> >
> >
> >
> >
>

attached mail follows:


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 <afanafan.net> 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 <afanafan.net> 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
>>>>
>>>>
>>>
>>>
>>>
>>>
>
>
>

attached mail follows:


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: invalidaddressabcg.com
Reply-To: devnullabcg.com
To: afanafan.net

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.

.

attached mail follows:


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

attached mail follows:


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
johnkegworks.com

attached mail follows:


On Mon, 18 Oct 2004 13:31:40 -0400, Rahul S. Johari
<rjoharinycap.rr.com> 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/

attached mail follows:


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.

attached mail follows:


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

attached mail follows:


On Tue, 19 Oct 2004 04:35:21 +1000, Murray PlanetThoughtful
<listsplanetthoughtful.org> 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/

attached mail follows:


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. |
`------------------------------------------------------------'

attached mail follows:


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
aemadridhyperxmedia.com
www.hyperxmedia.com

9000 S. 45 W.
Sandy, UT 84070

attached mail follows:


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
<aemadridhyperxmedia.com> 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
> aemadridhyperxmedia.com
> 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
>
>

attached mail follows:


On Sat, 16 Oct 2004 07:41:11 -0700 (PDT) Mag <genphpyahoo.com> 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

attached mail follows:


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, crp and shit. (Sorry for
any offense caused, but you see the problem)

Graham

> -----Original Message-----
> From: Skippy [mailto:skippyzuavra.net]
> Sent: 18 October 2004 18:13
> To: php-generallists.php.net
> Subject: Re: [PHP] dirty words
>
>
> On Sat, 16 Oct 2004 07:41:11 -0700 (PDT) Mag <genphpyahoo.com> 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
>
>

attached mail follows:


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" <grahamcossey.plus.com>
> Date: 2004/10/18 Mon PM 06:27:02 EDT
> To: <php-generallists.php.net>
> 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, crp and shit. (Sorry for
> any offense caused, but you see the problem)

>
> Graham
>
> > -----Original Message-----
> > From: Skippy [mailto:skippyzuavra.net]
> > Sent: 18 October 2004 18:13
> > To: php-generallists.php.net
> > Subject: Re: [PHP] dirty words
> >
> >
> > On Sat, 16 Oct 2004 07:41:11 -0700 (PDT) Mag <genphpyahoo.com> 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
>
>

attached mail follows:


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" it....the
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

attached mail follows:


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
 
 

attached mail follows:


.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 <cmdmiscev1.net> 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

attached mail follows:


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 <christianjul.net> wrote:
> benipmillercomcast.net (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
>
>

attached mail follows:


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

attached mail follows:


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
bedouglasearthlink.net

attached mail follows:


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:bedouglasearthlink.net]
Sent: Monday, October 18, 2004 6:18 PM
To: php-generallists.php.net
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
bedouglasearthlink.net

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

attached mail follows:


> 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

attached mail follows:


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:aarzakgmail.com]
Sent: Monday, October 18, 2004 6:57 PM
To: php-generallists.php.net
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

attached mail follows:


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

attached mail follows:


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

attached mail follows:


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

attached mail follows:


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

attached mail follows:


* Thus wrote 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?

The ? you are seeing is because the charset doesn't know what to do
with the ascii value that is contained there.

You have a couple of options to let the browser know exactly what
you mean by that character:

If before any output you specify:

  header('Content-Type: text/html; charset=iso-8859-1');

will let the browser know you want a charset that defines
what that ascii value means

Or

Because there is no entity defined the htmlentities() for 'tm' you
have to convert it yourself using the numeric entity for it:

echo str_replace("\x99", "&#153;", $a);

Then, your 'tm' will get displayed insted of '?'.

Curt
--
Quoth the Raven, "Nevermore."