[PHP] security risk by using remote files with include(); ?

2006-03-23 Thread Merlin

Hi there,

I am wondering if I am opening a potential security risk by
including files on remote servers. I am doing an include 
('http:/www.server.com/file.html') inside a php script of mine

to seperate content from function. Content is produced by a friend of mine and
I do not want to grant access to my server to him.

If including  into his file, I do get the info of php and
I believe it is the phpinfo of my server. Also I am not quit sure.

That lets me believe that he could write now any php code which would be 
ececuted on my server. Is that right? And if yes, what can I do against it?


Merlin

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



Re: [PHP] Parents constructor

2006-03-23 Thread Pham Huu Le Quoc Phuc
I want to execute polymorphism.

- Original Message -
From: "Robert Cummings" <[EMAIL PROTECTED]>
To: "Pham Huu Le Quoc Phuc" <[EMAIL PROTECTED]>
Cc: "Peter Lauri" <[EMAIL PROTECTED]>; "PHP-General"

Sent: Friday, March 24, 2006 2:01 PM
Subject: Re: [PHP] Parents constructor


> On Fri, 2006-03-24 at 01:48, Pham Huu Le Quoc Phuc wrote:
> > In PHP, I can do the flowing code:
>
> What you mean to say is that in PHP5 and only in PHP5 can you use
> interfaces... and that would only be true if the following code were
> correct.
>
> >  interface A
> > {
> >   function Get();
> > }
> >
> > class B extends A
> > {
> >function Get()
> >   {
> > echo "class B";
> > }
> > }
> >
> > class C extends A
> > {
> >echo "class C";
> > }
>
> I'm very sure that the above class definition will generate a parse
> error... and correct me if I'm wrong (I'm not by the way), but don't you
> need to implement an interface versus extending it?
>
> > $a = new B();
> > $a->Get();
> > $a = new C();
> > $a->Get();
> >
> > result:
> > Class B
> > Class C
>
> At any rate, I fail to see the point of your response in relation to the
> OP's question.
>
> 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] Parents constructor

2006-03-23 Thread Robert Cummings
On Fri, 2006-03-24 at 01:48, Pham Huu Le Quoc Phuc wrote:
> In PHP, I can do the flowing code:

What you mean to say is that in PHP5 and only in PHP5 can you use
interfaces... and that would only be true if the following code were
correct.

>  interface A
> {
>   function Get();
> }
> 
> class B extends A
> {
>function Get()
>   {
> echo "class B";
> }
> }
> 
> class C extends A
> {
>echo "class C";
> }

I'm very sure that the above class definition will generate a parse
error... and correct me if I'm wrong (I'm not by the way), but don't you
need to implement an interface versus extending it?

> $a = new B();
> $a->Get();
> $a = new C();
> $a->Get();
> 
> result:
> Class B
> Class C

At any rate, I fail to see the point of your response in relation to the
OP's question.

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] Parents constructor

2006-03-23 Thread Pham Huu Le Quoc Phuc
In PHP, I can do the flowing code:

 interface A
{
  function Get();
}

class B extends A
{
   function Get()
  {
echo "class B";
}
}

class C extends A
{
   echo "class C";
}

$a = new B();
$a->Get();
$a = new C();
$a->Get();

result:
Class B
Class C


- Original Message -
From: "Robert Cummings" <[EMAIL PROTECTED]>
To: "Peter Lauri" <[EMAIL PROTECTED]>
Cc: "PHP-General" 
Sent: Friday, March 24, 2006 12:57 PM
Subject: Re: [PHP] Parents constructor


> On Fri, 2006-03-24 at 00:40, Peter Lauri wrote:
> > Hi,
> >
> > I have a class B that extends class A. I want to call constructor of A
> > correctly, how to do that. This is how I tried:
> >
> > Class B extends A {
> > Function B($Bvariable) {
> > Parent::A($Bvariable);
> > }
> >
> > }
> >
> > Class A {
> > Function A($Avariable) {
> > Dostuff...
> > }
> > }
> >
> > It does not seem correct, maybe I am correct, but I do not feel correct.
>
> 
> Class A
> {
> function __construct( $Avariable )
> {
> // Do stuff...
> }
>
> function A( $Avariable )
> {
> $this->__construct( $Avariable );
> }
> }
>
> Class B extends A
> {
> function __construct( $Bvariable )
> {
> parent::__construct( $Bvariable );
> }
>
> function B( $Bvariable )
> {
> $this->__construct( $Bvariable );
> }
> }
>
> ?>
>
> 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Parents constructor

2006-03-23 Thread Robert Cummings
On Fri, 2006-03-24 at 00:40, Peter Lauri wrote:
> Hi,
> 
> I have a class B that extends class A. I want to call constructor of A
> correctly, how to do that. This is how I tried:
> 
> Class B extends A {
>   Function B($Bvariable) {
>   Parent::A($Bvariable);
>   }
> 
> }
> 
> Class A {
>   Function A($Avariable) {
>   Dostuff...
>   }
> }
> 
> It does not seem correct, maybe I am correct, but I do not feel correct.

__construct( $Avariable );
}
}

Class B extends A
{
function __construct( $Bvariable )
{
parent::__construct( $Bvariable );
}

function B( $Bvariable )
{
$this->__construct( $Bvariable );
}
}

?>

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] HTTPS with NuSOAP

2006-03-23 Thread Peter Lauri
[snip]
>
> 'account'=>'theaccountnumber',
>
> 'role internalId="theinternalid"'=>''));

Does that work to set the attribute?
[/snip]

You are correct, that does NOT work. I found out to use soapval instead.

Thank you!

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



[PHP] Parents constructor

2006-03-23 Thread Peter Lauri
Hi,

I have a class B that extends class A. I want to call constructor of A
correctly, how to do that. This is how I tried:

Class B extends A {
Function B($Bvariable) {
Parent::A($Bvariable);
}

}

Class A {
Function A($Avariable) {
Dostuff...
}
}

It does not seem correct, maybe I am correct, but I do not feel correct.

/Peter

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

Re: [PHP] PHP and Connection: Close

2006-03-23 Thread Jon Anderson

Richard Lynch wrote:

I *think* both client and server have to agree/support keep-alive, and
both have to be ready for the other guy to close the connection even
though they agreed in advance to keep-alive.

So you can use keep-alive, and it can work nifty, but ya gotta be
ready for the server/client to claim to support keep-alive and they're
gonna send you a close, and you gotta do the right thing.
  

Yep, all true.

I found the root of the problem. Much simpler than I'd imagined... Turns 
out that Debian Sarge puts the following entry in 
/etc/apache2/mods-available/mod_ssl.conf:



...
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ...
...


Unfortunately, that SetEnvIf line seems to disable keepalives in http 
_and_ https, so long as mod_ssl is loaded - IMHO, it should be in the 
vhost...


jon

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



Re: [PHP] PHP / Query trouble

2006-03-23 Thread PHP Mailer

Chris skrev:

PHP Mailer wrote:

Jay Blanchard skrev:


[snip]
User i am running is locally granted all in permission.
Using reply =)
[/snip]

Use reply-all, that way if the person that was helping you is not there
any more others can help.
Echo the query statement out and see what it looks like. Please post
that to the list.



  


Jay,
Sure thing, my apologies.

Notice, the error comes with all checkboxes checked (all values 
passed etc), if only one box checked the error will only occur for 
that box.



You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use 
near ''define'' at line 1You have an error in your SQL syntax; check 
the manual that corresponds to your MySQL server version for the 
right syntax to use near ''general'' at line 1You have an error in 
your SQL syntax; check the manual that corresponds to your MySQL 
server version for the right syntax to use near ''track'' at line 
1You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use 
near


Read Jay's suggestion.

After this line:

$optimizeTableQuery = mysql_query("OPTIMIZE TABLE ".$tableName);

add:

echo $optimizeTableQuery . "";

and see exactly what it's trying to do.



Hey Chris,

Solved with Jay's suggestion earlier

Thanks!

- Jimmie

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



Re: [PHP] PHP / Query trouble

2006-03-23 Thread Chris

PHP Mailer wrote:

Jay Blanchard skrev:


[snip]
User i am running is locally granted all in permission.
Using reply =)
[/snip]

Use reply-all, that way if the person that was helping you is not there
any more others can help.
Echo the query statement out and see what it looks like. Please post
that to the list.



  


Jay,
Sure thing, my apologies.

Notice, the error comes with all checkboxes checked (all values passed 
etc), if only one box checked the error will only occur for that box.



You have an error in your SQL syntax; check the manual that corresponds 
to your MySQL server version for the right syntax to use near ''define'' 
at line 1You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use 
near ''general'' at line 1You have an error in your SQL syntax; check 
the manual that corresponds to your MySQL server version for the right 
syntax to use near ''track'' at line 1You have an error in your SQL 
syntax; check the manual that corresponds to your MySQL server version 
for the right syntax to use near


Read Jay's suggestion.

After this line:

$optimizeTableQuery = mysql_query("OPTIMIZE TABLE ".$tableName);

add:

echo $optimizeTableQuery . "";

and see exactly what it's trying to do.


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

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



Re: [PHP] PHP / Query trouble

2006-03-23 Thread PHP Mailer

PHP Mailer skrev:

Jay Blanchard skrev:

[snip]
User i am running is locally granted all in permission.
Using reply =)
[/snip]

Use reply-all, that way if the person that was helping you is not there
any more others can help.
Echo the query statement out and see what it looks like. Please post
that to the list.



  

Jay,
Sure thing, my apologies.

Notice, the error comes with all checkboxes checked (all values passed 
etc), if only one box checked the error will only occur for that box.



You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use 
near ''define'' at line 1You have an error in your SQL syntax; check 
the manual that corresponds to your MySQL server version for the right 
syntax to use near ''general'' at line 1You have an error in your SQL 
syntax; check the manual that corresponds to your MySQL server version 
for the right syntax to use near ''track'' at line 1You have an error 
in your SQL syntax; check the manual that corresponds to your MySQL 
server version for the right syntax to use near



- Jimmie


Jay,

Your the man, solved it by removing all single quotes around the $tableName
original syntax was '".$tableName."' while i removed the quotes to 
'$tableName'

bad habit!

working query:
$query = mysql_query("OPTIMIZE $tableName");

Thanks a bunch dude!

- Jimmie

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



Re: [PHP] PHP / Query trouble

2006-03-23 Thread PHP Mailer

Jay Blanchard skrev:

[snip]
User i am running is locally granted all in permission.
Using reply =)
[/snip]

Use reply-all, that way if the person that was helping you is not there
any more others can help. 


Echo the query statement out and see what it looks like. Please post
that to the list.



  

Jay,
Sure thing, my apologies.

Notice, the error comes with all checkboxes checked (all values passed 
etc), if only one box checked the error will only occur for that box.



You have an error in your SQL syntax; check the manual that corresponds 
to your MySQL server version for the right syntax to use near ''define'' 
at line 1You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use 
near ''general'' at line 1You have an error in your SQL syntax; check 
the manual that corresponds to your MySQL server version for the right 
syntax to use near ''track'' at line 1You have an error in your SQL 
syntax; check the manual that corresponds to your MySQL server version 
for the right syntax to use near



- Jimmie

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



RE: [PHP] PHP / Query trouble

2006-03-23 Thread Jay Blanchard
[snip]
User i am running is locally granted all in permission.
Using reply =)
[/snip]

Use reply-all, that way if the person that was helping you is not there
any more others can help. 

Echo the query statement out and see what it looks like. Please post
that to the list.

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



RE: [PHP] PHP / Query trouble

2006-03-23 Thread Jay Blanchard
[snip]

 [snip]
  

