RE: [PHP] mssql_* overhead

2007-01-10 Thread bruce
hey chris..

you're confirming what i had seen/experienced.. just wanted to better
understand what phillip was saying.

thanks

-bruce


-Original Message-
From: Chris [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 10, 2007 5:37 PM
To: [EMAIL PROTECTED]
Cc: 'php General List'
Subject: Re: [PHP] mssql_* overhead


bruce wrote:
> hi phillip...
>
> just to clarify regarding having the mysql resource ID in a session var.
are
> you saying that you're able to more or less, do a mysql_connect and store
> the resourceID in a session var, which can then be used on any given page
> within your site, without having to recall the mysql_connect to establish
a
> new connection?
>
> at one time, i had played with how this might be accomplished, and could
> never get it to work, without having to get into the idea/area of
connection
> pools...

No, that won't work (one minor irrelevant detail - he's talking about
mssql not mysql - but either way it doesn't matter - I'm just being
pedantic :P).

Resource connections cannot be stored in the session and then re-used in
another page request.

You could put the resource in the session variable and then re-use it
from the session within the same request, but it's not going to work if
you go to another page.

To confirm that, try a simple page:

';
var_dump($_SESSION);

$connection = mysql_connect();

$_SESSION['DbConnection'] = $connection;

$_SESSION['AnotherVariable'] = 1;

var_dump($_SESSION);

?>

View the page, you'll see an empty array at the top and two variables at
the bottom.

Refresh the page and you'll see two variables in $_SESSION - however the
DbConnection will always be 0 (false).

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

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

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



Re: [PHP] Imap certificate error?

2007-01-10 Thread Chris

MIKE YRABEDRA wrote:


When using imap_open to access my email server, I keep getting a invalid
certificate error.

The cert on the email server is  issued from Geotrust and is quite common
(Rapidssl).

The error comes from it not being listed in the root certificates list
(bundle).


My question is, is this a problem with my email server or my php(www)
server?


Can't see an option in php or the php-imap section to specify where to 
look for certificates, so I guess the problem is happening because it's 
not in the certificate bundle.


I suspect you'd get the same problem with perl, ruby, whatever for the 
same reason, I think you're out of luck.


--
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] Extending 'include' behavior in a function

2007-01-10 Thread Eli

Jochem Maas wrote:

short of playing around with the global keyword
(which won't work when you call includeIt() from
another function)) your pretty much stuck.

basically imho you need to rethink what it is your trying to do.

function have their own scope for a reason; maybe consider using
an array argument like so:

function incIt($file, $args = array())
{
extract((array)$args);
include $file; // don't forget some error checking
}

function includeIt($file, $args = array())
{
// bla
incIt($file, $args);
// more bla
}

I broke it down into 2 functions to avoid local variables
being overridden in includeIt() [by the call to extract].


In addition to your solution, it is needed to transfer the variables by 
reference.


Your solution is good when you know what variables you want to transfer 
ahead, and then make a list of them. But if I want to transfer all the 
variables in the current environment scope?


-thanks, Eli.

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



Re: [PHP] mssql_* overhead

2007-01-10 Thread Chris

bruce wrote:

hi phillip...

just to clarify regarding having the mysql resource ID in a session var. are
you saying that you're able to more or less, do a mysql_connect and store
the resourceID in a session var, which can then be used on any given page
within your site, without having to recall the mysql_connect to establish a
new connection?

at one time, i had played with how this might be accomplished, and could
never get it to work, without having to get into the idea/area of connection
pools...


No, that won't work (one minor irrelevant detail - he's talking about 
mssql not mysql - but either way it doesn't matter - I'm just being 
pedantic :P).


Resource connections cannot be stored in the session and then re-used in 
another page request.


You could put the resource in the session variable and then re-use it 
from the session within the same request, but it's not going to work if 
you go to another page.


To confirm that, try a simple page:

';
var_dump($_SESSION);

$connection = mysql_connect();

$_SESSION['DbConnection'] = $connection;

$_SESSION['AnotherVariable'] = 1;

var_dump($_SESSION);

?>

View the page, you'll see an empty array at the top and two variables at 
the bottom.


Refresh the page and you'll see two variables in $_SESSION - however the 
DbConnection will always be 0 (false).


--
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] 5.2 installer not working and iis looking for password

2007-01-10 Thread Dick Jiang
You should give the anonymous access to the directory, you can configure it
in the IIS management.

Regards,
Dick
-Original Message-
From: Ross [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 11, 2007 4:27 AM
To: php-general@lists.php.net
Subject: [PHP] 5.2 installer not working and iis looking for password


I am trying to install 5.2 via the installer but the when I try and open a 
page IIS asks for a password and the page is not found.

Any ideas?


R. 

-- 
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] Extending 'include' behavior in a function

2007-01-10 Thread Jochem Maas
short of playing around with the global keyword
(which won't work when you call includeIt() from
another function)) your pretty much stuck.

basically imho you need to rethink what it is your trying to do.

function have their own scope for a reason; maybe consider using
an array argument like so:

function incIt($file, $args = array())
{
extract((array)$args);
include $file; // don't forget some error checking
}

function includeIt($file, $args = array())
{
// bla
incIt($file, $args);
// more bla
}

I broke it down into 2 functions to avoid local variables
being overridden in includeIt() [by the call to extract].

Eli wrote:
> Hi,
> 
> I want to create a function that does some stuff, and then includes
> another file in the place from where it was called. The idea is to run
> the included file not in the function, but in the place of the caller in
> the caller's environment (not in the function environment).
> For example:
> 
>  function includeIt($file) {
> $name = "Debora";
> trigger_error("Include START: '$file'");
> include($file);// This include should run in the environment
> // of the caller, from the place it was called.
> trigger_error("Include END: '$file'");
> }
> 
> $name = "Joe";
> echo "Hello!";
> includeIt("msg.inc");// The file should be included here, not in the
> // 'includeIt' function.
> // Say the file 'msg.inc' uses the $name
> // variable from the caller's environment.
> // In this case, I want it to say hello to Joe,
> // and not to Debora.
> echo "Bye!";
> ?>
> 
> -thanks, Eli.
> 

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



Re: [PHP] Extending session timeouts manually

2007-01-10 Thread Ryan Fielding

Chris wrote:

Ryan Fielding wrote:

Ryan Fielding wrote:

Chris wrote:

Ryan Fielding wrote:
I'm using a session to save cart contents within a store, and this 
session follows the user as they proceed through the checkout. My 
problem is, if a customer orders say 10 items, they have the 
option to input 10 different addresses that these items will be 
delivered to. I've noticed that some sessions are timing out 
before the user can finish entering in all the details. I thought 
that maybe a tiny iframe calling a page that used Http-equiv="Refresh" Content="300"> to refresh the iframe every 5 
minutes, but no such luck.


Does anyone know of any thing else i can try to stop this from 
happening?




What's the session expiry time set to? Try setting it manually?

See http://www.php.net/manual/en/function.session-cache-expire.php


It's currently set to the default 180 minutes.


What about other session settings? Check a phpinfo page and see what 
your other settings are.


In regards to this, i would like to keep it at 180 minutes, but only 
extend it for certain instances where the customer is taking a long 
time to enter the details.


How are you going to know that? Have a checkbox on the page - 'are you 
going to take a long time to fill in this form?' ;) (Yeh bad joke :P).



Session config is as follows:


   session

Session Support enabled
Registered save handlersfiles user


Directive   Local Value Master Value
session.auto_start  Off Off
session.bug_compat_42   Off Off
session.bug_compat_warn On  On
session.cache_expire180 180
session.cache_limiter   nocache nocache
session.cookie_domain   /no value/  /no value/
session.cookie_lifetime 2592000 2592000
session.cookie_path /   /
session.cookie_secure   Off Off
session.entropy_file/no value/  /no value/
session.entropy_length  0   0
session.gc_divisor  10001000
session.gc_maxlifetime  14400   1440
session.gc_probability  1   1
session.namePHPSESSID   PHPSESSID
session.referer_check   /no value/  /no value/
session.save_handlerfiles   files
session.save_path   /tmp/tmp
session.serialize_handler   php php
session.use_cookies On  On
session.use_only_cookiesOff Off
session.use_trans_sid   Off Off


i can't see anything in there that would be causing this sort of 
behaivour. I've also just tested it again and it seems the session is 
actually losing the majority of its contents before the 180 minute mark, 
which could explain why it seems to time out.


Re: [PHP] Extending 'include' behavior in a function

2007-01-10 Thread Chris

Eli wrote:

Hi,

I want to create a function that does some stuff, and then includes 
another file in the place from where it was called. The idea is to run 
the included file not in the function, but in the place of the caller in 
the caller's environment (not in the function environment).

For example:




Try

$name = "Deb";

..

function includeIt($file) {
  global $name;
  include($file);
}

...

does that work?

The problem is to do with variable scope (see 
http://www.php.net/manual/en/language.variables.scope.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] Extending session timeouts manually

2007-01-10 Thread Chris

Ryan Fielding wrote:

Ryan Fielding wrote:

Chris wrote:

Ryan Fielding wrote:
I'm using a session to save cart contents within a store, and this 
session follows the user as they proceed through the checkout. My 
problem is, if a customer orders say 10 items, they have the option 
to input 10 different addresses that these items will be delivered 
to. I've noticed that some sessions are timing out before the user 
can finish entering in all the details. I thought that maybe a tiny 
iframe calling a page that used Content="300"> to refresh the iframe every 5 minutes, but no such luck.


Does anyone know of any thing else i can try to stop this from 
happening?




What's the session expiry time set to? Try setting it manually?

See http://www.php.net/manual/en/function.session-cache-expire.php


It's currently set to the default 180 minutes.


What about other session settings? Check a phpinfo page and see what 
your other settings are.


In regards to this, i would like to keep it at 180 minutes, but only 
extend it for certain instances where the customer is taking a long time 
to enter the details.


How are you going to know that? Have a checkbox on the page - 'are you 
going to take a long time to fill in this form?' ;) (Yeh bad joke :P).


--
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] Extending session timeouts manually

2007-01-10 Thread Jochem Maas
Ryan Fielding wrote:
> Ryan Fielding wrote:
>> Chris wrote:
>>> Ryan Fielding wrote:
 I'm using a session to save cart contents within a store, and this
 session follows the user as they proceed through the checkout. My
 problem is, if a customer orders say 10 items, they have the option
 to input 10 different addresses that these items will be delivered
 to. I've noticed that some sessions are timing out before the user
 can finish entering in all the details. I thought that maybe a tiny
 iframe calling a page that used >>> Content="300"> to refresh the iframe every 5 minutes, but no such luck.

 Does anyone know of any thing else i can try to stop this from
 happening?

>>>
>>> What's the session expiry time set to? Try setting it manually?
>>>
>>> See http://www.php.net/manual/en/function.session-cache-expire.php
>>>
>> It's currently set to the default 180 minutes.
>>
> In regards to this, i would like to keep it at 180 minutes, but only
> extend it for certain instances where the customer is taking a long time
> to enter the details.

3 hours to fill in a form??
that said is it really necessary to make it so short?

if your okay with using javascript you could popup a confirm()
and conditionally make an ajax request (which will cause the expiry timeout
to be reset)

> 

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



Re: [PHP] Extending session timeouts manually

2007-01-10 Thread Ryan Fielding

Ryan Fielding wrote:

Chris wrote:

Ryan Fielding wrote:
I'm using a session to save cart contents within a store, and this 
session follows the user as they proceed through the checkout. My 
problem is, if a customer orders say 10 items, they have the option 
to input 10 different addresses that these items will be delivered 
to. I've noticed that some sessions are timing out before the user 
can finish entering in all the details. I thought that maybe a tiny 
iframe calling a page that used Content="300"> to refresh the iframe every 5 minutes, but no such luck.


Does anyone know of any thing else i can try to stop this from 
happening?




What's the session expiry time set to? Try setting it manually?

See http://www.php.net/manual/en/function.session-cache-expire.php


It's currently set to the default 180 minutes.

In regards to this, i would like to keep it at 180 minutes, but only 
extend it for certain instances where the customer is taking a long time 
to enter the details.


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



Re: [PHP] Extending session timeouts manually

2007-01-10 Thread Ryan Fielding

Ryan Fielding wrote:

Chris wrote:

Ryan Fielding wrote:
I'm using a session to save cart contents within a store, and this 
session follows the user as they proceed through the checkout. My 
problem is, if a customer orders say 10 items, they have the option 
to input 10 different addresses that these items will be delivered 
to. I've noticed that some sessions are timing out before the user 
can finish entering in all the details. I thought that maybe a tiny 
iframe calling a page that used Content="300"> to refresh the iframe every 5 minutes, but no such luck.


