Re: [PHP] List all files in directory

2007-03-07 Thread Tijnema !

On 3/6/07, Jay Blanchard <[EMAIL PROTECTED]> wrote:


[snip]
Oh, yes, about that, how do you _really_ use PHP to do some reading on
the
client machine... like say. listing files... ;D
[/snip]

You're kidding, right? Here's how, set up a PHP enabled.nah, never
mind. Just repeat to yourself Dorothy, "PHP is server-side, not
client-side.."



Yeah that's what i tell a lot of people...

--

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




[PHP] Can i use DateTime Object with an timestamp as reference instead of an formated string.

2007-03-07 Thread Mathijs

Hello there,

I Use timestamps for logging etc..
But i need this timestamp to let is show the right time in different 
timezones.


Now i wanted to use DateTime object, but it seems it needs a string as 
reference, so i can't use a timestamp to re-generate that time.


How can i fix this?

Thx in advance.

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



Re: [PHP] Can i use DateTime Object with an timestamp as reference instead of an formated string.

2007-03-07 Thread Németh Zoltán
2007. 03. 7, szerda keltezéssel 12.58-kor Mathijs ezt írta:
> Hello there,
> 
> I Use timestamps for logging etc..
> But i need this timestamp to let is show the right time in different 
> timezones.
> 
> Now i wanted to use DateTime object, but it seems it needs a string as 
> reference, so i can't use a timestamp to re-generate that time.
> 
> How can i fix this?

I think
http://hu2.php.net/manual/hu/function.strftime.php
should be okay

greets
Zoltán Németh

> 
> Thx in advance.
> 

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



Re: [PHP] Can i use DateTime Object with an timestamp as referenceinstead of an formated string.

2007-03-07 Thread Mathijs

Németh Zoltán wrote:

2007. 03. 7, szerda keltezéssel 12.58-kor Mathijs ezt írta:

Hello there,

I Use timestamps for logging etc..
But i need this timestamp to let is show the right time in different 
timezones.


Now i wanted to use DateTime object, but it seems it needs a string as 
reference, so i can't use a timestamp to re-generate that time.


How can i fix this?


I think
http://hu2.php.net/manual/hu/function.strftime.php
should be okay

greets
Zoltán Németh


Thx in advance.



I hoped to avoid this.
I Now i need an extra function call to get the right time.
Hoped there was a way to give just the timestamp directly.

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



Re: [PHP] Can i use DateTime Object with an timestamp as reference instead of an formated string.

2007-03-07 Thread Jochem Maas
Mathijs wrote:
> Hello there,
> 
> I Use timestamps for logging etc..

so you do something like this no?:

$stamp = mktime();

so if you want to use DateTime why not do this?:

$stamp = new DateTime;

alternatively if you are stuck with the original integer timestamp,
then you can get round the issue like so:


$stamp = mktime();
$date  = getdate($stamp);

$obj   = new DateTime;
$obj->setDate($date['year'], $date['mon'], $date['mday']);
$obj->setTime($date['hours'], $date['minutes'], $date['seconds']);
$obj->setTimezone('er?');

or something like that.

seems rather stupid that DateTime doesn't accept a timestamp, but there is
probably a good reason ... as Richard Lynch pointed out date/time stuff seems
easy but is actually very very hard (and something computers will probably
never get 'right')

anyway, everything you need is right here if care to read it:

http://php.net/manual/en/ref.datetime.php

> But i need this timestamp to let is show the right time in different
> timezones.
> 
> Now i wanted to use DateTime object, but it seems it needs a string as
> reference, so i can't use a timestamp to re-generate that time.
> 
> How can i fix this?
> 
> Thx in advance.
> 

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



Re: [PHP] Re: Opinion on on-line payment and banking gateway

2007-03-07 Thread clive


  

That sounds good.  Could I know more about this clearing service?  I
mean, to whom should my friend contact?  Some bank?  His company is in
Chicago.  So, is there any central banking organization in United-States
that he should contact?  Or some bank in Chicago?


try worldpay, they are one of the oldest payment gateways

--
Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}


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



[PHP] Textarea update problem

2007-03-07 Thread Delta Storm

Hi,

I'd like to thank everybody who have helped me till now. All your 
advices were very helpfull... :)


But I have a problem again

I need to build a script which will have have the following functions:

1.Be able to select 3 columns from a MySQL database(idnetify the columns 
by ID) and put the column contents into 3 textarea objects. (for example 
title,Text1,Text2 each into i textarea).


2.Edit and MySQL update the textarea contents


And all in one script.

The script has a $id = $_GET['id'] variable which holds the information 
about the certain table id.


Thank you very much!

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



[PHP] namespace equivalent in PHP

2007-03-07 Thread Alain Roger

Hi,

Coming from C++ world, i would like to know what in PHP, is the equivalent
of namespace in C++ ?
I have several class which should work together, or Class B which is used to
create a private property of class A.

How can i do that without including the class B into the class A definition
?

thanks a lot,

--
Alain

Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5


Re: [PHP] Can i use DateTime Object with an timestamp as referenceinstead of an formated string.

2007-03-07 Thread Mathijs

Jochem Maas wrote:

Mathijs wrote:

Hello there,

I Use timestamps for logging etc..


so you do something like this no?:

$stamp = mktime();

so if you want to use DateTime why not do this?:

$stamp = new DateTime;

alternatively if you are stuck with the original integer timestamp,
then you can get round the issue like so:


$stamp = mktime();
$date  = getdate($stamp);

$obj   = new DateTime;
$obj->setDate($date['year'], $date['mon'], $date['mday']);
$obj->setTime($date['hours'], $date['minutes'], $date['seconds']);
$obj->setTimezone('er?');

or something like that.

seems rather stupid that DateTime doesn't accept a timestamp, but there is
probably a good reason ... as Richard Lynch pointed out date/time stuff seems
easy but is actually very very hard (and something computers will probably
never get 'right')

anyway, everything you need is right here if care to read it:

http://php.net/manual/en/ref.datetime.php


But i need this timestamp to let is show the right time in different
timezones.

Now i wanted to use DateTime object, but it seems it needs a string as
reference, so i can't use a timestamp to re-generate that time.

How can i fix this?

Thx in advance.



Thx for that idea.
I Now created an class/object which extends from DateTime.
Hope this can help other ppl with the same prob as well.

Thx.
Mathijs.


class DateTimeHandler extends DateTime {
public final function __construct($time=null, DateTimeZone 
$object=null) {
if (is_numeric($time)) {
parent::__construct();
$datetime = getdate($time);
parent::setDate($datetime['year'], $datetime['mon'], 
$datetime['mday']);
			parent::setTime($datetime['hours'], $datetime['minutes'], 
$datetime['seconds']);

parent::setTimezone($object);
return $this;
} else {
if ($object) {
return parent::__construct($time, $object);
} else {
return parent::__construct();
}
}
}
}

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



Re: [PHP] namespace equivalent in PHP

2007-03-07 Thread Jochem Maas
Alain Roger wrote:
> Hi,
> 
> Coming from C++ world, i would like to know what in PHP, is the equivalent
> of namespace in C++ ?

the closest you get to a namespace is a class (used purely as a static
place holder for a set of functions, constants & variables).

namespaces is on the php dev list of things to have continuing
discussions/flamewars about but as such no one has yet agreed on the
correct implementation and/or whether to include it.

I do remember a chap named Jesse created a patch that implements namespaces,
actually I recall that he wrote a stack of different patches related to
various namespace implementations - you'd have to search for them (and the
relevant discussions on the internals mailing list) in order to determine
if they are a viable option for you.

> I have several class which should work together, or Class B which is
> used to
> create a private property of class A.
> 
> How can i do that without including the class B into the class A definition
> ?

er, you don't, at least not with vanilla php. :-/

which leaves the question to why you want to do this, maybe there is a simpler
alternative. it might simply be down to letting go of [your] C++ mindset
somewhat and just living with less structured/rigid/er? code in php ... not that
I know anything about C++ (and not meaning any insult)

> 
> thanks a lot,
> 

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



[PHP] Class and subclass

2007-03-07 Thread Alain Roger

Hi,

i have a class A with some properties.
i have a class B with several public functions (i.e : Render())

i would like to do something like that :

class B()
{
B()
{
}

public function Render()
{
 ...
}
}

class A
{
private $myotherclass;

A()
{
 $this->myotherclass = new classB();
}

public function test()
{
 $this->myotherclass->Render();
}
}

however, i'm not able to access to ->Render() of class B from Class A
property. Where could be the problem ?

--
Alain

Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5


Re: [PHP] Class and subclass

2007-03-07 Thread Robert Cummings
On Wed, 2007-03-07 at 14:23 +0100, Alain Roger wrote:
> Hi,
> 
> i have a class A with some properties.
> i have a class B with several public functions (i.e : Render())
> 
> i would like to do something like that :
> 
> class B()
> {
>  B()

I'm pretty sure you mean "function B()" or in PHP 5 "function
__construct()".

>  {
>  }
> 
>  public function Render()
>  {
>   ...
>  }
> }
> 
> class A
> {
>  private $myotherclass;
> 
>  A()

Similarly, I'm pretty sure you mean "function A()" or in PHP 5 "function
__construct()".

>  {
>   $this->myotherclass = new classB();
>  }
> 
>  public function test()
>  {
>   $this->myotherclass->Render();
>  }
> }
> 
> however, i'm not able to access to ->Render() of class B from Class A
> property. Where could be the problem ?

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

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



Re: [PHP] Class and subclass

2007-03-07 Thread Alain Roger

A() or B() mean constructors of th class A and B respectively.

Al.

On 3/7/07, Robert Cummings <[EMAIL PROTECTED]> wrote:


On Wed, 2007-03-07 at 14:23 +0100, Alain Roger wrote:
> Hi,
>
> i have a class A with some properties.
> i have a class B with several public functions (i.e : Render())
>
> i would like to do something like that :
>
> class B()
> {
>  B()

I'm pretty sure you mean "function B()" or in PHP 5 "function
__construct()".

>  {
>  }
>
>  public function Render()
>  {
>   ...
>  }
> }
>
> class A
> {
>  private $myotherclass;
>
>  A()

Similarly, I'm pretty sure you mean "function A()" or in PHP 5 "function
__construct()".

>  {
>   $this->myotherclass = new classB();
>  }
>
>  public function test()
>  {
>   $this->myotherclass->Render();
>  }
> }
>
> however, i'm not able to access to ->Render() of class B from Class A
> property. Where could be the problem ?

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





--
Alain

Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5


[PHP] create and save file to folder

2007-03-07 Thread Ross
Hi,

I am trying to create a file with php. I want to enter the value of a string 
into it and then browse (if possible) and save to a specified folder with 
the filename/extension (.php/.txt) entered in the dialog box.


R.

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



Re: [PHP] Class and subclass

2007-03-07 Thread Tijnema !

On 3/7/07, Alain Roger <[EMAIL PROTECTED]> wrote:


A() or B() mean constructors of th class A and B respectively.

Al.



Yes but they are functions.

On 3/7/07, Robert Cummings <[EMAIL PROTECTED]> wrote:

>
> On Wed, 2007-03-07 at 14:23 +0100, Alain Roger wrote:
> > Hi,
> >
> > i have a class A with some properties.
> > i have a class B with several public functions (i.e : Render())
> >
> > i would like to do something like that :
> >
> > class B()
> > {
> >  B()
>
> I'm pretty sure you mean "function B()" or in PHP 5 "function
> __construct()".
>
> >  {
> >  }
> >
> >  public function Render()
> >  {
> >   ...
> >  }
> > }
> >
> > class A
> > {
> >  private $myotherclass;
> >
> >  A()
>
> Similarly, I'm pretty sure you mean "function A()" or in PHP 5 "function
> __construct()".
>
> >  {
> >   $this->myotherclass = new classB();
> >  }
> >
> >  public function test()
> >  {
> >   $this->myotherclass->Render();
> >  }
> > }
> >
> > however, i'm not able to access to ->Render() of class B from Class A
> > property. Where could be the problem ?
>
> Cheers,
> Rob.
> --
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'
>
>


--
Alain

Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5



Re: [PHP] Class and subclass

2007-03-07 Thread Alain Roger

Yes, for sure.

On 3/7/07, Tijnema ! <[EMAIL PROTECTED]> wrote:




On 3/7/07, Alain Roger <[EMAIL PROTECTED]> wrote:
>
> A() or B() mean constructors of th class A and B respectively.
>
> Al.


Yes but they are functions.

On 3/7/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
> >
> > On Wed, 2007-03-07 at 14:23 +0100, Alain Roger wrote:
> > > Hi,
> > >
> > > i have a class A with some properties.
> > > i have a class B with several public functions (i.e : Render())
> > >
> > > i would like to do something like that :
> > >
> > > class B()
> > > {
> > >  B()
> >
> > I'm pretty sure you mean "function B()" or in PHP 5 "function
> > __construct()".
> >
> > >  {
> > >  }
> > >
> > >  public function Render()
> > >  {
> > >   ...
> > >  }
> > > }
> > >
> > > class A
> > > {
> > >  private $myotherclass;
> > >
> > >  A()
> >
> > Similarly, I'm pretty sure you mean "function A()" or in PHP 5
> "function
> > __construct()".
> >
> > >  {
> > >   $this->myotherclass = new classB();
> > >  }
> > >
> > >  public function test()
> > >  {
> > >   $this->myotherclass->Render();
> > >  }
> > > }
> > >
> > > however, i'm not able to access to ->Render() of class B from Class
> A
> > > property. Where could be the problem ?
> >
> > Cheers,
> > Rob.
> > --
> > ..
> > | InterJinn Application Framework - http://www.interjinn.com |
> > ::
> > | An application and templating framework for PHP. Boasting  |
> > | a powerful, scalable system for accessing system services  |
> > | such as forms, properties, sessions, and caches. InterJinn |
> > | also provides an extremely flexible architecture for   |
> > | creating re-usable components quickly and easily.  |
> > `'
> >
> >
>
>
> --
> Alain
> 
> Windows XP SP2
> PostgreSQL 8.1.4
> Apache 2.0.58
> PHP 5
>





--
Alain

Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5


Re: [PHP] create and save file to folder

2007-03-07 Thread Tijnema !

On 3/7/07, Ross <[EMAIL PROTECTED]> wrote:


Hi,

I am trying to create a file with php. I want to enter the value of a
string
into it and then browse (if possible) and save to a specified folder with
the filename/extension (.php/.txt) entered in the dialog box.



R.


Sure it is possible, but it seems you have totally no knowledge about file
opening etc, if you want to browser stuff en save things, you are actually
making a file manager, and believe me, that's quite a lot of work.
Opening files is just by fopen, saving data with fread, and then closing it
with fclose. (simple huh?)
their manual pages:
http://www.php.net/fopen
http://www.php.net/fread
http://www.php.net/fclose

and sure, if you want to make a file manager, you might want to look at the
readdir function, http://www.php.net/readdir

Tijnema

--

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




Re: [PHP] Class and subclass

2007-03-07 Thread Robert Cummings
On Wed, 2007-03-07 at 14:31 +0100, Alain Roger wrote:
> A() or B() mean constructors of th class A and B respectively.

Obviously, but you appear to have declared them incorrectly by not
including the "function" keyword.

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

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



[PHP] db query not working

2007-03-07 Thread Ed Curtis

I have this code:

mysql_connect ($local_host, $local_user, $local_pass);
mysql_select_db ($local_db);

mysql_query ("DELETE FROM tmphitsmag");

$result = mysql_query ("SELECT DISTINCT company FROM view_log WHERE 
company != ''");


if ($row = mysql_fetch_array($result)) {

do {

$magazine_path = $row['company'];
$magazine_path = explode("/", $magazine_path);

echo str_replace("_", " ", $magazine_path[2]) . "";

mysql_query ("INSERT INTO tmphitsmag (magazine) 		 
   VALUES('$magazine_path[2]'");


} while($row = mysql_fetch_array($result));

} mysql_close();

It dumps the table fine, works the explode, outputs the string in the 
echo command the way I expect, but doesn't place the value in tmphitsmag 
table.


Anyone have a clue?

Thanks,

Ed

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



RE: [PHP] db query not working

2007-03-07 Thread Jim Moseby

> 
> It dumps the table fine, works the explode, outputs the string in the 
> echo command the way I expect, but doesn't place the value in 
> tmphitsmag 
> table.

Does it insert an empty record?

JM

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



Re: [PHP] db query not working

2007-03-07 Thread Tijnema !

On 3/7/07, Ed Curtis <[EMAIL PROTECTED]> wrote:


I have this code:

mysql_connect ($local_host, $local_user, $local_pass);
mysql_select_db ($local_db);

mysql_query ("DELETE FROM tmphitsmag");

$result = mysql_query ("SELECT DISTINCT company FROM view_log WHERE
company != ''");

if ($row = mysql_fetch_array($result)) {

do {

$magazine_path = $row['company'];
$magazine_path = explode("/", $magazine_path);

echo str_replace("_", " ", $magazine_path[2]) . "";

mysql_query ("INSERT INTO tmphitsmag (magazine)
   VALUES('$magazine_path[2]'");



Look how many ( you have, and how many ) you have
that's the problem...
try
mysql_query ("INSERT INTO tmphitsmag (magazine)
VALUES('$magazine_path[2]')");
that should solve the problem

Tijnema

   } while($row = mysql_fetch_array($result));


} mysql_close();

It dumps the table fine, works the explode, outputs the string in the
echo command the way I expect, but doesn't place the value in tmphitsmag
table.

Anyone have a clue?

Thanks,

Ed

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




[PHP] db query not working as expected

2007-03-07 Thread Ed Curtis

I have this code:

mysql_connect ($local_host, $local_user, $local_pass);
mysql_select_db ($local_db);

mysql_query ("DELETE FROM tmphitsmag");

$result = mysql_query ("SELECT DISTINCT company FROM view_log WHERE 
company != ''");


if ($row = mysql_fetch_array($result)) {

do {

$magazine_path = $row['company'];
$magazine_path = explode("/", $magazine_path);

echo str_replace("_", " ", $magazine_path[2]) . "";

mysql_query ("INSERT INTO tmphitsmag (magazine) 
VALUES 		('$magazine_path[2]')");


} while($row = mysql_fetch_array($result));

} mysql_close();

The code dumps the first table fine, selects, manipulates, and echoes 
the string the way I expect, but fails to input the string into the 
tmphitsmag table.


Any ideas?

Thanks,

Ed

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



Re: [PHP] db query not working as expected

2007-03-07 Thread Tijnema !

On 3/7/07, Ed Curtis <[EMAIL PROTECTED]> wrote:


I have this code:

mysql_connect ($local_host, $local_user, $local_pass);
mysql_select_db ($local_db);

mysql_query ("DELETE FROM tmphitsmag");

$result = mysql_query ("SELECT DISTINCT company FROM view_log WHERE
company != ''");

if ($row = mysql_fetch_array($result)) {

do {

$magazine_path = $row['company'];
$magazine_path = explode("/", $magazine_path);

echo str_replace("_", " ", $magazine_path[2]) . "";

mysql_query ("INSERT INTO tmphitsmag (magazine)
VALUES  ('$magazine_path[2]')");



Not sure about it but try this:
 mysql_query ("INSERT INTO tmphitsmag (magazine) VALUES
('".$magazine_path[2]."')");

Tijnema

   } while($row = mysql_fetch_array($result));


} mysql_close();

The code dumps the first table fine, selects, manipulates, and echoes
the string the way I expect, but fails to input the string into the
tmphitsmag table.

Any ideas?

Thanks,

Ed

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




Re: [PHP] db query not working as expected

2007-03-07 Thread Tijnema !

On 3/7/07, Ed Curtis <[EMAIL PROTECTED]> wrote:


I have this code:

mysql_connect ($local_host, $local_user, $local_pass);
mysql_select_db ($local_db);

mysql_query ("DELETE FROM tmphitsmag");

$result = mysql_query ("SELECT DISTINCT company FROM view_log WHERE
company != ''");

if ($row = mysql_fetch_array($result)) {

do {

$magazine_path = $row['company'];
$magazine_path = explode("/", $magazine_path);

echo str_replace("_", " ", $magazine_path[2]) . "";

mysql_query ("INSERT INTO tmphitsmag (magazine)
VALUES  ('$magazine_path[2]')");




what about adding the usual "or die"?
mysql_query ("INSERT INTO tmphitsmag (magazine)VALUES
('$magazine_path[2]')") or die(mysql_error());

Tijnema

   } while($row = mysql_fetch_array($result));


} mysql_close();

The code dumps the first table fine, selects, manipulates, and echoes
the string the way I expect, but fails to input the string into the
tmphitsmag table.

Any ideas?

Thanks,

Ed

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




Re: [PHP] db query not working as expected

2007-03-07 Thread cajbecu
try:

mysql_query ("INSERT INTO tmphitsmag (magazine) VALUES
   ('{$magazine_path[2]}')");

cajb.

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



Re: [PHP] Class and subclass

2007-03-07 Thread Jochem Maas
$> php -r '
class A
{
function render() { echo "foo\n"; }
}

class B
{
function __construct() {
$this->a = new A;
}

function test() { $this->a->render(); }
}

$b = new B;
$b->test();
'
foo




... works for me.


Alain Roger wrote:
> Hi,
> 
> i have a class A with some properties.
> i have a class B with several public functions (i.e : Render())
> 
> i would like to do something like that :
> 
> class B()

 ^^--- ???

> {
> B()
> {
> }
> 
> public function Render()
> {
>  ...
> }
> }
> 
> class A
> {
> private $myotherclass;
> 
> A()
> {
>  $this->myotherclass = new classB();
> }
> 
> public function test()
> {
>  $this->myotherclass->Render();
> }
> }
> 
> however, i'm not able to access to ->Render() of class B from Class A
> property. Where could be the problem ?
> 

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



Re: [PHP] db query not working as expected

2007-03-07 Thread Stut

Ed Curtis wrote:
mysql_query ("INSERT INTO tmphitsmag (magazine) 
VALUES ('$magazine_path[2]')");


Replace that with this...


mysql_query ("INSERT INTO tmphitsmag (magazine) VALUES 


 ('".mysql_real_escape_string($magazine_path[2])."')");

-Stut

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



Re: [PHP] Password Protect Directory

2007-03-07 Thread Jochem Maas
Jason Karns wrote:
> I'm trying to find a way to password protect a directory.  I currently have
> an authentication and authorization system in place for pages in my
> directory.  I'd prefer to use my existing system somehow (as it includes
> OpenID authentication) as opposed to using htaccess and HTTP Auth.  The
> only
> idea of found is to use mod_rewrite to have a PHP script serve up all the
> files in the particular directory and have the authentication handled in
> this script.  This just seems a little 'hackish' to me.

why?

as an alternative you could setup apache to force php to handle *all*
files in that directory using a Files directive inconjunction with a
auto_prepend_file directive for that dir that does the authentication and
pumps out the requested file - same affect as using mod_rewrite without
actually using mod_rewrite.

>  Is there any other
> way to password protect a directory with PHP?  I'd even entertain the idea
> of using HTTP Auth if I could get PHP to 'login'.  For instance, the user
> logs in at another page in the site, and then during the login process, PHP
> sets the HTTP Auth password so when the files in the directory are
> accessed,
> the user has already been logged in.
> 
> Any suggestions would be great, I can't find anything else online.
> 

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



Re: [PHP] Class and subclass

2007-03-07 Thread Stut

Alain Roger wrote:

i have a class A with some properties.
i have a class B with several public functions (i.e : Render())

i would like to do something like that :

class B()
{
B()
{
}

public function Render()
{
 ...
}
}

class A
{
private $myotherclass;

A()
{
 $this->myotherclass = new classB();
}

public function test()
{
 $this->myotherclass->Render();
}
}

however, i'm not able to access to ->Render() of class B from Class A
property. Where could be the problem ?


That code is not valid for a number of reasons. What you're trying to do 
is done like so... http://dev.stut.net/php/ab.php


I suggest you read up on classes and the syntax thereof in the manual - 
you're not getting it at the moment. Remember, PHP is not C++.


-Stut

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



Re: [PHP] Textarea update problem

2007-03-07 Thread Delta Storm

[EMAIL PROTECTED] wrote:

is there a question here, or are you asking us to write the script for
you? 


  - Rick


 Original Message 
  

Date: Wednesday, March 07, 2007 01:54:04 PM +0100
From: Delta Storm <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Subject: [PHP] Textarea update problem

Hi,

I'd like to thank everybody who have helped me till now. All your
advices were very helpfull... :)

But I have a problem again

I need to build a script which will have have the following functions:

1.Be able to select 3 columns from a MySQL database(idnetify the
columns by ID) and put the column contents into 3 textarea objects.
(for example title,Text1,Text2 each into i textarea).

2.Edit and MySQL update the textarea contents


And all in one script.

The script has a $id = $_GET['id'] variable which holds the
information about the certain table id.




-- End Original Message --



  

This is the script, I have dealt with both problems but when I click on
the update button (submit button) i get an error msg:


 Access forbidden!

You don't have permission to access the requested object. It is either
read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster
.


   Error 403

localhost 
03/07/07 16:17:37
Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d
mod_autoindex_color PHP/5.2.0


The user name and pass for the MySQL server are 100% correct.

It reads out the data from the database into the textarea object but
when I click the update button I get that msg.

Thank you! :)



http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml"; lang="hr">



UPDATE news and article items





 0)
   {
   while ($row = mysql_fetch_array($selResult))
   {
   if (!$_POST["submit"])
   {
   echo '';
   echo "";
   echo '';
   echo "";
   echo "";
   echo "";
   echo "";
   echo "";
   echo "";
   echo "sText";
   echo '';
   echo $row['sText'];
   echo "";
   echo '
   
   fText
   ';
   echo $row['fText'];
   echo '
   
   
   
   
   
   
   
   
   ';
   }
   else
   {
   $title = ($_POST['title']);
   $sText = ($_POST['sText']);
   $fText = ($_POST['fText']);

   $query = "update news set title='$title',
sText='$sText', fText='$fText' where id='$id'";

   $result = mysql_query($query) or die ("could not process
query : $query" . mysql_error());

   if ($result)
   {
   echo "Data updated succesfully";
   echo 'Povratak na
editiranje';
   }
   else
   {
   echo "Data update FAILED";
   }
   mysql_close($link);
   }
   }
   }

?>



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



Re: [PHP] Textarea update problem

2007-03-07 Thread Tijnema !

The file permissions are not set right, Apache is not able to read the PHP
file you've just uploaded to your server, chmod it to 644.

That should fix it.

Tijnema


On 3/7/07, Delta Storm <[EMAIL PROTECTED]> wrote:


[EMAIL PROTECTED] wrote:
> is there a question here, or are you asking us to write the script for
> you?
>
>   - Rick
>
>
>  Original Message 
>
>> Date: Wednesday, March 07, 2007 01:54:04 PM +0100
>> From: Delta Storm <[EMAIL PROTECTED]>
>> To: php-general@lists.php.net
>> Subject: [PHP] Textarea update problem
>>
>> Hi,
>>
>> I'd like to thank everybody who have helped me till now. All your
>> advices were very helpfull... :)
>>
>> But I have a problem again
>>
>> I need to build a script which will have have the following functions:
>>
>> 1.Be able to select 3 columns from a MySQL database(idnetify the
>> columns by ID) and put the column contents into 3 textarea objects.
>> (for example title,Text1,Text2 each into i textarea).
>>
>> 2.Edit and MySQL update the textarea contents
>>
>>
>> And all in one script.
>>
>> The script has a $id = $_GET['id'] variable which holds the
>> information about the certain table id.
>>
>>
>
> -- End Original Message --
>
>
>
>
This is the script, I have dealt with both problems but when I click on
the update button (submit button) i get an error msg:


Access forbidden!

You don't have permission to access the requested object. It is either
read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster
.


   Error 403

localhost 
03/07/07 16:17:37
Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d
mod_autoindex_color PHP/5.2.0


The user name and pass for the MySQL server are 100% correct.

It reads out the data from the database into the textarea object but
when I click the update button I get that msg.

Thank you! :)



http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml"; lang="hr">



UPDATE news and article items





 0)
   {
   while ($row = mysql_fetch_array($selResult))
   {
   if (!$_POST["submit"])
   {
   echo '';
   echo "";
   echo '';
   echo "";
   echo "";
   echo "";
   echo "";
   echo "";
   echo "";
   echo "sText";
   echo '';
   echo $row['sText'];
   echo "";
   echo '
   
   fText
   ';
   echo $row['fText'];
   echo '
   
   
   
   
   
   
   
   
   ';
   }
   else
   {
   $title = ($_POST['title']);
   $sText = ($_POST['sText']);
   $fText = ($_POST['fText']);

   $query = "update news set title='$title',
sText='$sText', fText='$fText' where id='$id'";

   $result = mysql_query($query) or die ("could not process
query : $query" . mysql_error());

   if ($result)
   {
   echo "Data updated succesfully";
   echo 'Povratak na
editiranje';
   }
   else
   {
   echo "Data update FAILED";
   }
   mysql_close($link);
   }
   }
   }

?>



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




[PHP] Save and Continue

2007-03-07 Thread Dan Shirah

Hello All,

I am trying to think through my new forms process.  I want to allow a
customer to submit multiple orders using the same credit card.   At the
bottom of my form I will have a "Save" link and a "Save and Submit
Additional" link/checkbox.

Basically what I want to happen is that if the user clicks on "Save" it
processes the form and sends them back to my homepage.

But if the user clicks "Save and Submit Additional", I want it to submit the
first payment, then return to the same screen with the credit card
information still populated to the fields and allow the user to enter in a
new transaction.

I think my process for this would be something along the lines of:

if (isset($_POST['submit_additional'])) {

  include save.php
}  //This would save the information just entered to the database


By building a save.php file and including it only if needed, this would
accomplish what I am trying to do, correct?

I'm open to any/all ideas :)


Re: [PHP] Save and Continue

2007-03-07 Thread Tijnema !

Hi,

i was more thinking about automatically going to save.php, and if checked
(the code u used) redirect back to your shop, cart, etc. using header
function.

Tijnema

On 3/7/07, Dan Shirah <[EMAIL PROTECTED]> wrote:


Hello All,

I am trying to think through my new forms process.  I want to allow a
customer to submit multiple orders using the same credit card.   At the
bottom of my form I will have a "Save" link and a "Save and Submit
Additional" link/checkbox.

Basically what I want to happen is that if the user clicks on "Save" it
processes the form and sends them back to my homepage.

But if the user clicks "Save and Submit Additional", I want it to submit
the
first payment, then return to the same screen with the credit card
information still populated to the fields and allow the user to enter in a
new transaction.

I think my process for this would be something along the lines of:

if (isset($_POST['submit_additional'])) {

  include save.php
}  //This would save the information just entered to the database


By building a save.php file and including it only if needed, this would
accomplish what I am trying to do, correct?

I'm open to any/all ideas :)



Re: [PHP] Textarea update problem

2007-03-07 Thread Németh Zoltán
2007. 03. 7, szerda keltezéssel 16.28-kor Delta Storm ezt írta:
> [EMAIL PROTECTED] wrote:
> > is there a question here, or are you asking us to write the script for
> > you? 
> >
> >   - Rick
> >
> >
> >  Original Message 
> >   
> >> Date: Wednesday, March 07, 2007 01:54:04 PM +0100
> >> From: Delta Storm <[EMAIL PROTECTED]>
> >> To: php-general@lists.php.net
> >> Subject: [PHP] Textarea update problem
> >>
> >> Hi,
> >>
> >> I'd like to thank everybody who have helped me till now. All your
> >> advices were very helpfull... :)
> >>
> >> But I have a problem again
> >>
> >> I need to build a script which will have have the following functions:
> >>
> >> 1.Be able to select 3 columns from a MySQL database(idnetify the
> >> columns by ID) and put the column contents into 3 textarea objects.
> >> (for example title,Text1,Text2 each into i textarea).
> >>
> >> 2.Edit and MySQL update the textarea contents
> >>
> >>
> >> And all in one script.
> >>
> >> The script has a $id = $_GET['id'] variable which holds the
> >> information about the certain table id.
> >>
> >> 
> >
> > -- End Original Message --
> >
> >
> >
> >   
> This is the script, I have dealt with both problems but when I click on
> the update button (submit button) i get an error msg:
> 
> 
>   Access forbidden!
> 
> You don't have permission to access the requested object. It is either
> read-protected or not readable by the server.
> 
> If you think this is a server error, please contact the webmaster
> .
> 
> 
> Error 403
> 
> localhost 
> 03/07/07 16:17:37
> Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d
> mod_autoindex_color PHP/5.2.0
> 
> 
> The user name and pass for the MySQL server are 100% correct.
> 
> It reads out the data from the database into the textarea object but
> when I click the update button I get that msg.
> 
> Thank you! :)
> 
> 
> 
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml"; lang="hr">
> 
> 
> 
> UPDATE news and article items
> 
> 
> 
> 
> 
>  
> $id = $_GET['id'];
> include("authenticate.php");
> $link = mysql_connect("localhost","$admin","$pass") or die ("Could
> not connect to database");
> 
> mysql_select_db("europe") or die ("Could not select database");
> 
> mysql_query("set names utf8");
> $selResult = mysql_query("select title,sText,fText from news where
> id='$id'");
> 
> if (mysql_num_rows($selResult) > 0)
> {
> while ($row = mysql_fetch_array($selResult))
> {

you don't need that if above, as the while loop will not start at all if
there is no rows in the result

> if (!$_POST["submit"])
> {
> echo ' align="center">';
> echo "";
> echo '';
> echo "";
> echo " value=" . $row['title'] .">";
> echo "";
> echo "";
> echo "";
> echo "";
> echo "sText";
> echo '';
> echo $row['sText'];
> echo "";
> echo '
> 
> fText
> ';
> echo $row['fText'];
> echo '
> 
> 
> 
> 
> 
> 
> 
> 
> ';
> }
> else
> {
> $title = ($_POST['title']);
> $sText = ($_POST['sText']);
> $fText = ($_POST['fText']);

why are you putting those $_POST values in brackets?
it should be
$title = $_POST['title'];

btw, you should check those values before passing them to the database
because of security reasons

> 
> $query = "update news set title='$title',
> sText='$sText', fText='$fText' where id='$id'";
> 
> $result = mysql_query($query) or die ("could not process
> query : $query" . mysql_error());

here you don't need $result I think, you could just use
mysql_query($query) or die ("could not process query : $query" .
mysql_error());

> 
> if ($result)
> {

and you don't have to check for $result, as the die statement would
cause your script to stop executing if there was an error, so if it gets
here you might just print out "everything is ok"

> echo "Data updated succesfully";
> echo 'Povratak na
> editiranje';
> }
> else
> {
> echo "Data update FAILED";
> }

and this "else" part is also totally useless, as it never gets here. it
there is an error it dies right at the query, otherwise it is successful

> mysql_

Re: [PHP] Save and Continue

2007-03-07 Thread Robert Cummings
On Wed, 2007-03-07 at 10:39 -0500, Dan Shirah wrote:
>
> then return to the same screen with the credit card
> information still populated

You should treat credit card information like a hot potato... get rid of
it as soon as possible. What happens if Johnny Forgetful forgets to log
out of his session on a public computer? Then Jenny Fastfingers jumps on
and notices the open session? Voila, Jenny Fastfingers just got Johnny
Forgetful's credit information.

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

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



Re: [PHP] db query not working

2007-03-07 Thread Satyam
I saw two people pointing two errors on the SQL insert statement which you 
would have found yourself had you put the 'or die()' at the end of the 
query, as someone else suggested.  Do never leave any query without the 'or 
die()' after it (or any other means to check if mysql_query returns anything 
not false).  This would have saved lots of your time, our time, everybody's 
bandwidth and would avoid your asking everybody again for the next error you 
make.  We all make errors, none of us is above that, that's why, at least in 
my case, I never fail to add the or die() at the end.  That's why the 
developers of function libraries have put some means of reporting errors 
back.  It takes time for providing good error reporting.  You are wasting 
that effort as well.


Do you deserve all this speech?  No more than the dozens who write what I 
call 'ballistic' code: code you have no control over once it launches. 
Guided missiles are far better.  Anyway, you got it because I had time to 
rant about this.


Satyam



- Original Message - 
From: "Ed Curtis" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, March 07, 2007 3:28 PM
Subject: [PHP] db query not working



I have this code:

mysql_connect ($local_host, $local_user, $local_pass);
mysql_select_db ($local_db);

mysql_query ("DELETE FROM tmphitsmag");

$result = mysql_query ("SELECT DISTINCT company FROM view_log WHERE 
company != ''");


if ($row = mysql_fetch_array($result)) {

do {

$magazine_path = $row['company'];
$magazine_path = explode("/", $magazine_path);

echo str_replace("_", " ", $magazine_path[2]) . "";

mysql_query ("INSERT INTO tmphitsmag (magazine) 
VALUES('$magazine_path[2]'");


} while($row = mysql_fetch_array($result));

} mysql_close();

It dumps the table fine, works the explode, outputs the string in the echo 
command the way I expect, but doesn't place the value in tmphitsmag table.


Anyone have a clue?

Thanks,

Ed

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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.7/712 - Release Date: 06/03/2007 
15:42





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



[PHP] php and javascript error

2007-03-07 Thread Ed Curtis

I've just run into this problem this morning




This produces an "Error on Page" in IE 7, but works perfectly in Firefox 
and Netscape.


I have several other javascript calls on the page where this call 
resides and all of them work perfectly except for this one. Does this 
error occur because I'm sending the variables to another script that 
does some logging then forwards the user to the URL or is it just a IE 
quirk?


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



Re: [PHP] php and javascript error

2007-03-07 Thread Németh Zoltán
2007. 03. 7, szerda keltezéssel 10.59-kor Ed Curtis ezt írta:
> I've just run into this problem this morning
> 
> 
> 
> This produces an "Error on Page" in IE 7, but works perfectly in Firefox 
> and Netscape.
> 
> I have several other javascript calls on the page where this call 
> resides and all of them work perfectly except for this one. Does this 
> error occur because I'm sending the variables to another script that 
> does some logging then forwards the user to the URL or is it just a IE 
> quirk?
> 

I'm almost sure it has nothing to do with php
rather javascript, and maybe microsoft's special javascript
interpretations...

greets
Zoltán Németh

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



Re: [PHP] php and javascript error

2007-03-07 Thread Tijnema !

Open the page with IE 7, and open the source, if it doesn't show any  tags, then it is a IE problem..

Tijnema


On 3/7/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:


2007. 03. 7, szerda keltezéssel 10.59-kor Ed Curtis ezt írta:
> I've just run into this problem this morning
>
> 
>
> This produces an "Error on Page" in IE 7, but works perfectly in Firefox
> and Netscape.
>
> I have several other javascript calls on the page where this call
> resides and all of them work perfectly except for this one. Does this
> error occur because I'm sending the variables to another script that
> does some logging then forwards the user to the URL or is it just a IE
> quirk?
>

I'm almost sure it has nothing to do with php
rather javascript, and maybe microsoft's special javascript
interpretations...

greets
Zoltán Németh

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




RE: [PHP] php and javascript error

2007-03-07 Thread Edward Kay

> I've just run into this problem this morning
>
> 
>
> This produces an "Error on Page" in IE 7, but works perfectly in Firefox
> and Netscape.
>
> I have several other javascript calls on the page where this call
> resides and all of them work perfectly except for this one. Does this
> error occur because I'm sending the variables to another script that
> does some logging then forwards the user to the URL or is it just a IE
> quirk?
>

This is a JavaScript issue, but may have something to do with the data you
are echoing out in PHP. Look at the source in the browser. My guess it that
you've got a stay quote mark in one of your PHP vars.

Edward

PS: If you want your code to validate, change the & to &  Add the
closing  tag too.
PPS: It's advisable not to use the short tags, use http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] db query not working

2007-03-07 Thread Ed Curtis

Satyam wrote:
I saw two people pointing two errors on the SQL insert statement which 
you would have found yourself had you put the 'or die()' at the end of 
the query, as someone else suggested.  Do never leave any query without 
the 'or die()' after it (or any other means to check if mysql_query 
returns anything not false).  This would have saved lots of your time, 
our time, everybody's bandwidth and would avoid your asking everybody 
again for the next error you make.  We all make errors, none of us is 
above that, that's why, at least in my case, I never fail to add the or 
die() at the end.  That's why the developers of function libraries have 
put some means of reporting errors back.  It takes time for providing 
good error reporting.  You are wasting that effort as well.


Do you deserve all this speech?  No more than the dozens who write what 
I call 'ballistic' code: code you have no control over once it launches. 
Guided missiles are far better.  Anyway, you got it because I had time 
to rant about this.


Satyam


 I wasted no more bandwidth than you did with your rant. My code post 
was edited from the original code and that's where the mistake was made, 
not in the code itself. And I do, by the way, end all my queries with 
or die(). I just left it out of the edit. Besides, the problem is fixed 
now. Thanks to all that helped.


Ed

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



Re: [PHP] db query not working

2007-03-07 Thread Jochem Maas
Satyam wrote:
> I saw two people pointing two errors on the SQL insert statement which
> you would have found yourself had you put the 'or die()' at the end of
> the query, as someone else suggested.  Do never leave any query without
> the 'or die()' after it (or any other means to check if mysql_query
> returns anything not false).  This would have saved lots of your time,
> our time, everybody's bandwidth and would avoid your asking everybody
> again for the next error you make.  We all make errors, none of us is
> above that, that's why, at least in my case, I never fail to add the or
> die() at the end.  That's why the developers of function libraries have
> put some means of reporting errors back.  It takes time for providing
> good error reporting.  You are wasting that effort as well.
> 
> Do you deserve all this speech? 

yes. no error checking, no attempt at self improvement and above all
no patience when it comes to waiting for an answer.

...

> I call 'ballistic' code: code you have no control over once it launches.
> Guided missiles are far better.  

might I suggest that the word 'better' shouldn't be used to describe any kind
of missile other than a decommissioned one. 'better' ways of killing people
are things generally only sought after by fundamentalists, arms-industry 
employees
and megalomaniacs (it just springs to mind that a certain leader of the [not so]
free world could happily sit in any of those categories)

gun analogies suck almost as much as guns, as opposed to good old rant, which, 
as
long as they're not combined with guns are fairly harmless and quite often 
informative.

Anyway, you got it because I had time
> to rant about this.

we make time to rant ;-)

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



Re: [PHP] php and javascript error

2007-03-07 Thread Ed Curtis

Németh Zoltán wrote:

2007. 03. 7, szerda keltezéssel 10.59-kor Ed Curtis ezt írta:


I've just run into this problem this morning




This produces an "Error on Page" in IE 7, but works perfectly in Firefox 
and Netscape.


I have several other javascript calls on the page where this call 
resides and all of them work perfectly except for this one. Does this 
error occur because I'm sending the variables to another script that 
does some logging then forwards the user to the URL or is it just a IE 
quirk?





I'm almost sure it has nothing to do with php
rather javascript, and maybe microsoft's special javascript
interpretations...


I know it's not the PHP but rather the JS that's causing it. What I fail 
to understand is that there are 2 JS calls before, and 2 JS calls after 
this one in my page and the other 4 work perfectly. They are basically 
the same call too, just to different scripts. I just wondered if anyone 
 knew why this particular call doesn't work or had come across anything 
like this.


Thanks

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



Re: [PHP] php and javascript error

2007-03-07 Thread Tijnema !

On 3/7/07, Ed Curtis <[EMAIL PROTECTED]> wrote:


Németh Zoltán wrote:
> 2007. 03. 7, szerda keltezéssel 10.59-kor Ed Curtis ezt írta:
>
>>I've just run into this problem this morning
>>
>>
>>
>>This produces an "Error on Page" in IE 7, but works perfectly in Firefox
>>and Netscape.
>>
>>I have several other javascript calls on the page where this call
>>resides and all of them work perfectly except for this one. Does this
>>error occur because I'm sending the variables to another script that
>>does some logging then forwards the user to the URL or is it just a IE
>>quirk?
>>
>
>
> I'm almost sure it has nothing to do with php
> rather javascript, and maybe microsoft's special javascript
> interpretations...

I know it's not the PHP but rather the JS that's causing it. What I fail
to understand is that there are 2 JS calls before, and 2 JS calls after
this one in my page and the other 4 work perfectly. They are basically
the same call too, just to different scripts. I just wondered if anyone
knew why this particular call doesn't work or had come across anything
like this.

Thanks



I think you're not at the right mailing list for this, and btw, it would be
a lot easier to find what is going wrong, if you post one of the working
ones...

Tijnema

--

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




Re: [PHP] Save and Continue

2007-03-07 Thread Jochem Maas
Robert Cummings wrote:
> On Wed, 2007-03-07 at 10:39 -0500, Dan Shirah wrote:
>> then return to the same screen with the credit card
>> information still populated
> 
> You should treat credit card information like a hot potato... get rid of
> it as soon as possible. What happens if Johnny Forgetful forgets to log
> out of his session on a public computer? Then Jenny Fastfingers jumps on
> and notices the open session? Voila, Jenny Fastfingers just got Johnny
> Forgetful's credit information.

and don't forget the all the Bob Shitesters that'll sue you for every penny 
you'll
ever have at the slightest opportunity regardless of what you try/do/intend,
best not accept CC numbers or any of that jazz at all.

> 
> Cheers,
> Rob.

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



RE: [PHP] php and javascript error

2007-03-07 Thread afan
>
>> I've just run into this problem this morning
>>
>> 
>>
>> This produces an "Error on Page" in IE 7, but works perfectly in Firefox
>> and Netscape.
>>
>> I have several other javascript calls on the page where this call
>> resides and all of them work perfectly except for this one. Does this
>> error occur because I'm sending the variables to another script that
>> does some logging then forwards the user to the URL or is it just a IE
>> quirk?
>>
>
> This is a JavaScript issue, but may have something to do with the data you
> are echoing out in PHP. Look at the source in the browser. My guess it
> that
> you've got a stay quote mark in one of your PHP vars.
>
> Edward
>
> PS: If you want your code to validate, change the & to &  Add the
> closing  tag too.
> PPS: It's advisable not to use the short tags, use  instead . At
least it's shorter. :)

-afan

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

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



Re: [PHP] Save and Continue

2007-03-07 Thread Tijnema !

But ofcourse you could add a lot of things to a shopping cart and checkout
once

btw, it's safer to use things like Paypal...

Tijnema

-- To the full PHP list now


On 3/7/07, Jochem Maas <[EMAIL PROTECTED]> wrote:


Robert Cummings wrote:
> On Wed, 2007-03-07 at 10:39 -0500, Dan Shirah wrote:
>> then return to the same screen with the credit card
>> information still populated
>
> You should treat credit card information like a hot potato... get rid of
> it as soon as possible. What happens if Johnny Forgetful forgets to log
> out of his session on a public computer? Then Jenny Fastfingers jumps on
> and notices the open session? Voila, Jenny Fastfingers just got Johnny
> Forgetful's credit information.

and don't forget the all the Bob Shitesters that'll sue you for every
penny you'll
ever have at the slightest opportunity regardless of what you
try/do/intend,
best not accept CC numbers or any of that jazz at all.

>
> Cheers,
> Rob.

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




Re: [PHP] Save and Continue

2007-03-07 Thread Dan Shirah

Rght, that is similar to what I am trying to do...let them inout several
items to be paid on and let them all be tied to the same credit card to be
charged.

On 3/7/07, Tijnema ! <[EMAIL PROTECTED]> wrote:


But ofcourse you could add a lot of things to a shopping cart and checkout
once

btw, it's safer to use things like Paypal...

Tijnema

-- To the full PHP list now


On 3/7/07, Jochem Maas <[EMAIL PROTECTED]> wrote:
>
> Robert Cummings wrote:
> > On Wed, 2007-03-07 at 10:39 -0500, Dan Shirah wrote:
> >> then return to the same screen with the credit card
> >> information still populated
> >
> > You should treat credit card information like a hot potato... get rid
of
> > it as soon as possible. What happens if Johnny Forgetful forgets to
log
> > out of his session on a public computer? Then Jenny Fastfingers jumps
on
> > and notices the open session? Voila, Jenny Fastfingers just got Johnny
> > Forgetful's credit information.
>
> and don't forget the all the Bob Shitesters that'll sue you for every
> penny you'll
> ever have at the slightest opportunity regardless of what you
> try/do/intend,
> best not accept CC numbers or any of that jazz at all.
>
> >
> > Cheers,
> > Rob.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



Re: [PHP] php and javascript error

2007-03-07 Thread Ed Curtis





This produces an "Error on Page" in IE 7, but works perfectly in Firefox
and Netscape.

I have several other javascript calls on the page where this call
resides and all of them work perfectly except for this one. Does this
error occur because I'm sending the variables to another script that
does some logging then forwards the user to the URL or is it just a IE
quirk?



This is a JavaScript issue, but may have something to do with the data you
are echoing out in PHP. Look at the source in the browser. My guess it
that



you've got a stay quote mark in one of your PHP vars.


Not it, I looked and there's nothing there.


PS: If you want your code to validate, change the & to &  Add the
closing  tag too.


Thanks, the &'s are now all &. The closing  is in the script, 
just wasn't posted in the message.



PPS: It's advisable not to use the short tags, use 

Can you tell me why? Is it just a personal preference?

Another JS call directly in front of this one works perfectly.



Send Me Email


The only difference is this call has the window options included the one 
that doesn't work doesn't have them. I've added them just to check and 
it didn't change anything.


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



Re: [PHP] Save and Continue

2007-03-07 Thread Tijnema !

So, what is your actual problem?

you can simple add all items to a session, and then when checking out,
getting all data from the session.

*means all data is lost when user leaves page...

Tijnema

On 3/7/07, Dan Shirah <[EMAIL PROTECTED]> wrote:


Rght, that is similar to what I am trying to do...let them inout several
items to be paid on and let them all be tied to the same credit card to be
charged.

On 3/7/07, Tijnema ! <[EMAIL PROTECTED]> wrote:
>
> But ofcourse you could add a lot of things to a shopping cart and
> checkout
> once
>
> btw, it's safer to use things like Paypal...
>
> Tijnema
>
> -- To the full PHP list now
>
>
> On 3/7/07, Jochem Maas <[EMAIL PROTECTED]> wrote:
> >
> > Robert Cummings wrote:
> > > On Wed, 2007-03-07 at 10:39 -0500, Dan Shirah wrote:
> > >> then return to the same screen with the credit card
> > >> information still populated
> > >
> > > You should treat credit card information like a hot potato... get
> rid of
> > > it as soon as possible. What happens if Johnny Forgetful forgets to
> log
> > > out of his session on a public computer? Then Jenny Fastfingers
> jumps on
> > > and notices the open session? Voila, Jenny Fastfingers just got
> Johnny
> > > Forgetful's credit information.
> >
> > and don't forget the all the Bob Shitesters that'll sue you for every
> > penny you'll
> > ever have at the slightest opportunity regardless of what you
> > try/do/intend,
> > best not accept CC numbers or any of that jazz at all.
> >
> > >
> > > Cheers,
> > > Rob.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>




[PHP] help with script needed

2007-03-07 Thread Bruce Gilbert

I have a little script that prints a number out from 1 to 100
[php]
";

}
?>
[/php]

I just need to add code to print something different, say "foo" if the
output is a multiple of 5 or 10 for example. How do I go about doing
this?

--
::Bruce::

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



Re: [PHP] help with script needed

2007-03-07 Thread Tijnema !

On 3/7/07, Bruce Gilbert <[EMAIL PROTECTED]> wrote:


I have a little script that prints a number out from 1 to 100
[php]
";

}
?>
[/php]

I just need to add code to print something different, say "foo" if the
output is a multiple of 5 or 10 for example. How do I go about doing
this?

--
::Bruce::




I've seen that question a lot, what i use is fairly simple
if( intval($number / $multiple) == ($number / $multiple ) )

try that

Tijnema

--

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




Re: [PHP] help with script needed

2007-03-07 Thread afan
try this
if ($i%5 == 0) echo "foo";

-afan

> I have a little script that prints a number out from 1 to 100
> [php]
>  for( $i=1; $i<=100; $i++ )
> {
> echo $i;
> echo "";
>
> }
> ?>
> [/php]
>
> I just need to add code to print something different, say "foo" if the
> output is a multiple of 5 or 10 for example. How do I go about doing
> this?
>
> --
> ::Bruce::
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



RE: [PHP] php and javascript error

2007-03-07 Thread Brad Fuller
> -Original Message-
> From: Ed Curtis [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 07, 2007 11:47 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] php and javascript error
> 
> 
> >>>
> >>>
> >>>This produces an "Error on Page" in IE 7, but works perfectly in
> Firefox
> >>>and Netscape.


Is it because you have given the window the name 'Web Site' which contains a
space character?  Try naming it 'WebSite' (without the space)

Hopefully that is the culprit.


> >>>I have several other javascript calls on the page where this call
> >>>resides and all of them work perfectly except for this one. Does this
> >>>error occur because I'm sending the variables to another script that
> >>>does some logging then forwards the user to the URL or is it just a IE
> >>>quirk?
> >>>
> >>
> >>This is a JavaScript issue, but may have something to do with the data
> you
> >>are echoing out in PHP. Look at the source in the browser. My guess it
> >>that
> 
> >>you've got a stay quote mark in one of your PHP vars.
> 
> Not it, I looked and there's nothing there.
> 
> >>PS: If you want your code to validate, change the & to &  Add the
> >>closing  tag too.
> 
> Thanks, the &'s are now all &. The closing  is in the script,
> just wasn't posted in the message.
> 
> >>PPS: It's advisable not to use the short tags, use  
> Can you tell me why? Is it just a personal preference?
> 
> Another JS call directly in front of this one works perfectly.
> 
> 
> Send Me Email
> 
> 
> The only difference is this call has the window options included the one
> that doesn't work doesn't have them. I've added them just to check and
> it didn't change anything.
> 
> --
> 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] Textarea update problem

2007-03-07 Thread Jim Lucas

Delta Storm wrote:

[EMAIL PROTECTED] wrote:

is there a question here, or are you asking us to write the script for
you?
  - Rick


 Original Message 
 

Date: Wednesday, March 07, 2007 01:54:04 PM +0100
From: Delta Storm <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Subject: [PHP] Textarea update problem

Hi,

I'd like to thank everybody who have helped me till now. All your
advices were very helpfull... :)

But I have a problem again

I need to build a script which will have have the following functions:

1.Be able to select 3 columns from a MySQL database(idnetify the
columns by ID) and put the column contents into 3 textarea objects.
(for example title,Text1,Text2 each into i textarea).

2.Edit and MySQL update the textarea contents


And all in one script.

The script has a $id = $_GET['id'] variable which holds the
information about the certain table id.




-- End Original Message --



  

This is the script, I have dealt with both problems but when I click on
the update button (submit button) i get an error msg:


 Access forbidden!

You don't have permission to access the requested object. It is either
read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster
.


   Error 403

localhost 
03/07/07 16:17:37
Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d
mod_autoindex_color PHP/5.2.0


The user name and pass for the MySQL server are 100% correct.

It reads out the data from the database into the textarea object but
when I click the update button I get that msg.

Thank you! :)



http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml"; lang="hr">



UPDATE news and article items





 0)
   {
   while ($row = mysql_fetch_array($selResult))
   {
   if (!$_POST["submit"])
   {
   echo '';
   echo "";
   echo '';


You can't do this You are inside a php echo statement already.
Then you are trying to break into php from html

   echo "";


Not sure what error level you are set to but you should have quotes 
around PHP_SELF I see it everywhere else, maybe you missed this one.


ie: $_SERVER['PHP_SELF'];

Previous line should read:
echo "";


   echo "";
   echo "";
   echo "";
   echo "";
   echo "";
   echo "sText";
   echo '';
   echo $row['sText'];
   echo "";
   echo '
   
   fText
   ';
   echo $row['fText'];
   echo '
   
   
   
   
   
   
   
   
   ';
   }
   else
   {
   $title = ($_POST['title']);
   $sText = ($_POST['sText']);
   $fText = ($_POST['fText']);

   $query = "update news set title='$title',
sText='$sText', fText='$fText' where id='$id'";

   $result = mysql_query($query) or die ("could not process
query : $query" . mysql_error());

   if ($result)
   {
   echo "Data updated succesfully";
   echo 'Povratak na
editiranje';
   }
   else
   {
   echo "Data update FAILED";
   }
   mysql_close($link);
   }
   }
   }

?>






--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



RE: [PHP] php and javascript error

2007-03-07 Thread Brad Fuller
> -Original Message-
> From: Brad Fuller [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 07, 2007 12:02 PM
> To: 'Ed Curtis'; 'php-general@lists.php.net'
> Subject: RE: [PHP] php and javascript error
> 
> > -Original Message-
> > From: Ed Curtis [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, March 07, 2007 11:47 AM
> > To: php-general@lists.php.net
> > Subject: Re: [PHP] php and javascript error
> >
> >
> > >>> onclick="javascript:window.open('web_forward.php?address= > >>>echo $web_url; ?>&agent=&real_company_name= > >>>$real_company_name; ?>', 'Web Site');">
> > >>>
> > >>>This produces an "Error on Page" in IE 7, but works perfectly in
> > Firefox
> > >>>and Netscape.
> 
> 
> Is it because you have given the window the name 'Web Site' which contains
> a space character?  Try naming it 'WebSite' (without the space)
> 
> Hopefully that is the culprit.

You should also be making sure to use urlencode() on all data that goes into
that URL.

 click here 


> > >>>I have several other javascript calls on the page where this call
> > >>>resides and all of them work perfectly except for this one. Does this
> > >>>error occur because I'm sending the variables to another script that
> > >>>does some logging then forwards the user to the URL or is it just a
> IE
> > >>>quirk?
> > >>>
> > >>
> > >>This is a JavaScript issue, but may have something to do with the data
> > you
> > >>are echoing out in PHP. Look at the source in the browser. My guess it
> > >>that
> >
> > >>you've got a stay quote mark in one of your PHP vars.
> >
> > Not it, I looked and there's nothing there.
> >
> > >>PS: If you want your code to validate, change the & to &  Add the
> > >>closing  tag too.
> >
> > Thanks, the &'s are now all &. The closing  is in the script,
> > just wasn't posted in the message.
> >
> > >>PPS: It's advisable not to use the short tags, use  >
> > Can you tell me why? Is it just a personal preference?
> >
> > Another JS call directly in front of this one works perfectly.
> >
> > 
> > Send Me Email
> > 
> >
> > The only difference is this call has the window options included the one
> > that doesn't work doesn't have them. I've added them just to check and
> > it didn't change anything.
> >
> > --
> > 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: Save and Continue

2007-03-07 Thread Mark
Dan Shirah wrote:

> Hello All,
> 
> I am trying to think through my new forms process.  I want to allow a
> customer to submit multiple orders using the same credit card.   At the
> bottom of my form I will have a "Save" link and a "Save and Submit
> Additional" link/checkbox.
> 
> Basically what I want to happen is that if the user clicks on "Save" it
> processes the form and sends them back to my homepage.
> 
> But if the user clicks "Save and Submit Additional", I want it to submit
> the first payment, then return to the same screen with the credit card
> information still populated to the fields and allow the user to enter in a
> new transaction.
> 
> I think my process for this would be something along the lines of:
> 
> if (isset($_POST['submit_additional'])) {
> 
>include save.php
> }  //This would save the information just entered to the database
> 
> 
> By building a save.php file and including it only if needed, this would
> accomplish what I am trying to do, correct?
> 
> I'm open to any/all ideas :)

I think you can accomplish what you "want to do" just in a different way. I
think that you need to view the credit card phase as the last step, and
figure out a way to chunk up multiple independent "shopping cart" invoices.

Something like, "pay now" and "add new order"

if you have a PHP class, say "class invoice," which represents a shopping
cart, and use the serialize function to create a text variable which can be
stored in a database or session. Then a user can create and edit multiple
invoices, and as a last step go to billing and enter credit information.

You should NEVER EVER store, no matter how securely or temporarily, credit
card information unless you have major liability insurance.

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



RE: [PHP] php and javascript error

2007-03-07 Thread Edward Kay

> >>>
> >>>
> >>
> >>This is a JavaScript issue, but may have something to do with
> the data you
> >>are echoing out in PHP. Look at the source in the browser. My guess it
> >>that
>
> >>you've got a stay quote mark in one of your PHP vars.
>
> Not it, I looked and there's nothing there.

I'm sure it's because you've got some stray characters in your output that
mess it up. It would help if you actually posted the source rather than just
saying it's OK, when it clearly isn't.


> >>PPS: It's advisable not to use the short tags, use 
> Can you tell me why? Is it just a personal preference?

If you move to another server where the short tags option is off, your code
will break. From the manual:

Using short tags should be avoided when developing applications or libraries
that are meant for redistribution, or deployment on PHP servers which are
not under your control, because short tags may not be supported on the
target server. For portable, redistributable code, be sure not to use short
tags.

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



Re: [PHP] help with script needed

2007-03-07 Thread Tijnema !

oops, ofcourse whe have the modular :)

On 3/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


try this
if ($i%5 == 0) echo "foo";

-afan

> I have a little script that prints a number out from 1 to 100
> [php]
>  for( $i=1; $i<=100; $i++ )
> {
> echo $i;
> echo "";
>
> }
> ?>
> [/php]
>
> I just need to add code to print something different, say "foo" if the
> output is a multiple of 5 or 10 for example. How do I go about doing
> this?
>
> --
> ::Bruce::
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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




Re: [PHP] help with script needed

2007-03-07 Thread Jake McHenry

lol . i remember this from a 2nd semester quiz 5 years ago :)



I have a little script that prints a number out from 1 to 100
[php]
";

}
?>
[/php]

I just need to add code to print something different, say "foo" if the
output is a multiple of 5 or 10 for example. How do I go about doing
this?

--
::Bruce::

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



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



Re: [PHP] php and javascript error

2007-03-07 Thread Seak, Teng-Fong
Ed Curtis wrote:
> Németh Zoltán wrote:
>> 2007. 03. 7, szerda keltezéssel 10.59-kor Ed Curtis ezt írta:
>>
>>> I've just run into this problem this morning
>>>
>>> >> onclick="javascript:window.open('web_forward.php?address=>> $web_url; ?>&agent=&real_company_name=>> $real_company_name; ?>', 'Web Site');">
>>>
>>> This produces an "Error on Page" in IE 7, but works perfectly in
>>> Firefox and Netscape.
>>>
>>> I have several other javascript calls on the page where this call
>>> resides and all of them work perfectly except for this one. Does
>>> this error occur because I'm sending the variables to another script
>>> that does some logging then forwards the user to the URL or is it
>>> just a IE quirk?
>>>
>>
>>
>> I'm almost sure it has nothing to do with php
>> rather javascript, and maybe microsoft's special javascript
>> interpretations...
>
> I know it's not the PHP but rather the JS that's causing it. What I
> fail to understand is that there are 2 JS calls before, and 2 JS calls
> after this one in my page and the other 4 work perfectly. They are
> basically the same call too, just to different scripts. I just
> wondered if anyone  knew why this particular call doesn't work or had
> come across anything like this.
>
> Thanks
Sidenote: In new standard of HTML, it's no longer necessary to write
onclick="javascript:window.open(.
but you could write
onclick="window.open(.

Could you paste the generated code to show us?  You could paste it
back to a static page and try again to see what's wrong.



--
* Zoner PhotoStudio 8 - Your Photos perfect, shared, organised! 
www.zoner.com/zps
  You can download your free version.

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



[PHP] PHP Patch open_basedir for dynamic virtualhost

2007-03-07 Thread DoM
Hi all,
it's a lot of time that i am trying to let Jason Greene open_basedir
patch work with apache massive virtualhost.

This is direct link to patch when it was developed:
http://www.phpbuilder.com/lists/php-developer-list/2000101/0994.php

This is a FreeBSD port more recent with same code:
http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2005-September/066983.html

If i set to open_basedir directive (inside virtualhost config section)
value VIRTUAL_DOCUMENT_ROOT, it works but i am not able to add static
path like /tmp/

This is an example:

VirtualDocumentRoot /var/www/php.net/%1
php_admin_value open_basedir VIRTUAL_DOCUMENT_ROOT

user test.php.net is chrooted for php scripts in his homedir but he
cannot write temporary files inside /tmp/

I tried with value %1; VIRTUAL_DOCUMENT_ROOT:/tmp/ and more but no way.

These are my apps version:

OS: Debian Sarge 3.1
Server version: Apache/2.0.54 (mpm-prefork pacchettizzata)
PHP: 4.4.6 (Source) & 5.2.1 (Source)

Any help will be useful and appreciated.

Thank you all


Regards

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

Re: [PHP] db query not working

2007-03-07 Thread Satyam
- Original Message - 
From: "Jochem Maas" <[EMAIL PROTECTED]>




Satyam wrote:

I saw two people pointing two errors on the SQL insert statement which
you would have found yourself had you put the 'or die()' at the end of
the query, as someone else suggested.  Do never leave any query without
the 'or die()' after it (or any other means to check if mysql_query
returns anything not false).  This would have saved lots of your time,
our time, everybody's bandwidth and would avoid your asking everybody
again for the next error you make.  We all make errors, none of us is
above that, that's why, at least in my case, I never fail to add the or
die() at the end.  That's why the developers of function libraries have
put some means of reporting errors back.  It takes time for providing
good error reporting.  You are wasting that effort as well.

Do you deserve all this speech?


yes. no error checking, no attempt at self improvement and above all
no patience when it comes to waiting for an answer.

...


I call 'ballistic' code: code you have no control over once it launches.
Guided missiles are far better.


might I suggest that the word 'better' shouldn't be used to describe any 
kind
of missile other than a decommissioned one. 'better' ways of killing 
people
are things generally only sought after by fundamentalists, arms-industry 
employees
and megalomaniacs (it just springs to mind that a certain leader of the 
[not so]

free world could happily sit in any of those categories)



My apologies, it was not a happy comparison.

gun analogies suck almost as much as guns, as opposed to good old rant, 
which, as
long as they're not combined with guns are fairly harmless and quite often 
informative.


Anyway, you got it because I had time

to rant about this.


we make time to rant ;-)



It is an old guy thing, at least in my case (trivia: I was born the day 
after the ENIAC was turned off)


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.7/712 - Release Date: 06/03/2007 
15:42




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



Re: [PHP] Enclosing fields in MySQL queries with `" or '