$optimizeTableQuery = mysql_query("OPTIMIZE TABLE
'".$tableName."'");


[/snip]
 
Take the single quotes away from the table name. 
 
http://dev.mysql.com/doc/refman/4.1/en/optimize-table.html
 
Make sure they are the right kind of tables.
 

Tried that already, and same results.
Can't seem to figure this one out. 
Current snippet:
[/snip]

 

Make sure to hit reply all just in case your e-mail goes to a spam
folder. That way others on the list can see and perhaps help.

 

Does the user have permissions to optimize tables?





RE: [PHP] PHP / Query trouble

2006-03-23 Thread Jay Blanchard
[snip]
> $optimizeTableQuery = mysql_query("OPTIMIZE TABLE
> '".$tableName."'");
[/snip]

Take the single quotes away from the table name. 

http://dev.mysql.com/doc/refman/4.1/en/optimize-table.html

Make sure they are the right kind of tables.

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



Re: [PHP] Formatting a Time field

2006-03-23 Thread Richard Lynch
On Thu, March 23, 2006 5:51 pm, Todd Cary wrote:
> I have a field, Start_Time, in a MySQL DB.  Since it is not a
> TimeStamp, I believe I cannot use date(), correct?
>
> I would like to format 09:00:00 to 9:00 AM.
>
> If I convert the 09:00:00 with the strtotime(), I get a couple of
> extra minutes added.

You may be able to convince MySQL to convert it with a function from
http://mysql.com (hint: search for convert) and that might give much
more satisfactory results.

You should also consider biting the bullet and converting the field to
a real 'Time' type.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread Richard Lynch
On Thu, March 23, 2006 7:02 pm, Chrome wrote:
> Another thought: What type of field are you using for this storage?

Another thought he'll have to face eventually, on this insane path of
JPEG in database storage:

What size buffer does PHP <-> MySQL have?

If your JPEG is too big, ka-boom.

Actually, it's more like "silently discard the tail end of my larger
JPEGs, and some images are broken, but it works for small images, what
did I do wrong?"

You'll then need to start messing with BLOB data fields and
special-handling.

Again I say, just put the damn files in the file system where they
belong.

We've been through this whole scenario on this list S many times
it's frightening! :-)

It's like watching the same episode of Twilight Zone over and over and
over.  And not a good episode, either. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] PHP / Query trouble

2006-03-23 Thread Jay Blanchard
[snip]
#--> If submitted
if($_GET['method']=="optimize")
{

#--> Set to array
$allTables = mysql_query("SHOW TABLES");
if(!$query){ print mysql_error(); }
while($table = mysql_fetch_assoc($allTables))
#for($i = 0; $tableName = mysql_fetch_array($allTables);)
{
#--> Walk that array
foreach($table as $dbName => $tableName)
{
#--> Optimize query
$optimizeTableQuery = mysql_query("OPTIMIZE TABLE
'".$tableName."'");
if(!$optimizeTableQuery){ print mysql_error(); }
}   
}
}

anyone?
[/snip]

What, precisely, is the problem? Have you echo'd your query to see what
it looks like? 

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



RE: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread Richard Lynch
On Thu, March 23, 2006 6:42 pm, tedd wrote:
> Hi gang:
>
> Okay, another update:
>
> I tried all sorts of combinations of assorted functions as well as
> reading every source I could find. I won't bore you with the details
> -- but, this is as far as I've gotten.
>
> For storing an image into MySQL I simply used:
>
> $image_large = mysql_real_escape_string($buffer);
>
> Then for displaying the image, I use:
>
> if (get_magic_quotes_gpc())
>   {
>   $fileContent = stripslashes($fileContent);
>   }

This is bass-ackwards...

What you've done is store the data with "double" addslashes() when
MagicQuotes are on, and then you "undo" one of them.

So your data actually in the database has an extra set of slashes on it.

That's not good clean data.

> Remember, both servers show "magic_quotes_gpc" as ON. The only
> difference I see between them is that "magic_quotes_runtime" is ON
> for one server and is OFF for the other -- would that make a
> difference?
>
> What say you now?

Stop confusing the hell out of yourself, and use .htaccess to turn
magic_quotes OFF and magic_quotes_runtime OFF!!!

magic_quotes ==> calls addslashes() on all data in $_POST/$_GET/$_COOKIE
magic_quotes_runtime ==> calls addslashes() on all data from SELECT

So on the server with _runtime on, you need stripslashes, because
magic_quotes_runtime is just plain stupid, unless all your PHP
application does is suck stuff out of one database and insert it in
another.

Actually, even magic_quotes is stupid, because it ends up doing the
addslashes() too soon, and addslashes() is the wrong function to call
these days anyway.

TURN MAGIC OFF!!!

After all the MAGIC settings are off, you can just use
mysql_real_escape_string()

If that does not work, report a bug, and in the short term, use
base64_encode and base64_decode on your data going in/out of the db.

For that matter, stop trying to cram your JPEGs into your database in
the first place, and you'll also be a lot less frustrated.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Advice updating MS Access data to remote MySQL host that only allowslocal access

2006-03-23 Thread Robert Cummings
On Thu, 2006-03-23 at 21:30, Richard Lynch wrote:
> Are you using http://php.net/fgetcsv
> 
> Cuz if you're not, you're gonna go nuts trying to work out the CSV
> minutia
> 
> I think CSV musta been invented by Microsoft.  It's got that MS feel
> to it...

Taint anyways...

http://support.microsoft.com/default.aspx?scid=kb;en-us;323626&Product=xlw

Because nobody would EVER think to put ID in the top left corner
*grumble*. Nice when clients complain that your CSV is buggy because
that's what MS reports when they use excel to view it.

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] PHP / Query trouble

2006-03-23 Thread PHP Mailer

Hello folks,
Trying to grab all tables available in a database and optimize them.
The following code , or rather query is being trouble-some and i am out 
of ideas.



#--> If submitted
if($_GET['method']=="optimize")
{

#--> Set to array
$allTables = mysql_query("SHOW TABLES");
if(!$query){ print mysql_error(); }
while($table = mysql_fetch_assoc($allTables))
#for($i = 0; $tableName = mysql_fetch_array($allTables);)
{
#--> Walk that array
foreach($table as $dbName => $tableName)
{
   #--> Optimize query
   $optimizeTableQuery = mysql_query("OPTIMIZE TABLE '".$tableName."'");
   if(!$optimizeTableQuery){ print mysql_error(); }
}   
}

}



anyone?

- Jimmie

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



Re: [PHP] Howto Execute PHP as script owner/group without CGI?

2006-03-23 Thread Richard Lynch
On Wed, March 22, 2006 1:21 am, Mathijs wrote:
> I Want to know if it is possible to execute PHP(5) as the owner/group
> of
> the script it self.
>
> At the moment saved files get owner and group nobody.
> When i upload through ftp, it gets the normal owner and group nobody.
>
> Is there a way that i can set both owner and group to
> 'myuser-groupname', and let apache or php execute it with that
> owner/group?
>
> I can't use an CGI solution, this becouse the host can't/won't change
> this.

But it's unlikely the host will implement any of the other options
either...

http://www.php.net/manual/en/security.apache.php

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] HTTPS with NuSOAP

2006-03-23 Thread Richard Lynch
On Wed, March 22, 2006 1:41 am, Peter Lauri wrote:
> I am trying to use a Web Service on the following endpoint
> https://webservices.netsuite.com/wsdl/v1_3_1/netsuite.wsdl. As seen in
> the
> url, it is under HTTPS. I have compiled PHP with CURL and verified
> that CURL
> is working. In the documentation for NuSOAP I can not find how I set
> the
> soapclient to transmit via HTTPS.
>
>
>
> This is my code:
>
>
>
> 
> require_once('nusoap/lib/nusoap.php');
>
>
>
> $soapclient = new
>
> soapclient('https://webservices.netsuite.com/wsdl/v1_3_1/netsuite.wsdl');

The 's' in 'https' should be all that nuSOAP would need to know that
it should use SSL, if nuSOAP can do that.

> $login_info = array('passport'=>array(
>
> 'email'=>'myemail',
>
> 'password'=>'mypassword',
>
> 'account'=>'theaccountnumber',
>
> 'role internalId="theinternalid"'=>''));

Does that work to set the attribute?

> $soapclient->call('LoginRequest', $login_info);
>
>
>
> echo '';
>
>
>
> print_r($login_info);
>
>
>
> print_r($soapclient);
>
>
>
> echo '';
>
>
>
> ?>
>
>
>
> The full dump of the soapclient can be seen on
> http://devdws.com/soap/error.htm. This are parts of the dump that I
> think is
> valuable in solving this problem:
>
>
>
> 
>
>
>
> [error_str] => HTTP Error: Unsupported HTTP response status 405
> Method
> Not Allowed (soapclient->response has contents of the response)
>
> [debug_str] => 2006-03-22 10:56:25.644147 soapclient: instantiate
> SOAP
> with endpoint at
> https://webservices.netsuite.com/wsdl/v1_3_1/netsuite.wsdl
>
> 2006-03-22 10:56:25.644283 soapclient: call: operation=LoginRequest,
> namespace=http://tempuri.org, soapAction=, rpcParams=, style=rpc,
> use=encoded, endpointType=soap

I have to wonder how the namespace tempuri.org got involved...

> |
>
> |
>
> |
>
>
>
> [response] => HTTP/1.1 405 Method Not Allowed
>
> Date: Wed, 22 Mar 2006 03:56:26 GMT
>
> Server: Oracle-Application-Server-10g
>
> P3P: CP="CAO PSAa OUR BUS PUR"
>
> Vary: User-Agent
>
> Content-Length: 152
>
> Cache-Control: private
>
> Content-Type: text/html
>
>
>
> 405 Method Not Allowed
>
> HTTP method POST is not supported by this URL

This sounds to me like you've managed to use https/SSL, and are "in"
to the point of logging in, but something has convinced nuSOAP and/or
the WSDL that it should be using POST somewhere, and the server that's
handling the request don't like POST...

So maybe your question is how to get nuSOAP to use GET instead of POST.

Just guessing...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Advice updating MS Access data to remote MySQL host that only allowslocal access

2006-03-23 Thread Richard Lynch


Are you using http://php.net/fgetcsv

Cuz if you're not, you're gonna go nuts trying to work out the CSV
minutia

I think CSV musta been invented by Microsoft.  It's got that MS feel
to it...

On Tue, March 21, 2006 4:19 pm, Brian Anderson wrote:
> The only other thing that I can think to do is to try locally write a
> .sql file and ftp that for updating because MS Excel format csv is
> making me want to kill myself.
>
> -Brian
>
> Brian Anderson wrote:
>> Yeah, I thought of that, but how do I connect to a mdb file on a
>> linux
>> server that doesn't have odbc installed?
>>
>> Brady Mitchell wrote:
 -Original Message-
 I wonder if anyone has any ideas? As I can't just run an update
 locally and connect to the remote MySQL host, I was scheduling a
 periodic export of an access table to csv format, ftping it to the
 server, and then running an update script on the remote host
 (simplehost.com). It just seems convoluted, and frought with
 difficulties. There has to be a easier way to update the
 transaction
 status table?

>>>
>>> First schedule an automatic upload of the .mdb file to the server.
>>> (Not
>>> sure how to do this, google is your friend for this part.)
>>>
>>> Then write a PHP Script that will:
>>>
>>> 1 - Connect to the Access DB and query for the data you need
>>> 2 - Insert that data into the mySQL database
>>>
>>> Then schedule a cron job to run the script at a set time each day
>>> (or
>>> whatever frequency you need).
>>>
>>> Take a look at the ADODB Class (http://adodb.sf.net) for connecting
>>> to
>>> MS Access from PHP.  I used it once for a project where I had to
>>> use an
>>> Access DB and it was actually pretty smooth.  I now use ADODB for
>>> all of
>>> my DB connections. :)
>>>
>>> HTH,
>>>
>>> Brady
>>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Advice updating MS Access data to remote MySQL host that only allowslocal access

2006-03-23 Thread Richard Lynch


You don't.

You run PHP on the Windows box with the mdb file, and set up a way for
the two boxes to talk to each other.

Or you convince somebody somewhere just how bad MS-Access is and
abandon it entirely :-)