Does anyone know of any thing else i can try to stop this from 
happening?




What's the session expiry time set to? Try setting it manually?

See http://www.php.net/manual/en/function.session-cache-expire.php


It's currently set to the default 180 minutes.

In regards to this, i would like to keep it at 180 minutes, but only 
extend it for certain instances where the customer is taking a long time 
to enter the details.


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



Re: [PHP] Extending session timeouts manually

2007-01-10 Thread Ryan Fielding

Chris wrote:

Ryan Fielding wrote:
I'm using a session to save cart contents within a store, and this 
session follows the user as they proceed through the checkout. My 
problem is, if a customer orders say 10 items, they have the option 
to input 10 different addresses that these items will be delivered 
to. I've noticed that some sessions are timing out before the user 
can finish entering in all the details. I thought that maybe a tiny 
iframe calling a page that used Content="300"> to refresh the iframe every 5 minutes, but no such luck.


Does anyone know of any thing else i can try to stop this from 
happening?




What's the session expiry time set to? Try setting it manually?

See http://www.php.net/manual/en/function.session-cache-expire.php


It's currently set to the default 180 minutes.

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



[PHP] Extending 'include' behavior in a function

2007-01-10 Thread Eli

Hi,

I want to create a function that does some stuff, and then includes 
another file in the place from where it was called. The idea is to run 
the included file not in the function, but in the place of the caller in 
the caller's environment (not in the function environment).

For example:



-thanks, Eli.

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



Re: [PHP] Parsing an XML return from a POST - resend with a little more information

2007-01-10 Thread Jochem Maas
Richard Luckhurst wrote:
> Hi Jochem,
> 
> Thanks for your reply
> 
>>> 
>>> 
> 
> JM> I'm fairly certain that this 'ypsilon' tag is going to cause a
> JM> problem - although that's just a guess, it's based on the 'knowledge'
> JM> that a valid XML document *must* have only 1 root element
> JM> (which would be 'fareResponse' in this case).
> 
> That makes sense when I think about it.
> 
> 
> JM> do as Roman says and post the simpleXML code you have so far.
> 
> I have done very little with Simple XML as I can't even get anything back out 
> of
> it. I have found the examples very confusing and I am obviously missing the
> point of SimpleXML as it is obvious others are getting it to work.
> 
>   $file = "test.xml";
>   
> $data = simplexml_load_file($file);
> var_dump($data);
> 
> Produces the following
> 
> object(SimpleXMLElement)#1 (5) {
>   ["@attributes"]=>
>   array(2) {
> ["cntTarifs"]=>
> string(3) "122"
> ["offset"]=>
> string(1) "0"
>   }
>   ["fares"]=>
>   object(SimpleXMLElement)#2 (1) {
> ["fare"]=>
> array(2) {
>   [0]=>
>   object(SimpleXMLElement)#6 (2) {
> ["@attributes"]=>
> array(11) {
>   ["fareId"]=>
>   string(8) "11429927"
>   ["fareType"]=>
>   string(3) "PUB"
>   ["checked"]=>
>   string(5) "false"
>   ["class"]=>
>   string(1) "V"
>   ["depApt"]=>
>   string(3) "SYD"
>   ["dstApt"]=>
>   string(3) "LON"
>   ["paxType"]=>
>   string(3) "ADT"
>   ["vcr"]=>
>   string(2) "OS"
>   ["cos"]=>
>   string(1) "E"
>   ["yyFare"]=>
>   string(5) "false"
>   ["avail"]=>
>   string(5) "false"
> }
> ["fareBases"]=>
> object(SimpleXMLElement)#8 (1) {
>   ["fareBase"]=>
>   array(3) {
> [0]=>
> string(5) "VLOX2"
> [1]=>
> string(5) "VLOX2"
> [2]=>
> string(5) "VLOX2"
>   }
> }
>   }
>   [1]=>
>   object(SimpleXMLElement)#7 (2) {
> ["@attributes"]=>
> array(11) {
>   ["fareId"]=>
>   string(8) "11429924"
>   ["fareType"]=>
>   string(3) "PUB"
>   ["checked"]=>
>   string(5) "false"
>   ["class"]=>
>   string(1) "M"
>   ["depApt"]=>
>   string(3) "SYD"
>   ["dstApt"]=>
>   string(3) "LON"
>   ["paxType"]=>
>   string(3) "ADT"
>   ["vcr"]=>
>   string(2) "OS"
>   ["cos"]=>
>   string(1) "E"
>   ["yyFare"]=>
>   string(5) "false"
>   ["avail"]=>
>   string(5) "false"
> }
> ["fareBases"]=>
> object(SimpleXMLElement)#9 (1) {
>   ["fareBase"]=>
>   array(3) {
> [0]=>
> string(5) "MLOW2"
> [1]=>
> string(5) "MLOW2"
> [2]=>
> string(5) "MLOW2"
>   }
> }
>   }
> }
>   }
>   ["tarifs"]=>
>   object(SimpleXMLElement)#3 (2) {
> ["@attributes"]=>
> array(1) {
>   ["currency"]=>
>   string(3) "USD"
> }
> ["tarif"]=>
> array(2) {
>   [0]=>
>   object(SimpleXMLElement)#10 (2) {
> ["@attributes"]=>
> array(9) {
>   ["tarifId"]=>
>   string(8) "11429927"
>   ["adtBuy"]=>
>   string(6) "675.07"
>   ["adtSell"]=>
>   string(6) "675.07"
>   ["chdBuy"]=>
>   string(6) "675.07"
>   ["chdSell"]=>
>   string(6) "675.07"
>   ["infBuy"]=>
>   string(6) "675.07"
>   ["infSell"]=>
>   string(6) "675.07"
>   ["topCar"]=>
>   string(5) "false"
>   ["topHotel"]=>
>   string(5) "false"
> }
> ["fareXRefs"]=>
> object(SimpleXMLElement)#12 (1) {
>   ["fareXRef"]=>
>   string(8) "11429927"
> }
>   }
>   [1]=>
>   object(SimpleXMLElement)#11 (2) {
> ["@attributes"]=>
> array(9) {
>   ["tarifId"]=>
>   string(8) "11429926"
>   ["adtBuy"]=>
>   string(6) "714.83"
>   ["adtSell"]=>
>   string(6) "714.83"
>   ["chdBuy"]=>
>   string(6) "714.83"
>   ["chdSell"]=>
>   string(6) "714.83"
>   ["infBuy"]=>
>   string(6) "714.83"
>   ["infSell"]=>
>   string(6) "714.83"
>   ["topCar"]=>
>   string(5) "false"
>   ["topHotel"]=>
>   string(5) "false"
> }
> ["fareXRefs"]=>
> object(SimpleXMLElement)#13 (1) {
>   ["fareXRef"]=>
>   string(8) "11429926"
> }
>   }
> }
>   }
>   ["taxes"]=>
>   object(SimpleXMLElement)#4 (2) {
> ["@attributes"]=>
> array(1) {
>   ["c

Re: [PHP] Extending session timeouts manually

2007-01-10 Thread Chris

Ryan Fielding wrote:
I'm using a session to save cart contents within a store, and this 
session follows the user as they proceed through the checkout. My 
problem is, if a customer orders say 10 items, they have the option to 
input 10 different addresses that these items will be delivered to. I've 
noticed that some sessions are timing out before the user can finish 
entering in all the details. I thought that maybe a tiny iframe calling 
a page that used  to refresh 
the iframe every 5 minutes, but no such luck.


Does anyone know of any thing else i can try to stop this from happening?



What's the session expiry time set to? Try setting it manually?

See http://www.php.net/manual/en/function.session-cache-expire.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] Stored Procedure returns nothing on ROLLBACK

2007-01-10 Thread Chris

Philip Thompson wrote:

Hi.

I have been experiencing MSSQL woes lately. I have a stored procedure 
that I call in PHP using mssql_* functions. In my procedure, I have a 
transaction that rolls back on failure and commits on success (of 
course). If it commits, I get the proper return value (int) and the 
appropriate output parameters. However, if it rolls back, I get 
NOTHING... even if I try to return an error code (int) after the 
ROLLBACK TRANSACTION statement. The output parameter also does not get 
set upon rollback.


Is there a way to grab the error even in a rollback? or at least return 
something besides an empty string/int? I would like to know what error 
message to provide the user/admin.


SQL Server 2000, PHP 5.1.6, ntwdblib.dll version 8.00.194


Does it work outside of php? That is - you run it manually in mssql 
(whatever tools that has) you get the proper codes?


--
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] given up of iis now trying apache

2007-01-10 Thread Chris

Ross wrote:
Everything seems to be working but when I try and run a php file. It offer 
the download dialogue box.


I remeber doing something where you tick a box to enable scripts and execute 
them or something in the manager. Can anyone help?


AFAIK apache doesn't have a manager that has a bunch of checkbox 
options, it's a config file you need to edit manually (I know it is in 
*nix world, haven't installed apache on a windows machine in a long time 
so maybe there is one now).


Anyway the download box appearing means the webserver isn't set up properly.


Depending on which version of apache you are using, you need either this:

http://www.php.net/manual/en/install.windows.apache1.php

or

http://www.php.net/manual/en/install.windows.apache2.php


If you still have problems post the php related sections of your apache 
config file.


--
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] Extending session timeouts manually

2007-01-10 Thread Ryan Fielding
I'm using a session to save cart contents within a store, and this 
session follows the user as they proceed through the checkout. My 
problem is, if a customer orders say 10 items, they have the option to 
input 10 different addresses that these items will be delivered to. I've 
noticed that some sessions are timing out before the user can finish 
entering in all the details. I thought that maybe a tiny iframe calling 
a page that used  to refresh 
the iframe every 5 minutes, but no such luck.


Does anyone know of any thing else i can try to stop this from happening?

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



Re: [PHP] Unable to compile php with MSSQL support / configure: error: Directory /usr is not a FreeTDS installation directory

2007-01-10 Thread Frank M. Kromann
Hi,

--with-mssql=/usr or --with-mssql=shared,/user should work with your
configuration. It's looking for /usr/include/tds.h or
/usr/include/freetds/tds.h. If the file was not found in any of those
locations you will get the error you are describing here.

- Frank