2007-03-07 Thread Dotan Cohen

On 05/03/07, Chris <[EMAIL PROTECTED]> wrote:

Dotan Cohen wrote:
> Are there any advantages/disadvantages to using and of the ` " or '
> punctuation symbols in MySQL queries? I usually only put them around
> variables (after being sanitized, of course):
>
> INSERT INTO places (country, city) VALUES ('$country', '$city')
>
> Any thoughts on the issue? Thanks.


Single quotes are supported in any db (mysql, postgres, sqlite etc etc)
- so use them. No idea if double quotes are widely supported.

A backtick (`) on the other hand is a mysql-ism. It allows you to use
keywords as field names (eg `index`) amongst other things (including
quoting strings).

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




Thanks. I'll just keep using single quotes then, as I've always done.

Dotan Cohen

http://lyricslist.com/lyrics/artist_albums/338/meat_loaf.html
http://what-is-what.com/what_is/404.html

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



Re: [PHP] php and javascript error

2007-03-07 Thread Ed Curtis

Edward Kay wrote:


you've got a stay quote mark in one of your PHP vars.


Not it, I looked and there's nothing there.



I'm sure it's because you've got some stray characters in your output that
mess it up. It would help if you actually posted the source rather than just
saying it's OK, when it clearly isn't.



The problem wasn't a stray apostrophe. Brad Fuller was dead on. It was 
the space in the window name option of the javascript. It works as 
expected once the space is removed.





