[PHP] Re: CLASS/Object lifetime - Solution

2006-02-22 Thread roger helgesen

 function fyll_sub_konto($pv){
foreach($this-subposter AS $konto=$kt){
$kontoen= $this-subposter[$konto];
$kontoen-fyll_fra_post($pv);
$kontoen-endre();
}
}
the line
$kontoen= $this-subposter[$konto];
solved all

roger
roger helgesen wrote:

The function that gives me trouble
-
function fyll_sub_konto($pv){
foreach($this-subposter AS $konto){
$konto-fyll_fra_post($pv);
}
}
-

$this-subposter is the array of CLASS2

function fyll_fra_post($post_vars){
echo (gruppe)class = .get_class($this) .br\n;
$teller=0;
foreach($this-poster AS $post=$verd){
$best=bestilt_.$post;
$avik=avvik_.$post;
$fakt=faktura_.$post;
$this-poster[$post][bestilt]=$post_vars[$best];
$this-poster[$post][avvik]=$post_vars[$avik];
$this-poster[$post][faktura]=$post_vars[$fakt];
}
$this-endret='ja';
$this-sett_sum();
}

If I print the data (after setting the new data) inside 'fyll_fra_post' 
it puts out the new data.
If I do the same from 'fyll_sub_konto' (after foreach) it gives me the 
old data.


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



Re: [PHP] Request for views on ASP/PHP/ASP.NET - please!

2006-02-22 Thread Wely E.R.

I'm waiting for the result.
It would be nice of you when you post it in this list.

Thanx.

From: Simon O'Beirne
On  Monday, February 20, 2006 11:58 PM
Wrote:


Hi guys,

A bit of an odd request.  I'm in my third and final year at university, 
and

part of an assignment requires obtaining developers' perspective on web
languages.

If anyone has done at least one of the languages in the subject title
(ASP/ASP.NET/PHP), I would be eternally grateful if you could pop to (and
also send any other web developers you know to)

http://www.coralsystemsolutions.co.uk/uni

Theres a maximum of 14 short questions (depending on answers to the other
questions), all optional, just fill out as much as you can be bothered 
with,

then click submit a few times until its saved.

Thank you very much in advance!

Simon


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



RE: [PHP] Nested Set Model or modified preorder tree traversal

2006-02-22 Thread Jared Williams


Hi,
As your using MySQL5, I'd recommend putting all the Nested Set code in 
stored procedures, that way the client doesn't need
to know about anything about the method, and the left, right columns never need 
to be retrieved.



Jared
 
 I've been searching the web for the past few hours trying to 
 find a simple drop-in class or functions to implement Nested 
 Set Model or modified preorder tree traversal.
 
 I've found several tutorials and related links:
 
   http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
   http://www.sitepoint.com/article/hierarchical-data-database
  
 http://www.zend.com/zend/tut/tutorial-ferrara2.php?article=tut
 orial-ferrara2
 id=3453open=1anc=0view=1
   http://simon.incutio.com/archive/2003/06/19/storingTrees
   http://istherelifeafter.com/joecelko.html
   http://www.codeproject.com/cs/database/Trees_in_SQL_databases.asp
 
 I even found some outdated PEAR DB_NestedSet class from 2003 
 that seemed way to overly complicated. And some other 
 PHP4_Mysql3MPTTA class on PHP Classes that was equally 
 complicated and written for ancient PHP4 and mySQL 3!!
 
 Hasn't anyone else done this before (recently)? 
 Did everyone just write their own code every time?
 Anyone have some easy to use code that allows for:
 Add, delete, update/rename, select, show tree, bread crumb 
 display, etc.
 
 I use PHP 5.0.5 and mySQL 5.0.18, so ideally it would take 
 advantage of all the optimizations and bells  whistles of 
 those more modern versions.
 
 TIA.
 
 D.Vin
 
 --
 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] php 4 v php 5

2006-02-22 Thread tedd

Hi:

Curt. said:


PHP 4.4.2 - Released Jan 13 2006
php 5.1.2 - Released Jan 12 2006
PHP 5.0.5 - Released Sept 6 2005

I wouldn't expect any more releases of 5.0.x version.


Pardon my ignorance -- I have enough problems pounding out code to 
spend time following what's happening at the higher levels. But, 
considering the above statement, are there continuing development 
paths for both php 4 and 5 independently?


If so, what's the distinction between the two, oop? And if so, what 
about non-oop stuff -- do they share common libraries, or what? 
Generally, how does all of this fit together?


Thanks.

tedd

--

http://sperling.com

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



RE: [PHP] Session problems [SOLVED]

2006-02-22 Thread Dan Parry
Hi all

I didn't get that many replies (thanks to those who did reply :) ) for this,
so now I've figured out the problem I thought I'd share the solution just in
case anyone else has the same issue:

solution
The problem stemmed from the way the return from UPDATE is handled and the
scripts reliance on the mysql_affected_rows() command

If the UPDATE command is executed on a record and no values are altered the
command exits with a value of 0 meaning that the result of
mysql_affected_rows() is false

This occurs on redirects and fast refreshes because the time value hasn't
changed so no values are altered in the row, mysql_affected_rows() is false
and the function continues as no condition is met to return a value... the
following INSERT then causes the problem

The solution was do execute a simple SELECT to get the number of rows for
the session ID and if mysql_affected_rows() evaluated to false but the
number of records is 1 return true
/solution

And there we have it... nearly drove me nuts but I got there in the end

Cheers

Dan
-
Dan Parry
Senior Developer
Virtua Webtech Ltd
http://www.virtuawebtech.co.uk

-Original Message-
From: Dan Parry [mailto:[EMAIL PROTECTED] 
Sent: 16 February 2006 09:51
To: php-general@lists.php.net
Subject: [PHP] Session problems

Hi all

 

I've been getting an error while using a custom session handler utilising a
MySQL database

 

The error I receive is:

 

Duplicate entry 'PHPSESSID_REMOVED' for key 1
Warning: Unknown(): A session is active. You cannot change the session
module's ini settings at this time. in Unknown on line 0

 

I've contacted my hosting company regarding this but currently they don't
seem to know the cause

 

I've Googled but I can't find anything I can use

 

Thanks in advance :-)

 

Dan

 

-

Dan Parry

Senior Developer

Virtua Webtech Ltd

http://www.virtuawebtech.co.uk

 

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



Re: [PHP] php 4 v php 5

2006-02-22 Thread David Tulloh
tedd wrote:
 Hi:
 
 Curt. said:
 
 PHP 4.4.2 - Released Jan 13 2006
 php 5.1.2 - Released Jan 12 2006
 PHP 5.0.5 - Released Sept 6 2005

 I wouldn't expect any more releases of 5.0.x version.
 
 
 Pardon my ignorance -- I have enough problems pounding out code to spend
 time following what's happening at the higher levels. But, considering
 the above statement, are there continuing development paths for both php
 4 and 5 independently?
 
 If so, what's the distinction between the two, oop? And if so, what
 about non-oop stuff -- do they share common libraries, or what?
 Generally, how does all of this fit together?
 
 Thanks.
 
 tedd
 