> Hi,
> 
> I am trying to compile php 5.0.6 with mssql support with no luck.
> 
> I have freetds, freetds-devel but no luck so far.
> 
> I've tried the simplest form and some variations variations
> ./configure --with-mssql
> ./configure --with-mssql=/usr
> ./configure --with-mssql=shared,/usr
> ./configure --with-mssql=shared,/usr/lib
> ...
> 
> All end up with
> 
> checking for MSSQL support via FreeTDS... yes
> configure: error: Directory /usr is not a FreeTDS installation
directory
> 
> My rpm -ql of freetds freetds-devel shows
> 
> /etc/freetds.conf
> /etc/locales.conf
> /etc/pool.conf
> /usr/bin/bsqldb
> /usr/bin/defncopy
> /usr/bin/freebcp
> /usr/bin/tdspool
> /usr/bin/tsql
> /usr/lib/libct.so.3
> /usr/lib/libct.so.3.0.0
> /usr/lib/libsybdb.so.5
> /usr/lib/libsybdb.so.5.0.0
> /usr/lib/libtds.so.4
> /usr/lib/libtds.so.4.0.0
> /usr/lib/libtdsodbc.so.0
> /usr/lib/libtdsodbc.so.0.0.0
> /usr/lib/libtdssrv.so.2
> /usr/lib/libtdssrv.so.2.0.0
> /usr/share/doc/freetds-0.63
> /usr/share/doc/freetds-0.63/AUTHORS
> /usr/share/doc/freetds-0.63/BUGS
> /usr/share/doc/freetds-0.63/COPYING
> /usr/share/doc/freetds-0.63/COPYING.LIB
> /usr/share/doc/freetds-0.63/ChangeLog
> /usr/share/doc/freetds-0.63/NEWS
> /usr/share/doc/freetds-0.63/README
> /usr/share/doc/freetds-0.63/TODO
> /usr/share/doc/freetds-0.63/api_status.txt
> /usr/share/doc/freetds-0.63/bcp.txt
> /usr/share/doc/freetds-0.63/bsqldb.txt
> /usr/share/doc/freetds-0.63/cap.txt
> /usr/share/doc/freetds-0.63/defncopy.txt
> /usr/share/doc/freetds-0.63/freebcp.txt
> /usr/share/doc/freetds-0.63/getting_started.txt
> /usr/share/doc/freetds-0.63/policy.txt
> /usr/share/doc/freetds-0.63/tds.html
> /usr/share/doc/freetds-0.63/tsql.txt
> /usr/share/doc/freetds-0.63/userguide.sgml
> /usr/share/man/man1/bsqldb.1.gz
> /usr/share/man/man1/defncopy.1.gz
> /usr/share/man/man1/freebcp.1.gz
> /usr/share/man/man1/tsql.1.gz
> /usr/include/freetds
> /usr/include/freetds/bkpublic.h
> /usr/include/freetds/cspublic.h
> /usr/include/freetds/cstypes.h
> /usr/include/freetds/ctpublic.h
> /usr/include/freetds/sqldb.h
> /usr/include/freetds/sqlfront.h
> /usr/include/freetds/sybdb.h
> /usr/include/freetds/syberror.h
> /usr/include/freetds/sybfront.h
> /usr/include/freetds/tds.h
> /usr/include/freetds/tds_sysdep_public.h
> /usr/include/freetds/tdsconvert.h
> /usr/include/freetds/tdssrv.h
> /usr/include/freetds/tdsver.h
> /usr/lib/libct.a
> /usr/lib/libct.so
> /usr/lib/libsybdb.a
> /usr/lib/libsybdb.so
> /usr/lib/libtds.a
> /usr/lib/libtds.so
> /usr/lib/libtdsodbc.a
> /usr/lib/libtdsodbc.so
> /usr/lib/libtdssrv.a
> /usr/lib/libtdssrv.so
> /usr/share/doc/freetds-devel-0.63
> /usr/share/doc/freetds-devel-0.63/samples
> /usr/share/doc/freetds-devel-0.63/samples/Makefile
> /usr/share/doc/freetds-devel-0.63/samples/Makefile.am
> /usr/share/doc/freetds-devel-0.63/samples/Makefile.in
> /usr/share/doc/freetds-devel-0.63/samples/README
> /usr/share/doc/freetds-devel-0.63/samples/debug.c
> /usr/share/doc/freetds-devel-0.63/samples/dyntest.c
> /usr/share/doc/freetds-devel-0.63/samples/odbc.ini
> /usr/share/doc/freetds-devel-0.63/samples/odbctest.php
> /usr/share/doc/freetds-devel-0.63/samples/odbctest.pl
> /usr/share/doc/freetds-devel-0.63/samples/test.php
> /usr/share/doc/freetds-devel-0.63/samples/test.pl
>
/usr/share/doc/freetds-devel-0.63/samples/unixodbc.freetds.driver.template
> /usr/share/doc/freetds-devel-0.63
> /samples/unixodbc.freetds.driver.template.in
> /usr/share/doc/freetds-devel-0.63/samples/unixodbc.install.sh
>
/usr/share/doc/freetds-devel-0.63/samples/unixodbc.jdbc.datasource.template
> 

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



Re[2]: [PHP] Parsing an XML return from a POST - resend with a little more information

2007-01-10 Thread Richard Luckhurst
Hi Jochem,

Thanks for your reply

>> 
>> 
>> 

JM> I'm fairly certain that this 'ypsilon' tag is going to cause a
JM> problem - although that's just a guess, it's based on the 'knowledge'
JM> that a valid XML document *must* have only 1 root element
JM> (which would be 'fareResponse' in this case).

That makes sense when I think about it.


JM> do as Roman says and post the simpleXML code you have so far.

I have done very little with Simple XML as I can't even get anything back out of
it. I have found the examples very confusing and I am obviously missing the
point of SimpleXML as it is obvious others are getting it to work.

  $file = "test.xml";
  
$data = simplexml_load_file($file);
var_dump($data);

Produces the following

object(SimpleXMLElement)#1 (5) {
  ["@attributes"]=>
  array(2) {
["cntTarifs"]=>
string(3) "122"
["offset"]=>
string(1) "0"
  }
  ["fares"]=>
  object(SimpleXMLElement)#2 (1) {
["fare"]=>
array(2) {
  [0]=>
  object(SimpleXMLElement)#6 (2) {
["@attributes"]=>
array(11) {
  ["fareId"]=>
  string(8) "11429927"
  ["fareType"]=>
  string(3) "PUB"
  ["checked"]=>
  string(5) "false"
  ["class"]=>
  string(1) "V"
  ["depApt"]=>
  string(3) "SYD"
  ["dstApt"]=>
  string(3) "LON"
  ["paxType"]=>
  string(3) "ADT"
  ["vcr"]=>
  string(2) "OS"
  ["cos"]=>
  string(1) "E"
  ["yyFare"]=>
  string(5) "false"
  ["avail"]=>
  string(5) "false"
}
["fareBases"]=>
object(SimpleXMLElement)#8 (1) {
  ["fareBase"]=>
  array(3) {
[0]=>
string(5) "VLOX2"
[1]=>
string(5) "VLOX2"
[2]=>
string(5) "VLOX2"
  }
}
  }
  [1]=>
  object(SimpleXMLElement)#7 (2) {
["@attributes"]=>
array(11) {
  ["fareId"]=>
  string(8) "11429924"
  ["fareType"]=>
  string(3) "PUB"
  ["checked"]=>
  string(5) "false"
  ["class"]=>
  string(1) "M"
  ["depApt"]=>
  string(3) "SYD"
  ["dstApt"]=>
  string(3) "LON"
  ["paxType"]=>
  string(3) "ADT"
  ["vcr"]=>
  string(2) "OS"
  ["cos"]=>
  string(1) "E"
  ["yyFare"]=>
  string(5) "false"
  ["avail"]=>
  string(5) "false"
}
["fareBases"]=>
object(SimpleXMLElement)#9 (1) {
  ["fareBase"]=>
  array(3) {
[0]=>
string(5) "MLOW2"
[1]=>
string(5) "MLOW2"
[2]=>
string(5) "MLOW2"
  }
}
  }
}
  }
  ["tarifs"]=>
  object(SimpleXMLElement)#3 (2) {
["@attributes"]=>
array(1) {
  ["currency"]=>
  string(3) "USD"
}
["tarif"]=>
array(2) {
  [0]=>
  object(SimpleXMLElement)#10 (2) {
["@attributes"]=>
array(9) {
  ["tarifId"]=>
  string(8) "11429927"
  ["adtBuy"]=>
  string(6) "675.07"
  ["adtSell"]=>
  string(6) "675.07"
  ["chdBuy"]=>
  string(6) "675.07"
  ["chdSell"]=>
  string(6) "675.07"
  ["infBuy"]=>
  string(6) "675.07"
  ["infSell"]=>
  string(6) "675.07"
  ["topCar"]=>
  string(5) "false"
  ["topHotel"]=>
  string(5) "false"
}
["fareXRefs"]=>
object(SimpleXMLElement)#12 (1) {
  ["fareXRef"]=>
  string(8) "11429927"
}
  }
  [1]=>
  object(SimpleXMLElement)#11 (2) {
["@attributes"]=>
array(9) {
  ["tarifId"]=>
  string(8) "11429926"
  ["adtBuy"]=>
  string(6) "714.83"
  ["adtSell"]=>
  string(6) "714.83"
  ["chdBuy"]=>
  string(6) "714.83"
  ["chdSell"]=>
  string(6) "714.83"
  ["infBuy"]=>
  string(6) "714.83"
  ["infSell"]=>
  string(6) "714.83"
  ["topCar"]=>
  string(5) "false"
  ["topHotel"]=>
  string(5) "false"
}
["fareXRefs"]=>
object(SimpleXMLElement)#13 (1) {
  ["fareXRef"]=>
  string(8) "11429926"
}
  }
}
  }
  ["taxes"]=>
  object(SimpleXMLElement)#4 (2) {
["@attributes"]=>
array(1) {
  ["currency"]=>
  string(3) "USD"
}
["tax"]=>
string(6) "201.52"
  }
  ["vcrSummary"]=>
  object(SimpleXMLElement)#5 (1) {
["vcr"]=>
array(2) {
  [0]=>
  string(2) "AA"
  [1]=>
  string(2) "PR"
}
  }
}


So I can clearly see the data I want is there. However I have tried the
following

 foreach ($data->fares as $fares)
 {
print "{$fares->fa

[PHP] Unable to compile php with MSSQL support / configure: error: Directory /usr is not a FreeTDS installation directory

2007-01-10 Thread mbneto

Hi,

I am trying to compile php 5.0.6 with mssql support with no luck.

I have freetds, freetds-devel but no luck so far.

I've tried the simplest form and some variations variations
./configure --with-mssql
./configure --with-mssql=/usr
./configure --with-mssql=shared,/usr
./configure --with-mssql=shared,/usr/lib
...

All end up with

checking for MSSQL support via FreeTDS... yes
configure: error: Directory /usr is not a FreeTDS installation directory

My rpm -ql of freetds freetds-devel shows

/etc/freetds.conf
/etc/locales.conf
/etc/pool.conf
/usr/bin/bsqldb
/usr/bin/defncopy
/usr/bin/freebcp
/usr/bin/tdspool
/usr/bin/tsql
/usr/lib/libct.so.3
/usr/lib/libct.so.3.0.0
/usr/lib/libsybdb.so.5
/usr/lib/libsybdb.so.5.0.0
/usr/lib/libtds.so.4
/usr/lib/libtds.so.4.0.0
/usr/lib/libtdsodbc.so.0
/usr/lib/libtdsodbc.so.0.0.0
/usr/lib/libtdssrv.so.2
/usr/lib/libtdssrv.so.2.0.0
/usr/share/doc/freetds-0.63
/usr/share/doc/freetds-0.63/AUTHORS
/usr/share/doc/freetds-0.63/BUGS
/usr/share/doc/freetds-0.63/COPYING
/usr/share/doc/freetds-0.63/COPYING.LIB
/usr/share/doc/freetds-0.63/ChangeLog
/usr/share/doc/freetds-0.63/NEWS
/usr/share/doc/freetds-0.63/README
/usr/share/doc/freetds-0.63/TODO
/usr/share/doc/freetds-0.63/api_status.txt
/usr/share/doc/freetds-0.63/bcp.txt
/usr/share/doc/freetds-0.63/bsqldb.txt
/usr/share/doc/freetds-0.63/cap.txt
/usr/share/doc/freetds-0.63/defncopy.txt
/usr/share/doc/freetds-0.63/freebcp.txt
/usr/share/doc/freetds-0.63/getting_started.txt
/usr/share/doc/freetds-0.63/policy.txt
/usr/share/doc/freetds-0.63/tds.html
/usr/share/doc/freetds-0.63/tsql.txt
/usr/share/doc/freetds-0.63/userguide.sgml
/usr/share/man/man1/bsqldb.1.gz
/usr/share/man/man1/defncopy.1.gz
/usr/share/man/man1/freebcp.1.gz
/usr/share/man/man1/tsql.1.gz
/usr/include/freetds
/usr/include/freetds/bkpublic.h
/usr/include/freetds/cspublic.h
/usr/include/freetds/cstypes.h
/usr/include/freetds/ctpublic.h
/usr/include/freetds/sqldb.h
/usr/include/freetds/sqlfront.h
/usr/include/freetds/sybdb.h
/usr/include/freetds/syberror.h
/usr/include/freetds/sybfront.h
/usr/include/freetds/tds.h
/usr/include/freetds/tds_sysdep_public.h
/usr/include/freetds/tdsconvert.h
/usr/include/freetds/tdssrv.h
/usr/include/freetds/tdsver.h
/usr/lib/libct.a
/usr/lib/libct.so
/usr/lib/libsybdb.a
/usr/lib/libsybdb.so
/usr/lib/libtds.a
/usr/lib/libtds.so
/usr/lib/libtdsodbc.a
/usr/lib/libtdsodbc.so
/usr/lib/libtdssrv.a
/usr/lib/libtdssrv.so
/usr/share/doc/freetds-devel-0.63
/usr/share/doc/freetds-devel-0.63/samples
/usr/share/doc/freetds-devel-0.63/samples/Makefile
/usr/share/doc/freetds-devel-0.63/samples/Makefile.am
/usr/share/doc/freetds-devel-0.63/samples/Makefile.in
/usr/share/doc/freetds-devel-0.63/samples/README
/usr/share/doc/freetds-devel-0.63/samples/debug.c
/usr/share/doc/freetds-devel-0.63/samples/dyntest.c
/usr/share/doc/freetds-devel-0.63/samples/odbc.ini
/usr/share/doc/freetds-devel-0.63/samples/odbctest.php
/usr/share/doc/freetds-devel-0.63/samples/odbctest.pl
/usr/share/doc/freetds-devel-0.63/samples/test.php
/usr/share/doc/freetds-devel-0.63/samples/test.pl
/usr/share/doc/freetds-devel-0.63/samples/unixodbc.freetds.driver.template
/usr/share/doc/freetds-devel-0.63
/samples/unixodbc.freetds.driver.template.in
/usr/share/doc/freetds-devel-0.63/samples/unixodbc.install.sh
/usr/share/doc/freetds-devel-0.63/samples/unixodbc.jdbc.datasource.template


Re: [PHP] Security with dbHost, dbUser, dbPassword

2007-01-10 Thread Jochem Maas
Satyam wrote:
> 
> - Original Message - From: "Otto Wyss" <[EMAIL PROTECTED]>
> 
>> What is the usual save way to store/use DB access info in a script. I
>> currently just use some PHP variables in a file which I include in all
>> other scripts.
>>
>> config.php
>> >   if (!defined ("config_include")) die ("Error...");
>>   $dbhost = "localhost";
>>   $dbuser = "name";
>>   $dbpass = "password";
>>   $dbname = "database";
>>   $dbcoll = "utf8_unicode_ci";
>> ?>
>>
>> Is this save enough or are there better ways? Where should I store
>> this file so it isn't accessible via the net but inside scripts?
>>
>> O. Wyss
>>
> 
> Besides what Jochem has already sugested, I would add that I usually
> have in the include file, in an unaccessible path as he said, a function
> that returns a connection. The function has all the connection
> information local, so that they are neither global variables nor
> constants, just local literal values within the function.  

I'm sure most people end up with some kind of abstraction in the form
of a class or function to do all the 'heavy lifting' regarding connecting
to the DB, etc - but when projects get rather large and/or your faced with a
situation where you want/need to run your project on different systems
(e.g. local-dev, test/staging, live) it often most handy to place all 
installation
specific configuration values in a single file that is specific to the
given installation and therefore usually not included as part of the
version control (e.g. CVS or SVN) module that stores the projects files.

> In the same
> function I put the call to mysql_select_db.  Though I check the return
> values for errors, I usually ignore them since unless you have either
> more than one database engine or more than one database, the default
> link resource does not need to me explicitly passed to other functions.
> 
> Satyam
> 

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



[PHP] Stored Procedure returns nothing on ROLLBACK

2007-01-10 Thread Philip Thompson

Hi.

I have been experiencing MSSQL woes lately. I have a stored procedure  
that I call in PHP using mssql_* functions. In my procedure, I have a  
transaction that rolls back on failure and commits on success (of  
course). If it commits, I get the proper return value (int) and the  
appropriate output parameters. However, if it rolls back, I get  
NOTHING... even if I try to return an error code (int) after the  
ROLLBACK TRANSACTION statement. The output parameter also does not  
get set upon rollback.


Is there a way to grab the error even in a rollback? or at least  
return something besides an empty string/int? I would like to know  
what error message to provide the user/admin.


SQL Server 2000, PHP 5.1.6, ntwdblib.dll version 8.00.194

Thanks in advance.
~Philip

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



Re: [PHP] Security with dbHost, dbUser, dbPassword

2007-01-10 Thread Satyam


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


What is the usual save way to store/use DB access info in a script. I 
currently just use some PHP variables in a file which I include in all 
other scripts.


config.php


Is this save enough or are there better ways? Where should I store this 
file so it isn't accessible via the net but inside scripts?


O. Wyss



Besides what Jochem has already sugested, I would add that I usually have in 
the include file, in an unaccessible path as he said, a function that 
returns a connection. The function has all the connection information local, 
so that they are neither global variables nor constants, just local literal 
values within the function.  In the same function I put the call to 
mysql_select_db.  Though I check the return values for errors, I usually 
ignore them since unless you have either more than one database engine or 
more than one database, the default link resource does not need to me 
explicitly passed to other functions.


Satyam

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



Re: [PHP] Javascript detection , working version

2007-01-10 Thread Jürgen Wind

>index.php, jstest110.php) , make it one.
no, it was just a proof of concept