PPS: It's advisable not to use the short tags, use 

Can you tell me why? Is it just a personal preference?


If you move to another server where the short tags option is off, your code
will break. From the manual:

Using short tags should be avoided when developing applications or libraries
that are meant for redistribution, or deployment on PHP servers which are
not under your control


My scripts aren't meant for distribution also they will only ever be 
delpoyed on a server that I control. Thanks for the tip though and 
thanks to everyone that helped.


Ed

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



Re: [PHP] help with script needed

2007-03-07 Thread Martin Marques

Tijnema ! escribió:

On 3/7/07, Bruce Gilbert <[EMAIL PROTECTED]> wrote:

I just need to add code to print something different, say "foo" if the
output is a multiple of 5 or 10 for example. How do I go about doing
this?



I've seen that question a lot, what i use is fairly simple
if( intval($number / $multiple) == ($number / $multiple ) )

try that


Very bad solution. Try the % operator:

if($number % $multiple == 0)

http://www.php.net/manual/en/language.operators.arithmetic.php

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
   Universidad Nacional
del Litoral
-

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



Re: [PHP] db query not working

2007-03-07 Thread Ed Curtis
It is an old guy thing, at least in my case (trivia: I was born the day 
after the ENIAC was turned off)


Aha! October 3, 1955

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



