[PHP] I know this is not easy and I'm not stupid but...

2007-08-09 Thread Phil Curry
how can this be? This is not the first time I've run into a situation  
like this. What am I missing?


line 102echo  ($userValues['afterDark']); // outputs 1

line 103if ( $userValues['afterDark'] == 0 ) {// passes


Thanks.
-Phil

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



RE: [PHP] magic quotes

2007-08-09 Thread k3cheese
It did work I was expecting a physical change in the form display as the
form field values are set to stripslashes values.


-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 09, 2007 12:20 AM
To: k3cheese
Cc: php-general@lists.php.net
Subject: RE: [PHP] magic quotes

runtime data means data that is coming out of your database at
runtime as opposed to gpc data which means data from
GET/POST/COOKIE

It most certainly does NOT mean that you can't modify the data you
have received in any way you choose.

Can you clarify Didn't work at all. for us?

Or, perhaps, see if what you think is happening is happening:

?php
  echo preBEFORE:\n; var_dump($_POST); echo /pre;
  if (ini_get('magic_quotes_gpc')){
echo ALTERINGbr /\n;
$_POST['data'] = stripslashes($_POST['data']);
echo preAFTER:\n; var_dump($_POST); echo /pre;
  }
?

Because using stripslashes to un-do the evil effects of
magic_quotes_gpc is pretty much a no-brainer...

.htaccess might not work for a number of reasons, such as:
  You're not using Apache.
  .htaccess is turned off in your httpd.conf
  You didn't put .htaccess in the same directory as your PHP script

On Wed, August 8, 2007 11:58 pm, k3cheese wrote:
 I added the code to my script and I still ended up escaped quotes.
 if(ini_get('magic_quotes_gpc')) $_POST['data'] =
 stripslashes($_POST['data']);  Didn't work at all.  I think I read
 something
 about it not working on runtime data. Like gpc if this is correct do
 you
 have another solution?  I put this line in the .htaccess file it
 didn't work
 either: php_flag magic_quotes_gpc off... Is there anyway possible? I
 don't
 need it now but it'd be nice to know for the future dev.

 Kevon K. Hayes
 815-980-3435
 RFD, IL

 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 08, 2007 11:49 PM
 To: k3cheese
 Cc: php-general@lists.php.net
 Subject: RE: [PHP] magic quotes

 .htaccess is only meaningful for Apache.

 JavaScript is equally useless to Ajax for working around Magic Quotes.

 On Wed, August 8, 2007 7:55 am, k3cheese wrote:
 Thanks,

 Met javascript not ajax. I had AJAX on the brain do to a project I'm
 working
 on. So I'm assuming there is a library of functions to use with the
 .htaccess file?  Cause it looks like you can use UNIX and PHP to
 edit
 this
 file?

 Kevon K. Hayes
 815-980-3435
 RFD, IL

 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, August 07, 2007 11:30 PM
 To: KVIGOR
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] magic quotes

 On Tue, July 31, 2007 9:28 am, KVIGOR wrote:
 If magic quotes is on and I dont have access to the php.ini.

 Is there any way I can strip quotes from the form field with out
 using
 AJAX?

 Best: Use .htaccess to turn magic_quotes off.
 Okay: Use something like if (ini_get('magic_quotes_gpc')) $data =
 stripslashes($data);
 Worst: Ajax cannot possibly begin to address this issue and is
 completely useless to solve this particular problem.

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

 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.5.476 / Virus Database: 269.11.6/938 - Release Date:
 8/5/2007
 4:16 PM


 No virus found in this outgoing message.
 Checked by AVG Free Edition.
 Version: 7.5.476 / Virus Database: 269.11.6/938 - Release Date:
 8/5/2007
 4:16 PM




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

 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.5.476 / Virus Database: 269.11.8/941 - Release Date:
 8/7/2007
 4:06 PM


 No virus found in this outgoing message.
 Checked by AVG Free Edition.
 Version: 7.5.476 / Virus Database: 269.11.8/941 - Release Date:
 8/7/2007
 4:06 PM




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

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.11.8/941 - Release Date: 8/7/2007
4:06 PM
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.11.8/941 - Release Date: 8/7/2007
4:06 PM
 

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



Re: [PHP] Re: get domain component from email

2007-08-09 Thread Stut

Richard Lynch wrote:

On Wed, August 8, 2007 4:26 am, Stut wrote:

Completely agree. It's like banning someone from a pub based on the
clothes they were wearing the last time you saw them.


Yeah, one drunk abusive chick in a little black dress could get EVERY
gal in a little black dress banned.

That's pretty messed up.

:-)


Messed up? That would be a disaster. It could happen to hot pants too!

-Stut

--
http://stut.net/

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



Re: [PHP] I know this is not easy and I'm not stupid but...

2007-08-09 Thread Stut

Phil Curry wrote:
how can this be? This is not the first time I've run into a situation 
like this. What am I missing?


line 102echo  ($userValues['afterDark']); // outputs 1