>It would be cool if I could send js value via a 
>POST instead of GET-- can that be done?
should be possible with some onload/xhtmlrequest

>tedd

>PS: I read somewhere that using  is not recommended.
hmm, any links or buzzwords for google?
-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8267553
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] Security with dbHost, dbUser, dbPassword

2007-01-10 Thread Jochem Maas
I think what your doing now is reasonably safe,
but it assumes that apache will actually pass all .php files
to php for processing. if the php module doesn't load for
some reason then the contents of the file will be output
in it's entirety - this is why it's much better to store
this file outside of the webroot ...

Otto Wyss wrote:
> What is the usual save way to store/use DB access info in a script. I
> currently just use some PHP variables in a file which I include in all
> other scripts.
> 
> config.php
>if (!defined ("config_include")) die ("Error...");

even without the above statement the file wouldn't
display anything - that said the if statement doesn't hurt.

I usually define constants for the values below to avoid
the possibility that the values are overwritten at any stage,
I also do it because I prefer not to pollute the global scope
with 'unnecessary' vars.

granted define() is slower than creating a var - which is why some
people would recommend against using it.

>   $dbhost = "localhost";
>   $dbuser = "name";
>   $dbpass = "password";
>   $dbname = "database";
>   $dbcoll = "utf8_unicode_ci";
> ?>

I never include the closing php tag in include files to avoid
stray empty lines being output - which can cause any headers
that you try to send after the offending include file is included
to fail.

> 
> Is this save enough or are there better ways? Where should I store this
> file so it isn't accessible via the net but inside scripts?

outside the webroot. what people often do is create an include dir
at the same level as the webroot dir and add this directory to the include_path
ini setting.

e.g.

/home/webroot/global.php
/home/webroot/index.php
/home/include
/home/include/config.php

index.php
=
 
> O. Wyss
> 

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



[PHP] Re: PHP/Apache configuration failure

2007-01-10 Thread zerof

Bruce A. Julseth escreveu:

I can't get Apache to restart after I've configured for PHP. I've upgraded my 
installation to
5.2. 
...

...

My mailbox is spam-free with ChoiceMail, the leader in personal and corporate 
anti-spam solutions. Download your free copy of ChoiceMail from 
www.digiportal.com


I wrote a tutorial on how to install Apache2/PHP5 in a non standard way.

http://www.educar.pro.br/compl/php5/

http://www.educar.pro.br/compl/apache22/

http://www.educar.pro.br/compl/apache2/
--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
--
Você deve, sempre, consultar uma segunda opião!
--  
You must hear, always, one second opinion! In all cases.
--

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



[PHP] Security with dbHost, dbUser, dbPassword

2007-01-10 Thread Otto Wyss
What is the usual save way to store/use DB access info in a script. I 
currently just use some PHP variables in a file which I include in all 
other scripts.


config.php


Is this save enough or are there better ways? Where should I store this 
file so it isn't accessible via the net but inside scripts?


O. Wyss

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



Re: [PHP] 5.2 installer not working and iis looking for password

2007-01-10 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-10 20:26:44 -:
> 
> I am trying to install 5.2 via the installer but the when I try and open a 
> page IIS asks for a password and the page is not found.
> 
> Any ideas?

Umm, configure the webserver manually?

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] mssql_* overhead

2007-01-10 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-10 10:49:35 -0600:
> On Jan 10, 2007, at 10:09 AM, Jochem Maas wrote:
> >Philip Thompson wrote:
> >>Does anyone know if the mssql_connect/_init/_bind/etc require a  
> >>lot of overhead?

You can quite easily find out what effect those function have on the
performance profile of your program with xdebug.

> >>I have a page that requires multiple function calls and each of those
> >>opens a new connection to the database, performs the necessary  
> >>actions in stored procedure(s), and then closes the connection.
> >>However, I  found this to be slower than I was wanting.

*What* have you found slower? Which of the multiple actions you mention
are you talking about?

> >>So I thought, just create one connection and assign it to the
> >>SESSION (a global), and in each  function that requires a
> >>connection, call that SESSION variable. At the end of the page,
> >>close the connection and nullify the variable.
> >
> >I wouldn't stick it in the SESSION superglobal (my tactic is  usually
> >to create a little wrapper class to the relevant DB functions and
> >store the  connection as a property of the class/object.
> >
> >basically opening & closing the connection once per request is the  
> >way to go - if your going to using a global, better [than $_SESSION]
> >to  stick it in $GLOBALS imho.
> 
> Would there be any speed decrease with multiple users (hundreds)  
> sharing this $GLOBALS variable (if that makes sense)?
 
Looks like you're confused about semantics associated with $GLOBALS and
$_SESSION. In the context of web servers, $GLOBALS is limited to the
current request, $_SESSION persists across requests for a single
*session*, just as Jochem wrote.


-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



[PHP] 5.2 installer not working and iis looking for password

2007-01-10 Thread Ross

I am trying to install 5.2 via the installer but the when I try and open a 
page IIS asks for a password and the page is not found.

Any ideas?


R. 

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



RE: [PHP] mssql_* overhead

2007-01-10 Thread bruce
hi phillip...

just to clarify regarding having the mysql resource ID in a session var. are
you saying that you're able to more or less, do a mysql_connect and store
the resourceID in a session var, which can then be used on any given page
within your site, without having to recall the mysql_connect to establish a
new connection?

at one time, i had played with how this might be accomplished, and could
never get it to work, without having to get into the idea/area of connection
pools...

thanks for the clarification.



-Original Message-
From: Philip Thompson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 10, 2007 9:28 AM
To: php General List
Subject: Re: [PHP] mssql_* overhead


I just wanted to make sure that there is no speed decrease if I
change from $_SESSION to $GLOBALS to hold my connection (even with
lots of people). I guess that's my question?

Thanks,
~Philip


On Jan 10, 2007, at 11:01 AM, [EMAIL PROTECTED] wrote:

> I thought the same thing as Jochem... that resources like database
> connections, couldn't be stored in $_SESSION. You say that's how
> you have (had?) it set up and it was working, but still sounds
> wrong to me.
>
> As for connections.. definitely don't open a new connection every
> time you run a function, unless it's run so rarely that it makes it
> more efficient to open and close within the function.   If it's a
> function run many times, you're definitely going to see a
> performance hit.
>
> Typical procedure (at least how I've seen it done and done it
> myself at a few different jobs) is to open the connection once and
> close it once.  Which sounds like what you're doing now.
>
> So was your question answered?   Sounds like there's still some
> lingering questions or curiosities...
>
> -TG
>
> = = = Original message = = =
>
> On Jan 10, 2007, at 10:09 AM, Jochem Maas wrote:
>
>> Philip Thompson wrote:
>>> Hi.
>>>
>>> Does anyone know if the mssql_connect/_init/_bind/etc require a
>>> lot of
>>> overhead?
>>>
>>> I have a page that requires multiple function calls and each of
>>> those
>>> opens a new connection to the database, performs the necessary
>>> actions
>>> in stored procedure(s), and then closes the connection. However, I
>>> found
>>> this to be slower than I was wanting. So I thought, just create one
>>> connection and assign it to the SESSION (a global), and in each
>>> function
>>> that requires a connection, call that SESSION variable. At the
>>> end of
>>> the page, close the connection and nullify the variable.
>>
>> I wouldn't stick it in the SESSION superglobal (my tactic is
>> usually to create
>> a little wrapper class to the relevant DB functions and store the
>> connection
>> as a property of the class/object.
>>
>> basically opening & closing the connection once per request is the
>> way to
>> go - if your going to using a global, better [than $_SESSION] to
>> stick it
>> in $GLOBALS imho.
>
> Would there be any speed decrease with multiple users (hundreds)
> sharing this $GLOBALS variable (if that makes sense)?
>
>
>> $_SESSION is used for persisting data over multiple requests -
>> something that
>> is not possible to do for 'resource identifiers' (which is what the
>> connection [id] is).
>
> BTW, it does work b/c that's how it's currently setup. I am open to
> changing it though. I should say, I'm creating at the beginning of
> the script and closing it at the end. So, it doesn't actually stay
> open throughout the whole user session.
>
>
>>> Does anyone see a problem with doing it this way? Security concerns?
>>> Anything?
>>>
>>> Thanks in advance,
>>> ~Philip

--
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] mssql_* overhead

2007-01-10 Thread Philip Thompson
Ok, just kidding. Thank you Jim and Jochem. You answered my question  
in your previous posts!


Thanks to all!
~Phil


On Jan 10, 2007, at 11:27 AM, Philip Thompson wrote:

I just wanted to make sure that there is no speed decrease if I  
change from $_SESSION to $GLOBALS to hold my connection (even with  
lots of people). I guess that's my question?