PHP 5.1 is the active development branch.  5.1.2 is the latest release
of that branch.

4.4 and 5.0 are old branches, they are not actively being developed.
Security and some bug fixes are applied to these branches, hence the
recent releases.


If you are developing new code, I'd recomend using 5.1.  Some servers
still use 4.4 and should probably be avoided.  There's fairly
substantial differences between 4  5 making upgrading an issue; I
suspect the devs will get tired of patching up version 4 soon, making
security an issue.


David Tulloh

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



[PHP] auto download

2006-02-22 Thread Benjamin Adams

I have three links. The code already auto selects one.
I'm trying to take that one link and automaticly start the download.
I tryed with header('location:$link');
but it tells me Warning: Cannot modify header information
what would I use to start downloading?
one of the link is another page so I need it to pop up in a new window.

Thanks for any help

Re: [PHP] CLI utility

2006-02-22 Thread John Nichel

Ray Cantwell wrote:

Hello again,
I was wondering if any of you knew of a good command line utility for 
php5 on linux? The box i write on has no X-windows.

Ray.



A command line utility to do what?

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] auto download

2006-02-22 Thread John Nichel

Benjamin Adams wrote:

I have three links. The code already auto selects one.
I'm trying to take that one link and automaticly start the download.
I tryed with header('location:$link');
but it tells me Warning: Cannot modify header information
what would I use to start downloading?
one of the link is another page so I need it to pop up in a new window.

Thanks for any help


http://us2.php.net/header

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] auto download

2006-02-22 Thread Benjamin Adams

I have it working with javascript but the if statements are not working:
?php
$num_download = rand(0,100);
echo $num_download;
if($num_downlaod = 50){
?
script type=text/javascript
   window.open('?=$conf[$links]['link1']?');
   /script
?php
}else if(($num_download  50)  ($num_download = 75)  ($conf 
[$links]['link2'] != '')){

?
script type=text/javascript
   window.open('?=$conf[$links]['link2']?');
   /script
?php
}else if(($num_download  75)  ($num_download = 100)  ($conf 
[$links]['link3'] != '')){

?
script type=text/javascript
   window.open('?=$conf[$links]['link3']?');
   /script
?php
}else{
?
script type=text/javascript
   window.open('?=$conf[$links]['link1']?');
   /script
?php
}
?

Only the first if runs and is true all the time.
What is wrong with the code?

On Feb 22, 2006, at 12:41 PM, John Nichel wrote:


Benjamin Adams wrote:

I have three links. The code already auto selects one.
I'm trying to take that one link and automaticly start the download.
I tryed with header('location:$link');
but it tells me Warning: Cannot modify header information
what would I use to start downloading?
one of the link is another page so I need it to pop up in a new  
window.

Thanks for any help


http://us2.php.net/header

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
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] Wormux

2006-02-22 Thread yeKcim
Hello.



Wormux is an opensource clone of Worms (Team17) :
http://www.wormux.org.

My name is CARRÉ Anthony (yeKcim) and i'm a Wormux
contributor, i draw some characters (skins) for this
game : http://www.wormux.org/wiki/en/skins.php.



My idea is to use opensource software mascots to draw
funny characters. I already drew : Tux team (Linux),
GNU team (GNU), Konqui team (KDE), Firefox team
(Firefox), Wilber team (Gimp), Nupik team (NuFW), PHP
Team (PHP), Snort Team (Snort). The next team i will
draw should certainly be the Thunderbird.



All skins are now integrated in Wormux but now the
Wormux team want to be sure that no licence problems
will appear ? 
Of course, i don't use original pictures.