On Tue, March 21, 2006 4:05 pm, Brian Anderson wrote:
> Yeah, I thought of that, but how do I connect to a mdb file on a linux
> server that doesn't have odbc installed?
>
> Brady Mitchell wrote:
>>> -Original Message-
>>> I wonder if anyone has any ideas? As I can't just run an
>>> update locally
>>> and connect to the remote MySQL host, I was scheduling a
>>> periodic export
>>> of an access table to csv format, ftping it to the server, and then
>>> running an update script on the remote host (simplehost.com). It
>>> just
>>> seems convoluted, and frought with difficulties. There has to be a
>>> easier way to update the transaction status table?
>>>
>>
>> First schedule an automatic upload of the .mdb file to the server.
>> (Not
>> sure how to do this, google is your friend for this part.)
>>
>> Then write a PHP Script that will:
>>
>> 1 - Connect to the Access DB and query for the data you need
>> 2 - Insert that data into the mySQL database
>>
>> Then schedule a cron job to run the script at a set time each day
>> (or
>> whatever frequency you need).
>>
>> Take a look at the ADODB Class (http://adodb.sf.net) for connecting
>> to
>> MS Access from PHP.  I used it once for a project where I had to use
>> an
>> Access DB and it was actually pretty smooth.  I now use ADODB for
>> all of
>> my DB connections. :)
>>
>> HTH,
>>
>> Brady
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] Advice updating MS Access data to remote MySQL host that only allowslocal access

2006-03-23 Thread Richard Lynch
There is, or used to be, an MS-Access MySQL synchronizer package "out
there"

Haven't seen it mentioned in years now, but maybe I just wasn't paying
attention.

Try searching for it:
info.com/MS-Access MySQL synchronize


On Tue, March 21, 2006 4:00 pm, Brady Mitchell wrote:
>> -Original Message-
>> I wonder if anyone has any ideas? As I can't just run an
>> update locally
>> and connect to the remote MySQL host, I was scheduling a
>> periodic export
>> of an access table to csv format, ftping it to the server, and then
>> running an update script on the remote host (simplehost.com). It
>> just
>> seems convoluted, and frought with difficulties. There has to be a
>> easier way to update the transaction status table?
>
> First schedule an automatic upload of the .mdb file to the server.
> (Not
> sure how to do this, google is your friend for this part.)
>
> Then write a PHP Script that will:
>
> 1 - Connect to the Access DB and query for the data you need
> 2 - Insert that data into the mySQL database
>
> Then schedule a cron job to run the script at a set time each day (or
> whatever frequency you need).
>
> Take a look at the ADODB Class (http://adodb.sf.net) for connecting to
> MS Access from PHP.  I used it once for a project where I had to use
> an
> Access DB and it was actually pretty smooth.  I now use ADODB for all
> of
> my DB connections. :)
>
> HTH,
>
> Brady
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Is there a way to get multiple values for a single input in a form submission?

2006-03-23 Thread Richard Lynch
On Tue, March 21, 2006 4:44 pm, mslemko wrote:
> this is what I am trying to do:
>
> On a web form I might have a select input with multiple selections
> enabled, however I want to have access to the list within PHP after
> submission.
>
> 

For PHP, use name='myselect[]'

Then PHP turns it into an array as it processes it.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP and Connection: Close

2006-03-23 Thread Richard Lynch
I *think* both client and server have to agree/support keep-alive, and
both have to be ready for the other guy to close the connection even
though they agreed in advance to keep-alive.

So you can use keep-alive, and it can work nifty, but ya gotta be
ready for the server/client to claim to support keep-alive and they're
gonna send you a close, and you gotta do the right thing.

On Tue, March 21, 2006 6:31 pm, Jon Anderson wrote:
> Chris wrote:
>> That's the design of http - it's stateless. Each connection is
>> treated
>> separately and as such closes itself when it's finished.
>>
>> If you want to keep it open you'll need to create your own "service"
>> that listens to a port and responds accordingly - which can be quite
>> a
>> lot of work.
>>
>> http://www.php.net/manual/en/ref.sockets.php
>>
> I can easily prove that HTTP can do it: Open a terminal or an SSH
> connection to a unix machine, then type:
> $ telnet  80
> GET / 1.1
> Connection: Keep-Alive
>
> 
> GET / 1.1
> Connection: Keep-Alive
>
> 
> GET / 1.1
> Connection: close
>
> 
>
> Connections are capable of keeping themselves open for multiple
> requests
> - that's what "Connection: close" and "Connection: Keep-Alive" headers
> are for. For example  http://webservices.codingtheweb.com/bin/qotd
> (with
> WSDL http://webservices.codingtheweb.com/bin/qotd.wsdl). If you open a
> connection to that with a soap client, you can make multiple requests
> to
> it. Trace it with ethereal or something, and you'll notice there's
> only
> one TCP connection setup (syn,syn/ack), followed by as many requests
> as
> you want, and eventually one TCP teardown (fin/ack,ack) if you set up
> the soap client to send a close request at some point.
>
> The example script above may not be PHP (I don't have the code, as
> it's
> not mine - just a random example), so for all I know PHP may not be
> capable of such a thing. It may even be a limitation of the web server
> (apache2) or the server's setup. (I just don't know, so that's why I'm
> asking here.)
>
> jon
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP and Connection: Close

2006-03-23 Thread Richard Lynch


httpd.conf search for Keep-alive

Some old old old browsers will puke on it, though, I think...

We're talking like Netscape 2.0 though, as I recall...

I got swiss-cheese memory, so better double-check that. :-)

On Tue, March 21, 2006 5:16 pm, Jon Anderson wrote:
> I've been looking at a problem with our software. It uses Flash with
> SOAP to connect to a PHP backend. It seems to work okay, except that
> at
> the TCP level, the client keeps initiating new connections for every
> soap request rather than using a single connection for multiple
> requests. One possible reason for this is that the server sends a
> "Connection: close" HTTP header after the first request. I've been
> trying to find a way to control this from PHP (or Apache) - anyone
> know
> a way around that kind of thing?
>
> Cheers,
>
> jon
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP 4.3.11, question about classes

2006-03-23 Thread Richard Lynch
On Wed, March 22, 2006 5:27 am, Michael Hulse wrote:
> I am just learning about classes.
>
> My server is running PHP 4.3.11
>
> Example code:
>
> class testing {
>   var $what;
> }
>
> $linkGenClass = new testing();
> $linkGenClass->what = 'hi';
> echo $linkGenClass->what;
>
> Why does the constructor require the "()"?
>
> I have seen many examples via google that do not use "()".

I dunno.

May be version-dependant, or maybe because you didn't define
__constructor nor function testing() as a contructor...

Try adding a constructor function and see what happens.

> Should I worry about capitalizing the first letter of the class?

Try it and see.

Most crucial is to be consistent.

Second most crucial is to just do it the way everybody else does it.

> Can class names have underscores?

That's in the manual, but try it and see.

> Are spaces allowed on either side of the "->"?

In the manual, try it and see.

> Is "var $what" PHP 4 and 5, whereas "public $what" is PHP 5?

Yes.

> Got any good links to class tutorials for PHP 4.3.11?

info.com/PHP OOP tutorial

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Reading data from SELECT in PHP

2006-03-23 Thread Richard Lynch
On Wed, March 22, 2006 6:00 am, Lorca wrote:
> Hello friends,
> I've create a form containing a SELECT under JavaScript, where the
> user
> decide all list's elements.
>
> My problem is how can I get all list's elements on PHP. Using $-POST[]
> I
> only get the selected option.
>
> With my most sincere thanks.

HTTP simply does not anything other than the selected element.

If you need the other elements, and you don't already know them,
they'd have to be sent as another variable in the FORM itself.

If THAT is impossible, because you are trying to "catch" the values
from somebody else's form or something, you could MAYBE use
$_SERVER['HTTP_REFERER'] and file_get_contents() on that and then you
could attempt to parse the HTML, perhaps with HTMLTidy, and, assuming
the browser bothered to send HTTP_REFERER in the first place, you
could maybe mostly sometimes get the values from that...

But if this is a normal situation on your own server, maybe you just
need to restructure things so that your options list is in an include
file that both the form display script and the form processing script
can include.

Or, maybe, the list of potential inputs should be in your database so
that you can easily modify it -- That's true for many sites built by
beginners.

Just some ideas for you to consider.

Bottom line, HTTP ain't gonna send it to you, so it's up to you to get
it somehow.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Creating a Window without JavaScript that is on top

2006-03-23 Thread Richard Lynch
On Wed, March 22, 2006 1:23 pm, Todd Cary wrote:
> Is there a way to create a Window that is like the Help or Popup
> type windows one can create with JavaScript?
>
> I have an event calendar and I want the link for the event to go
> to a PHP page, but I want the page to be on top and have focus
> with a Close button.  The PHP page will have some PHP code that
> will display the data passed by the GET var.

You can use PHP to echo out JavaScript to popup a window that has a
URL back to a PHP script, and pass whatever you want into the GET
paramaters of that URL...

But this actually has almost NOTHING to do with PHP per se.

PHP lives on the server.  Period.

PHP code never executes or does anything in the browser.  Period.

By the time you want to popup your window, PHP is *gone* from the
process -- It has already served up the HTML, finished its output, and
gone back to bed.

Examine the HTTP process of URL request, and response, and browser
display, and pretend you have a slow-motion camera in your head --
Repeat this until you understand why your question doesn't even really
belong here.

Cuz you're gonna save yourself (and us) a lot of grief in coming
days/months/years if you do, and you're gonna be very frustrated if
you don't.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] pulling in template file in var and populating vars?

2006-03-23 Thread Richard Lynch
On Wed, March 22, 2006 3:02 pm, blackwater dev wrote:
> I have a chunk of html data that I want to output for each iteration
> through
> a db result
>
> while($result){
>
>$list.=file_get_contents("my_template_file.php");
>
> }
> return $list;
>
> The template file looks like this:
>
> 
> 
>  
> 
> 
>
> I basically want a good way to keep the template file out of the class
> so I
> don't have to code:
>  $list.="...etc
>
> The problem is with the method I have, it doesn't translate the
> vars...what's the best way to do this?

You have a home-brew templating engine, and you've run into the EXACT
SAME problem every other templating engine has ever had...

So you REALLY ought to look at how Smarty solved it, how PEAR solved
it, how all the other templating engines solved it.

Be Warned:
You're going to go for awhile, and then run into ANOTHER problem which
is the EXACT SAME problem every other PHP Template author has hit.

And you're going to REPEAT this process indefinitely...

Maybe this is a case where re-inventing the wheel is a Bad Idea.

At a minimum, you ought to understand very well how all the other
wheels work, and don't work -- which it is clear from the question
that you don't.

Keep on rollin' :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Formatting a Time field

2006-03-23 Thread Tom Rogers
Hi,

Friday, March 24, 2006, 9:51:48 AM, you wrote:
TC> I have a field, Start_Time, in a MySQL DB.  Since it is not a 
TC> TimeStamp, I believe I cannot use date(), correct?

TC> I would like to format 09:00:00 to 9:00 AM.

TC> If I convert the 09:00:00 with the strtotime(), I get a couple of 
TC> extra minutes added.

TC> Suggestions are welcomed

TC> Todd


use gmdate() to do the formatting. in strtotime you should give a date something
like
$ftime = gmdate('h:i A',strtotime("2000-01-01 $Start_Time"));

-- 
regards,
Tom

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



Re: [PHP] GD Library or PHP Function

2006-03-23 Thread Richard Lynch
On Wed, March 22, 2006 9:18 pm, brian dichiara wrote:
> Is there a way to check to see if a JPEG or PDF is color or
> black/white?
> Like a function or something?

There does not appear to be a built-in function that does that...

However, this hack should work:

function image_is_color($image){
  for ($x = 0, $xmax = imagesx($image); $x < $xmax; $x++){
for ($y = 0, $ymax = imagesy($image); $y < $ymax; $y++){
  $index = imagecolorat($image, $x, $y);
  list($r, $g, $b) = imagecolorsforindex($image, $index);
  //If all images are TrueColor, the preceding can be replaced with
  // $r = ($index >> 16) & 0xFF;
  // $g = ($index >> 8) & 0xFF;
  // $b = $index & 0xFF;
  // because in TrueColor the index is just the 24-bit color value
  if ($r != $g || $g != $b) return true;
  // You could add || $r != $b, but it's a tautology, no???
}
  }

  //If we made it here, EVERY damn pixel has R==G==B, so it's grayscale
  return false;
}

NOTE:
This is NOT going to be fast, especially for large images, especially
for large gray-scale images, in which EVERY pixel will get checked
before we know it's grayscale.

If you have MOSTLY grayscale images and a few color, switch around the
true/false and the test and make it is_grayscale() so you can bail out
MUCH faster, when the first few pixels prove an image is NOT what you
usually have.

You could also set up a multi-threaded environment and run is_color
and is_grayscale and then time-out the one that takes forever...  This
might be best if you have humoungous images and you are checking them
in a cron job or something.