Thanks,
~Philip


On Jan 10, 2007, at 11:01 AM, [EMAIL PROTECTED] wrote:

I thought the same thing as Jochem... that resources like database  
connections, couldn't be stored in $_SESSION. You say that's how  
you have (had?) it set up and it was working, but still sounds  
wrong to me.


As for connections.. definitely don't open a new connection every  
time you run a function, unless it's run so rarely that it makes  
it more efficient to open and close within the function.   If it's  
a function run many times, you're definitely going to see a  
performance hit.


Typical procedure (at least how I've seen it done and done it  
myself at a few different jobs) is to open the connection once and  
close it once.  Which sounds like what you're doing now.


So was your question answered?   Sounds like there's still some  
lingering questions or curiosities...


-TG

= = = Original message = = =

On Jan 10, 2007, at 10:09 AM, Jochem Maas wrote:


Philip Thompson wrote:

Hi.

Does anyone know if the mssql_connect/_init/_bind/etc require a
lot of
overhead?

I have a page that requires multiple function calls and each of  
those

opens a new connection to the database, performs the necessary
actions
in stored procedure(s), and then closes the connection. However, I
found
this to be slower than I was wanting. So I thought, just create one
connection and assign it to the SESSION (a global), and in each
function
that requires a connection, call that SESSION variable. At the  
end of

the page, close the connection and nullify the variable.


I wouldn't stick it in the SESSION superglobal (my tactic is
usually to create
a little wrapper class to the relevant DB functions and store the
connection
as a property of the class/object.

basically opening & closing the connection once per request is the
way to
go - if your going to using a global, better [than $_SESSION] to
stick it
in $GLOBALS imho.


Would there be any speed decrease with multiple users (hundreds)
sharing this $GLOBALS variable (if that makes sense)?



$_SESSION is used for persisting data over multiple requests -
something that
is not possible to do for 'resource identifiers' (which is what the
connection [id] is).


BTW, it does work b/c that's how it's currently setup. I am open to
changing it though. I should say, I'm creating at the beginning of
the script and closing it at the end. So, it doesn't actually stay
open throughout the whole user session.


Does anyone see a problem with doing it this way? Security  
concerns?

Anything?

Thanks in advance,
~Philip


--
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] mssql_* overhead

2007-01-10 Thread Philip Thompson
I just wanted to make sure that there is no speed decrease if I  
change from $_SESSION to $GLOBALS to hold my connection (even with  
lots of people). I guess that's my question?


Thanks,
~Philip


On Jan 10, 2007, at 11:01 AM, [EMAIL PROTECTED] wrote:

I thought the same thing as Jochem... that resources like database  
connections, couldn't be stored in $_SESSION. You say that's how  
you have (had?) it set up and it was working, but still sounds  
wrong to me.


As for connections.. definitely don't open a new connection every  
time you run a function, unless it's run so rarely that it makes it  
more efficient to open and close within the function.   If it's a  
function run many times, you're definitely going to see a  
performance hit.


Typical procedure (at least how I've seen it done and done it  
myself at a few different jobs) is to open the connection once and  
close it once.  Which sounds like what you're doing now.


So was your question answered?   Sounds like there's still some  
lingering questions or curiosities...


-TG

= = = Original message = = =

On Jan 10, 2007, at 10:09 AM, Jochem Maas wrote:


Philip Thompson wrote:

Hi.

Does anyone know if the mssql_connect/_init/_bind/etc require a
lot of
overhead?

I have a page that requires multiple function calls and each of  
those

opens a new connection to the database, performs the necessary
actions
in stored procedure(s), and then closes the connection. However, I
found
this to be slower than I was wanting. So I thought, just create one
connection and assign it to the SESSION (a global), and in each
function
that requires a connection, call that SESSION variable. At the  
end of

the page, close the connection and nullify the variable.


I wouldn't stick it in the SESSION superglobal (my tactic is
usually to create
a little wrapper class to the relevant DB functions and store the
connection
as a property of the class/object.

basically opening & closing the connection once per request is the
way to
go - if your going to using a global, better [than $_SESSION] to
stick it
in $GLOBALS imho.


Would there be any speed decrease with multiple users (hundreds)
sharing this $GLOBALS variable (if that makes sense)?



$_SESSION is used for persisting data over multiple requests -
something that
is not possible to do for 'resource identifiers' (which is what the
connection [id] is).


BTW, it does work b/c that's how it's currently setup. I am open to
changing it though. I should say, I'm creating at the beginning of
the script and closing it at the end. So, it doesn't actually stay
open throughout the whole user session.



Does anyone see a problem with doing it this way? Security concerns?
Anything?

Thanks in advance,
~Philip


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



Re: [PHP] mssql_* overhead

2007-01-10 Thread Jochem Maas
Philip Thompson wrote:
> On Jan 10, 2007, at 10:09 AM, Jochem Maas wrote:
> 
>> Philip Thompson wrote:
>>> Hi.
>>>
>>> Does anyone know if the mssql_connect/_init/_bind/etc require a lot of
>>> overhead?
>>>
>>> I have a page that requires multiple function calls and each of those
>>> opens a new connection to the database, performs the necessary actions
>>> in stored procedure(s), and then closes the connection. However, I found
>>> this to be slower than I was wanting. So I thought, just create one
>>> connection and assign it to the SESSION (a global), and in each function
>>> that requires a connection, call that SESSION variable. At the end of
>>> the page, close the connection and nullify the variable.
>>
>> I wouldn't stick it in the SESSION superglobal (my tactic is usually
>> to create
>> a little wrapper class to the relevant DB functions and store the
>> connection
>> as a property of the class/object.
>>
>> basically opening & closing the connection once per request is the way to
>> go - if your going to using a global, better [than $_SESSION] to stick it
>> in $GLOBALS imho.
> 
> Would there be any speed decrease with multiple users (hundreds) sharing
> this $GLOBALS variable (if that makes sense)?

php is a 'share nothing' architecture - there is no concept of sharing data 
between
multiple processes like you might find a java-based web application. (there are 
caveats,
with regard to using SysV shared memory extension and [I believe] some DB 
extensions
do DB connection pooling at a low[er] level)

google for 'share nothing' and 'php' and your sure to find *much* better 
explanations
of this than I can/care to give :-)

$GLOBALS is only for the current request - it contains a reference to every
variable defined in the global scope of the current process, it can't be
used/viewed/manipulated by any other process/thread/request/badger.

> 
> 
>> $_SESSION is used for persisting data over multiple requests -
>> something that
>> is not possible to do for 'resource identifiers' (which is what the
>> connection [id] is).
> 
> BTW, it does work b/c that's how it's currently setup. I am open to
> changing it though. I should say, I'm creating at the beginning of the
> script and closing it at the end. 

it works because your not trying to persist the db connection resource
identifier between request - which is why is pointless (and possibly a little 
weird)
to use $_SESSION to store the resource identifier in .. then again it's
not really doing any harm (it's certainly a whole lot better than building up 
and
tearing down a db connection for every query!)

> So, it doesn't actually stay open
> throughout the whole user session.

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



Re: [PHP] mssql_* overhead

2007-01-10 Thread Jim Lucas

Philip Thompson wrote:

On Jan 10, 2007, at 10:09 AM, Jochem Maas wrote:


Philip Thompson wrote:

Hi.

Does anyone know if the mssql_connect/_init/_bind/etc require a lot of
overhead?

I have a page that requires multiple function calls and each of those
opens a new connection to the database, performs the necessary actions
in stored procedure(s), and then closes the connection. However, I 
found

this to be slower than I was wanting. So I thought, just create one
connection and assign it to the SESSION (a global), and in each 
function

that requires a connection, call that SESSION variable. At the end of
the page, close the connection and nullify the variable.


I wouldn't stick it in the SESSION superglobal (my tactic is usually 
to create
a little wrapper class to the relevant DB functions and store the 
connection

as a property of the class/object.

basically opening & closing the connection once per request is the 
way to
go - if your going to using a global, better [than $_SESSION] to 
stick it

in $GLOBALS imho.


Would there be any speed decrease with multiple users (hundreds) 
sharing this $GLOBALS variable (if that makes sense)?


They are not sharing the $GLOBALS array(), because the instance $GLOBALS 
is on a per-connection/page-request basis.  The data stored in the 
$GLOBALS is unique to that one request and dumped at the end of that request


$_SESSION is used for persisting data over multiple requests - 
something that
is not possible to do for 'resource identifiers' (which is what the 
connection [id] is).


BTW, it does work b/c that's how it's currently setup. I am open to 
changing it though. I should say, I'm creating at the beginning of the 
script and closing it at the end. So, it doesn't actually stay open 
throughout the whole user session.


He didn't say that it wasn't possible to 'store' the variable there.  
but afaik it is impossible to 'retain' the 'same' resource connection 
over the duration of a users SESSION ( not one page call, but many calls )


You said yourself that you are opening a new connection to the DB each 
time you make a call, then close that connection.  As far as your 
description leads me to believe that you are not reusing the same 
connection.


$_SESSION - From the manual: Variables which are currently registered to 
a script's

session.
   From me: persisting data over multiple page requests,
ie: PHPSESSID, login_name, authenticated, etc...

$GLOBALS - From the manual:  Contains a reference to every variable 
which is currently

available within the global scope of the script.
  From me: existing only on a per-page request.  What ever you 
have in here is

tossed at the end of each page request,
ie: DB connections, File Handlers, etc...

So, moving it from the SESSIONs Super Global to the GLOBALS Super Global 
would be suggested.


Jim



Does anyone see a problem with doing it this way? Security concerns?
Anything?

Thanks in advance,
~Philip


--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] mssql_* overhead

2007-01-10 Thread tg-php
I thought the same thing as Jochem... that resources like database connections, 
couldn't be stored in $_SESSION. You say that's how you have (had?) it set up 
and it was working, but still sounds wrong to me.

As for connections.. definitely don't open a new connection every time you run 
a function, unless it's run so rarely that it makes it more efficient to open 
and close within the function.   If it's a function run many times, you're 
definitely going to see a performance hit.

Typical procedure (at least how I've seen it done and done it myself at a few 
different jobs) is to open the connection once and close it once.  Which sounds 
like what you're doing now.

So was your question answered?   Sounds like there's still some lingering 
questions or curiosities...

-TG

= = = Original message = = =

On Jan 10, 2007, at 10:09 AM, Jochem Maas wrote:

> Philip Thompson wrote:
>> Hi.
>>
>> Does anyone know if the mssql_connect/_init/_bind/etc require a  
>> lot of
>> overhead?
>>
>> I have a page that requires multiple function calls and each of those
>> opens a new connection to the database, performs the necessary  
>> actions
>> in stored procedure(s), and then closes the connection. However, I  
>> found
>> this to be slower than I was wanting. So I thought, just create one
>> connection and assign it to the SESSION (a global), and in each  
>> function
>> that requires a connection, call that SESSION variable. At the end of
>> the page, close the connection and nullify the variable.
>
> I wouldn't stick it in the SESSION superglobal (my tactic is  
> usually to create
> a little wrapper class to the relevant DB functions and store the  
> connection
> as a property of the class/object.
>
> basically opening & closing the connection once per request is the  
> way to
> go - if your going to using a global, better [than $_SESSION] to  
> stick it
> in $GLOBALS imho.

Would there be any speed decrease with multiple users (hundreds)  
sharing this $GLOBALS variable (if that makes sense)?


> $_SESSION is used for persisting data over multiple requests -  
> something that
> is not possible to do for 'resource identifiers' (which is what the  
> connection [id] is).

BTW, it does work b/c that's how it's currently setup. I am open to  
changing it though. I should say, I'm creating at the beginning of  
the script and closing it at the end. So, it doesn't actually stay  
open throughout the whole user session.


>> Does anyone see a problem with doing it this way? Security concerns?
>> Anything?
>>
>> Thanks in advance,
>> ~Philip


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] mssql_* overhead

2007-01-10 Thread Eric Butera

On 1/10/07, Philip Thompson <[EMAIL PROTECTED]> wrote:

On Jan 10, 2007, at 10:09 AM, Jochem Maas wrote:

> Philip Thompson wrote:
>> Hi.
>>
>> Does anyone know if the mssql_connect/_init/_bind/etc require a
>> lot of
>> overhead?
>>
>> I have a page that requires multiple function calls and each of those
>> opens a new connection to the database, performs the necessary
>> actions
>> in stored procedure(s), and then closes the connection. However, I
>> found
>> this to be slower than I was wanting. So I thought, just create one
>> connection and assign it to the SESSION (a global), and in each
>> function
>> that requires a connection, call that SESSION variable. At the end of
>> the page, close the connection and nullify the variable.
>
> I wouldn't stick it in the SESSION superglobal (my tactic is
> usually to create
> a little wrapper class to the relevant DB functions and store the
> connection
> as a property of the class/object.
>
> basically opening & closing the connection once per request is the
> way to
> go - if your going to using a global, better [than $_SESSION] to
> stick it
> in $GLOBALS imho.