I know that NuFW team is happy to see Nupik in Wormux
(http://www.nufw.org/+Nupik-NuFW-s-mascotte-in-wormux+.html).
I don't know what is your opinion for your mascott. If
your project team don't want to see your mascott in
Wormux, we will delete it.



If this message is not addressed to the good mail, if
you know who can inform me, thank you to contact me
and sorry for the disturbance.



I'm french, sorry for my english.

Thank you




yeKcim

PS @ Mr Nitot : Je sais que je vous ai déjà dérangé
avec cette question et je m'excuse de vous déranger à
nouveau mais l'équipe de Wormux me demande de
contacter les équipes de developpeurs avant chaque
nouvelle création. Je n'ai pas trouvé d'adresse ou de
liste de diffusion adaptée à cette question, si vous
savez ou je devrais écrire, merci. Pour info,
thunderbird pourrait ressembler à :
http://yeknan.free.fr/thunder.png il n'a pas un
physique gracieux mais c'est voulu.





___ 
Nouveau : téléphonez moins cher avec Yahoo! Messenger. Appelez le monde entier 
à partir de 0,012 €/minute ! 
Téléchargez sur http://fr.messenger.yahoo.com

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



Re: [PHP] Problem with mail() on Debian

2006-02-22 Thread Jochem Maas

George Pitcher wrote:

Hi,

I am in the process of moving from Windows (NT/XP) to Linux. I'm starting
with a new small application which I have working on my Windows XP laptop.

On my Linux box, I have php.ini saying:


search this page for 'exim' - it should help:

http://php.net/mail



sendmail_path /usr/sbin/sendmail


this may need to become:

sendmail_path /usr/sbin/sendmail -t

and it may require quotes:

sendmail_path /usr/sbin/sendmail -t



That 'sendmail' is a symbolic link to exim4 in the same directory. I can
send mail using exim4 from the command line, but not using PHP. I couldn't
find anything in the manual or on Google that helps me solve the problem.

Can anyone give me a clue where to look to solve this problem?

Cheers

George, in Oxford



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



[PHP] Beta Testers Wanted

2006-02-22 Thread Matt Palermo
Hey guys.  I would like to first say thanks for all the help you have all 
given me in the past (especially in my early programming days).  Once again, 
I would like to show my appreciation by offering an opportunity to use a new 
PHP program I have created.  The program is called TotalXplorer.  Basically 
it's an online file manager for your website that uses PHP's FTP 
functionality to perform actions on files/folders (this get's rid of the 
need to make them writable for PHP).  The file manager also has a built-in 
file upload feature, file editor, mp3 music player (to play tracks directly 
from your site without downloading them first), and more.  You can view the 
demo of it here:

http://sweetphp.com/projects/TotalXplorer/

I'm looking for 5-10 people who would be willing to help test it out and 
give feedback about it.  In exchange for this, you will receive a free copy 
of the software when it's ready to go.  If you are interested, please let me 
know.  This will be first come, first server, but please be willing to put 
in a little time with the testing of it.  I have offered similar beta 
testing programs for some of the other scripts I have available at 
http://sweetphp.com and they have become very successful because of all your 
help.

Thanks,

Matt Palermo
[EMAIL PROTECTED]
http://sweetphp.com 

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



[PHP] Altering subject of email in a pop3 mailbox

2006-02-22 Thread IG

Hi all.

Tried to find this and can't find any info.

I am writing a spam filter to run over multiple pop3 mail boxes which 
will work on keywords and Bayesian. With a very high score the filter 
will simply delete the email, with a med-high it will back the email in 
a 'bulk-mail' folder and delete it from the mailbox. with medium score I 
was wanting it to append the keyword [spam?] to the subject line and 
keep it in the pop3 mailbox. I can't work out how to do this in php. Can 
anyone help me on this one? Is it possible to alter a subject line (or 
body for that matter) of an email in a pop3 mailbox?


Thanks.

--

[EMAIL PROTECTED]
www.selectperformers.com

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



Re: [PHP] auto download

2006-02-22 Thread John Nichel

Benjamin Adams wrote:

I have it working with javascript but the if statements are not working:
?php
$num_download = rand(0,100);

---

echo $num_download;
if($num_downlaod = 50){

--

See a problem?

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] auto download

2006-02-22 Thread tedd

I have three links. The code already auto selects one.
I'm trying to take that one link and automaticly start the download.
I tryed with header('location:$link');
but it tells me Warning: Cannot modify header information
what would I use to start downloading?
one of the link is another page so I need it to pop up in a new window.

Thanks for any help



Check out:

http://www.weberdev.com/get_example-3938.html

If you have additional problems, contact me I have code that I use.

tedd


--

http://sperling.com

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



[PHP] Re: array variables with or without quotes

2006-02-22 Thread Chuck Anderson

2dogs wrote:

I recently encountered a situation where I had to retrieve data from a MYSQL 
database table with a field named include. My code looked like this:


$content_result = mysql_query('SELECT * FROM calander') or 
die(mysql_error());

$content_row = mysql_fetch_array($content_result);
if ($content_row[include])
   {go do something;}

When I tried to run this, PHP treated the word  -include- as a control 
structure rather than an index name. Understandable. So, I put it in single 
quotes  ('include') to see what would happen and it works fine. But I don't 
understand why!


What is the difference between $content_row [include] and 
$content_row['include']? I have been unable to resolve this question in the 
php manual, I need enlightenment.


2dogs 
 


http://www.php.net/manual/en/language.types.array.php#language.types.array.foo-bar

--
*
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*

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



[PHP] Conceptional question on dealing with different languages

2006-02-22 Thread janbro
Hello list,
it has been a while since I've posted the last time, but now I need your
 help/ opinion again.  I'm re-designing an existing page for an online
shop which is supposed to be used in different languages. The former
design was just a plan echo for an output since the page was only
intended for the German market. But now the output depends  on the
language the user selected. Currently we think of two languages, but
that might change sooner or later (management decision...).

Of course I don't want to ad an case of $language for every former echo.
I want to export the content to one central file/ object / table...
The infrastructure is PHP5 MySQL.

Now my ideas, where I would need your opinion:
1. a XML File which I read via SimplXML
2. a plan Text file
3. a PHP class where I delviver the content out of arrays
4. or a table in MySQL

Do you have other options, that might be useful? Which would you prefer?

thx Jan

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



RE: [PHP] Nested Set Model or modified preorder tree traversal

2006-02-22 Thread Daevid Vincent
Peter Brawley on the mySQL list pointed me at: 
http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html 

Which uses mySQL 5's procedures and such.
I haven't implemented this yet, but it appears to be what I wanted for the
most part.

 -Original Message-
 From: Curt Zirzow [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, February 21, 2006 10:58 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Nested Set Model or modified preorder 
 tree traversal
 
 On Tue, Feb 21, 2006 at 09:38:53PM -0800, Daevid Vincent wrote:
  I've been searching the web for the past few hours trying 
 to find a simple
  drop-in class or functions to implement Nested Set Model 
 or modified
  preorder tree traversal.
 
 I actually fell in love of this method of doing trees when I
 discovered it about a year ago, when researching a fast way to do
 a parent child retrieval.
 
  
  I've found several tutorials and related links:
  

 http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
http://www.sitepoint.com/article/hierarchical-data-database
   
  
 http://www.zend.com/zend/tut/tutorial-ferrara2.php?article=tut
 orial-ferrara2
  id=3453open=1anc=0view=1
http://simon.incutio.com/archive/2003/06/19/storingTrees
http://istherelifeafter.com/joecelko.html
http://www.codeproject.com/cs/database/Trees_in_SQL_databases.asp
 
 oh i have to add some of these to my list, i didn't have a couple
 of them.
 
  
  I even found some outdated PEAR DB_NestedSet class from 
 2003 that seemed way
  to overly complicated. And some other PHP4_Mysql3MPTTA 
 class on PHP Classes
  that was equally complicated and written for ancient PHP4 
 and mySQL 3!!
 
 yeah, i kind of got that feeling with the PEAR class as well, i
 think it was designed that way to be as flexible as possible. I'm
 not familiar with the other class, i tend to avoid anything from
 PHP Classes.
 
  
  Hasn't anyone else done this before (recently)? 
  Did everyone just write their own code every time?
  Anyone have some easy to use code that allows for:
  Add, delete, update/rename, select, show tree, bread crumb 
 display, etc.
 
 It would be nice to have a tool to manage the functionality. There
 will always be the issue with any common tool that is built for
 this purpose is how do you relate the table that defines the nested
 with the table that actually holds the data.
 
 I believe that why the PEAR and other classes you came across
 seemed to be overly complicated.  I have found that it is easier to
 write my own management (as awful as that sounds) for the job at
 hand.
 
  
  I use PHP 5.0.5 and mySQL 5.0.18, so ideally it would take 
 advantage of all
  the optimizations and bells  whistles of those more modern 
 versions.
 
 5.0.5? you mentioned that php4 is ancient, 5.0.5 is more ancient
 than php4.. infact 5.0.x is rather dead.
 
 PHP 4.4.2 - Released Jan 13 2006
 php 5.1.2 - Released Jan 12 2006
 PHP 5.0.5 - Released Sept 6 2005
 
 I wouldn't expect any more releases of 5.0.x version.
 
 
 Curt.
 -- 
 cat .signature: No such file or directory
 
 -- 
 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] Conceptional question on dealing with different languages

2006-02-22 Thread Philip Hallstrom

Hello list,
it has been a while since I've posted the last time, but now I need your
help/ opinion again.  I'm re-designing an existing page for an online
shop which is supposed to be used in different languages. The former
design was just a plan echo for an output since the page was only
intended for the German market. But now the output depends  on the
language the user selected. Currently we think of two languages, but
that might change sooner or later (management decision...).

Of course I don't want to ad an case of $language for every former echo.
I want to export the content to one central file/ object / table...
The infrastructure is PHP5 MySQL.

Now my ideas, where I would need your opinion:
1. a XML File which I read via SimplXML
2. a plan Text file
3. a PHP class where I delviver the content out of arrays
4. or a table in MySQL

Do you have other options, that might be useful? Which would you prefer?


Haven't used it, but see it everywhere...

http://us3.php.net/gettext

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



RE: [PHP] Re: array variables with or without quotes

2006-02-22 Thread Jason Karns
I believe it is because without the quotes, it is expecting a predefined
constant.  With the quotes, it is expecting an array key. This is why if you
use a word that is not defined as a constant, php will first look for it as
a constant, won't find it, then looks through the array treating it like a
key. If it is found as a constant, then the constant's value is used as the
key.

Jason

-Original Message-
From: Chuck Anderson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 22, 2006 3:30 PM
To: php-general@lists.php.net
Subject: [PHP] Re: array variables with or without quotes

2dogs wrote:

I recently encountered a situation where I had to retrieve data from a 
MYSQL database table with a field named include. My code looked like
this:

$content_result = mysql_query('SELECT * FROM calander') or 
die(mysql_error()); $content_row = mysql_fetch_array($content_result);
if ($content_row[include])
{go do something;}

When I tried to run this, PHP treated the word  -include- as a control 
structure rather than an index name. Understandable. So, I put it in 
single quotes  ('include') to see what would happen and it works fine. 
But I don't understand why!

What is the difference between $content_row [include] and 
$content_row['include']? I have been unable to resolve this question in 
the php manual, I need enlightenment.

2dogs
  

http://www.php.net/manual/en/language.types.array.php#language.types.array.f
oo-bar

--
*
 Chuck Anderson . Boulder, CO
 http://www.CycleTourist.com
 Integrity is obvious.
 The lack of it is common.
*

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



smime.p7s
Description: S/MIME cryptographic signature


[PHP] (array)

2006-02-22 Thread Jay Paulson
Just came across some code I haven't seen before and can't find anything on
php.net or google about it (maybe I'm not searching for the right thing?).
What is the following doing?

// $dataobject is holding a bunch of variables like:
//  $dataobject-var1
//  $dataobject-var2
//  etc...

(array)$dataobject;

Is this making the $dataobject an associative array like:

$dataobject[var1]
$dataobject[var2]

Or is it doing something different?

Thanks!

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



Re: [PHP] (array)

2006-02-22 Thread John Nichel

Jay Paulson wrote:

Just came across some code I haven't seen before and can't find anything on
php.net or google about it (maybe I'm not searching for the right thing?).
What is the following doing?

// $dataobject is holding a bunch of variables like:
//  $dataobject-var1
//  $dataobject-var2
//  etc...

(array)$dataobject;

Is this making the $dataobject an associative array like:

$dataobject[var1]
$dataobject[var2]

Or is it doing something different?



Yes, I believe it's type-casting the object into an array.  Do a print_r 
( $dataobject ) on it before and after the casting.


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] (array)

2006-02-22 Thread Ray Hauge
On Wednesday 22 February 2006 15:09, John Nichel wrote:
 Jay Paulson wrote:
  Just came across some code I haven't seen before and can't find anything
  on php.net or google about it (maybe I'm not searching for the right
  thing?). What is the following doing?
 
  // $dataobject is holding a bunch of variables like:
  //  $dataobject-var1
  //  $dataobject-var2
  //  etc...
 
  (array)$dataobject;
 
  Is this making the $dataobject an associative array like:
 
  $dataobject[var1]
  $dataobject[var2]
 
  Or is it doing something different?

 Yes, I believe it's type-casting the object into an array.  Do a print_r
 ( $dataobject ) on it before and after the casting.

 --
 John C. Nichel IV
 Programmer/System Admin (ÜberGeek)
 Dot Com Holdings of Buffalo
 716.856.9675
 [EMAIL PROTECTED]

I was curious about this myself, so I took a look at the Types section of 
the PHP manual, and an array is really a compound type.  With that in mind it 
makes sense that you could typecast to an array.

http://www.php.net/manual/en/language.types.php

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
http://www.americanstudentloan.com
1.800.575.1099

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



[PHP] How secure is this?

2006-02-22 Thread tedd

Hi gang:

A few days ago I posted my first attempt ajax. I posed the question 
Could a bot find my email address contained within the code?


There was some discussion, but I wasn't sure as to what the decision 
was, so I made another example, which can be found at:


http://www.xn--ovg.com/aja

How secure is this from bots?  Could a bot (or anyone) get to my 
email address via the code? Of course, you can read my email address 
by looking at the site, but I think I've hidden the code well enough 
from bots -- am I wrong?  And if so, how would a bot, or anyone for 
that matter, find it?


Thanks for looking and any suggestions you may have.

tedd

PS: This site works for: Opera 8.5+, Safari, Netscape 7.2+, Mozillia 
1.6+, FireFox 1.0.7+, Konqueror 3.4.0+, and IE 5+ (except Mac)


--

http://sperling.com

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



Re: [PHP] How secure is this?

2006-02-22 Thread Björn Bartels
Hi tedd...

is this enough... : http://www.xn--ovg.com/aja/rpc.php?action=start

in my opinion, an img src=crt_eml_btn.php onclick=contact() is a
handy way...

cheers
bb

Hi gang:

A few days ago I posted my first attempt ajax. I posed the question
Could a bot find my email address contained within the code?

There was some discussion, but I wasn't sure as to what the decision
was, so I made another example, which can be found at:

http://www.xn--ovg.com/aja

How secure is this from bots? Could a bot (or anyone) get to my
email address via the code? Of course, you can read my email address
by looking at the site, but I think I've hidden the code well enough
from bots -- am I wrong? And if so, how would a bot, or anyone for
that matter, find it?

Thanks for looking and any suggestions you may have.

tedd

PS: This site works for: Opera 8.5+, Safari, Netscape 7.2+, Mozillia
1.6+, FireFox 1.0.7+, Konqueror 3.4.0+, and IE 5+ (except Mac)

--


http://sperling.com

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




Björn Bartels
-Development/IT-Services-

--
dbusiness.de gmbh
digital business  printing gmbh

Greifswalder Str. 152
D-10409 Berlin

Fon: [0.30] 4.21.19.95
Fax: [0.30] 4.21.19.74

www.dbusiness.de
[EMAIL PROTECTED]
ftp://dbusiness.dyndns.org

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

Re: [PHP] Altering subject of email in a pop3 mailbox

2006-02-22 Thread Chris

IG wrote:
Is it possible to alter a subject line (or 
body for that matter) of an email in a pop3 mailbox?


If it's already in the mailbox, then I highly doubt you can do this.

You need to do this on the way in before it gets to the account.

Consider the ramifications if you could:

Anyone could login to your mail account and change the emails already there.

Eek!

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

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



[PHP] How can I stop PHP from resolving symlinks?

2006-02-22 Thread Roy Souther




I am trying to stop PHP from resolving symlinks. I have a PHP CMS that I use to host dozens of sites using Apache virtual hosting features. I need all the sites to run the exact same PHP CMS code but use their unique directories to host the different config files. The problem is that the PHP scripts are running from the directory that the links point to and not the directory where the site is. The big problem with that is the CMS tries to read a configuration file that is in a relative location to the PHP script like ../config.php. 

[EMAIL PROTECTED] ls -l /usr/local/cms
-rw-r--r-- 1 user users 20 Jan 16 02:17 index.php
drwxr-xr-x 9 user users 4096 Feb 22 16:40 admin
[EMAIL PROTECTED] ls -l /vhost/test01.com/var/www/html/
-rw-r--r-- 1 user users 20 Jan 16 02:17 config.php
lrwxrwxrwx 1 root root 31 Feb 22 14:05 index.php - /usr/local/cms/index.php
lrwxrwxrwx 1 root root 31 Feb 22 14:05 admin - /usr/local/cms/admin
[EMAIL PROTECTED] cd /vhost/test01.com/var/www/html/admin/
[EMAIL PROTECTED] pwd
/vhost/test01.com/var/www/html/admin
[EMAIL PROTECTED][admin]#

Bash is doing what I need. It sees the current directory as the full path of the symlink.

The admin.php at this point only has system(pwd); in it and it prints out /usr/local/cms/admin as the directory it is in, not what I want. It will never see the ../config.php file.

I tried doing this 
chdir ($_SERVER[DOCUMENT_ROOT]./.$_SERVER[REQUEST_URI]);
but it still resolves the link and does not accept the path that I constructed.

How can I make PHP use the symlink and stop trying to resolve the original files?








Royce Souther
www.SiliconTao.com
Let Open Source help your business move beyond.

For security this message is digitally authenticated by GnuPG.













signature.asc
Description: This is a digitally signed message part


[PHP] Case issue with eregi_replace in text highlight function

2006-02-22 Thread Nicolas Verhaeghe
Hi all!

I have a text highlight function which does not behave exactly as
needed. Behavior is logical but result is cumbersome.

Instead of replacing the portion of the text with the same portion of
text with some highlighting code added before and after, it replaces the
said text with the chunk of text looked for (highlight), which is an
issue when there is a difference in case.

It is used in a product search engine and it is important to keep the
case the same.

Here is the function:

function highlight_text($text, $highlight) {
return eregi_replace($highlight, span class=highlight . $highlight .
/span, $text);
}

In this case, if the  text to highglight is:

MacOS X Super Gizmo

And a client searches for the string macos, the result will be: 

span class=highlightmacos/span X Super Gizmo

Not very pritty.

How complicated would it be to prevent this from happening?

Thanks a lot in advance!

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



Re: [PHP] How can I stop PHP from resolving symlinks?

2006-02-22 Thread Chris

Roy Souther wrote:

How can I make PHP use the symlink and stop trying to resolve the 
original files?


Can you try:

$mydir = dirname(__FILE__);
include($mydir . '/../config.php');

?

or

$mydir = dirname(__FILE__);
include(dirname($mydir) . '/config.php');

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

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



Re: [PHP] Case issue with eregi_replace in text highlight function

2006-02-22 Thread Chris



Here is the function:

function highlight_text($text, $highlight) {
return eregi_replace($highlight, span class=highlight . $highlight .
/span, $text);
}

In this case, if the  text to highglight is:

MacOS X Super Gizmo

And a client searches for the string macos, the result will be: 


span class=highlightmacos/span X Super Gizmo


You're using the eregi_replace function - which does case insensitive 
replaces (read the man page).


Change it to use

ereg_replace

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

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



RE: [PHP] Case issue with eregi_replace in text highlight function

2006-02-22 Thread Nicolas Verhaeghe
That's not where the issue is.

Eregi_replace conducts a case insensitive SEARCH but how the REPLACE
operates has nothing to do with it.

If you use ereg_replace, then it is most obviously not going to replace
MacOS with span class=highlightmacos/span or even span
class=highlightMacOS/span, because the string searched for is of a
different case.

But thanks for helping.

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 22, 2006 5:39 PM
To: Nicolas Verhaeghe
Cc: php-general@lists.php.net
Subject: Re: [PHP] Case issue with eregi_replace in text highlight
function



 Here is the function:
 
 function highlight_text($text, $highlight) {
 return eregi_replace($highlight, span class=highlight . $highlight

 . /span, $text); }
 
 In this case, if the  text to highglight is:
 
 MacOS X Super Gizmo
 
 And a client searches for the string macos, the result will be:
 
 span class=highlightmacos/span X Super Gizmo

You're using the eregi_replace function - which does case insensitive 
replaces (read the man page).

Change it to use

ereg_replace

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

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

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



Re: [PHP] Case issue with eregi_replace in text highlight function

2006-02-22 Thread Chris

Nicolas Verhaeghe wrote:

That's not where the issue is.

Eregi_replace conducts a case insensitive SEARCH but how the REPLACE
operates has nothing to do with it.

If you use ereg_replace, then it is most obviously not going to replace
MacOS with span class=highlightmacos/span or even span
class=highlightMacOS/span, because the string searched for is of a
different case.


Good point, I had it around the wrong way.


function highlight_text($text, $highlight) {
  return eregi_replace($highlight, span class=highlight . $highlight
. /span, $text);
}


So where does 'highlight' come from when you pass it in ?

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

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



RE: [PHP] Case issue with eregi_replace in text highlight function

2006-02-22 Thread Chrome
How about

function highlight_text($text, $highlight) {
   return preg_replace('/(' . $highlight . ')/i', 'span
class=highlight$1/span', $text); 
}

Case should be retained and the search is case insensitive

HTH

Dan
---
http://chrome.me.uk
 

-Original Message-
From: Nicolas Verhaeghe [mailto:[EMAIL PROTECTED] 
Sent: 23 February 2006 00:55
To: 'Chris'
Cc: php-general@lists.php.net
Subject: RE: [PHP] Case issue with eregi_replace in text highlight function

That's not where the issue is.

Eregi_replace conducts a case insensitive SEARCH but how the REPLACE
operates has nothing to do with it.

If you use ereg_replace, then it is most obviously not going to replace
MacOS with span class=highlightmacos/span or even span
class=highlightMacOS/span, because the string searched for is of a
different case.

But thanks for helping.

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 22, 2006 5:39 PM
To: Nicolas Verhaeghe
Cc: php-general@lists.php.net
Subject: Re: [PHP] Case issue with eregi_replace in text highlight
function



 Here is the function:
 
 function highlight_text($text, $highlight) {
 return eregi_replace($highlight, span class=highlight . $highlight

 . /span, $text); }
 
 In this case, if the  text to highglight is:
 
 MacOS X Super Gizmo
 
 And a client searches for the string macos, the result will be:
 
 span class=highlightmacos/span X Super Gizmo

You're using the eregi_replace function - which does case insensitive 
replaces (read the man page).

Change it to use

ereg_replace

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

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

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


__ NOD32 1.1416 (20060222) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



[PHP] Issue with encrypted string created with Crypt_CBC and urls and mod_rewrite

2006-02-22 Thread Dan Rossi
hi there im having issue decoding an encoded string created with a pear  
package Crypt_CBC which i am encoding a uri into the string and sending  
to a rewrite url. The query string is not returning the encoded part of  
the url properly for some reason and not decoding properly.


I have already sent this to the pear list, but maybe someone here has  
experienced issues with encoded strings and mod_rewrite not relocating  
with a url encoded string ?


The encoded string without mod_rewrite rules is

RandomIVQ%83%80%E6%0F%E7%E4%7CdY%E7%BA%9B%14%5B%60%98%A1%1D%04%94L_%16%E 
4%19%EF%F1%FE%5C%D6%CE%09%C8DI%A7%1F%04%25%A8%7B%FA%19%B51%1D%7C%0D%04%1 
3%E3%21%F1%60f%C6%91%A8b%82%11YK%21l+%C5%D0W%D9%9A%2B%CD3%C3%FA%82LE%D8% 
1EA%07%25%F5%BB%22%EA%B7%B8%82%F0WZ%40


With rewritten urls its from viewing source.

RandomIVQƒ€æçä|dY纛[`˜¡”L_äïñþ\ÖÎÈDI§%¨{úµ1|
ã!ñ`fÆ‘¨b‚YK!l+ÅÐWÙš+Í3Ãú‚LEØA%õ»ê·¸‚ðWZ@


The rewrite rule is

RewriteEngine on
RewriteBase /
RewriteRule ^feeds/(.*) refer.php?$1 [L]

Any ideas why its not urlencoding the urlencoded string in the rewrite  
url ?


I may have to use the request_uri instead of sending it as a query  
string if this is a flaw in mod_rewrite ?? I think however if i use the  
request_uri things could break a little.


Let me know.

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



[PHP] parse_url not parsing hosts with www properly in php 5.1.2

2006-02-22 Thread Dan Rossi
Ive just discovered a strange issue where parse_url is not splitting up 
the url properly. in the host key its returning like //www.php.net 
where the url is http://www.php.net. any ideas ?



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



Re: [PHP] parse_url not parsing hosts with www properly in php 5.1.2

2006-02-22 Thread Chris

Dan Rossi wrote:
Ive just discovered a strange issue where parse_url is not splitting up 
the url properly. in the host key its returning like //www.php.net where 
the url is http://www.php.net. any ideas ?





If the behaviour changed between versions without it being documented or 
noted somewhere, post a bug report - http://bugs.php.net.


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

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



[PHP] [JOB] Sr PHP Developer, Boca Raton, FL | 80-125k

2006-02-22 Thread Beau Gould
Senior PHP Developer, Boca Raton, FL | 80-125k

Senior PHP Developer/Lead Programmer that has a solid object-oriented analysis 
and design background. The new team member will be involved in the planning and 
development of a variety of in-house, enterprise level e-commerce and marketing 
applications. The candidates for these positions should have experience 
building database driven business web applications using PHP, MySQL, HTML, and 
Javascript. Working knowledge of the Linux operating system is also required.  
The preferred candidate should have knowledge of object-oriented analysis and 
design concepts and be familiar with use case driven requirements and UML.  

Requirements: 
* Strong object-oriented analysis and design background. 
* 2+ years PHP programming experience on enterprise level applications. 
* Ability to oversee and mentor a small team of programmers. 
* Familiarity with PHPDoc. 
* Strong MySQL background. 
* Highly proficient with database analysis and design. 
* Excellent analytical and logic skills. 
* Extremely detail oriented and organized. 
* XML experience is a plus; particularly XML-RPC. 
* UML experience is a plus. 
* C++ experience is a plus. 

Responsibilities
* Use object-oriented design principles to plan and develop new applications 
and enhance existing applications with PHP and other relevant technologies. 
* Oversee and mentor other programmers within the department. 

Candidates must be authorized to work in the U.S.A. 

If you are interested in this position and live in the Miami/Boca Raton area, 
please submit resume, a paragraph or cover letter highlighting your experience 
as it pertains to this job and your salary requirements to [EMAIL PROTECTED]

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.12/266 - Release Date: 2/21/2006
 

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



Re: [PHP] parse_url not parsing hosts with www properly in php 5.1.2

2006-02-22 Thread Dan Rossi
Ok it looks like when i exploded the urls by a comma, one has space 
padding, i had to trim it first, the array was coming out like 
host=__http path=//www.thedomain.com :\


On 23/02/2006, at 1:05 PM, Chris wrote:


Dan Rossi wrote:
Ive just discovered a strange issue where parse_url is not splitting 
up the url properly. in the host key its returning like //www.php.net 
where the url is http://www.php.net. any ideas ?


If the behaviour changed between versions without it being documented 
or noted somewhere, post a bug report - http://bugs.php.net.


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

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



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



Re: [PHP] Issue with encrypted string created with Crypt_CBC and urls and mod_rewrite

2006-02-22 Thread Dan Rossi
It also seems that any forward slash being encoded if it encodes,  
mod_rewrite doesnt like, therefore I have to split up the urls using  
parse_url, but it seems it still doesnt like the query part and some  
special characters like ampersands and equals ?


On 23/02/2006, at 12:30 PM, Dan Rossi wrote:

hi there im having issue decoding an encoded string created with a  
pear package Crypt_CBC which i am encoding a uri into the string and  
sending to a rewrite url. The query string is not returning the  
encoded part of the url properly for some reason and not decoding  
properly.


I have already sent this to the pear list, but maybe someone here has  
experienced issues with encoded strings and mod_rewrite not relocating  
with a url encoded string ?


The encoded string without mod_rewrite rules is

RandomIVQ%83%80%E6%0F%E7%E4%7CdY%E7%BA%9B%14%5B%60%98%A1%1D%04%94L_%16% 
E4%19%EF%F1%FE%5C%D6%CE%09%C8DI%A7%1F%04%25%A8%7B%FA%19%B51%1D%7C%0D%04 
%13%E3%21%F1%60f%C6%91%A8b%82%11YK%21l+%C5%D0W%D9%9A%2B%CD3%C3%FA%82LE% 
D8%1EA%07%25%F5%BB%22%EA%B7%B8%82%F0WZ%40


With rewritten urls its from viewing source.

RandomIVQƒ€æçä|dY纛[`˜¡”L_äïñþ\ÖÎÈDI§%¨{úµ1|
ã!ñ`fÆ‘¨b‚YK!l+ÅÐWÙš+Í3Ãú‚LEØA%õ»ê·¸‚ðWZ@


The rewrite rule is

RewriteEngine on
RewriteBase /
RewriteRule ^feeds/(.*) refer.php?$1 [L]

Any ideas why its not urlencoding the urlencoded string in the rewrite  
url ?


I may have to use the request_uri instead of sending it as a query  
string if this is a flaw in mod_rewrite ?? I think however if i use  
the request_uri things could break a little.


Let me know.

Dan
--
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] Case issue with eregi_replace in text highlight function

2006-02-22 Thread Nicolas Verhaeghe
This does not highlight anything... Sorry!

Thanks for the help

-Original Message-
From: Chrome [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 22, 2006 6:19 PM
To: 'Nicolas Verhaeghe'; 'Chris'
Cc: php-general@lists.php.net
Subject: RE: [PHP] Case issue with eregi_replace in text highlight
function


How about

function highlight_text($text, $highlight) {
   return preg_replace('/(' . $highlight . ')/i', 'span
class=highlight$1/span', $text); 
}

Case should be retained and the search is case insensitive

HTH

Dan
---
http://chrome.me.uk
 

-Original Message-
From: Nicolas Verhaeghe [mailto:[EMAIL PROTECTED] 
Sent: 23 February 2006 00:55
To: 'Chris'
Cc: php-general@lists.php.net
Subject: RE: [PHP] Case issue with eregi_replace in text highlight
function

That's not where the issue is.

Eregi_replace conducts a case insensitive SEARCH but how the REPLACE
operates has nothing to do with it.

If you use ereg_replace, then it is most obviously not going to replace
MacOS with span class=highlightmacos/span or even span
class=highlightMacOS/span, because the string searched for is of a
different case.

But thanks for helping.

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 22, 2006 5:39 PM
To: Nicolas Verhaeghe
Cc: php-general@lists.php.net
Subject: Re: [PHP] Case issue with eregi_replace in text highlight
function



 Here is the function:
 
 function highlight_text($text, $highlight) {
 return eregi_replace($highlight, span class=highlight . $highlight

 . /span, $text); }
 
 In this case, if the  text to highglight is:
 
 MacOS X Super Gizmo
 
 And a client searches for the string macos, the result will be:
 
 span class=highlightmacos/span X Super Gizmo

You're using the eregi_replace function - which does case insensitive 
replaces (read the man page).

Change it to use

ereg_replace

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

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

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


__ NOD32 1.1416 (20060222) Information __

This message was checked by NOD32 antivirus system. http://www.eset.com

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

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



[PHP] Re: array variables with or without quotes

2006-02-22 Thread 2dogs
Chuck, you are the man! I decided to reread the manual word for word but 
have only gotten through Strings as of last night. Thanks for zeroing me in 
on the right spot.

txs
2dogs





Chuck Anderson [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 2dogs wrote:

I recently encountered a situation where I had to retrieve data from a 
MYSQL database table with a field named include. My code looked like 
this:

$content_result = mysql_query('SELECT * FROM calander') or 
die(mysql_error());
$content_row = mysql_fetch_array($content_result);
if ($content_row[include])
{go do something;}

When I tried to run this, PHP treated the word  -include- as a control 
structure rather than an index name. Understandable. So, I put it in 
single quotes  ('include') to see what would happen and it works fine. But 
I don't understand why!

What is the difference between $content_row [include] and 
$content_row['include']? I have been unable to resolve this question in 
the php manual, I need enlightenment.

2dogs
 http://www.php.net/manual/en/language.types.array.php#language.types.array.foo-bar

 -- 
 *
 Chuck Anderson • Boulder, CO
 http://www.CycleTourist.com
 Integrity is obvious.
 The lack of it is common.
 * 

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



[PHP] Re: Reading binary http post

2006-02-22 Thread Manuel Lemos
Hello,

on 02/21/2006 03:40 PM Dirk Vanden Boer said the following:
 I have a C++ application that posts binary data to a php script that I 
 created using libcurl. Everything works fine except when my binary data 
 happens to start with the '' symbol. In that case I can't read the http 
 post data (isset returns false).
 
 The post argument then looks like data=ÑÚA
 Reading the post is done like this:
 if (isset($_POST['data'])
 Is there a way to fix this problem?

The problem is that you are misleading PHP telling that you are posting
form data. You need to correct the request Content-Type. It must not be
application/x-www-form-urlencoded nor multipart/form-data . I think you
can use anything except those types, like for instance
application/octet-stream which is the default for binary files.

I don't know how can you hack libcurl to make it use the right request
content-type. It is probably easy. If you are not able to do it, you may
want to try this PHP HTTP client class . It can send custom POST requests.

http://www.phpclasses.org/httpclient

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] HN CAPTCHA at http://www.phpclasses.org

2006-02-22 Thread Manuel Lemos
Hello,

on 02/17/2006 05:10 PM tedd said the following:
 Manuel:
 
 Your points are well taken.
 
 A good CAPTCHA must be fuzzy. If you know other fuzzy CAPTCHA besides
 these, it may help to sharing that knowledge.
 
 The CAPTCHA I was primarily referring to was the image one -- however,
 it's just another barrier.
 
 I am sure there are all sorts of ways to fool a computer while making it
 easy for a human to comply, like Enter the third word of the first
 paragraph; or What is the color of an orange?; or presenting an easy
 question from a vast lists of questions provided at random.

That is not hard to beat because it does not make it difficult to
determine what is the question, like image and audio captchas. Therefore
that solution is vulnerable to dictionary attacks.


 While computers could be designed to answer such questions, the amount
 of time required would be better spent going after those sites that
 don't have any CAPTCHA.

It depends on the purpose of the attackers. If they want to attack
specific sites, soon or later they will figure a way to defeat them if
they have weak protection schemes.


 As for me, I'm trying to understand both sides and see if there is a
 midway solution. However, it appears that both sides are steadfastly
 rooted in their opinion. One side wants barriers and the other side
 doesn't -- mutually exclusive positions.
 
 I can't help but think there must be a software solution.

Maybe, but this is not a trivial solution. Research and development
costs time and money to those that need to invest on it to find better
protection . People that complain against CAPTCHAs should also consider
these aspects before blaming people for not using better CAPTCHA schemes.

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] HN CAPTCHA at http://www.phpclasses.org

2006-02-22 Thread Manuel Lemos
Hello,

on 02/19/2006 09:12 PM tedd said the following:
 Manuel:
 
 A good CAPTCHA must be fuzzy. If you know other fuzzy CAPTCHA besides
 these, it may help to sharing that knowledge.
 
 Try this:
 
 http://xn--ovg.com/no_bot
 
 The point of CAPTCHA is to provide something that a bot can't figure
 out, but a human can, right?
 
 Well, for a bot to figure out the answer, the bot must be able to get at
 the source code, right? Take a look at this source code and from it
 determine the answer. Also, try to view the content source code from
 any page on this site. I think this data is bot-proof, isn't it? Or have
 I blundered?

I think you are missing the point. The role of robots is to find the
solutions to hack the sites. Hackers find the solutions and develop
robots to attack the sites. For an hacker, this site is easy to hack.

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] novice with hacked email form issue

2006-02-22 Thread Manuel Lemos
Hello,

on 02/21/2006 03:19 PM cKc Consultants said the following:
 An email form that uses a simple server side php code to send the variable
 values managed to send:


 Content-Type: multipart/alternative;
 boundary=5c7c7e682d991e8ec1f6825582ea2103
 MIME-Version: 1.0
 Subject: round a rock by way of anchorage
 bcc: [EMAIL PROTECTED]

 This is a multi-part message in MIME format.

 --5c7c7e682d991e8ec1f6825582ea2103
 Content-Type: text/plain; charset=\us-ascii\
 MIME-Version: 1.0
 Content-Transfer-Encoding: 7bit

 system expict th time is
 --5c7c7e682d991e8ec1f6825582ea2103--


 This appears between responses to $msg.= and shouldn't be something the
 user could see. In order to figure out how to prevent this, I need to know
 how it was done. I know I need to validate the email address more closely,
 but I'm curious as to what created this. I've found some interesting
 articles on the web, but nothing seems to deal with this issue.
Pointing me
 in the right direction would be appreciated!

The problem is that you are using unverified data came from the form
directly into the message. It is easy to hack your form because you are
neglecting the fact that an e-mail field may contain line breaks. This
opens the chance for hackers to add extra headers and even message body
data, as the PHP mail() function is very weak and does nothing reject
abusive data.

If you are looking for a more robust solution, take a look at this MIME
message composing class. Not only it can encode special characters that
can be legitemately fed to the message, but it also escapes line breaks
on headers, so any attacks like you suffered are suppressed, even when
you do not validate the form fields for valid e-mail addresses as you
should have done:

http://www.phpclasses.org/mimemessage


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



RE: [PHP] novice with hacked email form issue

2006-02-22 Thread cKc Consultants
Thanks for all of the help!
Thanks for all of the help and resources! 

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



Re: [PHP] How secure is this?

2006-02-22 Thread David Tulloh
Your example fails for me, Firefox and Mozilla.  The rpc.php file 
doesn't seem to return anything.


To answer your question though, a bot is capable of getting anything 
that a human can, probably more.  It's all a question of effort.  As the 
email scrapers get plenty of hits looking for standard email addresses, 
they don't put much effort into getting addresses from people who try to 
hide them (people who hide them are also less likely to fall for spam).
In the current environment, I don't think any bot is going to bother 
running javascript, so any obstuftication using javascript should be safe.



David

tedd wrote:


Hi gang:

A few days ago I posted my first attempt ajax. I posed the question 
Could a bot find my email address contained within the code?


There was some discussion, but I wasn't sure as to what the decision 
was, so I made another example, which can be found at:


http://www.xn--ovg.com/aja

How secure is this from bots?  Could a bot (or anyone) get to my email 
address via the code? Of course, you can read my email address by 
looking at the site, but I think I've hidden the code well enough from 
bots -- am I wrong?  And if so, how would a bot, or anyone for that 
matter, find it?


Thanks for looking and any suggestions you may have.

tedd

PS: This site works for: Opera 8.5+, Safari, Netscape 7.2+, Mozillia 
1.6+, FireFox 1.0.7+, Konqueror 3.4.0+, and IE 5+ (except Mac)




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



RE: [PHP] Problem with mail() on Debian

2006-02-22 Thread George Pitcher
Jochem,

Thanks, but I tried that and it made no difference.

I have found that any changes I make to php.ini are ignored, even after
restarting Apache. I have been editing httpd.conf via Webmin, which for most
configs works fine (and is displayed in phpinfo(), the sendmail changes are
never displayed (always shows sendmail_path = /usr/sbin/sendmail).

Cheers

George

 -Original Message-
 From: Jochem Maas [mailto:[EMAIL PROTECTED]
 Sent: 22 February 2006 7:01 pm
 To: George Pitcher; [php] PHP General List
 Subject: Re: [PHP] Problem with mail() on Debian


 George Pitcher wrote:
  Hi,
 
  I am in the process of moving from Windows (NT/XP) to Linux.
 I'm starting
  with a new small application which I have working on my Windows
 XP laptop.
 
  On my Linux box, I have php.ini saying:

 search this page for 'exim' - it should help:

 http://php.net/mail

 
  sendmail_path /usr/sbin/sendmail

 this may need to become:

   sendmail_path /usr/sbin/sendmail -t

 and it may require quotes:

   sendmail_path /usr/sbin/sendmail -t

 
  That 'sendmail' is a symbolic link to exim4 in the same directory. I can
  send mail using exim4 from the command line, but not using PHP.
 I couldn't
  find anything in the manual or on Google that helps me solve
 the problem.
 
  Can anyone give me a clue where to look to solve this problem?
 
  Cheers
 
  George, in Oxford
 



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



[PHP] encrypted urls, mcrypt and mod_rewrite

2006-02-22 Thread Dan Rossi
Hi ive been trying to find answers with no luck. I am sending a 
urlencoded encrypted string made with mcrypt. what is happening is 
there is somehow special characters that mod_rewrite doesnt like so it 
wont find a regex match properly with this rule


RewriteRule ^feeds/(.*)$ refer.php?$1 [L,QSA]

Any ideas what it could be doing ? The strings are also quite random, 
so it will work sometimes for a particular url then other times not ?

Re: [PHP] Problem with mail() on Debian

2006-02-22 Thread Manuel Lemos
Hello,

on 02/23/2006 03:55 AM George Pitcher said the following:
 Jochem,
 
 Thanks, but I tried that and it made no difference.
 
 I have found that any changes I make to php.ini are ignored, even after
 restarting Apache. I have been editing httpd.conf via Webmin, which for most
 configs works fine (and is displayed in phpinfo(), the sendmail changes are
 never displayed (always shows sendmail_path = /usr/sbin/sendmail).

There are no miracles. If you change restarted Apache and phpinfo()
shows the same in sendmail_path, either you have other Apache
configuration changing PHP options, or you have not really changed
php.ini, which is very likely.

No, I am not saying you are crazy. It is very likely that the real
php.ini is not in the path you think it is. This may happen if you have
installed Zend Studio or some other tool that needs to replace the real
php.ini and moves it elsewhere.

Look again to the phpinfo() output to determine the real path of php.ini .

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] encrypted urls, mcrypt and mod_rewrite

2006-02-22 Thread Dan Rossi
Somehow this part of the string is a problem, it has underscores, but 
there is probably other things in this.


_%E5%D4%13%82%C9%DFN%5EFs%5E47%B2v%2F%D7%A4%0C%C6%9EnJ

On 23/02/2006, at 6:01 PM, Dan Rossi wrote:

Hi ive been trying to find answers with no luck. I am sending a 
urlencoded encrypted string made with mcrypt. what is happening is 
there is somehow special characters that mod_rewrite doesnt like so it 
wont find a regex match properly with this rule


RewriteRule ^feeds/(.*)$ refer.php?$1 [L,QSA]

Any ideas what it could be doing ? The strings are also quite random, 
so it will work sometimes for a particular url then other times not ?


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



RE: [PHP] Problem with mail() on Debian

2006-02-22 Thread George Pitcher
Manuel,

  I have found that any changes I make to php.ini are ignored, even after
  restarting Apache. I have been editing httpd.conf via Webmin,
 which for most
  configs works fine (and is displayed in phpinfo(), the sendmail
 changes are
  never displayed (always shows sendmail_path = /usr/sbin/sendmail).

 There are no miracles. If you change restarted Apache and phpinfo()
 shows the same in sendmail_path, either you have other Apache
 configuration changing PHP options, or you have not really changed
 php.ini, which is very likely.

 No, I am not saying you are crazy. It is very likely that the real
 php.ini is not in the path you think it is. This may happen if you have
 installed Zend Studio or some other tool that needs to replace the real
 php.ini and moves it elsewhere.

 Look again to the phpinfo() output to determine the real path of php.ini .

That's the crazy part! phpinfo() shows the path to the php.ini file as the
one that I have been editing, and if I open that file in vi, it shows all
the changes I've made. This is a bare debian install in as much as it has no
windowing environments. No Zend Studio, or anything else fancy. Smarty and
PEAR work, its just the emailing that is letting me down just now. Once
that's resolved I'll move on to spreadsheet reading.

Cheers

George

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