Still, if you have an image that's all grayscale, and only the
top-right corner is color, or vice versa, you're gonna wait a long
time...

H.

If it's NOT a TrueColor image, and imagecolorstotal() returns a
"small" number, then you could MUCH faster just do:

function is_color($image){
  for ($index = 0, $total = imagecolorstotal($image); $index < $total;
$index++){
list($r, $g, $b) = imagecolorsforindex($image, $index);
if ($r != $g || $g != $b) return true;
  }
  return false;
}

Which then makes me think that maybe you should do:
function is_color($image){
  $xmax = imagesx($image);
  $ymax = imagesy($image);
  $count = imagecolorstotal($image);

  if ($count > ($xmax * $ymax)){
//call my first version, cuz the image is 'small' in x/y size
  }
  else{
//call my second version, cuz the image has few colors in palette
  }
}

Some benchmarks could be done to refine the test that chooses between
the function bodies -- If imagecolorsforindex() is inherently
slower/faster than imagecolorat() + bit-shifting, then you'd want to
factor in the speed difference.

Have fun!

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread Chrome
[snip author="Michael Crute"]
I would base64encode the image string before puting it into the database
then you would probably not run in to quoting issues.
[/snip]

Have you tried this?

I realise a base64 increases the size of the target but it recognised as the
best way of storing an image in a DB

Apologies if this has already been restated :)

Another thought: What type of field are you using for this storage?

Dan

 
---
http://chrome.me.uk
 
-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: 24 March 2006 00:42
To: php-general@lists.php.net
Subject: RE: [PHP] Why does this work on one server, but not another?

Hi gang:

Okay, another update:

I tried all sorts of combinations of assorted functions as well as 
reading every source I could find. I won't bore you with the details 
-- but, this is as far as I've gotten.

For storing an image into MySQL I simply used:

$image_large = mysql_real_escape_string($buffer);

Then for displaying the image, I use:

if (get_magic_quotes_gpc())
{
$fileContent = stripslashes($fileContent);
}

This now works for the server that didn't work before. However, the 
other server now doesn't show an image unless I comment out 
stripslashes($fileContent) statement -- and then it works. So, I have 
found solutions for both servers, just not one solution that works 
for both servers.

Remember, both servers show "magic_quotes_gpc" as ON. The only 
difference I see between them is that "magic_quotes_runtime" is ON 
for one server and is OFF for the other -- would that make a 
difference?

What say you now?

tedd
-- 


http://sperling.com

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


__ NOD32 1.1456 (20060323) Information __

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

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



Re: [PHP] mail link problem with php echo statement

2006-03-23 Thread Richard Lynch




On Wed, March 22, 2006 10:29 pm, Mark wrote:
>
> How can i make this email from a database a hyperlink so it doesnt
> show the
> email address--i have tried many things but i keep getting errors. At
> the
> moment it just shows the email (no link)
> thanks
>
>
>
>  //get comp_id
> $query = mysql_query("SELECT * FROM comps WHERE name = '$comp_name'");
> $result = mysql_fetch_array($query);
>
> $comp_id = $result['id'];
> $joinfee = $result['joinfee'];
> $email = $result['email'];
>
> ?>
>
> Administrator email[]

echo "mailto:$email\";>whatever";


If you want to stop email harvesters, you can do:
$email = str_replace('@', '@', $email);
echo "mailto:$email\";>whatever";


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Atrributes and NuSOAP

2006-03-23 Thread Richard Lynch
Save yourself a ton of grief and upgrade to PHP5 + SOAP... :-^

On Thu, March 23, 2006 1:23 am, Peter Lauri wrote:
> Hi,
>
> I have been trying to find a simple example of how to add attributes
> to the
> requests, but after two days search I can not find an example. The
> $param is
> easy to create if it does not contain any attributes. This is what I
> want to
> create, but the internalId is giving me troubles:
>
> ---
> 
>
>   
>  [EMAIL PROTECTED]
>  Cracker1
>  11
>  
>   
>
> 
> ---
>
> So I started:
> $param = array(
>   'passport'=>array(
> 'email'=>'[EMAIL PROTECTED]',
> 'password'=>'Cracker1',
> 'account'=>'111',
> //But here I have no clue what to write
>   )
> );
>
> Maybe the reason is that you can not do that with NuSOAP, but I am a
> newbie
> so I have no clue.
>
> Best regards,
> Peter Lauri
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread tedd

Hi gang:

Okay, another update:

I tried all sorts of combinations of assorted functions as well as 
reading every source I could find. I won't bore you with the details 
-- but, this is as far as I've gotten.


For storing an image into MySQL I simply used:

$image_large = mysql_real_escape_string($buffer);

Then for displaying the image, I use:

if (get_magic_quotes_gpc())
{
$fileContent = stripslashes($fileContent);
}

This now works for the server that didn't work before. However, the 
other server now doesn't show an image unless I comment out 
stripslashes($fileContent) statement -- and then it works. So, I have 
found solutions for both servers, just not one solution that works 
for both servers.


Remember, both servers show "magic_quotes_gpc" as ON. The only 
difference I see between them is that "magic_quotes_runtime" is ON 
for one server and is OFF for the other -- would that make a 
difference?


What say you now?

tedd
--

http://sperling.com

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



Re: [PHP] undefined function error with lost password script

2006-03-23 Thread Richard Lynch

In incredibly ancient versions of PHP, you needed to have the:

function foo () { ... };

appear BEFORE you called it.

GOOD:
function foo () { return 'foo'};
foo();

BAD:
foo();
function foo() { return 'foo'};

It's remotely possible that you need to upgrade in a big way.

You can do a quick hack short-fix by moving the function definition
higher up in the source code, but not upgrading is not an option if
that's the root cause.

Maybe you need a refund... :-v


On Thu, March 23, 2006 1:35 am, Mark wrote:
> Can anyone see a problem with this at a glance. I think i have pushed
> my
> luck with this forum ( inc. Chris)of late but i paid a lot of money
> for this
> script and it has a few bugs.
>
> THis is what i get returned---
> Fatal error: Call to undefined function: recover_pw() in
> /home/realt905/public_html/lost_pw.php on line 70
>
> where line 70 is : recover_pw($_POST['email_address']);
>
>
> 
>  include("connect.php");
>
> if (isset($_POST['Submit'])) {
>
>  $comp_name = $_POST['comp_name'];
>  //get comp id
>  $sql = "SELECT id FROM comps WHERE name = '$comp_name'";
>  $query = mysql_query($sql);
>  $result = mysql_fetch_array($query);
>  $comp_id = $result['id'];
>  recover_pw($_POST['email_address']);
>
>  function recover_pw($email_address){
>
>   if(!$email_address){
> ?>
>
> Lost
> Password
>Back  |Main
> Site
>   echo "You forgot to enter your email address!";
>include("lost_pw_retry.php");
>exit();
>   }
>
>   // check to see if record exists
>   $sql_check = mysql_query("SELECT * FROM users WHERE
> email_address='$email_address' AND comp_id = $comp_id");
>   $sql_check_num = mysql_num_rows($sql_check);
>   if($sql_check_num == 0){
>   ?>
>
> Lost
> Password
>Back  |Main
> Site
>   echo "No records found matching your email address";
>include ("lost_pw_retry.php");
>exit();
>  }
>
>  // Generate password, update it and send it
>
>  function makeRandomPassword() {
>   $salt = "abchefghjkmnpqrstuvwxyz0123456789";
>   $pass = "";
>   srand((double)microtime()*100);
>   $i = 0;
>   while ($i <= 7) {
> $num = rand() % 33;
> $tmp = substr($salt, $num, 1);
> $pass = $pass . $tmp;
> $i++;
>   }
>   return $pass;
>  }
>
>  $random_password = makeRandomPassword();
>
>  $db_password = md5($random_password);
>
>  $sql = mysql_query("UPDATE users SET password='$db_password' WHERE
> email_address='$email_address' and comp_id = $comp_id");
>
>  $subject = "$comp_name - password reset";
>  $message =
>
>  "Hi, we have reset your password.
>
>  New Password: $random_password
>
>  To Login: $address/login_user.php?name=$comp_name
>
>  Thanks!
>
>  Admin
>
>  This is an automated response, please do not reply!";
>
>  mail($email_address, $subject, $message, "From:
> Admin<$fromemailaddress>\nX-Mailer: PHP/" . phpversion());
>  ?>
>   
> Lost
> Password
>   Back  |Main
> Site
>echo "Your new password has been sent. Please check
> your
> email.";
>  }
>
> } else {
>
> $comp_name = $_GET['name'];
>
> ?>
>  Lost
> Password
> Back  |Main
> Site
> 
>align="center">
>   
> 
> Email
> size="50">
> 
> 
>   
>
>
> 
>   
> 
>  }
> include("footer.html");
> ?>
>
> 
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Switching to UTF-8. Need help.

2006-03-23 Thread Richard Lynch
Check the HEADERS your web-server is sending.

If they don't have Charset UTF-8 in there, it won't work on REAL
browsers (Mozilla based)

Then, for reasons known only to Microsoft, you have to use a META tag
to define the Charset for IE.

MS will *ignore* the headers in favor of a heuristic whereby they
count the number of characters in any given document which do/don't
fit into various common charsets, and then they choose the charset
based on that.

Apparently, MS assumes that web-designers who can only handle META
tags are smarter than developers who use header() function.  Go
figure. :-^



On Thu, March 23, 2006 10:13 am, Andy wrote:
> Hi to all,
>
> We are developing a multilanguage application, and slowly it seems
> that the Latin1(ISO 5589 1) encoding is not enough.
> I tried simply to convert the database and the encoding of the php to
> UTF-8, but I'm getting some problems.
>
> If I make an echo 'möbel, Belgien' the browser does not show me the
> correct character. If I look in the source of the document the
> character is good. Default encoding of the browser is UTF-8. If I
> change manually the browser encoding then the chars are showed
> correclty.
>
> We have a lot of "defines" with fix texts, which are full with german
> and french characters. Any of these aren't shower correctly.
>
> What is the workaround for this?
>
> Best regards,
> Andy.


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] help with smarty+cms

2006-03-23 Thread Richard Lynch
On Thu, March 23, 2006 11:28 am, ganu wrote:
> Hello all,
>
> I worked with one site and now is working fine with smarty.
> Now I want to implement the CMS in that,
> I went thru the link http://smarty.php.net/resources.php?category=2
>
> now I want a CMS so my existing site looks as it is and with some or
> lot of
> changes
> I can implement CMS in that.
>
> somy body has faced the same situation then plz giude me..
> [ after everything I want to implement the CMS :( ]
>
> any CMS so I can start work on that...

You can try out a BUNCH of different CMS systems here:
http://www.opensourcecms.com/

YMMV


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread Richard Lynch
You're putting RAW data into MySQL, and not escaping it.

That's a really Bad Idea.

You should probably be using http://php.net/mysql_real_escape_string
on the JPEG before you try to cram it into MySQL.

If that still fails, you could http://php.net/base64 encode it or
something similar to get it into 'safe' characters that MySQL won't
choke on.

That said...

You really should consider using a highly-optimized large-sized-data
custom piece of wonderful software that's really MUCH better for
storing, managing, and retrieving JPEGs than MySQL...

It's called:  "the file system"

You're almost for sure NOT using any real MySQL features on your JPEG
data.  It's not indexed for speed of retrieval based on raw bytes. 
It's not something you're going to search through the raw bytes for
eye color.  MySQL will RARELY (and only for tiny files) be any faster
than the file system for retrieval.  So you're just clogging up your
database with this massive chunk of data for no real reason.

On Thu, March 23, 2006 11:47 am, tedd wrote:
> Hi gang:
>
> I posted this question to a MySQL list, but
> apparently it stumped them. So, I'll ask here:
>
> On one server, the following code works without any problems
> whatsoever:
>
> --- quote ---
>
> $sqlString = "INSERT INTO $dbtable (id,
> image_type, image_large, image_small,
> image_width, image_height, image_name,
> image_size, date_time, date_created )
> VALUES ('', '{$type}', '{$image_large}',
> '{$image_small}', '{$width}',
> '{$height}','{$name}', '{$size}', '{$date_time}',
> '{$date_created}')";
> $result = mysql_query($sqlString)  or die("2.
> Error in query $sqlString " . mysql_error());
>
> --- un-quote ---
>
> However, on another server, it doesn't (remember
> the code is identical for both).
>
> I have looked at the PHP Info on both servers,
> the php versions are different (4.3.10 v 4.4.2)
> but the mysql specifics are identical except the
> version differs slightly (v 4.1.15 v 4.1.14).
>
> A clue, on the server it chokes on, if I reduce
> the image size to 100 x 67 pixels, it will work.
> However, if the image is 150 x 100 pixels, or
> greater, it will crater.
>
> The error message is:
>
> 2. Error in query INSERT INTO as_table2 (id,
> image_type, image_large, image_small,
> image_width, image_height, image_name,
> image_size, date_time, date_created ) VALUES ('',
> 'image/jpeg', 'ÿØÿà\0JFIF\
> -snip- (the entire text file for the image)
> 'v_small.jpg', '32', '2006-03-22 14:10:55',
> '2006-03-22 14:10:55') You have an error in your
> SQL syntax; check the manual that corresponds to
> your MySQL server version for the right syntax to
> use near
> 'ö~?L-?æÏôÏjâ?(xÏJ?÷Ý>ԔsíHñåE(?êÏØʍÜ"ÁíÎkiË3¬4A''ÿ\0?Mm¿ä÷´?ÿ\0mÿ\0&¿'
> at line 2
>
> Any ideas?
>
> Many thanks in advance.
>
> tedd
> --
> 
> http://sperling.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] switching between admin areas on two domeins with one login?

2006-03-23 Thread Richard Lynch
On Thu, March 23, 2006 2:58 pm, Warren Vail wrote:
> I think the key to your problem is finding a way that the two domains
> can
> share information, do these domains have access to the same physical
> disk
> space, or a common database?  You can use the your own save handler
> routines to give them both access to the same area (database may work
> the
> best), so that when they create, write, and retrieve session data,
> both
> websites are using the same session data.
>
> http://www.php.net/manual/en/function.session-set-save-handler.php
>
> If they are in the same "virtual" server machine, you may be able to
> do
> something with a common file area, but this could prove risky,
> security
> wise, I would suggest the common database approach.  A lot of good
> books
> have writeups on how to change these routines to store session data in
> a
> mysql database.

But to transfer the session_id from domain A to domain B, you will
have to pass it in the data...

Actually, if it's all via SSL, you'd be okay -- The session_id you are
transferring would then be safely transmitted.

But if you're not using SSL, it's probably a "no go"

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] switching between admin areas on two domeins with one login?

2006-03-23 Thread Richard Lynch
On Thu, March 23, 2006 2:34 pm, [EMAIL PROTECTED] wrote:
> have two domains and each domain has it's own admin registered areas.
> Have
> to allow people who registered to change domains and areas without
> login
> again?
> On reg. areas, after login, create sess_id to check if visitor is
> logged
> in, but sess_ids on domains are different and can't compare them?

You'll need to have SOME shared data between the two domains.

Perhaps you could have a table in the database, for example, with
username and current sess_id on each site.

In your link to the "other" site, you'd embed their username and the
sess_id on the "current" site, and pass it on to the other site.

The HORRIBLE weakness here is that ANYBODY could intercept that
sess_id and break into the "other" site.

So, it's do-able, it's just not secure!

The sess_id's are different because domains cannot share Cookies. 
SUB-domains can share cookies, however.

So if the admin sections can both be put on foo.example.com and
bar.example.com, the cookie can be set to example.com, and foo and bar
can share it (I think).

Here's the thing:  Almost anything I can think of that you can do to
make it easy for the user to login between admin applications, will
make the admin applications inherently insecure.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Formatting a Time field

2006-03-23 Thread Todd Cary
I have a field, Start_Time, in a MySQL DB.  Since it is not a 
TimeStamp, I believe I cannot use date(), correct?


I would like to format 09:00:00 to 9:00 AM.

If I convert the 09:00:00 with the strtotime(), I get a couple of 
extra minutes added.


Suggestions are welcomed

Todd

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



Re: [PHP] switching between admin areas on two domeins with one login?

2006-03-23 Thread Chris

[EMAIL PROTECTED] wrote:

Hi to all,
have two domains and each domain has it's own admin registered areas. Have
to allow people who registered to change domains and areas without login
again?
On reg. areas, after login, create sess_id to check if visitor is logged
in, but sess_ids on domains are different and can't compare them?


Apart from the other suggestion, you could also set a cookie with the 
details you need to access in it. See http://www.php.net/setcookie



Don't just use the userid (or whatever you're using) in the cookie - 
also add a random string to the end so it's not predictable (I use the 
following and it works quite well):