Would there be any speed decrease with multiple users (hundreds)
sharing this $GLOBALS variable (if that makes sense)?


> $_SESSION is used for persisting data over multiple requests -
> something that
> is not possible to do for 'resource identifiers' (which is what the
> connection [id] is).

BTW, it does work b/c that's how it's currently setup. I am open to
changing it though. I should say, I'm creating at the beginning of
the script and closing it at the end. So, it doesn't actually stay
open throughout the whole user session.


>> Does anyone see a problem with doing it this way? Security concerns?
>> Anything?
>>
>> Thanks in advance,
>> ~Philip

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



If you want to keep it in $_SESSION look into __sleep & __wakeup to be
all proper.  Perhaps it is already doing this since you said it just
works.

Also if you are looking to tweak things to see how performance
changes, look into the profiling abilities of Xdebug 2.  It is amazing
because you can profile your entire request for any given page of your
site and see how long each method took and the memory usage.

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



[PHP] PHP/Apache configuration failure

2007-01-10 Thread Bruce A. Julseth

I can't get Apache to restart after I've configured for PHP. I've upgraded my 
installation to
5.2. 
Now, Apache 2.2.3 runs fine without any PHP additions.

1) I added my PHP directory, C:/PHP5, to my PATH
2) I copied php.ini-recommended to my C:/windows directory and renamed
it php.ini
3) I made the following changes to PHP.ini
   doc_root = "c:/inetpub/wwwroot"
extension_dir = "c:/php5/ext"
4) I made the following changes to Httpd.conf
After the last entry in the LoadModule section:

  LoadModule php5_module "c:/php5/php5apache.dll"
 AddModule mod_php5.c

NOTE: If I comment out the above two statemens, Apache will start.

   In the  Section, I added

  AddType application/x-httpd-php .php
  Action application/x-httpd-php "/php/php.exe"

And that's it.

When I restart Apache, I get an error dialog with the message:

  The requested operation has failed.

What have I missed or done wrong?

Thanks for the help...

Bruce


My mailbox is spam-free with ChoiceMail, the leader in personal and corporate 
anti-spam solutions. Download your free copy of ChoiceMail from 
www.digiportal.com

Re: [PHP] mssql_* overhead

2007-01-10 Thread Philip Thompson

On Jan 10, 2007, at 10:09 AM, Jochem Maas wrote:


Philip Thompson wrote:

Hi.

Does anyone know if the mssql_connect/_init/_bind/etc require a  
lot of

overhead?

I have a page that requires multiple function calls and each of those
opens a new connection to the database, performs the necessary  
actions
in stored procedure(s), and then closes the connection. However, I  
found

this to be slower than I was wanting. So I thought, just create one
connection and assign it to the SESSION (a global), and in each  
function

that requires a connection, call that SESSION variable. At the end of
the page, close the connection and nullify the variable.


I wouldn't stick it in the SESSION superglobal (my tactic is  
usually to create
a little wrapper class to the relevant DB functions and store the  
connection

as a property of the class/object.

basically opening & closing the connection once per request is the  
way to
go - if your going to using a global, better [than $_SESSION] to  
stick it

in $GLOBALS imho.


Would there be any speed decrease with multiple users (hundreds)  
sharing this $GLOBALS variable (if that makes sense)?



$_SESSION is used for persisting data over multiple requests -  
something that
is not possible to do for 'resource identifiers' (which is what the  
connection [id] is).


BTW, it does work b/c that's how it's currently setup. I am open to  
changing it though. I should say, I'm creating at the beginning of  
the script and closing it at the end. So, it doesn't actually stay  
open throughout the whole user session.




Does anyone see a problem with doing it this way? Security concerns?
Anything?

Thanks in advance,
~Philip


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



Re: [PHP] PHP milter SAPI: problem with smfi_getsymval

2007-01-10 Thread Atpic
Hi Jochem,

1) yes, the milter could do some action based on the subject of the mail,
the sender's address, the recipient's address, etc...
Note that it is sometimes difficult to compile several SAPIs at the same
time. I could get the Apache module and CLI (command line interface) SAPI
in one compile, but I needed to compile the milter SAPI separately as it
complained some symbols were already defined in the Apache compilation. (I
may have missed something here however).

2) the milter (mail filter) is following the API defined by sendmail.
Posfix also tried to provide an API which is compatible with the sendmail
API, but to my knowledge Postfix implements only a subset of the API.

Thanks
Alex, Atpic.com Webmaster
http://atpic.com

> Atpic wrote:
>> Hi Jochem,
>>
>> Well, the best known spam filtering solution is PERL based
>> (mimedefang/spamassassin).
>
> spamassassin at least I (a little) familiar with (I usually leave the
> intricacies
> to someone with much more knowledge about this kind of stuff - what are
> sys admins for? :-)
>
>> In theory, you could do this using the PHP milter SAPI: the SAPI
>> provides
>
> the 'PHP milter SAPI' bit confuses me - like where to start with regard to
> installing it properly - I'm not in need of answer regarding this ...
>
> first off I'm going to do a whole bunch of reading (including the link you
> pointed me at - thanks for that!)
>
> a couple of question that I do have are (hope you don't mind the
> intrusion):
>
> 1. based on your description I come to the conclusion
> that the milter SAPI could be used to intercept incoming (reply) emails
> that
> related to automated information request email from a website (the idea
> being to
> track the complete thread of conversation related to a sales lead that was
> initiated
> by a person visiting a website - I would like to do this because, for one
> of my clients,
> there are a lot of users that make a pigs ear of managing their
> leads/clients/etc - and
> initial contact always via a website and related to data stored in the
> websites DB),
> I could do something like this with the milter SAPI?
>
>
> 2. would I have to use sendmail as my MTA? or is it possible to use the
> milter SAPI
> in the 'toolchain' of any sendmail compatible MTA? (my
> hoster/sysadmin/magic-geek runs
> Gentoo installation with courier as the MTA, I believe courier is sendmail
> compatible,
> then again my believe may be completely unfounded/misguided)
>
>> you with a way to catch the STMP commands sent by  mail server to you
>> mail
>> server and tell your mail server want to tell to the sending server.
>> For instance if you see the connection coming from a spammer IP, then
>> you
>> could temp fail the mail.
>> In other words, there are huge spam related libraries in PERL with no
>> equivalent in PHP but the PHP SAPI allows you to develop such libraries.
>> The sendmail milter API is document here:
>> http://www.sendmail.org/doc/sendmail-current/libmilter/docs/
>>
>
> thanks again for your feedback.
>
> kind regards,
> Jochem
>

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



Re: [PHP] PHP milter SAPI: problem with smfi_getsymval

2007-01-10 Thread Jochem Maas
Atpic wrote:
> Hi Jochem,
> 
> Well, the best known spam filtering solution is PERL based
> (mimedefang/spamassassin).

spamassassin at least I (a little) familiar with (I usually leave the 
intricacies
to someone with much more knowledge about this kind of stuff - what are sys 
admins for? :-)

> In theory, you could do this using the PHP milter SAPI: the SAPI provides

the 'PHP milter SAPI' bit confuses me - like where to start with regard to
installing it properly - I'm not in need of answer regarding this ...

first off I'm going to do a whole bunch of reading (including the link you
pointed me at - thanks for that!)

a couple of question that I do have are (hope you don't mind the intrusion):

1. based on your description I come to the conclusion
that the milter SAPI could be used to intercept incoming (reply) emails that
related to automated information request email from a website (the idea being to
track the complete thread of conversation related to a sales lead that was 
initiated
by a person visiting a website - I would like to do this because, for one of my 
clients,
there are a lot of users that make a pigs ear of managing their 
leads/clients/etc - and
initial contact always via a website and related to data stored in the websites 
DB),
I could do something like this with the milter SAPI?


2. would I have to use sendmail as my MTA? or is it possible to use the milter 
SAPI
in the 'toolchain' of any sendmail compatible MTA? (my 
hoster/sysadmin/magic-geek runs
Gentoo installation with courier as the MTA, I believe courier is sendmail 
compatible,
then again my believe may be completely unfounded/misguided)

> you with a way to catch the STMP commands sent by  mail server to you mail
> server and tell your mail server want to tell to the sending server.
> For instance if you see the connection coming from a spammer IP, then you
> could temp fail the mail.
> In other words, there are huge spam related libraries in PERL with no
> equivalent in PHP but the PHP SAPI allows you to develop such libraries.
> The sendmail milter API is document here:
> http://www.sendmail.org/doc/sendmail-current/libmilter/docs/
> 

thanks again for your feedback.

kind regards,
Jochem

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



Re: [PHP] mssql_* overhead

2007-01-10 Thread Jochem Maas
Philip Thompson wrote:
> Hi.
> 
> Does anyone know if the mssql_connect/_init/_bind/etc require a lot of
> overhead?
> 
> I have a page that requires multiple function calls and each of those
> opens a new connection to the database, performs the necessary actions
> in stored procedure(s), and then closes the connection. However, I found
> this to be slower than I was wanting. So I thought, just create one
> connection and assign it to the SESSION (a global), and in each function
> that requires a connection, call that SESSION variable. At the end of
> the page, close the connection and nullify the variable.

I wouldn't stick it in the SESSION superglobal (my tactic is usually to create
a little wrapper class to the relevant DB functions and store the connection
as a property of the class/object.

basically opening & closing the connection once per request is the way to
go - if your going to using a global, better [than $_SESSION] to stick it
in $GLOBALS imho.

$_SESSION is used for persisting data over multiple requests - something that
is not possible to do for 'resource identifiers' (which is what the connection 
[id] is).

> 
> Does anyone see a problem with doing it this way? Security concerns?
> Anything?
> 
> Thanks in advance,
> ~Philip
> 
> --PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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



Re: [PHP] PHP milter SAPI: problem with smfi_getsymval

2007-01-10 Thread Atpic
Hi Jochem,

Well, the best known spam filtering solution is PERL based
(mimedefang/spamassassin).
In theory, you could do this using the PHP milter SAPI: the SAPI provides
you with a way to catch the STMP commands sent by  mail server to you mail
server and tell your mail server want to tell to the sending server.
For instance if you see the connection coming from a spammer IP, then you
could temp fail the mail.
In other words, there are huge spam related libraries in PERL with no
equivalent in PHP but the PHP SAPI allows you to develop such libraries.
The sendmail milter API is document here:
http://www.sendmail.org/doc/sendmail-current/libmilter/docs/

Thanks
Alex, Atpic.com Webmaster
http://atpic.com


> Atpic wrote:
>> Hi,
>>
>> I did not get a reply to my question on this list,
>
> most likely because nobody here had much of a clue as to how to help,
> I for one got my brain in a twist trying to figure what you were going on
> about,
> I didn't succeed :-)
>
>> so I raised a bug. The
>> bug was confirmed and fixed within 24 hours. Thank you the PHP team!
>
> that is impressive :-)
>
>> FYI the bug number is 40083
>> http://bugs.php.net/40083
>> You can now start filtering spam using your favorite programming
>> language!
>
> care to elaborate? I'm sure there are lots of people that would like to do
> this - but silly old me can't figure out even where to start learning
> about
> this great sounding functionality. apologies if I am asking the blindingly
> obvious :-/
>
> rgds,
> Jochem
>
>>
>> Thanks
>> Alex, Atpic.com Webmaster
>> http://atpic.com
>>
>>> Hi,
>>>
>>> I compiled the  milter sapi, the example in the distribution works
>>> well.
>>> BUT when I try to get the values of the sendmail macros with the
>>> smfi_getsymval function, i desperately get a blank string.
>>> I used strace and I do see the "i" sendmail macro in a red system call
>>> but
>>> I can no red its value in the PHP milter.
>>> Any ideas?
>>> Is this worth logging a bug?
>>>
>>> Thanks
>>>
>>> ---
>>> HERE is the code I used. It is just the distribution example with the
>>> milter_envfrom function modified by including two function calls:
>>>
>>> milter_log(smfi_getsymval("i"));
>>> milter_log(smfi_getsymval("{i}"));
>>>
>>> Example was retrieved from CVS:
>>>
>>> http://cvs.php.net/viewvc.cgi/php-src/sapi/milter/milter.php?revision=1.2&view=markup
>>>
>>> >> /**
>>>  * example milter script
>>>  *
>>>  * run: php-milter -D -p /path/to/sock milter.php
>>>  *
>>>  * for details on how to set up sendmail and configure the milter see
>>>  * http://www.sendmail.com/partner/resources/development/milter_api/
>>>  *
>>>  * for api details see
>>>  *
>>> http://www.sendmail.com/partner/resources/development/milter_api/api.html
>>>  *
>>>  * below is a list of all callbacks, that are available through the
>>> milter
>>> sapi,
>>>  * if you leave one or more out they simply won't get called (e.g. if
>>> you
>>> secify an
>>>  * empty php file, the milter would do nothing :)
>>>  */
>>>
>>> /**
>>>  * this function is called once on sapi startup,
>>>  * here you can specify the actions the filter may take
>>>  *
>>>  * see
>>> http://www.sendmail.com/partner/resources/development/milter_api/smfi_register.html#flags
>>>  */
>>>
>>> function milter_log($msg)
>>> {
>>> $GLOBALS['log'] = fopen("/tmp/milter.log", "a");
>>> fwrite($GLOBALS['log'], date("[H:i:s d.m.Y]") . "\t{$msg}\n");
>>> fclose($GLOBALS['log']);
>>> }
>>>
>>> function milter_init() {
>>> milter_log("-- startup --");
>>> milter_log("milter_init()");
>>> smfi_setflags(SMFIF_ADDHDRS);
>>> }
>>>
>>> /**
>>>  * is called once, at the start of each SMTP connection
>>>  */
>>> function milter_connect($connect)
>>> {
>>> milter_log("milter_connect('$connect')");
>>> }
>>>
>>> /**
>>>  * is called whenever the client sends a HELO/EHLO command.
>>>  * It may therefore be called between zero and three times.
>>>  */
>>> function milter_helo($helo)
>>> {
>>> milter_log("milter_helo('$helo')");
>>> }
>>>
>>> /**
>>>  * is called once at the beginning of each message,
>>>  * before milter_envrcpt.
>>>  */
>>> function milter_envfrom($args)
>>> {
>>> milter_log("milter_envfrom(args[])");
>>> foreach ($args as $ix => $arg) {
>>> milter_log("\targs[$ix] = $arg");
>>> }
>>> milter_log(smfi_getsymval("i"));
>>> milter_log(smfi_getsymval("{i}"));
>>> }
>>>
>>> /**
>>>  * is called once per recipient, hence one or more times per message,
>>>  * immediately after milter_envfrom
>>>  */
>>> function milter_envrcpt($args)
>>> {
>>> milter_log("milter_envrcpt(args[])");
>>> foreach ($args as $ix => $arg) {
>>> milter_log("\targs[$ix] = $arg");
>>> }
>>> }
>>>
>>> /**
>>>  * is called zero or more times between milter_envrcpt and milter_eoh,
>>>  * once per message header
>>>  */
>>> function milter_header($header, $value)
>>> {
>>> milter_log("milter_header('$header', '$value')");
>

[PHP] mssql_* overhead

2007-01-10 Thread Philip Thompson

Hi.

Does anyone know if the mssql_connect/_init/_bind/etc require a lot  
of overhead?


I have a page that requires multiple function calls and each of those  
opens a new connection to the database, performs the necessary  
actions in stored procedure(s), and then closes the connection.  
However, I found this to be slower than I was wanting. So I thought,  
just create one connection and assign it to the SESSION (a global),  
and in each function that requires a connection, call that SESSION  
variable. At the end of the page, close the connection and nullify  
the variable.


Does anyone see a problem with doing it this way? Security concerns?  
Anything?


Thanks in advance,
~Philip

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



Re: [PHP] Javascript detection , working version

2007-01-10 Thread tedd

At 4:54 AM -0800 1/10/07, Jürgen Wind wrote:

8< [source of index]

 
 




Nice -- now instead of two different pages (i.e., 
index.php, jstest110.php) , make it one.


Here's my solution:  

echo("type='text/javascript'>location.href='index.php?js=ok';"); 


}
else
{
$js  = $_GET['js'];
if($js != "ok")
{
$js = "no";
}
}
?>