Re: [PHP] determine time in city using GMT offset

2007-03-07 Thread Jim Lucas

Richard Kurth wrote:

How would I determine the time in a different city If I know the GMT offset
in both placesSay GMT -1 in one city   and GMT -7 in another city.  What
would the math and code look like for this


show us what you have so far...

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



Re: [PHP] PHP Patch open_basedir for dynamic virtualhost

2007-03-07 Thread Jim Lucas

DoM wrote:

Hi all,
it's a lot of time that i am trying to let Jason Greene open_basedir
patch work with apache massive virtualhost.

This is direct link to patch when it was developed:
http://www.phpbuilder.com/lists/php-developer-list/2000101/0994.php

This is a FreeBSD port more recent with same code:
http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2005-September/066983.html

If i set to open_basedir directive (inside virtualhost config section)
value VIRTUAL_DOCUMENT_ROOT, it works but i am not able to add static
path like /tmp/

This is an example:

VirtualDocumentRoot /var/www/php.net/%1
php_admin_value open_basedir VIRTUAL_DOCUMENT_ROOT

user test.php.net is chrooted for php scripts in his homedir but he
cannot write temporary files inside /tmp/

I tried with value %1; VIRTUAL_DOCUMENT_ROOT:/tmp/ and more but no way.

These are my apps version:

OS: Debian Sarge 3.1
Server version: Apache/2.0.54 (mpm-prefork pacchettizzata)
PHP: 4.4.6 (Source) & 5.2.1 (Source)

Any help will be useful and appreciated.

Thank you all


Regards



http://us3.php.net/manual/en/features.safe-mode.php#ini.open-basedir

Read the first line of the first paragraph.

/tmp/ is not with-in /var/www/php.net/%1 it is out side

But then read the fifth paragraph and you should have your solution.

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



RE: [PHP] determine time in city using GMT offset

2007-03-07 Thread Richard Kurth
That is what I am asking where do I start. I just need to be pointed in the
right direction. I have looked thru the manual for time and date and I have
searched this user group. Maybe I am not asking the question correctly.

-Original Message-
From: Jim Lucas [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 07, 2007 10:36 AM
To: Richard Kurth
Cc: php-general@lists.php.net
Subject: Re: [PHP] determine time in city using GMT offset

Richard Kurth wrote:
> How would I determine the time in a different city If I know the GMT
offset
> in both placesSay GMT -1 in one city   and GMT -7 in another city.
What
> would the math and code look like for this
> 
show us what you have so far...

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different
strings. But there are times for you and me when all such things agree.

- Rush

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



[PHP] ldap change password

2007-03-07 Thread Fabio Silva

Hi all, i would like to know if anybody has a script in php that
change the password of the users in ldap???

That the user can do it by yourself

the user put your "username" "old pass" "new pass" "confirm new pass"

Somebody can help me?

Regards,

--
Fabio S. Silva

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



Re: [PHP] PHP Patch open_basedir for dynamic virtualhost

2007-03-07 Thread DoM
Jim Lucas wrote:
> http://us3.php.net/manual/en/features.safe-mode.php#ini.open-basedir
> 
> Read the first line of the first paragraph.
> 
> /tmp/ is not with-in /var/www/php.net/%1 it is out side

Yes, of course i know this :)

As i wrote i would like to include static path after dynamic path like
/var/www/php.net/%1
( i remember you that i know i could assign dynamic open_basedir value
such as /var/www/php.net/%1/ or VIRTUAL_DOCUMENT_ROOT only with Jason
Greene patch)

I mean something like this:
/var/www/php.net/%1/:/tmp/:/usr/local/xxx/ and so on.