$rand_check = uniqid(true);

$oneyear = time() + (365 * 24 * 3600); // one year's time.

$usercookie_info = array('user' => $userid, 'time' => time(), 'rand' => 
$rand_check);


setcookie('YourCookieName', base64_encode(serialize($usercookie_info)), 
$oneyear, '/');


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

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



Re: [PHP] Switching to UTF-8. Need help.

2006-03-23 Thread Rasmus Lerdorf

Andy wrote:
Hi to all, 

We are developing a multilanguage application, and slowly it seems that the Latin1(ISO 5589 1) encoding is not enough. 
I tried simply to convert the database and the encoding of the php to UTF-8, but I'm getting some problems. 

If I make an echo 'möbel, Belgien' the browser does not show me the correct character. If I look in the source of the document the character is good. Default encoding of the browser is UTF-8. If I change manually the browser encoding then the chars are showed correclty. 

We have a lot of "defines" with fix texts, which are full with german and french characters. Any of these aren't shower correctly. 


What is the workaround for this?


In your php.ini file, use:

default_charset = "utf-8"

-Rasmus

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



Re: [PHP] switching between admin areas on two domeins with one login?

2006-03-23 Thread Warren Vail
I think the key to your problem is finding a way that the two domains can 
share information, do these domains have access to the same physical disk 
space, or a common database?  You can use the your own save handler 
routines to give them both access to the same area (database may work the 
best), so that when they create, write, and retrieve session data, both 
websites are using the same session data.


http://www.php.net/manual/en/function.session-set-save-handler.php

If they are in the same "virtual" server machine, you may be able to do 
something with a common file area, but this could prove risky, security 
wise, I would suggest the common database approach.  A lot of good books 
have writeups on how to change these routines to store session data in a 
mysql database.


HTH

Warren

At 12:34 PM 3/23/2006, [EMAIL PROTECTED] wrote:

Hi to all,
have two domains and each domain has it's own admin registered areas. Have
to allow people who registered to change domains and areas without login
again?
On reg. areas, after login, create sess_id to check if visitor is logged
in, but sess_ids on domains are different and can't compare them?

Thoughts?

Thanks!

-afan

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


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



RE: [PHP] Help?

2006-03-23 Thread Richard Lynch




On Thu, March 23, 2006 2:19 pm, Clinton, Rochelle A wrote:
> Hi Richard,
>
> WOW!  Thanks for such a quick response  -  this is just driving me
> crazy!  Not to mention consuming my time.
>
> I actually had been using the $line = in front of my replace attempts.
>
> Here is the exact offending code:
>
> for ($i=0; $i<$line_length; $i++) {
>$line[$i] = htmlspecialchars($line[$i]);
>echo "debug: line$i is: " . $line[$i] . "";
> }
> $line[$line_length-1] = str_replace("", "",
> $line[$line_length-1]);
> echo "DEBUG: replaced def line is: " .
> $line[$line_length-1] . "";
>
> And the uncooperative output:
>
> debug: line0 is: > href="http://www.ncbi.nlm.nih.gov:80/entrez/query.fcgi?cmd=Retrieve&db=Protein&list_uids=73966552&dopt=GenPept";
> >gi
> debug: line1 is: 73966552
> debug: line2 is: ref
> debug: line3 is: XP_866810.1
> debug: line4 is:  PREDICTED: similar to splicing factor,
> arginine/serine-rich 1
> DEBUG: replaced def line is:  PREDICTED: similar to splicing
> factor, arginine/serine-rich 1

Use "View Source" in your browser to see what REALLY is being printed
out...

The browser is interpreting your output, at all stages, and what you
see in the browser is not what you've got.

Word may not be exactly "WYSIWYG", but it tries...

A browser is *NOT* WYSIWYG to the Nth degree! :-)

For example, your ACTUAL data might ALREADY be:
 PREDICTED:...

Or, it might be:
 PREDICTED:...

Or, it might be...

There are at least 3x3x3x3 possible combinations on this theme.  Throw
in UTF-8 characters being presented in Latin-1, and you've got that
times a thousand.

I SUSPECT that somebody has already done htmlentities() on your data,
and so you're *seeing*  in the browser, but your DATA is:


So you need to do the str_replace() on THAT, not on what you see.

Or figure out where you already did htmlentities, and don't do that.

Only use htmlentities() at the last possible moment, at browser output.

Never [*] use htmlentities() on data for storage, nor processing.

Only at the last micro-second before spewing out to a browser should
your raw data be converted to a form suitable for browser display.

You'll just confuse yourself otherwise, with data converted too soon,
and not being what you expect when you look at it.

* There are bound to be exceptions to this, for some special 'expert'
situations...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] switching between admin areas on two domeins with one login?

2006-03-23 Thread afan
Hi to all,
have two domains and each domain has it's own admin registered areas. Have
to allow people who registered to change domains and areas without login
again?
On reg. areas, after login, create sess_id to check if visitor is logged
in, but sess_ids on domains are different and can't compare them?

Thoughts?

Thanks!

-afan

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



Re: [PHP] Help?

2006-03-23 Thread Richard Lynch
On Thu, March 23, 2006 1:50 pm, Clinton, Rochelle A wrote:
> I am fairly new to PHP and am having an (SILLY) issue that I cannot
> seem
> to resolve:
>
> I am pulling data from an html file and some of the lines of text that
> I
> need start with "".

Show us an actual line, copy/paste, to be sure we are working on the
right thing...

> I cannot seem to get rid of that tag!!!
>
> I have tried:
>
> * str_replace("<\a>", "", $line)

You need to do:
$line = str_replace("", "", $line);

Otherwise, you calculate the answer you want, and throw it away.

> * preg_replace('/<\/a>/', '', $line)  and various other attempts

Technically, you'd want:
'/<\\/a>/'

As \ is a special character inside '' marks, and PHP needs \\ to
represent \

It "works" because only \\ and \' are special inside '', so PHP
"figures out" \a as just \a

But it helps one understand strings better to be pedantic and use \\
inside '' to mean \

Again, it would seem you've left out the crucial step of storing the
result you want:

$line = preg_replace(..., $line);

> at creating the appropriate regex for <\a>

Is it really  or <\a>?

Because / and \ are not the same, despite the number of people, even
professional radio announcers, who insist on calling / 'backslash'

/ slash
\ backslash

You'd think they'd do their homework, eh?  Oh well.

I think the browsers have mainly gotten to the point where they just
try switching things around from \ to / if you goof anyway...

Must be frustrating to write a web browser...  Almost as frustrating
as trying to code HTML to one. :-)

> * $line = htmlspecialchars($line)
>
> str_replace("", "", $line)

This would, in theory, "work" IF you had '$line =' in front of the
str_replace (again), but adds a pointless extra step to convert to
HTML Entities before ripping out characters you don't want in the
first place.

> * And obviously strip_tags is not working for me either!

$line = strip_tags($line);

It seems like your primary difficulty in all this is in understanding
that MOST (if not all) PHP functions on strings will return the new
value, rather than destructively modify the input string.

It is possible, in some versions of PHP, to specifically craft
functions that will ALTER the input string.  But that's generally done
for performance reasons, and only in very specialized situations in
highly-optimized application code.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Help?

2006-03-23 Thread John Nichel

Clinton, Rochelle A wrote:

Hello,

 


I am fairly new to PHP and am having an (SILLY) issue that I cannot seem
to resolve:

 


I am pulling data from an html file and some of the lines of text that I
need start with "".

I cannot seem to get rid of that tag!!!

 


I have tried:

*   str_replace("<\a>", "", $line)
*   preg_replace('/<\/a>/', '', $line)  and various other attempts
at creating the appropriate regex for <\a>
*   $line = htmlspecialchars($line)

str_replace("", "", $line)