Now, depending upon the value of $js, do whatever.

It would be cool if I could send js value via a 
POST instead of GET-- can that be done?


tedd

PS: I read somewhere that using  is not recommended.
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] PHP milter SAPI: problem with smfi_getsymval

Atpic wrote:
> Hi,
> 
> I did not get a reply to my question on this list, 

most likely because nobody here had much of a clue as to how to help,
I for one got my brain in a twist trying to figure what you were going on about,
I didn't succeed :-)

> so I raised a bug. The
> bug was confirmed and fixed within 24 hours. Thank you the PHP team!

that is impressive :-)

> FYI the bug number is 40083
> http://bugs.php.net/40083
> You can now start filtering spam using your favorite programming language!

care to elaborate? I'm sure there are lots of people that would like to do
this - but silly old me can't figure out even where to start learning about
this great sounding functionality. apologies if I am asking the blindingly 
obvious :-/

rgds,
Jochem

> 
> Thanks
> Alex, Atpic.com Webmaster
> http://atpic.com
> 
>> Hi,
>>
>> I compiled the  milter sapi, the example in the distribution works well.
>> BUT when I try to get the values of the sendmail macros with the
>> smfi_getsymval function, i desperately get a blank string.
>> I used strace and I do see the "i" sendmail macro in a red system call but
>> I can no red its value in the PHP milter.
>> Any ideas?
>> Is this worth logging a bug?
>>
>> Thanks
>>
>> ---
>> HERE is the code I used. It is just the distribution example with the
>> milter_envfrom function modified by including two function calls:
>>
>> milter_log(smfi_getsymval("i"));
>> milter_log(smfi_getsymval("{i}"));
>>
>> Example was retrieved from CVS:
>>
>> http://cvs.php.net/viewvc.cgi/php-src/sapi/milter/milter.php?revision=1.2&view=markup
>>
>> > /**
>>  * example milter script
>>  *
>>  * run: php-milter -D -p /path/to/sock milter.php
>>  *
>>  * for details on how to set up sendmail and configure the milter see
>>  * http://www.sendmail.com/partner/resources/development/milter_api/
>>  *
>>  * for api details see
>>  *
>> http://www.sendmail.com/partner/resources/development/milter_api/api.html
>>  *
>>  * below is a list of all callbacks, that are available through the milter
>> sapi,
>>  * if you leave one or more out they simply won't get called (e.g. if you
>> secify an
>>  * empty php file, the milter would do nothing :)
>>  */
>>
>> /**
>>  * this function is called once on sapi startup,
>>  * here you can specify the actions the filter may take
>>  *
>>  * see
>> http://www.sendmail.com/partner/resources/development/milter_api/smfi_register.html#flags
>>  */
>>
>> function milter_log($msg)
>> {
>>  $GLOBALS['log'] = fopen("/tmp/milter.log", "a");
>>  fwrite($GLOBALS['log'], date("[H:i:s d.m.Y]") . "\t{$msg}\n");
>>  fclose($GLOBALS['log']);
>> }
>>
>> function milter_init() {
>>  milter_log("-- startup --");
>>  milter_log("milter_init()");
>>  smfi_setflags(SMFIF_ADDHDRS);
>> }
>>
>> /**
>>  * is called once, at the start of each SMTP connection
>>  */
>> function milter_connect($connect)
>> {
>>  milter_log("milter_connect('$connect')");
>> }
>>
>> /**
>>  * is called whenever the client sends a HELO/EHLO command.
>>  * It may therefore be called between zero and three times.
>>  */
>> function milter_helo($helo)
>> {
>>  milter_log("milter_helo('$helo')");
>> }
>>
>> /**
>>  * is called once at the beginning of each message,
>>  * before milter_envrcpt.
>>  */
>> function milter_envfrom($args)
>> {
>>  milter_log("milter_envfrom(args[])");
>>  foreach ($args as $ix => $arg) {
>>  milter_log("\targs[$ix] = $arg");
>>  }
>> milter_log(smfi_getsymval("i"));
>> milter_log(smfi_getsymval("{i}"));
>> }
>>
>> /**
>>  * is called once per recipient, hence one or more times per message,
>>  * immediately after milter_envfrom
>>  */
>> function milter_envrcpt($args)
>> {
>>  milter_log("milter_envrcpt(args[])");
>>  foreach ($args as $ix => $arg) {
>>  milter_log("\targs[$ix] = $arg");
>>  }
>> }
>>
>> /**
>>  * is called zero or more times between milter_envrcpt and milter_eoh,
>>  * once per message header
>>  */
>> function milter_header($header, $value)
>> {
>>  milter_log("milter_header('$header', '$value')");
>> }
>>
>> /**
>>  * is called once after all headers have been sent and processed.
>>  */
>> function milter_eoh()
>> {
>>  milter_log("milter_eoh()");
>> }
>>
>> /**
>>  * is called zero or more times between milter_eoh and milter_eom.
>>  */
>> function milter_body($bodypart)
>> {
>>  milter_log("milter_body('$bodypart')");
>> }
>>
>> /**
>>  * is called once after all calls to milter_body for a given message.
>>  * most of the api functions, that alter the message can only be called
>>  * within this callback.
>>  */
>> function milter_eom()
>> {
>>  milter_log("milter_eom()");
>>   /* add PHP header to the message */
>>   smfi_addheader("X-PHP", phpversion());
>> }
>>
>> /**
>>  * may be called at any time during message processing
>>  * (i.e. between some message-oriented routine and milter_eom).
>>  */
>> function milter_abort()
>> {
>>  

Re: [PHP] PHP milter SAPI: problem with smfi_getsymval

Hi,

I did not get a reply to my question on this list, so I raised a bug. The
bug was confirmed and fixed within 24 hours. Thank you the PHP team!
FYI the bug number is 40083
http://bugs.php.net/40083
You can now start filtering spam using your favorite programming language!

Thanks
Alex, Atpic.com Webmaster
http://atpic.com

> Hi,
>
> I compiled the  milter sapi, the example in the distribution works well.
> BUT when I try to get the values of the sendmail macros with the
> smfi_getsymval function, i desperately get a blank string.
> I used strace and I do see the "i" sendmail macro in a red system call but
> I can no red its value in the PHP milter.
> Any ideas?
> Is this worth logging a bug?
>
> Thanks
>
> ---
> HERE is the code I used. It is just the distribution example with the
> milter_envfrom function modified by including two function calls:
>
> milter_log(smfi_getsymval("i"));
> milter_log(smfi_getsymval("{i}"));
>
> Example was retrieved from CVS:
>
> http://cvs.php.net/viewvc.cgi/php-src/sapi/milter/milter.php?revision=1.2&view=markup
>
>  /**
>  * example milter script
>  *
>  * run: php-milter -D -p /path/to/sock milter.php
>  *
>  * for details on how to set up sendmail and configure the milter see
>  * http://www.sendmail.com/partner/resources/development/milter_api/
>  *
>  * for api details see
>  *
> http://www.sendmail.com/partner/resources/development/milter_api/api.html
>  *
>  * below is a list of all callbacks, that are available through the milter
> sapi,
>  * if you leave one or more out they simply won't get called (e.g. if you
> secify an
>  * empty php file, the milter would do nothing :)
>  */
>
> /**
>  * this function is called once on sapi startup,
>  * here you can specify the actions the filter may take
>  *
>  * see
> http://www.sendmail.com/partner/resources/development/milter_api/smfi_register.html#flags
>  */
>
> function milter_log($msg)
> {
>   $GLOBALS['log'] = fopen("/tmp/milter.log", "a");
>   fwrite($GLOBALS['log'], date("[H:i:s d.m.Y]") . "\t{$msg}\n");
>   fclose($GLOBALS['log']);
> }
>
> function milter_init() {
>   milter_log("-- startup --");
>   milter_log("milter_init()");
>   smfi_setflags(SMFIF_ADDHDRS);
> }
>
> /**
>  * is called once, at the start of each SMTP connection
>  */
> function milter_connect($connect)
> {
>   milter_log("milter_connect('$connect')");
> }
>
> /**
>  * is called whenever the client sends a HELO/EHLO command.
>  * It may therefore be called between zero and three times.
>  */
> function milter_helo($helo)
> {
>   milter_log("milter_helo('$helo')");
> }
>
> /**
>  * is called once at the beginning of each message,
>  * before milter_envrcpt.
>  */
> function milter_envfrom($args)
> {
>   milter_log("milter_envfrom(args[])");
>   foreach ($args as $ix => $arg) {
>   milter_log("\targs[$ix] = $arg");
>   }
> milter_log(smfi_getsymval("i"));
> milter_log(smfi_getsymval("{i}"));
> }
>
> /**
>  * is called once per recipient, hence one or more times per message,
>  * immediately after milter_envfrom
>  */
> function milter_envrcpt($args)
> {
>   milter_log("milter_envrcpt(args[])");
>   foreach ($args as $ix => $arg) {
>   milter_log("\targs[$ix] = $arg");
>   }
> }
>
> /**
>  * is called zero or more times between milter_envrcpt and milter_eoh,
>  * once per message header
>  */
> function milter_header($header, $value)
> {
>   milter_log("milter_header('$header', '$value')");
> }
>
> /**
>  * is called once after all headers have been sent and processed.
>  */
> function milter_eoh()
> {
>   milter_log("milter_eoh()");
> }
>
> /**
>  * is called zero or more times between milter_eoh and milter_eom.
>  */
> function milter_body($bodypart)
> {
>   milter_log("milter_body('$bodypart')");
> }
>
> /**
>  * is called once after all calls to milter_body for a given message.
>  * most of the api functions, that alter the message can only be called
>  * within this callback.
>  */
> function milter_eom()
> {
>   milter_log("milter_eom()");
>   /* add PHP header to the message */
>   smfi_addheader("X-PHP", phpversion());
> }
>
> /**
>  * may be called at any time during message processing
>  * (i.e. between some message-oriented routine and milter_eom).
>  */
> function milter_abort()
> {
>   milter_log("milter_abort()");
> }
>
> /**
>  * is always called once at the end of each connection.
>  */
> function milter_close()
> {
>   milter_log("milter_close()");
> }
> ?>
>
> Alex Madon http://atpic.com Webmaster
>
> --
> 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] Javascript detection , working version