> But then read the fifth paragraph and you should have your solution.
> 

If you mean this:
The restriction specified with open_basedir is actually a prefix, not a
directory name. This means that "open_basedir = /dir/incl" also allows
access to "/dir/include" and "/dir/incls" if they exist. When you want
to restrict access to only the specified directory, end with a slash.
For example: "open_basedir = /dir/incl/"

i tell you that i do not want an open_basedir value just like
/var/www/php.net/%1/ where /var/www/php.net/tmp/ is the answer cause
then all users (%1) inside /var/www/php.net/ can access their homedir
each other.

I do not know if i understand what you mean but i hope no and hope that
i am wrong, so i could hope in a solution :)

Anyway thanks to be interested about my problem.

Waiting for your reply.


Regards

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

Re: [PHP] zipArchive - corrupting files?

2007-03-07 Thread KMiller

Downloaded latest php_zip.dll; fixed!  


KMiller wrote:
> 
> Been playing with this for a few hours and it seems that anything but a
> plain text file (doc,xls,pdf,etc.) is being trashed by ZipArchive. 
> 
> Has anyone had similar experiences or am I just doing something stupid and
> can't see it?
> 
> Whatever the problem is, it certainly is silent about it.  I thought it
> may be a permissions thing but that doesn't seem to be it.  The one file
> it doesn't mess up is a plain text file.  Anything else gets trashed.  
> 
> -km
> 
>   public function zipAction() {
>   $params = SiteControllers::getParams();
>   if(!isset($params['file'])) {
>   echo "zip: file param expected - not found";
>   return false;
>   }
>   $file = $params['file'];
>   if(!file_exists("uploads/{$file}")) {
>   echo "file to zip: {$file} not found";
>   return false;
>   }
>   $zip = new ZipArchive;
>   $res = $zip->open("uploads/{$file}.zip", ZipArchive::OVERWRITE);
>   if ($res === TRUE) {
>   $zip->addFile("uploads/{$file}","{$file}");
>   $zip->close();
>   unlink("uploads/{$file}");
>   echo "{$file} - was zipped";
>   return true;
>   } else {
>   echo "{$file} - zip failed";
>   return false;
>   }
>   }
> 
>   public function unzipAction() {
>   $params = SiteControllers::getParams();
>   $file = $params['file'];
>   if(!isset($params['file'])) {
>   echo "unzip: file param expected - not found";
>   return false;
>   }
>   $zfn = "uploads/{$file}.zip";
>   if(!file_exists($zfn)) {
>   echo "zip file: {$zfn} not found";
>   return false;
>   }
>   if(file_exists("uploads/{$file}")) {
>   echo "file to unzip: {$file} exists";
>   return false;
>   }
>   $zip = new ZipArchive;
>   $res = $zip->open($zfn);
>   if ($res === TRUE) {
>   $zip->extractTo("uploads/");
>   $zip->close();
>   echo "{$file}: unzipped";
>   unlink($zfn);
>   return true;
>   } else {
>   echo "unzip for: {$file} failed";
>   return false;
>   }
>   }
> 
> 

-- 
View this message in context: 
http://www.nabble.com/zipArchive---corrupting-files--tf3359654.html#a9360328
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] PHP Patch open_basedir for dynamic virtualhost

2007-03-07 Thread Jim Lucas

DoM wrote:

Jim Lucas wrote:

http://us3.php.net/manual/en/features.safe-mode.php#ini.open-basedir

Read the first line of the first paragraph.

/tmp/ is not with-in /var/www/php.net/%1 it is out side


Yes, of course i know this :)

As i wrote i would like to include static path after dynamic path like
/var/www/php.net/%1
( i remember you that i know i could assign dynamic open_basedir value
such as /var/www/php.net/%1/ or VIRTUAL_DOCUMENT_ROOT only with Jason
Greene patch)

I mean something like this:
/var/www/php.net/%1/:/tmp/:/usr/local/xxx/ and so on.

does this work?

The manual says it should.




But then read the fifth paragraph and you should have your solution.



If you mean this:
The restriction specified with open_basedir is actually a prefix, not a
directory name. This means that "open_basedir = /dir/incl" also allows
access to "/dir/include" and "/dir/incls" if they exist. When you want
to restrict access to only the specified directory, end with a slash.
For example: "open_basedir = /dir/incl/"


Nope, that was the sixth paragraph.



i tell you that i do not want an open_basedir value just like
/var/www/php.net/%1/ where /var/www/php.net/tmp/ is the answer cause
then all users (%1) inside /var/www/php.net/ can access their homedir
each other.

I did not understand this last statement.

How would you get
/var/www/php.net/tmp/
from
/var/www/php.net/%1/:/tmp/



I do not know if i understand what you mean but i hope no and hope that
i am wrong, so i could hope in a solution :)

Anyway thanks to be interested about my problem.

Waiting for your reply.


Regards





--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different 
strings. But there are times for you and me when all such things agree.


- Rush

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



[PHP] DOM File Permissions

2007-03-07 Thread CK

The following code returns a permisson error:

Quote:
Warning: DOMDocument::save(./save1.xml) [function.DOMDocument-save]:  
failed to open stream: Permission denied in /Users/username/Sites/ 
xmlphp/dom/appendData/appendData.php on line 17

DOMCharacterData->appendData example

I attempted changing the owner of each file to System and read/write  
for each file, with the same result, MAC OS 10.4.8, without success,  
what steps are needed to correct this?


This source returned for the remote server(http://bushidodeep.com/php/ 
dom/appendData/appendData.php):

DOMCharacterData->appendData example



Load('./employee.xml');
//We retreive the attibute named id of the employee element
$employee = $doc->getElementsByTagName('employee')->item(0);
//Create a New element
$newElement = $doc->createElement('surname');
//Create a text node
$textNode = $doc->createTextNode("Text Node Created");
//Append the Text Node into the newly created node.
$newElement -> appendChild($textNode);
//Append the new element to the employee element
$employee -> appendChild($newElement);
//Save the DOMDocument into a file.
$test = $doc->save("./save1.xml");
echo "DOMCharacterData->appendData example"
?>

Return True,

.
PHP
Version 5.1.4

MySQL
Client API version 5.0.19
..

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



Re: [PHP] DOM File Permissions

2007-03-07 Thread Edward Vermillion
PHP needs read/write access to the files. More than likely PHP is  
running as Apache so the files would need to be owned by Apache* (or  
whatever PHP is running at), not System.


*Or at least give the Apache group (or whatever PHP is running at) r/ 
w access, that way you don't have to resort to world r/w.


On Mar 7, 2007, at 1:55 PM, CK wrote:


The following code returns a permisson error:

Quote:
Warning: DOMDocument::save(./save1.xml) [function.DOMDocument- 
save]: failed to open stream: Permission denied in /Users/username/ 
Sites/xmlphp/dom/appendData/appendData.php on line 17

DOMCharacterData->appendData example

I attempted changing the owner of each file to System and read/ 
write for each file, with the same result, MAC OS 10.4.8, without  
success, what steps are needed to correct this?


This source returned for the remote server(http://bushidodeep.com/ 
php/dom/appendData/appendData.php):

DOMCharacterData->appendData example



Load('./employee.xml');
//We retreive the attibute named id of the employee element
$employee = $doc->getElementsByTagName('employee')->item(0);
//Create a New element
$newElement = $doc->createElement('surname');
//Create a text node
$textNode = $doc->createTextNode("Text Node Created");
//Append the Text Node into the newly created node.
$newElement -> appendChild($textNode);
//Append the new element to the employee element
$employee -> appendChild($newElement);
//Save the DOMDocument into a file.
$test = $doc->save("./save1.xml");
echo "DOMCharacterData->appendData example"
?>

Return True,

.
PHP
Version 5.1.4

MySQL
Client API version 5.0.19
..

--
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] help with script needed

2007-03-07 Thread Bruce Gilbert

Thanks for the responses so far.

This is what I have come up with
[php]
";
if ($i%3 == 0) echo "Foo ";
elseif ($i%5 == 0) echo "Bar";
}

?>
[/php]

and the results can be seen here
http://www.inspired-evolution.com/image_test/numbers_output.php

I actually want the Foo and Bar to replace the numbers they are
dereivatives of and not appear below as they are now, and I also need
to add a third condition for "FooBar" which would be for numbers that
are both divisible by 3 and 5.

thanks

On 3/7/07, Martin Marques  wrote:

Tijnema ! escribió:
> On 3/7/07, Bruce Gilbert <[EMAIL PROTECTED]> wrote:
>> I just need to add code to print something different, say "foo" if the
>> output is a multiple of 5 or 10 for example. How do I go about doing
>> this?
>>
>
> I've seen that question a lot, what i use is fairly simple
> if( intval($number / $multiple) == ($number / $multiple ) )
>
> try that

Very bad solution. Try the % operator:

if($number % $multiple == 0)

http://www.php.net/manual/en/language.operators.arithmetic.php

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
Universidad Nacional
 del Litoral
-




--
::Bruce::

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



Re: [PHP] PHP Patch open_basedir for dynamic virtualhost

2007-03-07 Thread DoM
Jim Lucas wrote:
> DoM wrote:
>> I mean something like this:
>> /var/www/php.net/%1/:/tmp/:/usr/local/xxx/ and so on.
> does this work?
> 
> The manual says it should.

And it works for static path like /tmp/:/var/www/: but not for dynamic
path like /var/www/%0/%1 .
I need Jason Greene patch to let it work with dynamic path and
mod_vhost_alias apache.

http://www.phpbuilder.com/lists/php-developer-list/2000101/0994.php


Regards

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

Re: [PHP] DOM File Permissions

2007-03-07 Thread Edward Vermillion
I would bet it's the www, sorry about that. I've had to change the  
user/group name for mine so it will sync up with the linux file  
server permissions across NFS.




On Mar 7, 2007, at 2:56 PM, CK wrote:


Hi,

Thanks, attempted to use appServer without luck, these are the  
choices:




On Mar 7, 2007, at 2:25 PM, Edward Vermillion wrote:

PHP needs read/write access to the files. More than likely PHP is  
running as Apache so the files would need to be owned by Apache*  
(or whatever PHP is running at), not System.


*Or at least give the Apache group (or whatever PHP is running at)  
r/w access, that way you don't have to resort to world r/w.


On Mar 7, 2007, at 1:55 PM, CK wrote:


The following code returns a permisson error:

Quote:
Warning: DOMDocument::save(./save1.xml) [function.DOMDocument- 
save]: failed to open stream: Permission denied in /Users/ 
username/Sites/xmlphp/dom/appendData/appendData.php on line 17

DOMCharacterData->appendData example

I attempted changing the owner of each file to System and read/ 
write for each file, with the same result, MAC OS 10.4.8, without  
success, what steps are needed to correct this?


This source returned for the remote server(http://bushidodeep.com/ 
php/dom/appendData/appendData.php):

DOMCharacterData->appendData example



Load('./employee.xml');
//We retreive the attibute named id of the employee element
$employee = $doc->getElementsByTagName('employee')->item(0);
//Create a New element
$newElement = $doc->createElement('surname');
//Create a text node
$textNode = $doc->createTextNode("Text Node Created");
//Append the Text Node into the newly created node.
$newElement -> appendChild($textNode);
//Append the new element to the employee element
$employee -> appendChild($newElement);
//Save the DOMDocument into a file.
$test = $doc->save("./save1.xml");
echo "DOMCharacterData->appendData example"
?>

Return True,

.
PHP
Version 5.1.4

MySQL
Client API version 5.0.19
..

--
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] help with script needed

2007-03-07 Thread Jake McHenry
Are you only using 3 and 5? just echo 3 and 5 instead of Foo and Bar. and 
for both, just have a 3rd condition including both ... if (($i%3 ==0) && 
($i%5 == 0)) echo both or foobar..


does this help?

Jake


- Original Message - 
From: "Bruce Gilbert" <[EMAIL PROTECTED]>

To: "Martin Marques" 
Cc: "Tijnema !" <[EMAIL PROTECTED]>; "PHP-General" 


Sent: Wednesday, March 07, 2007 4:00 PM
Subject: Re: [PHP] help with script needed



Thanks for the responses so far.

This is what I have come up with
[php]
";
if ($i%3 == 0) echo "Foo ";
elseif ($i%5 == 0) echo "Bar";
}