*   And obviously strip_tags is not working for me either!

 


Do you have any suggestions?


Echo out the line before and after you perform something like 
strip_tags() on it to see if you're inputting what you're expecting...


echo ( $line );
$line = strip_tags ( $line );
echo ( $line );

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

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



[PHP] Help?

2006-03-23 Thread Clinton, Rochelle A
Hello,

 

I am fairly new to PHP and am having an (SILLY) issue that I cannot seem
to resolve:

 

I am pulling data from an html file and some of the lines of text that I
need start with "".

I cannot seem to get rid of that tag!!!

 

I have tried:

*   str_replace("<\a>", "", $line)
*   preg_replace('/<\/a>/', '', $line)  and various other attempts
at creating the appropriate regex for <\a>
*   $line = htmlspecialchars($line)

str_replace("", "", $line)

*   And obviously strip_tags is not working for me either!

 

Do you have any suggestions?

 

Best Regards,

 

Rochelle Clinton

Bioinformatics Coordinator

University of Kentucky

200 Thomas Hunt Morgan Building

office: (859) 257-2161

cell: (406) 570-5383

email: [EMAIL PROTECTED]

 



Re: [PHP] Is there a way to get multiple values for a singleinput in a form submission?

2006-03-23 Thread sgsweb

Hi Mark,

Actually you can access this variable within Javascript in the following 
manner:



function chgablacted() {
 box = regs['myselect[]'];
 value = box.options[box.selectedIndex].value;
 if (value == 'some value') {
   ...
 } else {
   ...
 }
}

The name of the variable will include the brackets [].

sunil.

mslemko wrote:

Thanks Warren,

This works!

The side effect that is -somewhat- undesirable is that it becomes 
incompatible accessing the field with Javascript. Perhaps there is a 
way to get around that problem though.


-Mark

Warren Vail wrote:

Set the name of your field in html to be;

name="myselect[]"

that way when the form is returned to you each selected value is 
returned to you, for example if you code


$choices = $_POST["myselect"];

choices will be an array containing the actual values selected when 
the form is submitted.


hope this is what you were looking for.

Warren Vail



- clip -



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



RE: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread tedd

Hi gang:

Another update.

The detect magic_quotes_gpc ON and then either do, or don't do, 
addslashes() thing (see below)  provided kindly by Dave doesn't work.


function myslashes($data) {

return (get_magic_quotes_gpc() == 1) ? $data : addslashes($data);
}

On both of the servers, the magic_gpc thing is ON.

I found on the server with magic_quotes_runtime ON, it didn't make 
any difference to addslashes or not (I suspect there is something 
more going on there, but don't need to go into this right now), it 
worked in both cases.


However, on the problematic server that has magic_quotes_runtime OFF 
-- it didn't make any difference either to addslashes or not because 
it failed in both cases.


I'm open to more suggestions.

tedd

--

http://sperling.com

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



RE: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread Weber Sites LTD
As you can see in this article : http://www.weberdev.com/ViewArticle-3.html

$mysqlPicture = addslashes(fread(fopen($Picture, "r"), $PSize));

Then you insert  $mysqlPicture.

If your settings prevent automatic slashes by PHP then this will
Give the problem you see..

berber

-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 23, 2006 8:16 PM
To: php-general@lists.php.net; Weber Sites LTD
Subject: RE: [PHP] Why does this work on one server, but not another?

>Are you escaping the image string before you insert it?
>
>berber

berber:

Aaahh, no ?? Why is it going to attack me?

But seriously, it works on one server, why not the other?

On the other hand, it appears to object to something within the string -- so
that might be the problem. Please forgive my ignorance, but how would I
escape the image string -- do I use
dbx_escape_string() or would something else be better?

tedd


>-Original Message-
>From: tedd [mailto:[EMAIL PROTECTED]
>Sent: Thursday, March 23, 2006 7:48 PM
>To: php-general@lists.php.net
>Subject: [PHP] Why does this work on one server, but not another?
>
>Hi gang:
>
>I posted this question to a MySQL list, but apparently it stumped them. So,
>I'll ask here:
>
>On one server, the following code works without any problems whatsoever:
>
>--- quote ---
>
>$sqlString = "INSERT INTO $dbtable (id, image_type, image_large,
>image_small, image_width, image_height, image_name, image_size, date_time,
>date_created ) VALUES ('', '{$type}', '{$image_large}', '{$image_small}',
>'{$width}', '{$height}','{$name}', '{$size}', '{$date_time}',
>'{$date_created}')"; $result = mysql_query($sqlString)  or die("2.
>Error in query $sqlString " . mysql_error());
>
>--- un-quote ---
>
>However, on another server, it doesn't (remember the code is identical for
>both).
>
>I have looked at the PHP Info on both servers, the php versions are
>different (4.3.10 v 4.4.2) but the mysql specifics are identical except the
>version differs slightly (v 4.1.15 v 4.1.14).
>
>A clue, on the server it chokes on, if I reduce the image size to 100 x 67
>pixels, it will work.
>However, if the image is 150 x 100 pixels, or greater, it will crater.
>
>The error message is:
>
>2. Error in query INSERT INTO as_table2 (id, image_type, image_large,
>image_small, image_width, image_height, image_name, image_size, date_time,
>date_created ) VALUES ('', 'image/jpeg', 'ÿØÿà\0JFIF\
>-snip- (the entire text file for the image) 'v_small.jpg', '32',
>'2006-03-22 14:10:55',
>'2006-03-22 14:10:55') You have an error in your SQL syntax; check the
>manual that corresponds to your MySQL server version for the right syntax
to
>use near
>'ö~?L-?æÏôÏjâ?(xÏJ?÷Ý>ԔsíHñåE(?êÏØʍÜ"ÁíÎkiË3¬4A''ÿ\0?Mm¿ä÷´?ÿ\0
m
>ÿ\0&¿'
>at line 2
>
>Any ideas?
>
>Many thanks in advance.
>
>tedd
>--
>---
-
>
>http://sperling.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


-- 


http://sperling.com

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



Re: [PHP] Is there a way to get multiple values for a singleinput in a form submission?

2006-03-23 Thread mslemko

Thanks Warren,

This works!

The side effect that is -somewhat- undesirable is that it becomes 
incompatible accessing the field with Javascript. Perhaps there is a way 
to get around that problem though.


-Mark

Warren Vail wrote:

Set the name of your field in html to be;

name="myselect[]"

that way when the form is returned to you each selected value is 
returned to you, for example if you code


$choices = $_POST["myselect"];

choices will be an array containing the actual values selected when the 
form is submitted.


hope this is what you were looking for.

Warren Vail



- clip -

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



RE: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread tedd

Hi gang:

Update:

Both servers state: enable-magic_quotes

One sever states (this is the one that fails):

magic_quotes_gpc ON
magic_quotes_runtime ON

The other sever states (this is the one that works):

magic_quotes_gpc ON
magic_quotes_runtime OFF

However, I am using addslashes() -- should I not 
use them when magic_quotes_runtime is ON? Is that 
the problem? I guess that I could check, but it's 
easier for me to ask at the moment.


tedd



-Original Message-
From: tedd [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 23, 2006 7:48 PM
To: php-general@lists.php.net
Subject: [PHP] Why does this work on one server, but not another?

Hi gang:

I posted this question to a MySQL list, but apparently it stumped them. So,
I'll ask here:

On one server, the following code works without any problems whatsoever:

--- quote ---

$sqlString = "INSERT INTO $dbtable (id, image_type, image_large,
image_small, image_width, image_height, image_name, image_size, date_time,
date_created ) VALUES ('', '{$type}', '{$image_large}', '{$image_small}',
'{$width}', '{$height}','{$name}', '{$size}', '{$date_time}',
'{$date_created}')"; $result = mysql_query($sqlString)  or die("2.
Error in query $sqlString " . mysql_error());

--- un-quote ---

However, on another server, it doesn't (remember the code is identical for
both).

I have looked at the PHP Info on both servers, the php versions are
different (4.3.10 v 4.4.2) but the mysql specifics are identical except the
version differs slightly (v 4.1.15 v 4.1.14).

A clue, on the server it chokes on, if I reduce the image size to 100 x 67
pixels, it will work.
However, if the image is 150 x 100 pixels, or greater, it will crater.

The error message is:

2. Error in query INSERT INTO as_table2 (id, image_type, image_large,
image_small, image_width, image_height, image_name, image_size, date_time,
date_created ) VALUES ('', 'image/jpeg', 'ÿØÿà\0JFIF\
-snip- (the entire text file for the image) 'v_small.jpg', '32',
'2006-03-22 14:10:55',
'2006-03-22 14:10:55') You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax to
use near
'ö~?L-?æÏôÏjâ?(xÏJ?÷Ý>ԔsíHñåE(?êÏØʍÜ"ÁíÎkiË3¬4A''ÿ\0?Mm¿ä÷´?ÿ\0m
ÿ\0&¿'
at line 2

Any ideas?

Many thanks in advance.

tedd
--


http://sperling.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



--

http://sperling.com

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



Re: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread Michael Crute
On 3/23/06, tedd <[EMAIL PROTECTED]> wrote:
> >Are you escaping the image string before you insert it?
>
> Aaahh, no ?? Why is it going to attack me?
>
> But seriously, it works on one server, why not the other?
>
> On the other hand, it appears to object to
> something within the string -- so that might be
> the problem. Please forgive my ignorance, but how
> would I escape the image string -- do I use
> dbx_escape_string() or would something else be
> better?

I would base64encode the image string before puting it into the
database then you would probably not run in to quoting issues.

http://us3.php.net/base64encode


--

Michael E. Crute
http://mike.crute.org

It is a mistake to think you can solve any major problems just with potatoes.
--Douglas Adams

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



RE: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread tedd

Are you escaping the image string before you insert it?

berber


berber:

Aaahh, no ?? Why is it going to attack me?

But seriously, it works on one server, why not the other?

On the other hand, it appears to object to 
something within the string -- so that might be 
the problem. Please forgive my ignorance, but how 
would I escape the image string -- do I use 
dbx_escape_string() or would something else be 
better?


tedd



-Original Message-
From: tedd [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 23, 2006 7:48 PM
To: php-general@lists.php.net
Subject: [PHP] Why does this work on one server, but not another?

Hi gang:

I posted this question to a MySQL list, but apparently it stumped them. So,
I'll ask here:

On one server, the following code works without any problems whatsoever:

--- quote ---

$sqlString = "INSERT INTO $dbtable (id, image_type, image_large,
image_small, image_width, image_height, image_name, image_size, date_time,
date_created ) VALUES ('', '{$type}', '{$image_large}', '{$image_small}',
'{$width}', '{$height}','{$name}', '{$size}', '{$date_time}',
'{$date_created}')"; $result = mysql_query($sqlString)  or die("2.
Error in query $sqlString " . mysql_error());

--- un-quote ---

However, on another server, it doesn't (remember the code is identical for
both).

I have looked at the PHP Info on both servers, the php versions are
different (4.3.10 v 4.4.2) but the mysql specifics are identical except the
version differs slightly (v 4.1.15 v 4.1.14).

A clue, on the server it chokes on, if I reduce the image size to 100 x 67
pixels, it will work.
However, if the image is 150 x 100 pixels, or greater, it will crater.

The error message is:

2. Error in query INSERT INTO as_table2 (id, image_type, image_large,
image_small, image_width, image_height, image_name, image_size, date_time,
date_created ) VALUES ('', 'image/jpeg', 'ÿØÿà\0JFIF\
-snip- (the entire text file for the image) 'v_small.jpg', '32',
'2006-03-22 14:10:55',
'2006-03-22 14:10:55') You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax to
use near
'ö~?L-?æÏôÏjâ?(xÏJ?÷Ý>ԔsíHñåE(?êÏØʍÜ"ÁíÎkiË3¬4A''ÿ\0?Mm¿ä÷´?ÿ\0m
ÿ\0&¿'
at line 2

Any ideas?

Many thanks in advance.

tedd
--


http://sperling.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



--

http://sperling.com

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



RE: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread Bobby Matthis
I'm far from an expert:
But maybe one Server has magic quotes on and the other does not.  One
automatically escapes all the characters for you in the data string and the
other does not? 

Bobby