Curt Zirzow-2 wrote:
> 
> On 1/1/07, Jürgen Wind <[EMAIL PROTECTED]> wrote:
>>
>> well,
>> no cute css, but (hopefully) working - here is my quick & dirty version :
>>
>> http://149.222.235.16/public/
> 
> I dont understand the point.
> 
> Curt,
> 

sorry, i should have posted the original code (it's merely js/html/browser
related, not php)

http://149.222.235.16/public/index.html (20070102) :


<!--// index.html 20070102
D=new Date()
location.href='jstest.php?js=ok&t='+D.getTimezoneOffset()
//-->



as i already said elsewhere in the thread: it was just a quick&dirty hack,
as tedds link didn't work. 
But Roman made a good point:
>Out of curiosity, can you guarantee the Javascript redirect will always
>occur before the meta redirect when Javascript is enabled? Otherwise you
>have a race condition.

so here is what's new in http://149.222.235.16/public/index.php (20070110) :

8<

 
 


-- 
View this message in context: 
http://www.nabble.com/Javascript-detection-tf2905451.html#a8256985
Sent from the PHP - General mailing list archive at Nabble.com.

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



[PHP] Imap certificate error?



When using imap_open to access my email server, I keep getting a invalid
certificate error.

The cert on the email server is  issued from Geotrust and is quite common
(Rapidssl).

The error comes from it not being listed in the root certificates list
(bundle).


My question is, is this a problem with my email server or my php(www)
server?



If it is a php problem, then  how do I fix it?

Other than using /notls or /no-validate


-- 
Mike B^)>

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



RE: [PHP] Problems with mysql_connect()

You're missing a closing parenthesis at the end of:

while ($row = mysql_fetch_row($result)

This should be

while ($row = mysql_fetch_row($result))

> -Original Message-
> From: Delta Storm [mailto:[EMAIL PROTECTED]
> Sent: 10 January 2007 10:45
> To: php-general@lists.php.net
> Subject: [PHP] Problems with mysql_connect()
>
>
> Hi,
>
> I'm having problems with this code (a simple exercise where i wanto to
> connect to sql server and get data from it and write that data in html)
>
>
> :
>
>
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> 
> Exercise 23 - Using PHP with MySQL
> 
>
> 
> 
>   //Povezuje se s MySQL serverom
>   $connection = mysql_connect('localhost','user','pass') or die
> ("Unable to connect to MySQL server");
>
>   //Odabira bazu podataka
>   mysql_select_db("php1") or die ("Unable to select database");
>
>   //Pravi i zadaje upit
>   $query = "SELECT * FROM items";
>   $result = mysql_query($query) or die ("Error in query:
> $query ." .
> mysql_error());
>
>   //Provjerava jeli li zapisi vraceni
>   if (mysql_num_rows($result) > 0)
>   {
>   //Pravi html tablicu
>   echo " cellspacing=0 border=1>";
>   echo "
>   
>   ID
>   
>   
>   Name
>   
>   
>   Price
>   
>   ";
>
>   //Prolazi kroz skup zapisa
>   //ispisuje svako polje
>   while ($row = mysql_fetch_row($result)
>   {
>   echo "";
>   echo "" . $row [0] ."";
>   echo "" . $row [1] ."";
>   echo "" . $row [2] ."";
>   echo "";
>   }
>   echo "";
>
>   }
>   else
>   {
>   //Ispisuje poruku o gresci
>   echo "No rows found!";
>   }
>
>   //Kad je obrada gotova oslobada skup rezultata
>   mysql_free_result($result);
>
>   //Prekida vezu s MySQL serverom
>   mysql_close($connection);
> ?>
>
> 
> 
>
>
> the error is : "Parse error: parse error, unexpected '{' in C:\Program
> Files\XAMPP\xampp\htdocs\test_folder\exercise23.php on line 41"
>
> I really dont know why is this error showing i looked for syntax errors
> but i think that there aren't any
>
>
> Thanks in advance! :)
>
>
> (P.S dont read the commnents they are croatian)
>
> --
> 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] Problems with mysql_connect()

Delta Storm wrote:
> Hi,
> 
> I'm having problems with this code (a simple exercise where i wanto to
> connect to sql server and get data from it and write that data in html)
> 

> //Prolazi kroz skup zapisa
> //ispisuje svako polje
> while ($row = mysql_fetch_row($result)

^--- HERE YOUR MISSING A ')' !  


> {
> echo "";
> echo "" . $row [0] ."";
> echo "" . $row [1] ."";
> echo "" . $row [2] ."";
> echo "";
> }
> echo "";

...


> the error is : "Parse error: parse error, unexpected '{' in C:\Program
> Files\XAMPP\xampp\htdocs\test_folder\exercise23.php on line 41"
> 
> I really dont know why is this error showing i looked for syntax errors
> but i think that there aren't any

if php is telling you there is a parse error then you have a syntax error,
there are no exceptions to this rule.

> 
> (P.S dont read the commnents they are croatian)
> 

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



Re: [PHP] Problems with mysql_connect()


There is a closing parenthesis missing, see below:
- Original Message - 
From: "Delta Storm" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, January 10, 2007 11:45 AM
Subject: [PHP] Problems with mysql_connect()



Hi,

I'm having problems with this code (a simple exercise where i wanto to 
connect to sql server and get data from it and write that data in html)



:



"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

http://www.w3.org/1999/xhtml";>


Exercise 23 - Using PHP with MySQL



$connection = mysql_connect('localhost','user','pass') or die  ("Unable to 
connect to MySQL server");


//Odabira bazu podataka
mysql_select_db("php1") or die ("Unable to select database");

//Pravi i zadaje upit
$query = "SELECT * FROM items";
$result = mysql_query($query) or die ("Error in query: $query ." . 
mysql_error());


//Provjerava jeli li zapisi vraceni
if (mysql_num_rows($result) > 0)
{
//Pravi html tablicu
echo "";
echo "
  
ID


Name


Price

";

//Prolazi kroz skup zapisa
//ispisuje svako polje
while ($row = mysql_fetch_row($result))  <== this one is missing *
{
echo "";
echo "" . $row [0] ."";
echo "" . $row [1] ."";
echo "" . $row [2] ."";
echo "";
}
echo "";

}
else
{
//Ispisuje poruku o gresci
echo "No rows found!";
}

//Kad je obrada gotova oslobada skup rezultata
mysql_free_result($result);

//Prekida vezu s MySQL serverom
mysql_close($connection);
?>





the error is : "Parse error: parse error, unexpected '{' in C:\Program 
Files\XAMPP\xampp\htdocs\test_folder\exercise23.php on line 41"


I really dont know why is this error showing i looked for syntax errors 
but i think that there aren't any



Thanks in advance! :)


(P.S dont read the commnents they are croatian)

--
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] Problems with mysql_connect()


Hi,

I'm having problems with this code (a simple exercise where i wanto to 
connect to sql server and get data from it and write that data in html)



:



"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

http://www.w3.org/1999/xhtml";>


Exercise 23 - Using PHP with MySQL



	$connection = mysql_connect('localhost','user','pass') or die  	 
("Unable to connect to MySQL server");


//Odabira bazu podataka
mysql_select_db("php1") or die ("Unable to select database");

//Pravi i zadaje upit
$query = "SELECT * FROM items";
	$result = mysql_query($query) or die ("Error in query: $query ." 	. 
mysql_error());


//Provjerava jeli li zapisi vraceni
if (mysql_num_rows($result) > 0)
{
//Pravi html tablicu
echo "";
echo "

ID


Name


Price

";

//Prolazi kroz skup zapisa
//ispisuje svako polje
while ($row = mysql_fetch_row($result)
{
echo "";
echo "" . $row [0] ."";
echo "" . $row [1] ."";
echo "" . $row [2] ."";
echo "";
}
echo "";

}
else
{
//Ispisuje poruku o gresci
echo "No rows found!";
}

//Kad je obrada gotova oslobada skup rezultata
mysql_free_result($result);

//Prekida vezu s MySQL serverom
mysql_close($connection);
?>





the error is : "Parse error: parse error, unexpected '{' in C:\Program 
Files\XAMPP\xampp\htdocs\test_folder\exercise23.php on line 41"


I really dont know why is this error showing i looked for syntax errors 
but i think that there aren't any



Thanks in advance! :)


(P.S dont read the commnents they are croatian)

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



Re: [PHP] Parsing an XML return from a POST - resend with a little more information

# [EMAIL PROTECTED] / 2007-01-10 09:52:34 +:
> That ypsilon is a *preprocessing instruction* AFAICT.

s/pre//

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Parsing an XML return from a POST - resend with a little more information

# [EMAIL PROTECTED] / 2007-01-10 09:38:30 +0100:
> Richard Luckhurst wrote:
> > Hi Jochem,
> > 
> > Thanks for your reply. Here is a short sample of the XML I have to parse. I 
> > need
> > the data in the attributes as well as the data in the character fields.
> > 
> > 
> > 
> 
> I'm fairly certain that this 'ypsilon' tag is going to cause a
> problem - although that's just a guess, it's based on the 'knowledge'
> that a valid XML document *must* have only 1 root element
> (which would be 'fareResponse' in this case).

That ypsilon is a *preprocessing instruction* AFAICT.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] Parsing an XML return from a POST - resend with a little more information

Richard Luckhurst wrote:
> Hi Jochem,
> 
> Thanks for your reply. Here is a short sample of the XML I have to parse. I 
> need
> the data in the attributes as well as the data in the character fields.
> 
> 
> 

I'm fairly certain that this 'ypsilon' tag is going to cause a
problem - although that's just a guess, it's based on the 'knowledge'
that a valid XML document *must* have only 1 root element
(which would be 'fareResponse' in this case).

you might have to use preg_replace() to strip this 'ypsilon' tag
from you xml stgring prior to feeding it into simpleXML (or other
XML parser).

e.g. something *like*:

$xml = preg_replace('#<\?ypsilon .*\?>#', '', $xml);

> 

...

> 
> 
> 
> 
> 
> JM> me, I'm pretty convinced simpleXML is what he wants.
> 
> JM> simpleXML was a dog to use in earlier versions of php5 because simpleXML 
> objects
> JM> were 'immune' to inspection by var_dump(), print_r(), etc [meaning you be 
> told some
> JM> property was an array and then get an error if you access said property 
> as an array,
> JM> stuff like that].
> 
> JM> those problems have been helped the way of the dodo so now simpleXML 
> really does
> JM> what it says on the tin.
> 
> JM> of course there is always the options of using regular expressions or 
> simple
> JM> string manipulation functions to extract the relevant data from the 
> string of
> JM> 'xml' - technically there is no need to go anywhere near a 'real' xml 
> parser
> JM> as such.
> 
> So far I have had no luck with simpleXML at all.

do as Roman says and post the simpleXML code you have so far.

> 
> Regards
> 
> Richard Luckhurst
> 

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