?>
[/php]

and the results can be seen here
http://www.inspired-evolution.com/image_test/numbers_output.php

I actually want the Foo and Bar to replace the numbers they are
dereivatives of and not appear below as they are now, and I also need
to add a third condition for "FooBar" which would be for numbers that
are both divisible by 3 and 5.

thanks

On 3/7/07, Martin Marques  wrote:

Tijnema ! escribió:
> On 3/7/07, Bruce Gilbert <[EMAIL PROTECTED]> wrote:
>> I just need to add code to print something different, say "foo" if the
>> output is a multiple of 5 or 10 for example. How do I go about doing
>> this?
>>
>
> I've seen that question a lot, what i use is fairly simple
> if( intval($number / $multiple) == ($number / $multiple ) )
>
> try that

Very bad solution. Try the % operator:

if($number % $multiple == 0)

http://www.php.net/manual/en/language.operators.arithmetic.php

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
Universidad Nacional
 del Litoral
-




--
::Bruce::

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




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



Re: [PHP] help with script needed

2007-03-07 Thread Stut

Bruce Gilbert wrote:

Thanks for the responses so far.

This is what I have come up with
[php]
";
if ($i%3 == 0) echo "Foo ";
elseif ($i%5 == 0) echo "Bar";
}

?>
[/php]

and the results can be seen here
http://www.inspired-evolution.com/image_test/numbers_output.php

I actually want the Foo and Bar to replace the numbers they are
dereivatives of and not appear below as they are now, and I also need
to add a third condition for "FooBar" which would be for numbers that
are both divisible by 3 and 5.


Ok, this is commonly known as the FizzBuzz problem and is used a lot as 
a university project or interview question. If you can't do it, be afraid!!


http://dev.stut.net/php/fizzbuzz.php

-Stut

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



Re: [PHP] ldap change password

2007-03-07 Thread Holger Blasum
Hi Fabio,

On 03-07, Fabio Silva wrote:
> Hi all, i would like to know if anybody has a script in php that
> change the password of the users in ldap???
> That the user can do it by yourself

http://logout.sh/computers/ldap/ looks like a starting point.
In that example, however the connection from the web server to 
the ldap server is not encrypted (which might be an issue if the 
webserver is different from the ldap server and you are not 
using ssh tunnelling for the connection), googling ldap_connect and 663 
(the port of LDAP with TLS) gives you other recipes. (For the TLS 
exchange you would also have to generate an X.509 cert, see eg
http://www.guug.de/veranstaltungen/ffg2003/papers/ffg2003-blasum-en.pdf
for essentially the same where python was used in place of php.)

Regards,

-- 
Holger Blasum +49-174-7313590 (cell) GnuPG 1024D/ACDFC3B769DC1ED66B47


signature.asc
Description: Digital signature


[PHP] Monitoring download, detecting completion?

2007-03-07 Thread Skip Evans

Hey all,

I have a need to monitor a download from the 
server to the client's machine.


I'm not familiar with any mechanisms for doing so.

If anyone has any hints to point me towards I'll 
get a' researching.

--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and
versatile PHP/MySQL development framework.
http://phpenguin.bigskypenguin.com/

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



[PHP] Links

2007-03-07 Thread StainOnRug

Hello.. I searched for an answer on the simple quesiton but I am only finding
complex answers... I simply just want to add a link in my database so when
my results display you can see the information.. and when they click the
link it takes them to the webpage of the article. I tried inserting 
examplesite.com User sees this text   but when the results page shows.. it
doesnt show the hyperlink.. Thank you all very much!



  -Darren

   Thanks again!
-- 
View this message in context: 
http://www.nabble.com/Links-tf3366303.html#a9365950
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] php and javascript error

2007-03-07 Thread jekillen


On Mar 7, 2007, at 10:24 AM, Ed Curtis wrote:


Edward Kay wrote:


you've got a stay quote mark in one of your PHP vars.


Not it, I looked and there's nothing there.
I'm sure it's because you've got some stray characters in your output 
that
mess it up. It would help if you actually posted the source rather 
than just

saying it's OK, when it clearly isn't.


The problem wasn't a stray apostrophe. Brad Fuller was dead on. It was 
the space in the window name option of the javascript. It works as 
expected once the space is removed.


PPS: It's advisable not to use the short tags, use of 

Can you tell me why? Is it just a personal preference?
If you move to another server where the short tags option is off, 
your code

will break. From the manual:
Using short tags should be avoided when developing applications or 
libraries
that are meant for redistribution, or deployment on PHP servers which 
are

not under your control


My scripts aren't meant for distribution also they will only ever be 
delpoyed on a server that I control. Thanks for the tip though and 
thanks to everyone that helped.


Ed


This isn't a javascript discussion list but, javascript and php 
compliment each other very well.


Internet Explorer has error reporting that can be turned on in the 
preferences.


I would try that before making any other assumptions.

Believe me, I started developing javascript before php and with no IDE 
for javascript you
'have to rely on the browsers error reporting facilities, and lots of 
alert dialogs used as
break points. Safari on Mac is a head ache because it has no error 
reporting at all and
I have encountered problems with it that do not show up in any of the 
browsers that do

have error reporting.
Hope that helps,
Jeff K

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



Re: [PHP] Links

2007-03-07 Thread fedt

:|

if i want link 3,

$result = mysql_query("SELECT address FROM db.links WHERE link_id=3");
$foo = mysql_fetch_assoc($result);
echo 'this is link 3';

On 3/7/07, StainOnRug <[EMAIL PROTECTED]> wrote:



Hello.. I searched for an answer on the simple quesiton but I am only
finding
complex answers... I simply just want to add a link in my database so when
my results display you can see the information.. and when they click the
link it takes them to the webpage of the article. I tried inserting
examplesite.com User sees this text   but when the results page shows.. it
doesnt show the hyperlink.. Thank you all very much!



  -Darren

   Thanks again!
--
View this message in context:
http://www.nabble.com/Links-tf3366303.html#a9365950
Sent from the PHP - General mailing list archive at Nabble.com.

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





--
|~ fedt ~|


Re: [PHP] db query not working

2007-03-07 Thread David Robley
Satyam wrote:
 
> It is an old guy thing, at least in my case (trivia: I was born the day
> after the ENIAC was turned off)

Young kids these days :-) I was born the month before it was turned _on_!




Cheers
-- 
David Robley

Why do we read left to right yet turn pages right to left?
Today is Boomtime, the 67th day of Chaos in the YOLD 3173. 

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



Re: [PHP] help with script needed

2007-03-07 Thread Jake McHenry

LOL I told'ya I rememberd it from my 2nd semester :)


Ok, this is commonly known as the FizzBuzz problem and is used a lot as a 
university project or interview question. If you can't do it, be afraid!!


http://dev.stut.net/php/fizzbuzz.php

-Stut

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

2007-03-07 Thread Jake McHenry
You have to add the href tags in the html output for the text to be a 
link


in your while statement or whatever your using to obtains the links from the 
database already,


instead of just displaying $link_value, change it to

$link_value


Jake

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

To: 
Sent: Wednesday, March 07, 2007 7:19 PM
Subject: [PHP] Links




Hello.. I searched for an answer on the simple quesiton but I am only 
finding

complex answers... I simply just want to add a link in my database so when
my results display you can see the information.. and when they click the
link it takes them to the webpage of the article. I tried inserting
examplesite.com User sees this text   but when the results page shows.. it
doesnt show the hyperlink.. Thank you all very much!



 -Darren

  Thanks again!
--
View this message in context: 
http://www.nabble.com/Links-tf3366303.html#a9365950

Sent from the PHP - General mailing list archive at Nabble.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] Problem with APC

2007-03-07 Thread steve

Hi,

I upgraded to PHP 4.4.6 and APC 3.0.13 at the same time. Every day at
some point, it starts having a problem and the load on that machine
styrockets.

It does not happen with the opcode cache in Zend Platform for PHP 4.4.6.

Also, in the error log I see a lot of things like this:

[apc-warning] GC cache entry 'path_to_file.php' (dev=64768 ino=0) was
on gc-list for 4590172 seconds

Any ideas?

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



[PHP] Is there a way to un include a file

2007-03-07 Thread jekillen

Hello;
Is there a way to un include a file once it has been included in a 
script.

My concern is where two php files might be included in another php
file they might have code or variables that conflict. I am thinking
of including files with different names but follow the same pattern
of code and variables but may have different values for variables
or different versions of the same function.
If there is not a specific function for un including a file (I have not
seen any indication from my text books that there is), it seems like
it would be nice to have one.
Meanwhile I will be doing some experimentation.
Thanks in advance;
Jeff K

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



Re: [PHP] Is there a way to un include a file

2007-03-07 Thread Børge Holen
On Thursday 08 March 2007 07:18, jekillen wrote:
> Hello;
> Is there a way to un include a file once it has been included in a
> script.

You seems to want the wrong thing... 

I could be mistaken, but from my point of view you would NOT include the file 
if not apropriate at that moment. 


> My concern is where two php files might be included in another php
> file they might have code or variables that conflict. I am thinking
> of including files with different names but follow the same pattern
> of code and variables but may have different values for variables
> or different versions of the same function.
> If there is not a specific function for un including a file (I have not
> seen any indication from my text books that there is), it seems like
> it would be nice to have one.
> Meanwhile I will be doing some experimentation.
> Thanks in advance;
> Jeff K

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

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



Re: [PHP] Is there a way to un include a file

2007-03-07 Thread Tijnema !

AFAIK there's no function to un include a file, but i don't see a problem
here, as when you include your second file, everything (all conflicting
variables) will be overwritten.
If you still have problems, you might want to use classes around your
functions and variables.

Tijnema


On 3/8/07, jekillen <[EMAIL PROTECTED]> wrote:


Hello;
Is there a way to un include a file once it has been included in a
script.
My concern is where two php files might be included in another php
file they might have code or variables that conflict. I am thinking
of including files with different names but follow the same pattern
of code and variables but may have different values for variables
or different versions of the same function.
If there is not a specific function for un including a file (I have not
seen any indication from my text books that there is), it seems like
it would be nice to have one.
Meanwhile I will be doing some experimentation.
Thanks in advance;
Jeff K

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




Re: [PHP] Monitoring download, detecting completion?

2007-03-07 Thread Tijnema !

Hi,

I think that cURL would do the job, starting the transfer with
curl_init ,curl_setopt and curl_exec
then you can get the info about the download with curl_getinfo
Also take a look at the other curl functions, and have a look at the
curl_setopt function page, as there are a lot of options that can be set.
cURL: http://www.php.net/curl

Hope this is what you need.

Tijnema


On 3/8/07, Skip Evans <[EMAIL PROTECTED]> wrote:


Hey all,

I have a need to monitor a download from the
server to the client's machine.

I'm not familiar with any mechanisms for doing so.

If anyone has any hints to point me towards I'll
get a' researching.
--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and
versatile PHP/MySQL development framework.
http://phpenguin.bigskypenguin.com/

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




Re: [PHP] php and javascript error

2007-03-07 Thread Tijnema !

Just a little side note, you said that firefox wasn't giving an error, i
think it does, but that it hides the error.
Open your page, and then go to Tools->javascript console.
There it will display all javascript errors. And gives a nice detailed
error.

Tijnema


Re: [PHP] Is there a way to un include a file

2007-03-07 Thread Larry Garfield
No there is not, because an included file *executes* at the time it is 
included and is then done.  Any memory-resident objects (function/class 
definitions, variables, etc.) that it defies then exist until you make them 
un-exist (with unset() for variables or, well, you can't with functions and 
classes AFAIK).  

Include files are libraries.  They are not functions.  What you're looking for 
is a function.  Don't try to use include files as functions.  Therein lies 
pain.  

On Thursday 08 March 2007 12:18 am, jekillen wrote:
> Hello;
> Is there a way to un include a file once it has been included in a
> script.
> My concern is where two php files might be included in another php
> file they might have code or variables that conflict. I am thinking
> of including files with different names but follow the same pattern
> of code and variables but may have different values for variables
> or different versions of the same function.
> If there is not a specific function for un including a file (I have not
> seen any indication from my text books that there is), it seems like
> it would be nice to have one.
> Meanwhile I will be doing some experimentation.
> Thanks in advance;
> Jeff K

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

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