-Original Message-
From: Weber Sites LTD [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 23, 2006 10:53 AM
To: 'tedd'; php-general@lists.php.net
Subject: RE: [PHP] Why does this work on one server, but not another?

Are you escaping the image string before you insert it?

berber 

-Original Message-
From: tedd [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 23, 2006 7:48 PM
To: php-general@lists.php.net
Subject: [PHP] Why does this work on one server, but not another?

Hi gang:

I posted this question to a MySQL list, but apparently it stumped them. So,
I'll ask here:

On one server, the following code works without any problems whatsoever:

--- quote ---

$sqlString = "INSERT INTO $dbtable (id, image_type, image_large,
image_small, image_width, image_height, image_name, image_size, date_time,
date_created ) VALUES ('', '{$type}', '{$image_large}', '{$image_small}',
'{$width}', '{$height}','{$name}', '{$size}', '{$date_time}',
'{$date_created}')"; $result = mysql_query($sqlString)  or die("2. 
Error in query $sqlString " . mysql_error());

--- un-quote ---

However, on another server, it doesn't (remember the code is identical for
both).

I have looked at the PHP Info on both servers, the php versions are
different (4.3.10 v 4.4.2) but the mysql specifics are identical except the
version differs slightly (v 4.1.15 v 4.1.14).

A clue, on the server it chokes on, if I reduce the image size to 100 x 67
pixels, it will work. 
However, if the image is 150 x 100 pixels, or greater, it will crater.

The error message is:

2. Error in query INSERT INTO as_table2 (id, image_type, image_large,
image_small, image_width, image_height, image_name, image_size, date_time,
date_created ) VALUES ('', 'image/jpeg', 'ÿØÿà\0JFIF\
-snip- (the entire text file for the image) 'v_small.jpg', '32',
'2006-03-22 14:10:55',
'2006-03-22 14:10:55') You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax to
use near
'ö~?L-?æÏôÏjâ?(xÏJ?÷Ý>ԔsíHñåE(?êÏØʍÜ"ÁíÎkiË3¬4A''ÿ\0?Mm¿ä÷´?ÿ\0m
ÿ\0&¿' 
at line 2

Any ideas?

Many thanks in advance.

tedd
--


http://sperling.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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread Weber Sites LTD
Are you escaping the image string before you insert it?

berber 

-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 23, 2006 7:48 PM
To: php-general@lists.php.net
Subject: [PHP] Why does this work on one server, but not another?

Hi gang:

I posted this question to a MySQL list, but apparently it stumped them. So,
I'll ask here:

On one server, the following code works without any problems whatsoever:

--- quote ---

$sqlString = "INSERT INTO $dbtable (id, image_type, image_large,
image_small, image_width, image_height, image_name, image_size, date_time,
date_created ) VALUES ('', '{$type}', '{$image_large}', '{$image_small}',
'{$width}', '{$height}','{$name}', '{$size}', '{$date_time}',
'{$date_created}')"; $result = mysql_query($sqlString)  or die("2. 
Error in query $sqlString " . mysql_error());

--- un-quote ---

However, on another server, it doesn't (remember the code is identical for
both).

I have looked at the PHP Info on both servers, the php versions are
different (4.3.10 v 4.4.2) but the mysql specifics are identical except the
version differs slightly (v 4.1.15 v 4.1.14).

A clue, on the server it chokes on, if I reduce the image size to 100 x 67
pixels, it will work. 
However, if the image is 150 x 100 pixels, or greater, it will crater.

The error message is:

2. Error in query INSERT INTO as_table2 (id, image_type, image_large,
image_small, image_width, image_height, image_name, image_size, date_time,
date_created ) VALUES ('', 'image/jpeg', 'ÿØÿà\0JFIF\
-snip- (the entire text file for the image) 'v_small.jpg', '32',
'2006-03-22 14:10:55',
'2006-03-22 14:10:55') You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax to
use near
'ö~?L-?æÏôÏjâ?(xÏJ?÷Ý>ԔsíHñåE(?êÏØʍÜ"ÁíÎkiË3¬4A''ÿ\0?Mm¿ä÷´?ÿ\0m
ÿ\0&¿' 
at line 2

Any ideas?

Many thanks in advance.

tedd
--


http://sperling.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] Why does this work on one server, but not another?

2006-03-23 Thread tedd

Hi gang:

I posted this question to a MySQL list, but 
apparently it stumped them. So, I'll ask here:


On one server, the following code works without any problems whatsoever:

--- quote ---

$sqlString = "INSERT INTO $dbtable (id, 
image_type, image_large, image_small, 
image_width, image_height, image_name, 
image_size, date_time, date_created )
VALUES ('', '{$type}', '{$image_large}', 
'{$image_small}', '{$width}', 
'{$height}','{$name}', '{$size}', '{$date_time}', 
'{$date_created}')";
$result = mysql_query($sqlString)  or die("2. 
Error in query $sqlString " . mysql_error());


--- un-quote ---

However, on another server, it doesn't (remember 
the code is identical for both).


I have looked at the PHP Info on both servers, 
the php versions are different (4.3.10 v 4.4.2) 
but the mysql specifics are identical except the 
version differs slightly (v 4.1.15 v 4.1.14).


A clue, on the server it chokes on, if I reduce 
the image size to 100 x 67 pixels, it will work. 
However, if the image is 150 x 100 pixels, or 
greater, it will crater.


The error message is:

2. Error in query INSERT INTO as_table2 (id, 
image_type, image_large, image_small, 
image_width, image_height, image_name, 
image_size, date_time, date_created ) VALUES ('', 
'image/jpeg', 'ÿØÿà\0JFIF\

-snip- (the entire text file for the image)
'v_small.jpg', '32', '2006-03-22 14:10:55', 
'2006-03-22 14:10:55') You have an error in your 
SQL syntax; check the manual that corresponds to 
your MySQL server version for the right syntax to 
use near 
'ö~?L-?æÏôÏjâ?(xÏJ?÷Ý>ԔsíHñåE(?êÏØʍÜ"ÁíÎkiË3¬4A''ÿ\0?Mm¿ä÷´?ÿ\0mÿ\0&¿' 
at line 2


Any ideas?

Many thanks in advance.

tedd
--

http://sperling.com

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



[PHP] help with smarty+cms

2006-03-23 Thread ganu
Hello all,

I worked with one site and now is working fine with smarty.
Now I want to implement the CMS in that,
I went thru the link http://smarty.php.net/resources.php?category=2

now I want a CMS so my existing site looks as it is and with some or lot of
changes
I can implement CMS in that.