line 103if ( $userValues['afterDark'] == 0 ) {// passes


Add a line at 102.5...

var_dump($userValues['afterDark']);

What type is that variable?

-Stut

--
http://stut.net/

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



[PHP] Special Bonus For Switching Over From SunRocket!

2007-08-09 Thread VoIPTelco.net
Hi,

I want to introduce you to a new phone service that I'm using. It's called 
VoIPTelCo and it transforms your high speed Internet connection into a regular 
phone line. It works just like your current telephone service except it's 40% - 
60% cheaper. You get features like Call Waiting, Caller ID Display, Voicemail, 
3-Way calling, Call Forwarding and many more for a fraction of what you're 
paying now. You can even keep your existing number if you decide to switch to 
their service.

With VoIPTelCo, I also save money on long distance calling. Unlike a regular 
phone line, VoIPTelCo is portable, which means I can get phone service 
anywhere in the world. All I need is high speed Internet access. For example, I 
use my VoIPTelCo service when I travel and there are no long distance fees 
because these calls are considered local. I save so much money just on this 
alone.

Right now, VoIPTelCo is offering a ONE MONTH FREE trial period to friends and 
families of their customers. There is no obligation and it is completely free. 
If you'd like to try them out, just click on the link below and you will 
receive a 30 days trial period, free of charge:

http://www.voiptelco.net

Hope you'll find this useful.


Re: [PHP] Hidden include_path Fall Back?

2007-08-09 Thread imacat
On Wed, 8 Aug 2007 23:56:34 -0500 (CDT)
Richard Lynch [EMAIL PROTECTED] wrote:
 The default of php.ini starts with '.' in the first place, I think, so
 unless you go out of your way to change it, you'll get '.' from a
 fresh install anyway.
 
 I personally would not rely on the behaviour of the code unless you
 can find Documentation on http://php.net that says it will work this
 way.
 
 It cannot be that hard to append/prepend '.:' yourself to the
 include_path...

I agree with this.  Personally I do not like the idea of having .
in the search path since I may get different files in different
directories.  And coders should not depend on undocumented features.  I
shall file a documentation bug onto bugs.php.net.

Thank you for your kind help.

-- 
imacat ^_*'
[EMAIL PROTECTED]
PGP Key: http://www.imacat.idv.tw/me/pgpkey.asc

Tavern IMACAT's http://www.imacat.idv.tw/
Woman's Voice http://www.wov.idv.tw/
TLUG List Manager http://www.linux.org.tw/mailman/listinfo/tlug


pgppdkx35aMuA.pgp
Description: PGP signature


[PHP] Access parent property from child

2007-08-09 Thread Suprie
dear all ...

i have question, i've tried look at google but still can't figured out
how to do it...
i want access parent property from child object the code was like

?

class DAO
{
private $db;
private $id;

protected function getId()
{
return $this-id;
}
protected function setId($id)
{
$this-id   = $id;
}

function getDB()
{
return $this-$db;
}
function setDB($db)
{
$this-db   = $db;
}

public function load($id)
{
$query  = SELECT * FROM .
constant(get_class($this).::tableName).
 WHERE .
constant(get_class($this).::pkFields).
='.$id.';
$rs = $this-db-Execute($query);
$cObj   = $rs-FetchObject(true);

return $cObj;
}

public function save($rowData)
{
$this-db-debug = true;
$query  =Select * FROM
.constant(get_class($this).::tableName).\n;
$res=$this-db-Execute($query);
$insertSQL  = $this-db-GetInsertSQL($res,$rowData);
$res=$this-db-Execute($insertSQL);
if($res)
return true;

return false;
}

public function update($row, $id)
{
$query  =   SELECT * FROM
.constant(get_class($this).::tableName).\n
.   WHERE
.constant(get_class($this).::pkFields).='.$id.';
$res= $this-db-Execute($query);
$updateSQL  = $this-db-GetUpdateSQL($res,$row);
$db-Execute($updateSQL);
}

public function getAll($criteria='', $order='')
{
if(empty($order))
$order  = constant(get_class($this).::pkFields);

$query  = SELECT * FROM
.constant(get_class($this).::tableName).\n
. $criteria
. ORDER BY .$order;
$row=   $this-db-Execute($query);
if(!$row)
{
$this-error= $this-db-ErrorMsg();
return  false;
}
return $row-getArray();
}

}

and i have this child
?php

include 'BaseDAO.class.php';
class TaskCLDAO extends DAO
{
const tableName = 'task';
const pkFields  = 'task_id';

function findWithRelation($id)
{
  $query = select * from task LEFT JOIN log ON task.id=log.task_id;
  $db  =  parent::getDB();
  $res =  $db-Execute($query);
  return $res-getArray();
}
}


?

and this is the class that called it

?php

$obj   = new TaskCLDAO();
$obj-setDB($db); //  i have another file called config that initialized the db;
$res   = $obj-findWithRelation(1);

?

but the php's said

Fatal error: Cannot access empty property...

what does it mean ?? is there another way to access $db that parent have ?

TIA
-- 
Jangan tanyakan apa yang Indonesia telah berikan pada mu
tapi bertanyalah apa yang telah engkau berikan kepada Indonesia

-BEGIN GEEK CODE BLOCK-
Version: 3.1
GU/IT  d- s: a-- C++ UL P L++ E W++ N* o-- K-
w PS  Y-- PGP- t++ 5 X R++ tv  b+ DI D+ G e+ h* r- z?
 --END GEEK CODE BLOCK--

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



RE: [PHP] ORM framework suggestion

2007-08-09 Thread Edward Kay

 -Original Message-
 From: Matt Arnilo S. Baluyos (Mailing Lists)
 [mailto:[EMAIL PROTECTED]
 Sent: 09 August 2007 00:35
 To: PHP-General
 Subject: [PHP] ORM framework suggestion


 Hello All,

 I'm thinking of using an ORM framework for a new project. From my
 research, I've found Propel and Doctrine (of course, there might be
 others).

 Would anyone suggest what ORM framework they're using right now? I am
 experienced with OOP and am just looking for a framework to speed
 things up.

 I can perhaps test-drive both frameworks above and see what works
 better for me but maybe there are users here who's have had experience
 with either one (or better, both).

 Regards,
 Matt


Have a look at Qcodo: http://www.qcodo.com

If you're not after a full framework, just use the code generator to build
your ORM. I've been using it for about a year now and found it excellent.

Edward

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



Re: [PHP] Access parent property from child

2007-08-09 Thread Stut

Suprie wrote:

function getDB()
{
return $this-$db;
}


There should not be a $ before db. It should be $this-db. That's why 
PHP is telling you the property is empty... because it is.


-Stut

--
http://stut.net/

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



RE: [PHP] Access parent property from child

2007-08-09 Thread Edward Kay


 -Original Message-
 From: Suprie [mailto:[EMAIL PROTECTED]
 Sent: 09 August 2007 11:13
 To: php-general@lists.php.net
 Subject: [PHP] Access parent property from child


 dear all ...

 i have question, i've tried look at google but still can't figured out
 how to do it...
 i want access parent property from child object the code was like

 ?

 class DAO
 {
 private $db;
 private $id;

 protected function getId()
 {
 return $this-id;
 }
 protected function setId($id)
 {
 $this-id   = $id;
 }

 function getDB()
 {
 return $this-$db;
 }
 function setDB($db)
 {
 $this-db   = $db;
 }

 public function load($id)
 {
 $query  = SELECT * FROM .
 constant(get_class($this).::tableName).
  WHERE .
 constant(get_class($this).::pkFields).
 ='.$id.';
 $rs = $this-db-Execute($query);
 $cObj   = $rs-FetchObject(true);

 return $cObj;
 }

 public function save($rowData)
 {
 $this-db-debug = true;
 $query  =Select * FROM
 .constant(get_class($this).::tableName).\n;
 $res=$this-db-Execute($query);
 $insertSQL  = $this-db-GetInsertSQL($res,$rowData);
 $res=$this-db-Execute($insertSQL);
 if($res)
 return true;

 return false;
 }

 public function update($row, $id)
 {
 $query  =   SELECT * FROM
 .constant(get_class($this).::tableName).\n
 .   WHERE
 .constant(get_class($this).::pkFields).='.$id.';
 $res= $this-db-Execute($query);
 $updateSQL  = $this-db-GetUpdateSQL($res,$row);
 $db-Execute($updateSQL);
 }

 public function getAll($criteria='', $order='')
 {
 if(empty($order))
 $order  = constant(get_class($this).::pkFields);

 $query  = SELECT * FROM
 .constant(get_class($this).::tableName).\n
 . $criteria
 . ORDER BY .$order;
 $row=   $this-db-Execute($query);
 if(!$row)
 {
 $this-error= $this-db-ErrorMsg();
 return  false;
 }
 return $row-getArray();
 }

 }

 and i have this child
 ?php

 include 'BaseDAO.class.php';
 class TaskCLDAO extends DAO
 {
 const tableName = 'task';
 const pkFields  = 'task_id';

 function findWithRelation($id)
 {
   $query = select * from task LEFT JOIN log ON
 task.id=log.task_id;
   $db  =  parent::getDB();
   $res =  $db-Execute($query);
   return $res-getArray();
 }
 }


 ?

 and this is the class that called it

 ?php

 $obj   = new TaskCLDAO();
 $obj-setDB($db); //  i have another file called config that
 initialized the db;
 $res   = $obj-findWithRelation(1);

 ?

 but the php's said

 Fatal error: Cannot access empty property...

 what does it mean ?? is there another way to access $db that
 parent have ?

 TIA


In function getDb()

  return $this-$db;

should be:

  return $this-db;

Also, although not strictly required, I suggest you add the public keyword
to your methods that don't specifiy their visibility.

Edward

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



RE: [PHP] magic quotes

2007-08-09 Thread Bastien Koert

you could use ini_set at the top of the script to turn the magic quotes 
off...if you add this in a prepend file or a common included file that sits at 
the top of the script, it should take care of the damn magic quotes...
 
failing that ask your host to turn it off
 
Bastien From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: 
php-general@lists.php.net Date: Wed, 8 Aug 2007 23:58:50 -0500 Subject: RE: 
[PHP] magic quotes  I added the code to my script and I still ended up 
escaped quotes. if(ini_get('magic_quotes_gpc')) $_POST['data'] = 
stripslashes($_POST['data']); Didn't work at all. I think I read something 
about it not working on runtime data. Like gpc if this is correct do you have 
another solution? I put this line in the .htaccess file it didn't work either: 
php_flag magic_quotes_gpc off... Is there anyway possible? I don't need it now 
but it'd be nice to know for the future dev.  Kevon K. Hayes 815-980-3435 
RFD, IL  -Original Message- From: Richard Lynch [mailto:[EMAIL 
PROTECTED]  Sent: Wednesday, August 08, 2007 11:49 PM To: k3cheese Cc: 
php-general@lists.php.net Subject: RE: [PHP] magic quotes  .htaccess is only 
meaningful for Apache.  JavaScript is equally useless to Ajax for working 
around Magic Quotes.  On Wed, August 8, 2007 7:55 am, k3cheese wrote:  
Thanks,   Met javascript not ajax. I had AJAX on the brain do to a project 
I'm  working  on. So I'm assuming there is a library of functions to use 
with the  .htaccess file? Cause it looks like you can use UNIX and PHP to 
edit  this  file?   Kevon K. Hayes  815-980-3435  RFD, IL   
-Original Message-  From: Richard Lynch [mailto:[EMAIL PROTECTED]  
Sent: Tuesday, August 07, 2007 11:30 PM  To: KVIGOR  Cc: 
php-general@lists.php.net  Subject: Re: [PHP] magic quotes   On Tue, July 
31, 2007 9:28 am, KVIGOR wrote:  If magic quotes is on and I dont have 
access to the php.ini.   Is there any way I can strip quotes from the 
form field with out  using  AJAX?   Best: Use .htaccess to turn 
magic_quotes off.  Okay: Use something like if (ini_get('magic_quotes_gpc')) 
$data =  stripslashes($data);  Worst: Ajax cannot possibly begin to address 
this issue and is  completely useless to solve this particular problem.   
--  Some people have a gift link here.  Know what I want?  I want you 
to buy a CD from some indie artist.  http://cdbaby.com/browse/from/lynch  
Yeah, I get a buck. So?   No virus found in this incoming message.  
Checked by AVG Free Edition.  Version: 7.5.476 / Virus Database: 269.11.6/938 
- Release Date:  8/5/2007  4:16 PMNo virus found in this outgoing 
message.  Checked by AVG Free Edition.  Version: 7.5.476 / Virus Database: 
269.11.6/938 - Release Date:  8/5/2007  4:16 PM --  Some people 
have a gift link here. Know what I want? I want you to buy a CD from some 
indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?  
No virus found in this incoming message. Checked by AVG Free Edition.  
Version: 7.5.476 / Virus Database: 269.11.8/941 - Release Date: 8/7/2007 4:06 
PM   No virus found in this outgoing message. Checked by AVG Free Edition. 
 Version: 7.5.476 / Virus Database: 269.11.8/941 - Release Date: 8/7/2007 
4:06 PM   --  PHP General Mailing List (http://www.php.net/) To 
unsubscribe, visit: http://www.php.net/unsub.php 
_
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=createwx_url=/friends.aspxmkt=en-us

[PHP] HTTP methods, Web Browsers and REST

2007-08-09 Thread Nathan Nobbe
all,

some time ago i read about
RESThttp://en.wikipedia.org/wiki/Representational_State_Transfer
.
at first i thought for web services SOAP is much better for the self
describing feature of the WSDL.
then, reading through the Zend certification preparation book, there was a
section on using POST
vs. GET to request data from the server.  The section said in general to use
GET when information on
the server was not going to me altered.
So i have now started to set the method attribute of the form tag to get on
those forms that do not
modify data on the server.  Looking over PHP i can see a web service client
could be written for a
RESTful web service using the curl extension (and perhaps others as well)
because it facilitates an
ability to invoke the HTTP PUT and DELETE methods.
Now, coming to my question..  Looking at the W3C page on the XHTML 1.0 form
tag specification http://www.w3schools.com/tags/tag_form.asp, it is
clear the method attribute supports only  get and post.  What i wonder is
why would it not also support
put and delete?  im sure javascript could be used to invoke the put and
delete methods, but is there a way
to do this w/ XHTML ?
certainly it would be cleaner to map actions in an application to specific
http methods rather than have an
action variable or whatever on every page.  since the form tag supports get
and post, still on every page
that offers add / delete functionality an action (or similar) variable is
still necessary.

can someone speak to this ?

thanks,

-nathan


[PHP] Segmentation fault on PHP CLI

2007-08-09 Thread Martin Marques
I have a script which I run from cron. I'm testing it directly from the 
console:


/usr/bin/php  -f /path/to/script.php

The thing is:

Script executes great, and everything it has to do gets done, but it 
throughs a segmentation fault at the end.


Is there anyway to debug PHP CLI? I'm using php5 from debian etch:

$ php -v
PHP 5.2.0-8+etch7 (cli) (built: Jul  2 2007 21:46:15)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

BTW: all this is on the development server. On the production server the 
cron runs without this problem.


--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
-
Lic. Martín Marqués |   SELECT 'mmarques' ||
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador,
del Litoral |   Administrador
-

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



Re: [PHP] Segmentation fault on PHP CLI

2007-08-09 Thread Stut

Martin Marques wrote:
I have a script which I run from cron. I'm testing it directly from the 
console:


/usr/bin/php  -f /path/to/script.php

The thing is:

Script executes great, and everything it has to do gets done, but it 
throughs a segmentation fault at the end.


Is there anyway to debug PHP CLI? I'm using php5 from debian etch:

$ php -v
PHP 5.2.0-8+etch7 (cli) (built: Jul  2 2007 21:46:15)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

BTW: all this is on the development server. On the production server the 
cron runs without this problem.


Is PHP on the production server the same old version? I would start by 
upgrading your development server to the latest version as you may be 
hitting a known bug that's already been fixed.


-Stut

--
http://stut.net/

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



Re: [PHP] magic quotes

2007-08-09 Thread David Giragosian
On 8/9/07, Bastien Koert [EMAIL PROTECTED] wrote:


 you could use ini_set at the top of the script to turn the magic quotes
 off...if you add this in a prepend file or a common included file that sits
 at the top of the script, it should take care of the damn magic quotes...


Why might this not work? I tried using ini_set(magic_quotes_gpc, 0 | 0 |
FALSE | FALSE ) and none of these worked either locally on my dev system
or on a hosting system I just started using. PHP versions were either 5.2.0or
5.2.1.

failing that ask your host to turn it off


The guy graciously did turn it off when I asked him to.

Bastien


David


Re: [PHP] Segmentation fault on PHP CLI

2007-08-09 Thread Martin Marques

Stut wrote:

Martin Marques wrote:
I have a script which I run from cron. I'm testing it directly from 
the console:


/usr/bin/php  -f /path/to/script.php

The thing is:

Script executes great, and everything it has to do gets done, but it 
throughs a segmentation fault at the end.


Is there anyway to debug PHP CLI? I'm using php5 from debian etch:

$ php -v
PHP 5.2.0-8+etch7 (cli) (built: Jul  2 2007 21:46:15)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

BTW: all this is on the development server. On the production server 
the cron runs without this problem.


Is PHP on the production server the same old version? I would start by 
upgrading your development server to the latest version as you may be 
hitting a known bug that's already been fixed.


Same version on both. The idea is to use the same version, so we don't 
end up with unhappy results when putting new stuff in production.



--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
-
Lic. Martín Marqués |   SELECT 'mmarques' ||
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador,
del Litoral |   Administrador
-

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



RE: [PHP] magic quotes

2007-08-09 Thread Ford, Mike
On 09 August 2007 14:44, David Giragosian wrote:

 On 8/9/07, Bastien Koert [EMAIL PROTECTED] wrote:
  
  
  you could use ini_set at the top of the script to turn the magic
  quotes off...if you add this in a prepend file or a common included
  file that sits at the top of the script, it should take care of the
  damn magic quotes... 
 
 
 Why might this not work?

Because, by the time your script starts executing, any magic_quotes_gpc 
processing has already been applied. As such, it only makes sense to set this 
option in php.ini, httpd.conf or .htaccess (or equivalents).

Cheers!

Mike

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


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

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



[PHP] Code Igniter for 'novices' ?

2007-08-09 Thread Steve Finkelstein
Hi all,

This isn't a 'which framework is better than the other' question. I'm a
novice developer and I'm looking to conform to an MVC model for my
applications. I was wondering if anyone would be kind enough and has used
code igniter, to respond to me and let me know their thoughts on it, and if
it's a good framework to work with as a novice.

I eventually hope to learn the core values and build my own robust
framework.

Thanks :-)


Re: [PHP] Code Igniter for 'novices' ?

2007-08-09 Thread Nathan Nobbe
steve,

though i havent used code igniter i consider the tutorials on the site
demonstrating how to use it quite valuable.
i think they are valuable because they can show people who arent familiar w/
a development flow,
using an mvc framework, what its like, in general.
i have heard good things about code igniter.

if you want to learn the core values, i recommend opp and design patterns.
here is a nice free site to get you headed in the right direction for php.

http://www.phppatterns.com/docs/start

-nathan

On 8/9/07, Steve Finkelstein [EMAIL PROTECTED] wrote:

 Hi all,

 This isn't a 'which framework is better than the other' question. I'm a
 novice developer and I'm looking to conform to an MVC model for my
 applications. I was wondering if anyone would be kind enough and has used
 code igniter, to respond to me and let me know their thoughts on it, and
 if
 it's a good framework to work with as a novice.

 I eventually hope to learn the core values and build my own robust
 framework.

 Thanks :-)



[PHP] Exceptions

2007-08-09 Thread Peter Pan

Peeps,

I'm having an issue where throwing Exceptions are displaying a blank page 
even though the Exception is being caught in a try...catch statement.  This 
is happening on our production server where warnings, errors, exceptions, 
etc. are not to be displayed to the user.  The assumption is that even 
though an Exception is being thrown it should be caught rather than 
displaying a blank page.  Is there a specific configuration variable that 
needs to be set in php.ini to allow warnings to not be displayed but 
Exceptions to still be caught?  Or is this just a bug?  Here is some code 
that replicates the issue:


try {
   closeCallTracker($appId, $salesRepId);
} catch (Exception $e) {
   // No need to display anything to user if call tracker is not closed
}

function closeCallTracker($appId, $salesRepId) {

  // Some code here...

  // A pretty near example of why the Exception is being thrown in our 
system

  if ($callTrackerAlreadyClosed) {
 throw new Exception('Can not close a call tracker that has already 
been closed.');

  }
}

I'm expecting the program to continue as normal as the Exception has been 
caught appropriately... but instead this code is displaying a blank page.


We're using PHP: 5.1.2 on SuSe

This is really a bizarre issue and any help would be greatly appreciated.  
I've searched PHP.net and Google far too long on this issue.  Thank you in 
advance.


-ec

_
Learn.Laugh.Share. Reallivemoms is right place! 
http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us


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



Re: [PHP] Exceptions

2007-08-09 Thread Nathan Nobbe
Peter,

you are doing something called swallowing the exception.  it may make sense
for your application to
continue processing if the closeCallTracker method throws an error, but at a
minimum you should
log the details of the exception so that you know why its occurring;
something like:

try {
   closeCallTracker($appId, $salesRepId);
} catch (Exception $e) {
   // No need to display anything to user if call tracker is not closed
   MyPHPLog::logMsg($e-getMessage());
}

also, i would assume processing does continue after you swallow the
exception.  in order to determine
why a blank page is displaying you should follow the logic in your
application to the point where it sends
html to the client browser during a case where the closeCallTracker() method
throws an error.

-nathan

On 8/9/07, Peter Pan [EMAIL PROTECTED] wrote:

 Peeps,

 I'm having an issue where throwing Exceptions are displaying a blank page
 even though the Exception is being caught in a try...catch
 statement.  This
 is happening on our production server where warnings, errors, exceptions,
 etc. are not to be displayed to the user.  The assumption is that even
 though an Exception is being thrown it should be caught rather than
 displaying a blank page.  Is there a specific configuration variable that
 needs to be set in php.ini to allow warnings to not be displayed but
 Exceptions to still be caught?  Or is this just a bug?  Here is some code
 that replicates the issue:

 try {
 closeCallTracker($appId, $salesRepId);
 } catch (Exception $e) {
 // No need to display anything to user if call tracker is not closed
 }

 function closeCallTracker($appId, $salesRepId) {

// Some code here...

// A pretty near example of why the Exception is being thrown in our
 system
if ($callTrackerAlreadyClosed) {
   throw new Exception('Can not close a call tracker that has already
 been closed.');
}
 }

 I'm expecting the program to continue as normal as the Exception has been
 caught appropriately... but instead this code is displaying a blank page.

 We're using PHP: 5.1.2 on SuSe

 This is really a bizarre issue and any help would be greatly appreciated.
 I've searched PHP.net and Google far too long on this issue.  Thank you in
 advance.

 -ec

 _
 Learn.Laugh.Share. Reallivemoms is right place!
 http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us

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




Re: [PHP] Exceptions

2007-08-09 Thread Peter Pan

Nathan,

I was hoping for a bug!  I'll take a deeper look at the ini.  More research 
is needed, me thinks.


It's become apparent that throwing an Exception for this particular case 
doesn't really make sense.  I'll just return early rather than throwing an 
exception.  The logging suggestion is a great idea, but not realistic given 
the amount of times this function is called.


Thank you for your help!  I'll update the list with my findings.

-ec


From: Nathan Nobbe [EMAIL PROTECTED]
To: Peter Pan [EMAIL PROTECTED]
CC: php-general@lists.php.net
Subject: Re: [PHP] Exceptions
Date: Thu, 9 Aug 2007 13:00:51 -0400

Peter,

you are doing something called swallowing the exception.  it may make sense
for your application to
continue processing if the closeCallTracker method throws an error, but at 
a

minimum you should
log the details of the exception so that you know why its occurring;
something like:

try {
   closeCallTracker($appId, $salesRepId);
} catch (Exception $e) {
   // No need to display anything to user if call tracker is not closed
   MyPHPLog::logMsg($e-getMessage());
}

also, i would assume processing does continue after you swallow the
exception.  in order to determine
why a blank page is displaying you should follow the logic in your
application to the point where it sends
html to the client browser during a case where the closeCallTracker() 
method

throws an error.

-nathan

On 8/9/07, Peter Pan [EMAIL PROTECTED] wrote:

 Peeps,

 I'm having an issue where throwing Exceptions are displaying a blank 
page

 even though the Exception is being caught in a try...catch
 statement.  This
 is happening on our production server where warnings, errors, 
exceptions,

 etc. are not to be displayed to the user.  The assumption is that even
 though an Exception is being thrown it should be caught rather than
 displaying a blank page.  Is there a specific configuration variable 
that

 needs to be set in php.ini to allow warnings to not be displayed but
 Exceptions to still be caught?  Or is this just a bug?  Here is some 
code

 that replicates the issue:

 try {
 closeCallTracker($appId, $salesRepId);
 } catch (Exception $e) {
 // No need to display anything to user if call tracker is not closed
 }

 function closeCallTracker($appId, $salesRepId) {

// Some code here...

// A pretty near example of why the Exception is being thrown in our
 system
if ($callTrackerAlreadyClosed) {
   throw new Exception('Can not close a call tracker that has already
 been closed.');
}
 }

 I'm expecting the program to continue as normal as the Exception has 
been
 caught appropriately... but instead this code is displaying a blank 
page.


 We're using PHP: 5.1.2 on SuSe

 This is really a bizarre issue and any help would be greatly 
appreciated.
 I've searched PHP.net and Google far too long on this issue.  Thank you 
in

 advance.

 -ec

 _
 Learn.Laugh.Share. Reallivemoms is right place!
 http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us

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




_
Messenger Café — open for fun 24/7. Hot games, cool activities served daily. 
Visit now. http://cafemessenger.com?ocid=TXT_TAGHM_AugHMtagline


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



Re: [PHP] ADODB Insert Question (Syntax)

2007-08-09 Thread Graham Anderson

Wow.  I feel really dumb.
I thought (incorrectly) that the surrounding quotes would screw with  
the variables in the ADODB's INSERT statement.


many thanks
G

On Aug 7, 2007, at 2:06 PM, Uber Wannabe wrote:


-Original Message-
From: Graham Anderson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 07, 2007 3:34 PM
To: php-general
Subject: [PHP] ADODB Insert Question (Syntax)

Hi

What is the proper way to get the ADODB class to automatically add
quotes to the below sql ?
I'm guessing that the below fails because none of the variables get
quoted with the method, qstr.

$sql = insert into email (to_name, to_email, from_name, from_email,
subject, message, timestamp, ip) ;
$sql .= values ($to_name, $to_email, $from_name, $from_email,
$subject, $message, $time, $ip);


I tried something like the below to no avail
$sql .= values($conn-qstr($to_name), $conn-qstr
($to_email), ...);


Is there an accepted way to place multiple $variables inside an ADODB
insert statement?

many thanks

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

-End Original Message-


Okay, I'm probably missing something, but why can't the values  
portion just

say:

values ('$to_name', '$to_email', '$from_name',... etc.

... with the single quotes around the variable names?


-- N/A





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



Re: [PHP] I know this is not easy and I'm not stupid but...

2007-08-09 Thread Stut

Please include the list when replying.

Phil Curry wrote:

Phil Curry wrote:
how can this be? This is not the first time I've run into a situation 
like this. What am I missing?

line 102echo  ($userValues['afterDark']); // outputs 1
line 103if ( $userValues['afterDark'] == 0 ) {// passes


Add a line at 102.5...

var_dump($userValues['afterDark']);

What type is that variable?


Don't have to do a dump, I know its a tinyint(1), not null, default 0


That would be the type in the database, not the type of that variable at 
that time.


-Stut

--
http://stut.net/

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



[PHP] Forwarding $_POST[]...

2007-08-09 Thread Tony Di Croce
I keep wanting to do something, and either I dont know how to do it, or I'm
doing something wrong and need to rethink things.

Quite often, I have a form that submits to a php script via POST and after
doing some processing (or more frequently, asking the user a question), I'd
like to forward those $_POST[] vars to another script (or even the same
script).

I could do something complicated and store the $_POST vars in $_SESSION[],
but what I'd rather do is simply add a var to $_POST[] and resubmit this to
the same .php.

Is their any way to do this, or do I need to rethink things?

   td

-- 
Publish technical articles @ skilledwords.com and get 100% of the
ad-revenue!
http://www.skilledwords.com


Re: [PHP] I know this is not easy and I'm not stupid but...

2007-08-09 Thread Jim Lucas

Stut wrote:

Please include the list when replying.

Phil Curry wrote:

Phil Curry wrote:
how can this be? This is not the first time I've run into a 
situation like this. What am I missing?

line 102echo  ($userValues['afterDark']); // outputs 1
line 103if ( $userValues['afterDark'] == 0 ) {// passes


Add a line at 102.5...

var_dump($userValues['afterDark']);

What type is that variable?


Don't have to do a dump, I know its a tinyint(1), not null, default 0


PHP does not have a type of tinyint

knowing now that this comes from a database, if it is mysql, then it is of type 
string

PHP converts all fields when pulled from the database into strings.  It does not take into account 
what type the field is actually set to in mysql.


Try puting a (int) in front of the condition like this

if ( (int)$userValues['afterDark'] == 0 ) {
...
}

Maybe this will help



That would be the type in the database, not the type of that variable at 
that time.


-Stut




--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Forwarding $_POST[]...

2007-08-09 Thread Stut

Tony Di Croce wrote:

I keep wanting to do something, and either I dont know how to do it, or I'm
doing something wrong and need to rethink things.

Quite often, I have a form that submits to a php script via POST and after
doing some processing (or more frequently, asking the user a question), I'd
like to forward those $_POST[] vars to another script (or even the same
script).


Sounds like an architectural issue to me. Think about why you want to do 
this. Can you not just include the other script rather than causing 
another HTTP request?



I could do something complicated and store the $_POST vars in $_SESSION[],
but what I'd rather do is simply add a var to $_POST[] and resubmit this to
the same .php.


Let me get this straight... you want to add a variable to the $_POST 
array and then re-run the current script? Put the functionality you need 
into a function and then use standard control structures (while, if, 
foreach, etc) to call it over and over again if necessary. There's 
absolutely no need to cause another HTTP request.



Is their any way to do this, or do I need to rethink things?


Rethink things. There's almost certainly a better way but without 
knowing why you think you need to do this it's not possible to help any 
further.


-Stut

--
http://stut.net/

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



Re: [PHP] Forwarding $_POST[]...

2007-08-09 Thread Simon
Session variables is a decent way.
Storing them in a DB session can be good too
It all depends on the data.

The dumbest (but still correct) way to do it is a for() loop that
creates a hidden input with the name/value pair for each variables you
want.

I would advise against resending the username/password over and over.

Simon

On 8/9/07, Tony Di Croce [EMAIL PROTECTED] wrote:
 I keep wanting to do something, and either I dont know how to do it, or I'm
 doing something wrong and need to rethink things.

 Quite often, I have a form that submits to a php script via POST and after
 doing some processing (or more frequently, asking the user a question), I'd
 like to forward those $_POST[] vars to another script (or even the same
 script).

 I could do something complicated and store the $_POST vars in $_SESSION[],
 but what I'd rather do is simply add a var to $_POST[] and resubmit this to
 the same .php.

 Is their any way to do this, or do I need to rethink things?

td

 --
 Publish technical articles @ skilledwords.com and get 100% of the
 ad-revenue!
 http://www.skilledwords.com


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



RE: [PHP] Forwarding $_POST[]...

2007-08-09 Thread Jay Blanchard
[snip]
I could do something complicated and store the $_POST vars in
$_SESSION[],
but what I'd rather do is simply add a var to $_POST[] and resubmit this
to
the same .php.

Is their any way to do this, or do I need to rethink things?
[/snip]

Put the processing in a function, run the post variables through the
function. Create another array to hold the post variables and add
another variable and send that array to the function.

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



Re: [PHP] ADODB Insert Question (Syntax)

2007-08-09 Thread Jim Lucas

Graham Anderson wrote:

Wow.  I feel really dumb.
I thought (incorrectly) that the surrounding quotes would screw with the 
variables in the ADODB's INSERT statement.


many thanks
G

On Aug 7, 2007, at 2:06 PM, Uber Wannabe wrote:


-Original Message-
From: Graham Anderson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 07, 2007 3:34 PM
To: php-general
Subject: [PHP] ADODB Insert Question (Syntax)

Hi

What is the proper way to get the ADODB class to automatically add
quotes to the below sql ?
I'm guessing that the below fails because none of the variables get
quoted with the method, qstr.

$sql = insert into email (to_name, to_email, from_name, from_email,
subject, message, timestamp, ip) ;
$sql .= values ($to_name, $to_email, $from_name, $from_email,
$subject, $message, $time, $ip);


I tried something like the below to no avail
$sql .= values($conn-qstr($to_name), $conn-qstr
($to_email), ...);


Is there an accepted way to place multiple $variables inside an ADODB
insert statement?

many thanks

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

-End Original Message-


Okay, I'm probably missing something, but why can't the values portion 
just

say:

values ('$to_name', '$to_email', '$from_name',... etc.


hold on now. you might want to make sure and escape data before you just throw it into the query 
like that.


His method was just fine, but the problem is is that the $obj-method() thing wont work in a quoted 
string.


If he had E_NOTICE turned on, he would see the error.

what needs to happen is that he needs to break out of the double quotes and concat the string(s) and 
method calls together like this.


$sql .= values(.$conn-qstr($to_name)., .$conn-qstr($to_email)., 
...);



... with the single quotes around the variable names?


-- N/A







--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Forwarding $_POST[]...

2007-08-09 Thread Richard Heyes



I could do something complicated and store the $_POST vars in $_SESSION[],
but what I'd rather do is simply add a var to $_POST[] and resubmit this to
the same .php.

Is their any way to do this, or do I need to rethink things?


There's nothing complicated about using sessions.

?php

  session_start();
  $_SESSION['post_data'] = $_POST;

?

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Forwarding $_POST[]...

2007-08-09 Thread Jim Lucas

Tony Di Croce wrote:

I keep wanting to do something, and either I dont know how to do it, or I'm
doing something wrong and need to rethink things.

Quite often, I have a form that submits to a php script via POST and after
doing some processing (or more frequently, asking the user a question), I'd
like to forward those $_POST[] vars to another script (or even the same
script).

I could do something complicated and store the $_POST vars in $_SESSION[],
but what I'd rather do is simply add a var to $_POST[] and resubmit this to
the same .php.

Is their any way to do this, or do I need to rethink things?

   td


What is complicated about

step1.php
?php

$my_post_data = $_POST;

...

$_SESSION['_POST'] = $my_post_data;

?
and
step2.php
?php

$my_post_data = $_SESSION['_POST'];

...

?

I see nothing about this that is complicated.  Where do you see the 
complication?

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Forwarding $_POST[]...

2007-08-09 Thread Daniel Brown
On 8/9/07, Tony Di Croce [EMAIL PROTECTED] wrote:
 I keep wanting to do something, and either I dont know how to do it, or I'm
 doing something wrong and need to rethink things.

 Quite often, I have a form that submits to a php script via POST and after
 doing some processing (or more frequently, asking the user a question), I'd
 like to forward those $_POST[] vars to another script (or even the same
 script).

 I could do something complicated and store the $_POST vars in $_SESSION[],
 but what I'd rather do is simply add a var to $_POST[] and resubmit this to
 the same .php.

 Is their any way to do this, or do I need to rethink things?

td

 --
 Publish technical articles @ skilledwords.com and get 100% of the
 ad-revenue!
 http://www.skilledwords.com


You can do either one, Tony --- rethink or go ahead with it.

Check out the cURL functions if you want to forward the variables
as a POST to a different script.  Otherwise, if you're just trying to
add new values to the $_POST array to be processed further down the
script, simply add them.

?
$_POST['new_name'] = new value;
?

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Hey, PHP-General list
50% off for life on web hosting plans $10/mo. or more at
http://www.pilotpig.net/.
Use the coupon code phpgeneralaug07
Register domains for about $0.01 more than what it costs me at
http://domains.pilotpig.net/.

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



Re: [PHP] Forwarding $_POST[]...

2007-08-09 Thread Daniel Brown
On 8/9/07, Jim Lucas [EMAIL PROTECTED] wrote:
 What is complicated about

 step1.php
 ?php

 $my_post_data = $_POST;

 ...

 $_SESSION['_POST'] = $my_post_data;

 ?
 and
 step2.php
 ?php

 $my_post_data = $_SESSION['_POST'];

 ...

 ?

Jim, perhaps I'm missing something that you're hinting at,
represented by the ellipsis, but why redefine the superglobal to a
transient variable prior to populating the session?


-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Hey, PHP-General list
50% off for life on web hosting plans $10/mo. or more at
http://www.pilotpig.net/.
Use the coupon code phpgeneralaug07
Register domains for about $0.01 more than what it costs me at
http://domains.pilotpig.net/.

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



[PHP] Open Source Job Wanted system

2007-08-09 Thread Joey
Has anybody had any experience with any open source Job posting systems out
there?

 

Thanks!

 

 

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



Re: [PHP] Open Source Job Wanted system

2007-08-09 Thread Robert Cummings
On Thu, 2007-08-09 at 14:54 -0400, Joey wrote:
 Has anybody had any experience with any open source Job posting systems out
 there?

I didn't get the job *sniffle*.

:B

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] Open Source Job Wanted system

2007-08-09 Thread Tom Ray [Lists]

Joey wrote:

Has anybody had any experience with any open source Job posting systems out
there?

 


Thanks!

  
I've written one myself. It allows for job seekers to put up a profile, 
resumes, etc and for employers to post their jobs and search resumes. 
Full search ability on both sides. They can even opt for Hot Resumes 
or Hot Jobs for higher/preferred listings in the search.


I'm not sure what else is really out there. I guess it will all depend 
on what you're looking to do.


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



Re: [PHP] Open Source Job Wanted system

2007-08-09 Thread Nathan Nobbe
craigslist is out there, but i havent posted a resume on there..

-nathan

On 8/9/07, Joey [EMAIL PROTECTED] wrote:

 Has anybody had any experience with any open source Job posting systems
 out
 there?



 Thanks!





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




[PHP] string as file

2007-08-09 Thread Rick Pasotto
Does php have a facility similar to python's stringIO?

What I'm wanting to do is similar to a mail merge. IOW, I know I can
create an include file like:

$out = EOT
This is an example of $var1 and $var2.
EOT;

and then after assigning values to $var1 and $var2 include that file. I
can later use different values for $var1 and $var2 and get a different
$out with a second include.

Can I someout include a string instead of a file? Or maybe there is
some completely different way to do what I want.

-- 
I have always in my own thought summed up individual liberty, and
 business liberty, and every other kind of liberty, in the phrase
 that is common in the sporting world, A free field and no favor.
-- Woodrow Wilson, U.S. President, 1915
Rick Pasotto[EMAIL PROTECTED]http://www.niof.net

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



Re: [PHP] string as file

2007-08-09 Thread Greg Donald
On 8/9/07, Rick Pasotto [EMAIL PROTECTED] wrote:
 Does php have a facility similar to python's stringIO?

 What I'm wanting to do is similar to a mail merge. IOW, I know I can
 create an include file like:

 $out = EOT
 This is an example of $var1 and $var2.
 EOT;

 and then after assigning values to $var1 and $var2 include that file. I
 can later use different values for $var1 and $var2 and get a different
 $out with a second include.

eval()


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] Forwarding $_POST[]...

2007-08-09 Thread Jim Lucas

Daniel Brown wrote:

On 8/9/07, Jim Lucas [EMAIL PROTECTED] wrote:

What is complicated about

step1.php
?php

$my_post_data = $_POST;

...


perhaps you want to have a clean data set
you can do this as you populate the $my_post_data
let me rename variable

?php

//This allows you to only have to clean the post data once.
//Then upon reuse in step2.php, you don't have to clean data a second time.
$clean_post_data = cleanup_input_data($_POST);
$_SESSION['_POST'] = $clean_post_data;

//You should never work with raw $_POST or $_GET data
//You should always clean first then use the data.  Storing it in a different 
array,
//not back in the $_POST and/or $_GET arrays and overwriting the original data.
...  working with $clean_post_data ...

?



$_SESSION['_POST'] = $clean_post_data;

?
and
step2.php
?php

$my_post_data = $_SESSION['_POST'];


this data is supposedly clean, some would say that it is best to assume that the data is might be 
tainted, but I have always assumed that nobody is actually going to modify the session data files 
directly and inject harmful data into the session file itself.


But some would say, even re-clean the data that you pull from your sessions, because you never know 
how someone might try and mess with you.





...

?


Jim, perhaps I'm missing something that you're hinting at,
represented by the ellipsis, but why redefine the superglobal to a
transient variable prior to populating the session?





--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] string as file

2007-08-09 Thread Jim Lucas

Rick Pasotto wrote:

Does php have a facility similar to python's stringIO?

What I'm wanting to do is similar to a mail merge. IOW, I know I can
create an include file like:

$out = EOT
This is an example of $var1 and $var2.
EOT;

and then after assigning values to $var1 and $var2 include that file. I
can later use different values for $var1 and $var2 and get a different
$out with a second include.

Can I someout include a string instead of a file? Or maybe there is
some completely different way to do what I want.


template.php
?php

ob_start();
echo Hi, my name is {$first_name} {$last_name}.;
return ob_get_clean();

?


This is two different ways you can do it, bases on your input data array 
structure

test.php
?php

$values = array();

$values[] = array('first_name' = 'Jim','last_name' = 'Lucas');
$values[] = array('first_name' = 'James','last_name' = 'Lucas');
$values[] = array('first_name' = 'Jimmy','last_name' = 'Lucas');

foreach ($values AS $row) {
extract($row);
echo include 'template.php';
}

$values = array();

$values[] = array('Jim','Lucas');
$values[] = array('James','Lucas');
$values[] = array('Jimmy','Lucas');

list($first_name, $last_name) = current($values);
do {
echo include 'template.php';
} while (list($first_name, $last_name) = next($values));
?

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



RE: [PHP] I know this is not easy and I'm not stupid but...

2007-08-09 Thread Jan Reiter
Hi!

Phil:
Still I am curious what var_dump($userValues['afterDark']); at line 102.5
would return. 
I managed to recreate that fault with 

$var['test'] = blah;

echo ($var['test']);

if( $var['test'] == 0)
{
echo ok;
}

//this returns blahok -- not expected. 

In my case Var_dump() returns string(4) blah as expected.

Using 

if( $var['test'] === 0)

behaves as expected!!


Jim:
TypeCasting would only be effective if you used the type sensitive
comparison operator === , because with == 0 equals NULL equals false
equals  and so on ... or do I miss something here??


Hope that solves it for you! I'm still investigating why my first examples
fails. I've got the strong feeling that I'm missing something there. I don't
believe in a php bug or a memory leak in this case! Must be something pretty
obvious! Anyone a clue??

Thanks,
Jan


-Original Message-
From: Jim Lucas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 09, 2007 8:08 PM
To: Stut
Cc: Phil Curry; php-general
Subject: Re: [PHP] I know this is not easy and I'm not stupid but...

Stut wrote:
 Please include the list when replying.
 
 Phil Curry wrote:
 Phil Curry wrote:
 how can this be? This is not the first time I've run into a 
 situation like this. What am I missing?
 line 102echo  ($userValues['afterDark']); // outputs 1
 line 103if ( $userValues['afterDark'] == 0 ) {// passes

 Add a line at 102.5...

 var_dump($userValues['afterDark']);

 What type is that variable?

 Don't have to do a dump, I know its a tinyint(1), not null, default 0

PHP does not have a type of tinyint

knowing now that this comes from a database, if it is mysql, then it is of
type string

PHP converts all fields when pulled from the database into strings.  It does
not take into account 
what type the field is actually set to in mysql.

Try puting a (int) in front of the condition like this

if ( (int)$userValues['afterDark'] == 0 ) {
...
}

Maybe this will help

 
 That would be the type in the database, not the type of that variable at 
 that time.
 
 -Stut
 


-- 
Jim Lucas

Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
 by William Shakespeare

-- 
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] I know this is not easy and I'm not stupid but...

2007-08-09 Thread Jim Lucas

Jan Reiter wrote:

Hi!

Phil:
Still I am curious what var_dump($userValues['afterDark']); at line 102.5
would return. 
I managed to recreate that fault with 


$var['test'] = blah;

echo ($var['test']);

if( $var['test'] == 0)
{
echo ok;
}

//this returns blahok -- not expected. 


In my case Var_dump() returns string(4) blah as expected.

Using 


if( $var['test'] === 0)

behaves as expected!!


Are you wanting to only test for a empty/non-empty string?

if so, use this.

if ( empty($var['test']) ) {
echo var['test'] is empty;
}




Jim:
TypeCasting would only be effective if you used the type sensitive
comparison operator === , because with == 0 equals NULL equals false
equals  and so on ... or do I miss something here??


Hope that solves it for you! I'm still investigating why my first examples
fails. I've got the strong feeling that I'm missing something there. I don't
believe in a php bug or a memory leak in this case! Must be something pretty
obvious! Anyone a clue??

Thanks,
Jan


-Original Message-
From: Jim Lucas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 09, 2007 8:08 PM

To: Stut
Cc: Phil Curry; php-general
Subject: Re: [PHP] I know this is not easy and I'm not stupid but...

Stut wrote:

Please include the list when replying.

Phil Curry wrote:

Phil Curry wrote:
how can this be? This is not the first time I've run into a 
situation like this. What am I missing?

line 102echo  ($userValues['afterDark']); // outputs 1
line 103if ( $userValues['afterDark'] == 0 ) {// passes

Add a line at 102.5...

var_dump($userValues['afterDark']);

What type is that variable?

Don't have to do a dump, I know its a tinyint(1), not null, default 0


PHP does not have a type of tinyint

knowing now that this comes from a database, if it is mysql, then it is of
type string

PHP converts all fields when pulled from the database into strings.  It does
not take into account 
what type the field is actually set to in mysql.


Try puting a (int) in front of the condition like this

if ( (int)$userValues['afterDark'] == 0 ) {
...
}

Maybe this will help

That would be the type in the database, not the type of that variable at 
that time.


-Stut







--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



[PHP] preg_match_all to match img tags

2007-08-09 Thread Ólafur Waage
I know this isn't exactly a php related question but due to the
quality of answers ive seen lately ill give this a shot. (yes yes im
smoothing up the crowd before the question)

I have a weblog system that i am creating, the trouble is that if a
user links to an external image larger than 500pixels in width, it
messes with the whole layout.

I had found some regex code im using atm but its not good at matching
the entire image tag. It seems to ignore properties after the src
declaration and not match tags that have properties before the src
declaration .

preg_match_all(/\ *[img][^\]*[src] *= *[\\']{0,1}([^\\'\ ]*)/i,
$data, $matches);
print_r($matches);

This currently makes two arrays for me, the source location from all
img tags and a large part of the tag itself. But not the entire tag.

What i do is i match the img tag, find the src, get the image
properties, and if the width is more than 500, i shrink it down and
add width=X and height=Y properties to the image tag.

How can i match an image tag correctly so it does not cause any issues
with how the user adds the image.

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



Re: [PHP] I know this is not easy and I'm not stupid but...

2007-08-09 Thread Phil Curry

Please include the list when replying.

Phil Curry wrote:

Phil Curry wrote:
how can this be? This is not the first time I've run into a  
situation like this. What am I missing?
line 102echo  ($userValues['afterDark']); //  
outputs 1

line 103if ( $userValues['afterDark'] == 0 ) {// passes


Add a line at 102.5...

var_dump($userValues['afterDark']);

What type is that variable?

Don't have to do a dump, I know its a tinyint(1), not null, default 0


That would be the type in the database, not the type of that  
variable at that time.


-Stut

--
http://stut.net/


Absolutely right. didn't think of that.

var_dump($userValues['afterDark']);  == string(1) 1

but then I'm comparing a string to an int and the result always seems  
to pass. So does that mean any string compared to any int will be true?
By casting (int)$userValues['afterDark'] the test still passes and  
var_dump shows the (int)$userValues['afterDark'] as an int(1) but  
does give a value like the previous example.
ie. string(1)1 but only int(1) Not sure if the expression has a  
value of 1 now that its been cast.


Then finally  if ( (int)$userValues['afterDark'] === 0 ) {//  
passes


So:
if ( $userValues['afterDark'] == 0 ) {  // passes
if ( (int)$userValues['afterDark'] == 0 ) {   // passes
if ( (int)$userValues['afterDark'] === 0 ) { // passes

And the value of afterdark in the mysql table is tinyint(1) 1.
And echo( 1+(int)$userValues['afterDark']);// outputs 2

Now I'm confused!
-Phil

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



RE: [PHP] I know this is not easy and I'm not stupid but...

2007-08-09 Thread Jan Reiter
Hi! 
Thank you for your response! 

The only intention of my code was to investigate the (back then) unexpected
behavior of the if statement. 


With $var['test'] set to blah this expression should be false
($var['test'] == 0) for what I know ...

$var['test'] = blah;
var_dump($var['test'] == 0); 

//returns bool(true)

Now I know why this happens! According to Table 6.5 of the Operators page in
the PHP Manual in this comparison all of the values are converted to
integer. And  atoi(blah) for sure will fail!;-) So you have to use === to
keep the types of the values! 

Jan



-Original Message-
From: Jim Lucas [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 10, 2007 1:47 AM
To: Jan Reiter
Cc: [EMAIL PROTECTED]; php-general@lists.php.net
Subject: Re: [PHP] I know this is not easy and I'm not stupid but...

Jan Reiter wrote:
 Hi!
 
 Phil:
 Still I am curious what var_dump($userValues['afterDark']); at line 102.5
 would return. 
 I managed to recreate that fault with 
 
 $var['test'] = blah;
 
 echo ($var['test']);
 
 if( $var['test'] == 0)
 {
   echo ok;
 }
 
 //this returns blahok -- not expected. 
 
 In my case Var_dump() returns string(4) blah as expected.
 
 Using 
 
 if( $var['test'] === 0)
 
 behaves as expected!!

Are you wanting to only test for a empty/non-empty string?

if so, use this.

if ( empty($var['test']) ) {
echo var['test'] is empty;
}

 
 
 Jim:
 TypeCasting would only be effective if you used the type sensitive
 comparison operator === , because with == 0 equals NULL equals false
 equals  and so on ... or do I miss something here??
 
 
 Hope that solves it for you! I'm still investigating why my first examples
 fails. I've got the strong feeling that I'm missing something there. I
don't
 believe in a php bug or a memory leak in this case! Must be something
pretty
 obvious! Anyone a clue??
 
 Thanks,
 Jan
 


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



RE: [PHP] get and post together

2007-08-09 Thread Daevid Vincent
I've done that on occasion, but do be careful what you are sending via
the GET.

It has a size limit for one (maybe 1k chars?) and it is trivial for
someone to modify.

I generally use GET when I think it's a page setup the user may wish
to bookmark (ie: page.php?orderby=namedescending=1report=69 )

And POST for submitting data that I want to save. (ie: add a new user
and all their glory).

I have done a mixture, such as page.php?action=deleteid=5 

But you have to be careful. I guess I always have some kind of user
class and verify they have permissions to use the page and or delete
said record anyways (logging failed attempts of course).

 -Original Message-
 From: Ray [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, August 08, 2007 8:19 PM
 To: php-general@lists.php.net
 Subject: [PHP] get and post together
 
 Hi all,
 I've done something and I want to know if I should be ashamed :)
 
 I've set up a form with method=POST and target =page.php?foo=bar
 it works fine. $_POST[...] gives me the data I want and 
 $_GET['foo']=='bar'.
 I freely admit it's an ugly kludge, but is it bad?
 Ray
 
 -- 
 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] permissions for include()

2007-08-09 Thread jekillen


On Aug 8, 2007, at 9:34 PM, Richard Lynch wrote:


On Wed, August 8, 2007 7:52 pm, jekillen wrote:

I have a question about including php files that are outside of
the web server document root. What permission does Apache
use to access files outside of the document root?
Here is the situation:
I want to store sensitive data such as login/pw data for
registered users. I also want to make all the web content
rwx for user nobody (FreeBSD) only. So no ftp access,
no mortal user access, etc. Is it possible to  do this in
this situation? Would the Parent Apache process use
its privileges to include a file of this type?
I have texts and other data about storing data out side
the document root,  but  none go into it in this detail?


Apache runs as the User setting in httpd.conf

If that User can rwx the files, then PHP can rwx the files.

If not, not.

It's that simple.


Thanks, so if I make the directory and file outside of the document
root owner noboby with rwx for owner only, that will work?
Jeff K

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



RE: [PHP] I know this is not easy and I'm not stupid but...

2007-08-09 Thread Jan Reiter
Ummh, no!

(int) and (integer) perform a C style atoi() conversion. 

(int)blah = integer 0
(int) = integer 0
(int)1= integer 1
(int)12   = integer 12

 (1 == 0) = false
 (blah == 0)  = true

( (int)$userValues['afterDark'] === 0 ) only is true, if
$userValues['afterDark'] is a string not containing an integer. This is what
happens:

$userValues['afterDark'] gets converted to integer by atoi(), and after that
is compared by type and value to integer 0. So the type part of the test
will pass for sure. 

But perhaps you should try to adapt the comparison to the DB value. So try
($userValues['afterDark'] == (string)0)
This expression is only true if $userValues['afterDark'] equals 0, not
when $userValues['afterDark'] equals  or blah or 1

Hope that helps!

Jan


-Original Message-
From: Phil Curry [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 10, 2007 2:49 AM
To: Stut
Cc: php-general
Subject: Re: [PHP] I know this is not easy and I'm not stupid but...

 Please include the list when replying.

 Phil Curry wrote:
 Phil Curry wrote:
 how can this be? This is not the first time I've run into a  
 situation like this. What am I missing?
 line 102echo  ($userValues['afterDark']); //  
 outputs 1
 line 103if ( $userValues['afterDark'] == 0 ) {// passes

 Add a line at 102.5...

 var_dump($userValues['afterDark']);

 What type is that variable?
 Don't have to do a dump, I know its a tinyint(1), not null, default 0

 That would be the type in the database, not the type of that  
 variable at that time.

 -Stut

 -- 
 http://stut.net/

Absolutely right. didn't think of that.

var_dump($userValues['afterDark']);  == string(1) 1

but then I'm comparing a string to an int and the result always seems  
to pass. So does that mean any string compared to any int will be true?
By casting (int)$userValues['afterDark'] the test still passes and  
var_dump shows the (int)$userValues['afterDark'] as an int(1) but  
does give a value like the previous example.
ie. string(1)1 but only int(1) Not sure if the expression has a  
value of 1 now that its been cast.

Then finally  if ( (int)$userValues['afterDark'] === 0 ) {//  
passes

So:
if ( $userValues['afterDark'] == 0 ) {  // passes
if ( (int)$userValues['afterDark'] == 0 ) {   // passes
if ( (int)$userValues['afterDark'] === 0 ) { // passes

And the value of afterdark in the mysql table is tinyint(1) 1.
And echo( 1+(int)$userValues['afterDark']);// outputs 2

Now I'm confused!
-Phil

-- 
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] Sorting files in a directory

2007-08-09 Thread Chad Robinson

Steve Marquez wrote:

I know this code does not work, but I was curious if someone can take a look
and tell me what is wrong? Thank you so much.
  

Re-indent your code properly. If you do it will look like:

?php
$pattern = .html*|.php*;

if (is_dir(files/)) {
   if ($dh = opendir(files/)) {
   echo select name=\file\ size=\8\;
   while (($file = readdir($dh)) !== false) {
   if (ereg($pattern, $file))
   if(strpos($file,'.')0) {
   $file_array = array($file);
   sort ($file_array);

   foreach($file_array as $key = $value) {
   echo option value=\$value\.$value./option;
   }
   }
   }
   echo /select;
   closedir($dh);
   }
   }
?

You have a number of things you need to look at here. First, you don't have a final 
closing brace for your opening if() statement. Second, you're outputting the 
option tags INSIDE the while loop that reads the directory, so for every file 
you read your options list will get bigger. Well, it would, but you're also not using 
the right array append method; it should be:
   $file_array[] = $file;

Next, you don't want to sort the array every time you add a file to it - just 
do it once when you're done.

Try this:
?php
$pattern = .html*|.php*;

if (is_dir(files/)  $dh = opendir(files/)) {
   echo 'select name=file size=8';
   while (($file = readdir($dh)) !== false) {
   if (!ereg($pattern, $file)) continue;
   if(strpos($file,'.')1) continue;
   $file_array[] = $file;
   }

   sort ($file_array);
   foreach($file_array as $value) {
   echo 'option value=' . $value . '' . $value . '/option';
   }
   echo /select;
   closedir($dh);
}
?

Syntax check is left as an exe3rcise for the student. =)

Regards,
Chad

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



Re: [PHP] preg_match_all to match img tags

2007-08-09 Thread brian

Ólafur Waage wrote:

I know this isn't exactly a php related question but due to the
quality of answers ive seen lately ill give this a shot. (yes yes im
smoothing up the crowd before the question)

I have a weblog system that i am creating, the trouble is that if a
user links to an external image larger than 500pixels in width, it
messes with the whole layout.

I had found some regex code im using atm but its not good at matching
the entire image tag. It seems to ignore properties after the src
declaration and not match tags that have properties before the src
declaration .

preg_match_all(/\ *[img][^\]*[src] *= *[\\']{0,1}([^\\'\ ]*)/i,
$data, $matches);
print_r($matches);

This currently makes two arrays for me, the source location from all
img tags and a large part of the tag itself. But not the entire tag.

What i do is i match the img tag, find the src, get the image
properties, and if the width is more than 500, i shrink it down and
add width=X and height=Y properties to the image tag.

How can i match an image tag correctly so it does not cause any issues
with how the user adds the image.



style
#your_content_div img { max-width: 500px !important; }
/style

OK, so it won't work with IE6. Screw them.

But if the height is set in the img tag it'll keep that, so the image 
could become distorted. So, you could also do something like:


#your_content_div img { visibility: none; }

Then run some Javascript routine onload to properly figure the 
dimensions of each image. Adjust the width down to 500px, if necessary, 
then the height by whatever percent difference between original width 
over new width:


var new_height = (original_width / 500) * original_height;

Then, whether you change the dimensions of the image or not, change the 
visibility of each to 'visible'.


So, um ... no PHP involved.

brian

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



[PHP] Re: your excel document

2007-08-09 Thread sla-list
I have received your document. The corrected document is attached.

 Attachment: No Virus found
 F-Secure AntiVirus - www.f-secure.com

Dangerous Attachment has been Removed.  The file document.pif has been 
removed because of a virus.  It was infected with the W32/[EMAIL PROTECTED] 
virus.  File quarantined as: . 
http://www.fortinet.com/VirusEncyclopedia/search/encyclopediaSearch.do?method=quickSearchDirectlyvirusName=W32%2FNetsky.P%40mm
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Access parent property from child

2007-08-09 Thread Suprie
ouch... hey it's work rite now... thanks a lot for your help Edward
and Stut, i really apprieciate it...

br///

On 8/9/07, Stut [EMAIL PROTECTED] wrote:
 Suprie wrote:
  function getDB()
  {
  return $this-$db;
  }

 There should not be a $ before db. It should be $this-db. That's why
 PHP is telling you the property is empty... because it is.

 -Stut

 --
 http://stut.net/



-- 
Jangan tanyakan apa yang Indonesia telah berikan pada mu
tapi bertanyalah apa yang telah engkau berikan kepada Indonesia

-BEGIN GEEK CODE BLOCK-
Version: 3.1
GU/IT  d- s: a-- C++ UL P L++ E W++ N* o-- K-
w PS  Y-- PGP- t++ 5 X R++ tv  b+ DI D+ G e+ h* r- z?
 --END GEEK CODE BLOCK--

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



RE: [PHP] preg_match_all to match img tags

2007-08-09 Thread Jan Reiter
Maybe this is what you are searching for:

$images = array();
$data = blah img src=img.png width=\400\ height='600' src=blah.png img
src=gg.tiff;

preg_match_all(/\ *[img][^\]*[.]*\/i, $data, $matches);
foreach($matches[0] as $match)
{
preg_match_all(/(src|height|width)*= *[\\']{0,1}([^\\'\ \]*)/i,
$match, $m);
$images[] = array_combine($m[1],$m[2]);
}

print_r($image);

It will produce:

Array 
( 
[0] = Array 
( 
[src] = img.png 
[width] = 400 
[height] = 600 
) 

[1] = Array 
( 
[src] = gg.tiff 
)
)

I wrote it just as an example. So you may modify it for your needs!
Does anyone know if there is a way to put this into ONE regex??

Jan

-Original Message-
From: brian [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 10, 2007 3:18 AM
To: php-general@lists.php.net
Subject: Re: [PHP] preg_match_all to match img tags

Ólafur Waage wrote:
 I know this isn't exactly a php related question but due to the
 quality of answers ive seen lately ill give this a shot. (yes yes im
 smoothing up the crowd before the question)
 
 I have a weblog system that i am creating, the trouble is that if a
 user links to an external image larger than 500pixels in width, it
 messes with the whole layout.
 
 I had found some regex code im using atm but its not good at matching
 the entire image tag. It seems to ignore properties after the src
 declaration and not match tags that have properties before the src
 declaration .
 
 preg_match_all(/\ *[img][^\]*[src] *= *[\\']{0,1}([^\\'\ ]*)/i,
 $data, $matches);
 print_r($matches);
 
 This currently makes two arrays for me, the source location from all
 img tags and a large part of the tag itself. But not the entire tag.
 
 What i do is i match the img tag, find the src, get the image
 properties, and if the width is more than 500, i shrink it down and
 add width=X and height=Y properties to the image tag.
 
 How can i match an image tag correctly so it does not cause any issues
 with how the user adds the image.
 

style
#your_content_div img { max-width: 500px !important; }
/style

OK, so it won't work with IE6. Screw them.

But if the height is set in the img tag it'll keep that, so the image 
could become distorted. So, you could also do something like:

#your_content_div img { visibility: none; }

Then run some Javascript routine onload to properly figure the 
dimensions of each image. Adjust the width down to 500px, if necessary, 
then the height by whatever percent difference between original width 
over new width:

var new_height = (original_width / 500) * original_height;

Then, whether you change the dimensions of the image or not, change the 
visibility of each to 'visible'.

So, um ... no PHP involved.

brian

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