somy body has faced the same situation then plz giude me..
[ after everything I want to implement the CMS :( ]

any CMS so I can start work on that...

plz help me out..

--

/* God is real, Unless declared integer */


Re: [PHP] Switching to UTF-8. Need help.

2006-03-23 Thread Jochem Maas

Andy wrote:
Hi to all, 

We are developing a multilanguage application, and slowly it seems that the Latin1(ISO 5589 1) encoding is not enough. 
I tried simply to convert the database and the encoding of the php to UTF-8, but I'm getting some problems. 

If I make an echo 'möbel, Belgien' the browser does not show me the correct character. If I look in the source of the document the character is good. Default encoding of the browser is UTF-8. If I change manually the browser encoding then the chars are showed correclty. 

We have a lot of "defines" with fix texts, which are full with german and french characters. Any of these aren't shower correctly. 


What is the workaround for this?


workaround suggest there is no real fix.

but in this case your probably outputting the wrong charset declaration in the 
HTML
source (or not at all, in which case the browser is guessing the chArset 
incorrectly):

so either a line like this in the  of your page:




alternatively if your outputting a form of XML somthing like this
at the top of your output:




ALSO check the headers being output with your pages
there should be a header like:

Content-Type: text/html; charset=UTF-8


and take a look here (it might help to figure out whats wrong exactly):

http://www.validome.org/lang/en/errors/XML-CHARSET




Best regards, 
Andy.


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



[PHP] Can't get rid of escaped quote (solved, but...)

2006-03-23 Thread Arno Kuhl
Solved (see bottom of message) but surely there's a better solution?


Sorry for this looong explanation, but I've been tearing my hair out with
this problem...

I use php 4.3.4 and ADOdb 4.64, developing on Win2000.

I've got magic_quotes_gpc switched off explicitly in htaccess, and I checked
phpinfo that it really is off. And magic_quotes_runtime is also off.

And I have a string fragment in a MySQL database field as

  ... click the http://www.link";>link ...

I can clearly see this value in my database manager. However when I read it
from the database it unexpectedly changes to

  click the http://www.link\";>link

even before I get it into my code - in my debugger I can see this in the
result set before my code even has a chance to screw it up. And the browser
can't handle this.

I've single-stepped through the ADOdb code and can see that the $rs fields
has the escaped quotes as soon as it executes the mysql command. I'm
confident there's nothing wrong with ADOdb - it's always worked like a
charm. The ADOdb manual mentions that mysql escapes quotes with a backslash,
but once the string is in a php variable I should be able to do with it what
I want, shouldn't I?

I have tried the following work-arounds without success (individually of
course, not all at the same time):

$string = stripslashes($string);
$string = str_replace('\\"', '"', $string);
$string = str_replace("\\", "", $string);// should be the same as
stripslashes
$string = str_replace("\\\"", "\"", $string);
$string = str_replace("\\\"", "'", $string);
$string = str_replace("\\\"", "\'", $string);
$string = str_replace("\\\"", "", $string);  // should remove the backslash
and the quote

In every case $string behaves as though it's a "read-only" variable for the
backslashes (I tried replacing other characters and they get replaced as
expected).

According to the php manual this is exactly what stripslashes is meant for
but it's not working in this case.

I also tried
  $string = str_replace("click", 'http://www.link";>', $string);
and it changed to
  http://www.link\";> the http://www.link\";>link
(ie it added the slashes)

but this worked
  $string = str_replace("click", "", $string);
(ie no slashes were added)
...so why doesn't work-around 5 or 6 above work?

First prize is to stop the quotes being escaped. If I can't stop the magical
appearance of the escaped quotes then str_replace('\\"' would be second
prize because I can't guarantee that the end user won't intentionally use a
backslash in the template string. stripslashes would be a poor third, and
needing to go through the string character by character would tell me I
should be coding in a different language.

So...
(1) Why are these quotes being escaped even with magic_quotes_gpc off?
(2) Why doesn't stripslashes or str_replace remove the backslashes?
(3) How do I get rid of these backslashes without killing the server?

I'm sure I'm doing something really stupid here but I just can't figure out
what it is. Hope someone has a simple answer.

TIA
Arno


OK, I tried one last thing before sending this, and IT WORKED
$string = str_replace("\"", "'", $string);
.. changed the double-quotes to single quotes and magically dropped the
backslashes.

But I'm sure the end-user will at some stage use double-quotes as part of
the text, and won't expect it to come out as single quotes. Surely there
must be a proper solution to this?

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



[PHP] Switching to UTF-8. Need help.

2006-03-23 Thread Andy
Hi to all, 

We are developing a multilanguage application, and slowly it seems that the 
Latin1(ISO 5589 1) encoding is not enough. 
I tried simply to convert the database and the encoding of the php to UTF-8, 
but I'm getting some problems. 

If I make an echo 'möbel, Belgien' the browser does not show me the correct 
character. If I look in the source of the document the character is good. 
Default encoding of the browser is UTF-8. If I change manually the browser 
encoding then the chars are showed correclty. 

We have a lot of "defines" with fix texts, which are full with german and 
french characters. Any of these aren't shower correctly. 

What is the workaround for this?

Best regards, 
Andy.

Re: [PHP] Letters in Loops

2006-03-23 Thread John Nichel

phpninja wrote:

Hello,


for($i=A;$i<=Z;$i++) {

if ($i == "ZZ") { break; }

echo "$i";

}
regards,
phpninja


While this may work (I didn't test it), it's a hack and might produce 
unexpected results (assuming you meant to quote the strings).  PHP will, 
"Translate strings and resources to numbers, usual math" to compare 
them.  It would be better to set the range you want, and loop thru that.


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

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



Re: [PHP] Letters in Loops

2006-03-23 Thread Jochem Maas

Ben Miller wrote:

In trying to make an alpha list, using the following:

for($i=A;$i<=Z;$i++) {


 ^ not a string technically! see what happens when
   you turn up error reporting to full (E_ALL).


echo "$i";
}


rather than using a loop to generate (as others have shown you),
try this way instead:



which will output:

A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z



Produces:
A
B
C...
X
Y
Z
AA
AB
AC...
AX
AY
AZ... all the way to YZ.


What am I doing wrong that it's not stopping at just plain old "Z", without
moving on to "AA" and continuing? 


it's down to a lack of understanding about the way php autocasts stuff 
maybe this output will help you to understand it:

$> php -r '
var_dump(
(Z <= Z),
("Z" <= "Z"),
ord("Z"),
ord("AA"),
(Z <= 90),
("Z" <= 90),
(AA <= Z),
("AA" <= "Z"));'
bool(true)
bool(true)
int(90)
int(65)
bool(true)
bool(true)
bool(true)
bool(true)







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



RE: [PHP] Letters in Loops

2006-03-23 Thread Ford, Mike
> -Original Message-
> From: Ben Miller [mailto:[EMAIL PROTECTED] 
> Sent: 23 March 2006 15:08
> To: php-general@lists.php.net
> Subject: [PHP] Letters in Loops
> 
> 
> In trying to make an alpha list, using the following:
> 
> for($i=A;$i<=Z;$i++) {
>   echo "$i";
> }
> 
> Produces:
> A
> B
> C...
> X
> Y
> Z
> AA
> AB
> AC...
> AX
> AY
> AZ... all the way to YZ.
> 
> 
> What am I doing wrong that it's not stopping at just plain 
> old "Z", without moving on to "AA" and continuing?

Well, think about it -- you have all the evidence in front of you!

If the iteration after "Z" is "AA" (which is as documented for the ++
operator on strings), when is the first time that $i<='Z' evaluates to
false, and hence your loop stops? It's when it reaches "ZA", which is,
not surprisingly, the iteration after "YZ".

So you need it to exit when you reach the value after "Z", which you can
see is "AA", thus you need to write:

  for($i='A'; $i!='AA'; $i++)

You might also consider the use of:

  foreach (range('A','Z') as $i)
Cheers!

Mike
 


Mike Ford, Electronic Information Services Adviser, Learning Support
Services,
JG125, The Library, James Graham Building, Headingley Campus, Beckett
Park,
LEEDS, LS6 3QS, United Kingdom
Tel: +44 113 283 2600 extn 4730Fax: +44 113 283 3211


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

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



Re: [PHP] Letters in Loops

2006-03-23 Thread Evan Priestley




On Mar 23, 2006, at 10:08 AM, Ben Miller wrote:


In trying to make an alpha list, using the following:

for($i=A;$i<=Z;$i++) {
echo "$i";
}

Produces:
A
B
C...
X
Y
Z
AA
AB
AC...
AX
AY
AZ... all the way to YZ.


What am I doing wrong that it's not stopping at just plain old "Z",  
without

moving on to "AA" and continuing?

--
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] Letters in Loops

2006-03-23 Thread phpninja
Hello,


for($i=A;$i<=Z;$i++) {

if ($i == "ZZ") { break; }

echo "$i";

}
regards,
phpninja

-Original Message-

From: Ben Miller [*mailto:[EMAIL PROTECTED] <[EMAIL PROTECTED]>]


Sent: Thursday, March 23, 2006 7:08 AM

To: php-general@lists.php.net

Subject: [PHP] Letters in Loops

In trying to make an alpha list, using the following:

for($i=A;$i<=Z;$i++) {

echo "$i";

}

Produces:

A

B

C...

X

Y

Z

AA

AB

AC...

AX

AY

AZ... all the way to YZ.



What am I doing wrong that it's not stopping at just plain old "Z", without
moving on to "AA" and continuing?

--

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


[PHP] Letters in Loops

2006-03-23 Thread Ben Miller
In trying to make an alpha list, using the following:

for($i=A;$i<=Z;$i++) {
echo "$i";
}

Produces:
A
B
C...
X
Y
Z
AA
AB
AC...
AX
AY
AZ... all the way to YZ.


What am I doing wrong that it's not stopping at just plain old "Z", without
moving on to "AA" and continuing?

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



[PHP] Better way to count bits set in an integer?

2006-03-23 Thread Jim McIntyre

Hi,

Is there a better/more efficient way to determine how many bits are 
set in an integer than this?


  substr_count(base_convert($myValue, 10, 2), '1');

I'm using PHP 4.

Thanks,
Jim

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



Re: [PHP] why is PEAR::DB constantly initting connection?

2006-03-23 Thread chris smith
On 3/23/06, joseph <[EMAIL PROTECTED]> wrote:
> bonjour,
>
> why does my DB object always send INIT DB to mysql server?
>
> the problem caused by calls like the following -- very simple code,
> really  may be caused by my PEAR/DB.php wrapper functions (see
> below) .   evidence is my mysql query log (shown below the code, also),
> please help me pinpoint the error

You're better off asking the pear list for help. They are more
familiar with Pear::DB than we will be.

http://pear.php.net/support/lists.php

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

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



Re: [PHP] undefined function error with lost password script

2006-03-23 Thread Robin Vickery
On 23/03/06, Mark <[EMAIL PROTECTED]> wrote:
> Can anyone see a problem with this at a glance. I think i have pushed my
> luck with this forum ( inc. Chris)of late but i paid a lot of money for this
> script and it has a few bugs.
>
> THis is what i get returned---
> Fatal error: Call to undefined function: recover_pw() in
> /home/realt905/public_html/lost_pw.php on line 70
>
> where line 70 is : recover_pw($_POST['email_address']);
>
>
> 
>  include("connect.php");
>
> if (isset($_POST['Submit'])) {
>
>   [...]
>  recover_pw($_POST['email_address']);
>
>  function recover_pw($email_address){
>  [...]
>   }

Normally it doesn't matter if you define a function before or after
you use it., but you're defining the function conditionally - if
$_POST['Submit'] isn't set then recover_pw() will not be defined. In
that case you have to make sure it's defined before it's used.

The manual tells you that.

   http://au.php.net/manual/en/language.functions.php

The solution is to take the function definition out if the if-block.

  -robin

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



Re: [PHP] Re: session vars

2006-03-23 Thread John Wells
U, is your top.php code being printed AT ALL? Because in the code
you gave us, you're attempting to include "topo.php".

HTH,
John

On 3/21/06, João Cândido de Souza Neto <[EMAIL PROTECTED]> wrote:
> tedd wrote:
>
> > Hi:
> >
> > I hate this.
> >
> >>Ok guy, don't fight with me. hehehe
> >>
> >>Follow's all code of files.
> >
> > Yeah ! Where's "rodape.php" ?
> >
> > If we're going to spend our time looking at your code, shouldn't you
> > spend the time to provide all of it?
> >
> > tedd
> >
>
> I'm sorry for do that.
>
> I'm stressed today. Forgive me.
>
> Follow's the rodape.php code:
>
>  bgcolor="#FF" align="center">
> 
> 
> 
> 
> 
> Buffet Online - 
> www.buffetonline.com.br
> 
> 
> Copyright (c) 2006 - Todos os 
> direitos reservados
> 
> 
> 
> 
> 
>
> --
> ---
> João Cândido de Souza Neto
> Web Developer
>
> --
> 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] why is PEAR::DB constantly initting connection?

2006-03-23 Thread joseph
bonjour,

why does my DB object always send INIT DB to mysql server?  i am using 
PHP 5.0.5 and 
* @versionRelease: 1.7.5
 * @link   http://pear.php.net/package/DB
 */


the problem caused by calls like the following -- very simple code,
really  may be caused by my PEAR/DB.php wrapper functions (see
below) .   evidence is my mysql query log (shown below the code, also),
please help me pinpoint the error

if (!$db) $db=db_connect();^M
   $this_userRS = db_query($db,$query);
$this_user= $this_userRS->fetchRow();
$top_bar_text =   "these are old todo list entries by "  .
$browse_user_name . " (". $this_user[0] .")";
$max_from_db_table = $this_user[0];



i use functions like this :


function db_connect() {
global $err,$errstring, $dsn,$mysql_host,$mysql_db,$mysql_user,
$mysql_password,$DEBUG_DICT_CONNECT,$options;
// Retries connection to server 5 times.
if ($DEBUG_DICT_CONNECT) echo "dsn = " . print_r($dsn) . "";
for ($i = 0; !(@$db = DB::connect($dsn,$options)) && $i < 5; $i++)
{ }
if (DB::isError($db))
{
header("Location: http://"; . $_SERVER['HTTP_HOST'] .
"/index.php?cfile=err&query=" . $err . "&errstring='" . $errstring."'");
exit;
}
else {
db_query($db,"set names utf8");
 return $db;
}
} // end db_connect

and


function db_query(&$db,$query)
{
global $err,$errstring, $DEBUG_DICT, $tpf_admin_email;
$result = $db->query($query);
if (DB::isError($result))
{
exit;
}
else return $result;
}

function db_getAssoc(&$db,$query)
{
global $err,$errstring, $DEBUG_DICT, $_SERVER, $tpf_admin_email;
$result = $db->getAssoc($query,false,array(),
DB_FETCHMODE_ORDERED,true);
if (DB::isError($result))
{
exit;
}
else return $result;
}


and my server query log shows up stuff like


373 Init DB   dict_explicit
  373 Query select
rss_id,rss_url,rss_name,rss_cache_time,rss_listnum,rss_listtype,from_lang from 
rss_info where rss_user = 'curious'  and cid = '246' and from_lang='german'
  373 Query select cid from rss_category where
cname= 'misc' and from_lang='french'
  373 Init DB   dict_explicit
  373 Query select
rss_id,rss_url,rss_name,rss_cache_time,rss_listnum,rss_listtype,from_lang from 
rss_info where rss_user = 'joe'  and cid = '219' and from_lang='french'
  373 Init DB   dict_explicit
  373 Query select
rss_id,rss_url,rss_name,rss_cache_time,rss_listnum,rss_listtype,from_lang from 
rss_info where rss_user = 'curious'  and cid = '219' and from_lang='french'

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



Re: [PHP] Atrributes and NuSOAP

2006-03-23 Thread chris smith
On 3/23/06, Peter Lauri <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have been trying to find a simple example of how to add attributes to the
> requests, but after two days search I can not find an example. The $param is
> easy to create if it does not contain any attributes. This is what I want to
> create, but the internalId is giving me troubles:

...

> Maybe the reason is that you can not do that with NuSOAP, but I am a newbie
> so I have no clue.

You're better off asking the NuSOAP list for help because they know
the script better than we do.

http://sourceforge.net/mail/?group_id=57663

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

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



[PHP] GD Library or PHP Function

2006-03-23 Thread brian dichiara
Is there a way to check to see if a JPEG or PDF is color or black/white? 
Like a function or something?


Thanks for any help!

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



[PHP] Re: Creating a Window without JavaScript that is on top

2006-03-23 Thread brian dichiara
you could create a div that floats on top of everything, but you'll 
still need javascript to set its position and to hide/unhide it.


as far as I know, you need javascript to do it.

_Brian.

Todd Cary wrote:
Is there a way to create a Window that is like the Help or Popup type 
windows one can create with JavaScript?


I have an event calendar and I want the link for the event to go to a 
PHP page, but I want the page to be on top and have focus with a Close 
button.  The PHP page will have some PHP code that will display the data 
passed by the GET var.


Todd


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



Re: [PHP] pulling in template file in var and populating vars?

2006-03-23 Thread Kevin Waterson
This one time, at band camp, clive <[EMAIL PROTECTED]> wrote:

> You could also look at using a templating engine like Smarty for instance.

BHAHAHAHAHAHAHAAA
1000 lines of code for "hello world"



-- 
"Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote."

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



[PHP] Re: undefined function error with lost password script

2006-03-23 Thread Barry

Mark wrote:
Can anyone see a problem with this at a glance. I think i have pushed my 
luck with this forum ( inc. Chris)of late but i paid a lot of money for this 
script and it has a few bugs.


THis is what i get returned---
Fatal error: Call to undefined function: recover_pw() in 
/home/realt905/public_html/lost_pw.php on line 70


where line 70 is : recover_pw($_POST['email_address']);


1. If you paid for it, why don't you ask the support?
2. Please use sites like pastebin.com to post huge code snippets.
3. The function lost_pw is called before it's declared!

Greets
Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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