Re: [PHP] Email Verification

2008-09-18 Thread Per Jessen
Lupus Michaelis wrote:

 Richard Heyes a écrit :
 
 New domain name extensions can be accounted for easily, eg:
 
 \.(?:[a-z]){2,4}
 
It excludes .museum tld.

Don't make assumptions about which TLDs that are or are not allowed -
the domain part of an email address could be validated with this:

@[a-z0-9][a-z0-9-]*(\.[a-z0-9][a-z0-9-]*)+

A test for total length and valid use of hyphens should be added.  See
RFC1034.  Then look up the A record. 



/Per Jessen, Zürich


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



Re: [PHP] Re: Pear XML parser finding nothing in ATOM / Movable Type feed

2008-09-18 Thread John Allsopp

Nathan Rixham wrote:
Atom and RSS are completely different; the only similarities lie in 
the fact they are both XML, and both used frequently for syndicating 
news.

Really? OK, back to the books, thanks

You need an atom parser; or just load the feed into DOMDocument..

SimplePie and RssPhp are the only two I know that handle atom feeds well.

Fab, thanks.

J

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



[PHP] Re: Email Verification

2008-09-18 Thread Colin Guthrie

Per Jessen wrote:

Lupus Michaelis wrote:


Richard Heyes a écrit :


New domain name extensions can be accounted for easily, eg:

\.(?:[a-z]){2,4}

   It excludes .museum tld.


Don't make assumptions about which TLDs that are or are not allowed -
the domain part of an email address could be validated with this:


and .anythingyouwant now that the TLD space has been opened up


@[a-z0-9][a-z0-9-]*(\.[a-z0-9][a-z0-9-]*)+

A test for total length and valid use of hyphens should be added.  See
RFC1034.  Then look up the A record. 


Or better, the MX record... :)

Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] Re: Email Verification

2008-09-18 Thread Stut

On 18 Sep 2008, at 09:44, Colin Guthrie wrote:

Per Jessen wrote:

Lupus Michaelis wrote:

Richard Heyes a écrit :


New domain name extensions can be accounted for easily, eg:

\.(?:[a-z]){2,4}

   It excludes .museum tld.

Don't make assumptions about which TLDs that are or are not allowed -
the domain part of an email address could be validated with this:


and .anythingyouwant now that the TLD space has been opened up


@[a-z0-9][a-z0-9-]*(\.[a-z0-9][a-z0-9-]*)+
A test for total length and valid use of hyphens should be added.   
See

RFC1034.  Then look up the A record.


Or better, the MX record... :)


An MX record is not required to accept email for a domain. The  
relevant RFC (can't recall the number right now) states that it  
should fall back to using the A record if no MX record is present.


-Stut

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



[PHP] Re: Email Verification

2008-09-18 Thread Colin Guthrie

Stut wrote:

Or better, the MX record... :)


An MX record is not required to accept email for a domain. The relevant 
RFC (can't recall the number right now) states that it should fall back 
to using the A record if no MX record is present.


Excellent. That's my new thing learned for the day. May as well go home :)

Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] Re: MySQL Workbench coming for Linux

2008-09-18 Thread Luke
so it's like Microsoft Access? I don't get it...

2008/9/18 Ross McKay [EMAIL PROTECTED]

 Bastien Koert wrote:

 what about dia on llinux? Not quite as nice as visio...but livable

 The Enterprise Architect version of Visio lets you add column
 definitions to your entities, add foreign key relationships, add
 indices, add comments at the table and column level, and then generate a
 build script. It also has a reporting tool for generating a data
 dictionary. In short, it makes a pretty good stab at being a data
 modelling tool (imperfectly, but sufficiently for my needs).

 Dia is just a diagramming tool (unless you can tell me otherwise).
 --
 Ross McKay, Toronto, NSW Australia
 Nobody ever rioted for austerity - George Monbiot

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




-- 
Luke Slater


Re: [PHP] Re: MySQL Workbench coming for Linux

2008-09-18 Thread Ross McKay
Luke wrote:

so it's like Microsoft Access? I don't get it...

No, Microsoft Access is a development environment sitting on top of a
simplistic database (JET). Access gives you a nice GUI to help you
interactively build up your database, and it makes a great prototyping
tool and data massage tool, but it isn't very good for data modelling.

I'm talking about proper data modelling tools, where you design the
conceptual and physical databases, then generate scripts to build them
(e.g. in Oracle, Microsoft SQL Server, MySQL, etc.) and generate nice
documentation including diagrams that help you understand your database
at a quick glance. Usually, they can also suck a live database back in
(reverse engineer) to help you document whatever nasty hack you've
inherited from your predecessors in a legacy application ;-)

MySQL Workbench is what I really want, or something similar. I just
happen to already have a copy of Visio Enterprise Architect that comes
close enough to doing the job, so I use that until Workbench is up and
working properly on Linux. I hack the generated SQL scripts (minimally)
to make them MySQL friendly, and I hack the generated RTF data
dictionary files to make them more to my liking, and load them into OOo
and embed the ER diagrams, to get nice, easily referenced documentation
on my DBs.

See here for more information about data modelling tools in general, and
a couple of specific ones:

http://en.wikipedia.org/wiki/Entity-relationship_model
http://en.wikipedia.org/wiki/CA_ERwin_Data_Modeler
http://en.wikipedia.org/wiki/ER/Studio
http://en.wikipedia.org/wiki/Toad_Data_Modeler
http://en.wikipedia.org/wiki/MySQL_Workbench
-- 
Ross McKay, Toronto, NSW Australia
Before enlightenment: chop wood, carry water;
 After enlightenment: chop wood, carry water - Wu Li

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



[PHP] ODBC Functions MS SQL Server 2005

2008-09-18 Thread Dan Joseph
Hi,

Anyone else using the odbc_* functions to interact with MS SQL Server 2005?

I'm having a problem getting odbc_num_rows() to return anything other than
-1 when querying a stored procedure.  I can get it to work using Top in a
normal query (non-stored procedure).

SELECT Top 100 * FROM Table

if I do an odbc_num_rows( result ) on that, I get the number of rows.
However...

EXEC ProcedureName @Var = 'value'

if I do an odbc_num_rows( result), I get -1.  The same is true if I did a
straight SELECT * FROM Table.  I've tried putting Top in my query in the
stored procedure.

Right now I'm either doing an extra query for @@ROWCOUNT, or I'm doing two
result sets, a counting query, and then the normal query.  I am concerned
about performance in doing the two queries, and with @@ROWCOUNT, I feel I'm
just adding extra things to the code that may be unreliable?

From what I've read, its something with the ODBC driver, and updating the
ODBC driver isn't an option.

Anyone else having this problem?  Any suggestions?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


[PHP] Static method variable

2008-09-18 Thread Christoph Boget
Perhaps I'm misunderstanding what a static method variable is supposed
to do.  I thought the value would be static for an class' instance but
it appears it is static across all instances of the class.  Consider:

class StaticTest
{
  public function __construct()
  {
  }

  public function test( $newVal )
  {
static $retval = '';

if( $retval == '' )
{
  $retval = $newVal;
}
echo $retval . 'br';
  }
}

$one = new StaticTest();
$one-test( 'joe' );
$two = new StaticTest();
$two-test( 'bob' );

Should it be working that way?

thnx,
Chris

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



Re: [PHP] Static method variable

2008-09-18 Thread Thijs Lensselink

Quoting Christoph Boget [EMAIL PROTECTED]:


Perhaps I'm misunderstanding what a static method variable is supposed
to do.  I thought the value would be static for an class' instance but
it appears it is static across all instances of the class.  Consider:

class StaticTest
{
  public function __construct()
  {
  }

  public function test( $newVal )
  {
static $retval = '';

if( $retval == '' )
{
  $retval = $newVal;
}
echo $retval . 'br';
  }
}

$one = new StaticTest();
$one-test( 'joe' );
$two = new StaticTest();
$two-test( 'bob' );

Should it be working that way?

thnx,
Chris



That's exactly how a static class var functions. It's available cross  
all instances of the class.




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



[PHP] Re: Static method variable

2008-09-18 Thread Carlos Medina

Christoph Boget schrieb:

Perhaps I'm misunderstanding what a static method variable is supposed
to do.  I thought the value would be static for an class' instance but
it appears it is static across all instances of the class.  Consider:

class StaticTest
{
  public function __construct()
  {
  }

  public function test( $newVal )
  {
static $retval = '';

if( $retval == '' )
{
  $retval = $newVal;
}
echo $retval . 'br';
  }
}

$one = new StaticTest();
$one-test( 'joe' );
$two = new StaticTest();
$two-test( 'bob' );

Should it be working that way?

thnx,
Chris

Hi Chris,
please read here. If you have questions after that. Write again please:

http://de3.php.net/manual/en/language.oop5.static.php

Regards

Carlos

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



Re: [PHP] Email Verification

2008-09-18 Thread Andrew Ballard
On Thu, Sep 18, 2008 at 2:09 AM, Per Jessen [EMAIL PROTECTED] wrote:
 Lupus Michaelis wrote:

 Richard Heyes a écrit :

 New domain name extensions can be accounted for easily, eg:

 \.(?:[a-z]){2,4}

It excludes .museum tld.

 Don't make assumptions about which TLDs that are or are not allowed -
 the domain part of an email address could be validated with this:

 @[a-z0-9][a-z0-9-]*(\.[a-z0-9][a-z0-9-]*)+

 A test for total length and valid use of hyphens should be added.  See
 RFC1034.  Then look up the A record.



 /Per Jessen, Zürich


I don't know that it would add much benefit, but you could
periodically download a TLD list from IANA and compare that last
segment to the list.

Andrew


[PHP] $_SERVER[REMOTE_ADDR] returning ::1

2008-09-18 Thread David Rocks
  I am running a test PHP web app on my local machine that uses 
REMOTE_ADDR and most of the time ::1 is returned as the IP addr and 
sometimes it is 127.0.0.1 . I am on OS X 10.5.5 and using APACHE 2. 
PHPINFO always returns ::1 for REMOTE_ADDR. Is this a PHP or a APACHE 2 
thing?


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



Re: [PHP] Static method variable

2008-09-18 Thread Micah Gersten
If you're looking for a persistent variable in one class instance, then
you need a member variable.  If you want it persistent across all class
instances, you want a static variable.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Christoph Boget wrote:
 Perhaps I'm misunderstanding what a static method variable is supposed
 to do.  I thought the value would be static for an class' instance but
 it appears it is static across all instances of the class.  Consider:

 class StaticTest
 {
   public function __construct()
   {
   }

   public function test( $newVal )
   {
 static $retval = '';

 if( $retval == '' )
 {
   $retval = $newVal;
 }
 echo $retval . 'br';
   }
 }

 $one = new StaticTest();
 $one-test( 'joe' );
 $two = new StaticTest();
 $two-test( 'bob' );

 Should it be working that way?

 thnx,
 Chris

   

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



Re: [PHP] $_SERVER[REMOTE_ADDR] returning ::1

2008-09-18 Thread Stut

On 18 Sep 2008, at 05:57, David Rocks wrote:
  I am running a test PHP web app on my local machine that uses  
REMOTE_ADDR and most of the time ::1 is returned as the IP addr and  
sometimes it is 127.0.0.1 . I am on OS X 10.5.5 and using APACHE 2.  
PHPINFO always returns ::1 for REMOTE_ADDR. Is this a PHP or a  
APACHE 2 thing?


It's coming from Apache and is correct. ::1 is the same as 127.0.0.1  
in IPv6. Which you get will depend on how you request the page and  
how your DNS/hosts file is set up. Request it with an IPv6 domain/IP  
and REMOTE_ADDR will also be IPv6.


You should be able to disable IPv6 in your system settings, but from  
a future-proof point of view you should be able to handle both.


-Stut

--
http://stut.net/

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



[PHP] Function parameters and arrays

2008-09-18 Thread Frank Stanovcak
I am trying to pass a multi dimmed array as a variable parameter to a custom 
function to build a query for me.  Here is the basic code and what I am 
getting.

$WhereList[0][0] = 'OESalesOrder.OrderNo';
$WhereList[0][1] = '=';
$WhereList[0][2] = '2272';
$SQLString = SQLCall('OESalesOrder',$FieldList,$WhereList);

I then use a foreach in the function to process it.

$i = 0;
  foreach(func_get_arg(2) as $WhereArray) {
   echo $WhereArray[0][0];
   if($i == 0) {
$SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' ' . 
$WhereArray[$i][2];
$i += 1;
   } else {
$SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' ' . 
$WhereArray[$i][2] . ' ' . $WhereArray[$i][3];
$i += 1;
   };
  };

What I get when it processes is the first three letters of [0][0]
[0][0] = O
[0][1] = E
[0][2] = S

Did I do something wrong, or is this not possible?  I have done an array 
processing this way before, but not multidimmed.

Frank. 



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



Re: [PHP] $_SERVER[REMOTE_ADDR] returning ::1

2008-09-18 Thread Brady Mitchell


On Sep 17, 2008, at 957PM, David Rocks wrote:

 I am running a test PHP web app on my local machine that uses  
REMOTE_ADDR and most of the time ::1 is returned as the IP addr and  
sometimes it is 127.0.0.1 . I am on OS X 10.5.5 and using APACHE 2.  
PHPINFO always returns ::1 for REMOTE_ADDR. Is this a PHP or a  
APACHE 2 thing?


I saw the same thing on my OS X box, and decided to disable IPV6 for  
now. Edit httpd.conf and change:  Listen 80 to Listen 0.0.0.0:80  
and when you restart Apache it'll always return 127.0.0.1


Brady

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



Re: [PHP] Function parameters and arrays

2008-09-18 Thread Stut

On 18 Sep 2008, at 16:29, Frank Stanovcak wrote:
I am trying to pass a multi dimmed array as a variable parameter to  
a custom
function to build a query for me.  Here is the basic code and what  
I am

getting.

$WhereList[0][0] = 'OESalesOrder.OrderNo';
$WhereList[0][1] = '=';
$WhereList[0][2] = '2272';
$SQLString = SQLCall('OESalesOrder',$FieldList,$WhereList);

I then use a foreach in the function to process it.

$i = 0;
  foreach(func_get_arg(2) as $WhereArray) {


This foreach will give you each array at the first level into  
$WhereArray...



   echo $WhereArray[0][0];


So there is no need for the first [0] here.


   if($i == 0) {
$SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i] 
[1] . ' ' .

$WhereArray[$i][2];
$i += 1;
   } else {
$SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i] 
[1] . ' ' .

$WhereArray[$i][2] . ' ' . $WhereArray[$i][3];
$i += 1;
   };
  };


And $i is not needed at all.


What I get when it processes is the first three letters of [0][0]
[0][0] = O
[0][1] = E
[0][2] = S

Did I do something wrong, or is this not possible?  I have done an  
array

processing this way before, but not multidimmed.


Suggest you read this: http://php.net/foreach

-Stut

--
http://stut.net/

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



Re: [PHP] SQLExtendedFetch

2008-09-18 Thread Liz Kim
thanks for all your input.
unfortunately, i cannot set up a new database as it is being used by other
applications/websites.
the versions of odbc, php and apache are all the same...

please do let me know if you have any other suggestions!

thanks

On Wed, Sep 17, 2008 at 5:48 PM, Chris [EMAIL PROTECTED] wrote:


  If you have Apache on IIS, why not go MySQL. It's a fair bit faster I've
 found, and a darn site easier to work with;


 because changing a web server is a lot easier than rewriting an app to use
 another database ;)

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




Re: [PHP] $_SERVER[REMOTE_ADDR] returning ::1

2008-09-18 Thread David Rocks

Stut wrote:

On 18 Sep 2008, at 05:57, David Rocks wrote:
  I am running a test PHP web app on my local machine that uses 
REMOTE_ADDR and most of the time ::1 is returned as the IP addr and 
sometimes it is 127.0.0.1 . I am on OS X 10.5.5 and using APACHE 2. 
PHPINFO always returns ::1 for REMOTE_ADDR. Is this a PHP or a APACHE 
2 thing?


It's coming from Apache and is correct. ::1 is the same as 127.0.0.1 in 
IPv6. Which you get will depend on how you request the page and how your 
DNS/hosts file is set up. Request it with an IPv6 domain/IP and 
REMOTE_ADDR will also be IPv6.


You should be able to disable IPv6 in your system settings, but from a 
future-proof point of view you should be able to handle both.


-Stut

   This app uses this test to insure that the page being processed came 
from the same machine as was used to login to the app. The app is 
intended for broad use so I can't control the use of IPv6. Is localhost 
the only case where the value returned might have different values? Can 
you point to a reference where I might figure out a better future proof 
test?


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



Re: [PHP] $_SERVER[REMOTE_ADDR] returning ::1

2008-09-18 Thread Stut

On 18 Sep 2008, at 16:37, David Rocks wrote:

Stut wrote:

On 18 Sep 2008, at 05:57, David Rocks wrote:
  I am running a test PHP web app on my local machine that uses  
REMOTE_ADDR and most of the time ::1 is returned as the IP addr  
and sometimes it is 127.0.0.1 . I am on OS X 10.5.5 and using  
APACHE 2. PHPINFO always returns ::1 for REMOTE_ADDR. Is this a  
PHP or a APACHE 2 thing?
It's coming from Apache and is correct. ::1 is the same as  
127.0.0.1 in IPv6. Which you get will depend on how you request  
the page and how your DNS/hosts file is set up. Request it with an  
IPv6 domain/IP and REMOTE_ADDR will also be IPv6.
You should be able to disable IPv6 in your system settings, but  
from a future-proof point of view you should be able to handle both.

-Stut
   This app uses this test to insure that the page being processed  
came from the same machine as was used to login to the app. The app  
is intended for broad use so I can't control the use of IPv6. Is  
localhost the only case where the value returned might have  
different values? Can you point to a reference where I might figure  
out a better future proof test?


Using the IP is not a reliable way to check for this. Some ISPs use  
transparent proxies which can cause each subsequent request to come  
from a different IP, regardless of whether it's v4 or v6. You'd be  
better off using a cookie, although that would be a bit less secure.


If you really need to use IP then you can probably rely on it not  
switching between v4 and v6 if you're not using localhost. For  
testing use the machine's real IP or hostname instead of localhost  
and this problem should disappear.


-Stut

--
http://stut.net/

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



RE: [PHP] Function parameters and arrays

2008-09-18 Thread Simcha
This would be a little neater:

  foreach(func_get_arg(2) as $k = $WhereArray) {
   //echo $WhereArray[0][0];
$SQLStmt .= ' ' . $WhereArray[0] . ' ' . $WhereArray[1] . ' ' .
$WhereArray[2];
if($k != 0) $SQLStmt .=' ' . $WhereArray[3];
   };

Simcha Younger

-Original Message-
From: Frank Stanovcak [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 18, 2008 5:30 PM
To: php-general@lists.php.net
Subject: [PHP] Function parameters and arrays

I am trying to pass a multi dimmed array as a variable parameter to a custom

function to build a query for me.  Here is the basic code and what I am 
getting.

$WhereList[0][0] = 'OESalesOrder.OrderNo';
$WhereList[0][1] = '=';
$WhereList[0][2] = '2272';
$SQLString = SQLCall('OESalesOrder',$FieldList,$WhereList);

I then use a foreach in the function to process it.

$i = 0;
  foreach(func_get_arg(2) as $WhereArray) {
   echo $WhereArray[0][0];
   if($i == 0) {
$SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' ' . 
$WhereArray[$i][2];
$i += 1;
   } else {
$SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' ' . 
$WhereArray[$i][2] . ' ' . $WhereArray[$i][3];
$i += 1;
   };
  };

What I get when it processes is the first three letters of [0][0]
[0][0] = O
[0][1] = E
[0][2] = S

Did I do something wrong, or is this not possible?  I have done an array 
processing this way before, but not multidimmed.

Frank. 



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

No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.169 / Virus Database: 270.6.21/1675 - Release Date: 17/09/2008
17:07


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



Re: [PHP] Function parameters and arrays

2008-09-18 Thread Jim Lucas
Frank Stanovcak wrote:
 I am trying to pass a multi dimmed array as a variable parameter to a custom 
 function to build a query for me.  Here is the basic code and what I am 
 getting.
 
 $WhereList[0][0] = 'OESalesOrder.OrderNo';
 $WhereList[0][1] = '=';
 $WhereList[0][2] = '2272';
 $SQLString = SQLCall('OESalesOrder',$FieldList,$WhereList);
 
 I then use a foreach in the function to process it.
 
 $i = 0;
   foreach(func_get_arg(2) as $WhereArray) {
echo $WhereArray[0][0];
if($i == 0) {
 $SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' ' . 
 $WhereArray[$i][2];
 $i += 1;
} else {
 $SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' ' . 
 $WhereArray[$i][2] . ' ' . $WhereArray[$i][3];
 $i += 1;
};
   };
 
 What I get when it processes is the first three letters of [0][0]
 [0][0] = O
 [0][1] = E
 [0][2] = S
 
 Did I do something wrong, or is this not possible?  I have done an array 
 processing this way before, but not multidimmed.
 
 Frank. 
 
 
 

Something like this should do.

function SQLCall($table, $FieldList, $WhereList=array()) {

# work  with your field list...

  $where_parts = array();
  foreach($WhereList AS $cond) {
$where_parts[] = $cond[0].' '.$cond[1].' '.$cond[2];
  }

  $WHERE = '';
  if ( count($where_parts) ) {
$WHERE = 'WHERE ' . join(' AND ', $where_parts);
  }

# put it all together.

}

-- 
Jim Lucas

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

Twelfth Night, Act II, Scene V
by William Shakespeare


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



Re: [PHP] textarea html generation problem

2008-09-18 Thread sean greenslade
I prefer the htmlentities because it allows me to edit the real code, not an
edited form of the code. All the  still appear.

On Tue, Sep 16, 2008 at 9:41 AM, TQ White II [EMAIL PROTECTED] wrote:


 I add str_replace('textarea', 'textareaHIDE', ... to the display code and
 the reverse to the store it away code.

 Good luck.

 tqii

 On Sep 15, 2008, at 8:08 PM, sean greenslade wrote:

 Hi all! I am trying to make a PHP HTML editor. I have made the entire
 editor
 function, but it has a big problem. If the page contains a /textarea tag,
 it ends the editor's textarea and the browser starts rendering the HTML.
 How
 do I go about preventing this from happening?

 Thanks a lot!
 --Zootboy




 TQ White II • 708-763-0100
 Website • JustKidding.com http://justkidding.com/





-- 
Feh.


[PHP] Re: Function parameters and arrays

2008-09-18 Thread Frank Stanovcak
Actually Stut pointed out that I was calling both dimmensions when my sorry 
butt should only have been referencing the second one.
I had everything over expanded so I could see where the code was breaking.
Thank you everyone for the help!  That was fantastic!

Frank
Frank Stanovcak [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I am trying to pass a multi dimmed array as a variable parameter to a 
custom function to build a query for me.  Here is the basic code and what I 
am getting.

 $WhereList[0][0] = 'OESalesOrder.OrderNo';
 $WhereList[0][1] = '=';
 $WhereList[0][2] = '2272';
 $SQLString = SQLCall('OESalesOrder',$FieldList,$WhereList);

 I then use a foreach in the function to process it.

 $i = 0;
  foreach(func_get_arg(2) as $WhereArray) {
   echo $WhereArray[0][0];
   if($i == 0) {
$SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' ' . 
 $WhereArray[$i][2];
$i += 1;
   } else {
$SQLStmt .= ' ' . $WhereArray[$i][0] . ' ' . $WhereArray[$i][1] . ' ' . 
 $WhereArray[$i][2] . ' ' . $WhereArray[$i][3];
$i += 1;
   };
  };

 What I get when it processes is the first three letters of [0][0]
 [0][0] = O
 [0][1] = E
 [0][2] = S

 Did I do something wrong, or is this not possible?  I have done an array 
 processing this way before, but not multidimmed.

 Frank.
 



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



Re: [PHP] $_SERVER[REMOTE_ADDR] returning ::1

2008-09-18 Thread David Rocks



Stut wrote:

On 18 Sep 2008, at 16:37, David Rocks wrote:

Stut wrote:

On 18 Sep 2008, at 05:57, David Rocks wrote:
  I am running a test PHP web app on my local machine that uses 
REMOTE_ADDR and most of the time ::1 is returned as the IP addr and 
sometimes it is 127.0.0.1 . I am on OS X 10.5.5 and using APACHE 2. 
PHPINFO always returns ::1 for REMOTE_ADDR. Is this a PHP or a 
APACHE 2 thing?
It's coming from Apache and is correct. ::1 is the same as 127.0.0.1 
in IPv6. Which you get will depend on how you request the page and 
how your DNS/hosts file is set up. Request it with an IPv6 domain/IP 
and REMOTE_ADDR will also be IPv6.
You should be able to disable IPv6 in your system settings, but from 
a future-proof point of view you should be able to handle both.

-Stut
   This app uses this test to insure that the page being processed 
came from the same machine as was used to login to the app. The app 
is intended for broad use so I can't control the use of IPv6. Is 
localhost the only case where the value returned might have different 
values? Can you point to a reference where I might figure out a 
better future proof test?


Using the IP is not a reliable way to check for this. Some ISPs use 
transparent proxies which can cause each subsequent request to come 
from a different IP, regardless of whether it's v4 or v6. You'd be 
better off using a cookie, although that would be a bit less secure.


If you really need to use IP then you can probably rely on it not 
switching between v4 and v6 if you're not using localhost. For testing 
use the machine's real IP or hostname instead of localhost and this 
problem should disappear.


-Stut

  Thanx, using the real ip addr solved my problem as far as my test 
install is concerned. I did do some research and found the text display 
conventions for IPv6 ip addresses. But it looks like it would be better 
to develop a better test than to make an IPv6 safe one.


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



Re: [PHP] Re: PHP and MySQL SELECT COUNT (*)

2008-09-18 Thread Vinny Gullotta
Thanks all, I appreciate the follow ups and the help with the code. I'm 
still relatively new with this stuff, and never had any formal training, 
it's all just been learn as I go, and I have to learn fast as this project 
is relatively urgent to get completed. I plan on going through all of my 
code on all of these pages and cleaning it up at the end to make it more 
efficient, so I will use these tips to help do that.


Thanks again to all who helped troubleshoot this. It is working great now 
and I think my bosses will be happy. =D



Nathan Rixham [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

learn something new every day! cheers Micah :)

Micah Gersten wrote:

While it's true that '.' concatenates and ',' is a list separator, The
comma is actually more appropriate in this instance since you are just
outputting each piece.  It saves the overhead of concatenation before
output.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Nathan Rixham wrote:

6:  vs '
when you use  php will parse the enclosed string for variables, when
you use ' it won't; so ' leads for faster code, and also encourages
you to code strongly by closing strings and concatenating variables.
Further it allows you to use valid html  around attributes rather
than the invalid '

7: , vs .
there is no vs :) to concatenate we use . (period) not , (comma)

so for 6  7..
echo 'td' . $i['servername'] . '/td';

I'm going to stop there, hope it helps a little bit; and I won't go
any further as half the fun is learning; so you finding out how to
save time on queries and write your own db handlers etc is not my
domain I reckons

Regards

nathan




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



Re: [PHP] Static method variable

2008-09-18 Thread Jochem Maas

Christoph Boget schreef:

Perhaps I'm misunderstanding what a static method variable is supposed
to do.  I thought the value would be static for an class' instance but
it appears it is static across all instances of the class.  Consider:

class StaticTest
{
  public function __construct()
  {
  }

  public function test( $newVal )
  {
static $retval = '';

if( $retval == '' )
{
  $retval = $newVal;
}
echo $retval . 'br';
  }
}

$one = new StaticTest();
$one-test( 'joe' );
$two = new StaticTest();
$two-test( 'bob' );

Should it be working that way?


yes. it's a function variable that retains state. everyone misread your
opst so far ... this has nothing to do with static class scope, although
it does work in the same way.

you can do the exact same thing with a normal function:

function test( $newVal )
{
static $retval;

if(!isset($retval))
$retval = $newVal;

echo $retval . \n;
}

test('joe');
test('bob');





thnx,
Chris




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



[PHP] Deconstruct PDF

2008-09-18 Thread Ashley Sheridan
Hi All,

I'm not sure if this is possible, but basically I was wondering if
anyone had any experience with using PHP to read/deconstruct a PDF file.

I'm asking because a system I built at work is being used by a complete
computer illiterate. Even after careful step-by-step instruction, she
still keeps trying to upload a PDF in a form carefully marked as a CSV
upload, and she wonders why it doesn't work. She knows how to press the
PDF button on Word to create the PDF, and that's about it. I was just
wondering if there was a way I could extract the information I wanted
from the PDF (it's a fairly simple affair, just text and no images.) If
not, perhaps there's a way to extract what I need from a Word document?

Thanks,


Ash
www.ashleysheridan.co.uk


Re: [PHP] Deconstruct PDF

2008-09-18 Thread Eric Butera
On Thu, Sep 18, 2008 at 3:15 PM, Ashley Sheridan
[EMAIL PROTECTED] wrote:
 Hi All,

 I'm not sure if this is possible, but basically I was wondering if
 anyone had any experience with using PHP to read/deconstruct a PDF file.

 I'm asking because a system I built at work is being used by a complete
 computer illiterate. Even after careful step-by-step instruction, she
 still keeps trying to upload a PDF in a form carefully marked as a CSV
 upload, and she wonders why it doesn't work. She knows how to press the
 PDF button on Word to create the PDF, and that's about it. I was just
 wondering if there was a way I could extract the information I wanted
 from the PDF (it's a fairly simple affair, just text and no images.) If
 not, perhaps there's a way to extract what I need from a Word document?

 Thanks,


 Ash
 www.ashleysheridan.co.uk


I heard one of the goals of Zend_PDF was to be able to read them and
index them with the Zend_Search_Lucene.As for if that works or
not, I don't know.. but maybe it might be a starting point for you.

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



Re: [PHP] Deconstruct PDF

2008-09-18 Thread Ashley Sheridan
On Thu, 2008-09-18 at 15:20 -0400, Eric Butera wrote:
 On Thu, Sep 18, 2008 at 3:15 PM, Ashley Sheridan
 [EMAIL PROTECTED] wrote:
  Hi All,
 
  I'm not sure if this is possible, but basically I was wondering if
  anyone had any experience with using PHP to read/deconstruct a PDF file.
 
  I'm asking because a system I built at work is being used by a complete
  computer illiterate. Even after careful step-by-step instruction, she
  still keeps trying to upload a PDF in a form carefully marked as a CSV
  upload, and she wonders why it doesn't work. She knows how to press the
  PDF button on Word to create the PDF, and that's about it. I was just
  wondering if there was a way I could extract the information I wanted
  from the PDF (it's a fairly simple affair, just text and no images.) If
  not, perhaps there's a way to extract what I need from a Word document?
 
  Thanks,
 
 
  Ash
  www.ashleysheridan.co.uk
 
 
 I heard one of the goals of Zend_PDF was to be able to read them and
 index them with the Zend_Search_Lucene.As for if that works or
 not, I don't know.. but maybe it might be a starting point for you.
 
Thanks, I think that'll do what I need it to (albeit depending on M$ not
making a hash of the PDF it produces!) This is going to sound like a bit
of a dumb question, but would I need to recompile PHP to make use of
this? The server itself is IIS, if that makes a difference also.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Deconstruct PDF

2008-09-18 Thread Eric Butera
On Thu, Sep 18, 2008 at 3:28 PM, Ashley Sheridan
[EMAIL PROTECTED] wrote:
 On Thu, 2008-09-18 at 15:20 -0400, Eric Butera wrote:
 On Thu, Sep 18, 2008 at 3:15 PM, Ashley Sheridan
 [EMAIL PROTECTED] wrote:
  Hi All,
 
  I'm not sure if this is possible, but basically I was wondering if
  anyone had any experience with using PHP to read/deconstruct a PDF file.
 
  I'm asking because a system I built at work is being used by a complete
  computer illiterate. Even after careful step-by-step instruction, she
  still keeps trying to upload a PDF in a form carefully marked as a CSV
  upload, and she wonders why it doesn't work. She knows how to press the
  PDF button on Word to create the PDF, and that's about it. I was just
  wondering if there was a way I could extract the information I wanted
  from the PDF (it's a fairly simple affair, just text and no images.) If
  not, perhaps there's a way to extract what I need from a Word document?
 
  Thanks,
 
 
  Ash
  www.ashleysheridan.co.uk
 

 I heard one of the goals of Zend_PDF was to be able to read them and
 index them with the Zend_Search_Lucene.As for if that works or
 not, I don't know.. but maybe it might be a starting point for you.

 Thanks, I think that'll do what I need it to (albeit depending on M$ not
 making a hash of the PDF it produces!) This is going to sound like a bit
 of a dumb question, but would I need to recompile PHP to make use of
 this? The server itself is IIS, if that makes a difference also.


 Ash
 www.ashleysheridan.co.uk



Nope, ZF is just a bunch of php classes that you require into your
script.  Since I'm on unix I just symlink it into the include path,
but you can also just copy it right in so you don't have to duplicate
it a hundred times. :)

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



Re: [PHP] Deconstruct PDF

2008-09-18 Thread Ashley Sheridan
On Thu, 2008-09-18 at 15:30 -0400, Eric Butera wrote:

 On Thu, Sep 18, 2008 at 3:28 PM, Ashley Sheridan
 [EMAIL PROTECTED] wrote:
  On Thu, 2008-09-18 at 15:20 -0400, Eric Butera wrote:
  On Thu, Sep 18, 2008 at 3:15 PM, Ashley Sheridan
  [EMAIL PROTECTED] wrote:
   Hi All,
  
   I'm not sure if this is possible, but basically I was wondering if
   anyone had any experience with using PHP to read/deconstruct a PDF file.
  
   I'm asking because a system I built at work is being used by a complete
   computer illiterate. Even after careful step-by-step instruction, she
   still keeps trying to upload a PDF in a form carefully marked as a CSV
   upload, and she wonders why it doesn't work. She knows how to press the
   PDF button on Word to create the PDF, and that's about it. I was just
   wondering if there was a way I could extract the information I wanted
   from the PDF (it's a fairly simple affair, just text and no images.) If
   not, perhaps there's a way to extract what I need from a Word document?
  
   Thanks,
  
  
   Ash
   www.ashleysheridan.co.uk
  
 
  I heard one of the goals of Zend_PDF was to be able to read them and
  index them with the Zend_Search_Lucene.As for if that works or
  not, I don't know.. but maybe it might be a starting point for you.
 
  Thanks, I think that'll do what I need it to (albeit depending on M$ not
  making a hash of the PDF it produces!) This is going to sound like a bit
  of a dumb question, but would I need to recompile PHP to make use of
  this? The server itself is IIS, if that makes a difference also.
 
 
  Ash
  www.ashleysheridan.co.uk
 
 
 
 Nope, ZF is just a bunch of php classes that you require into your
 script.  Since I'm on unix I just symlink it into the include path,
 but you can also just copy it right in so you don't have to duplicate
 it a hundred times. :)
 

Thanks! I'll try and get working with that later tonight!


Ash
www.ashleysheridan.co.uk


Re: [PHP] ODBC Functions MS SQL Server 2005

2008-09-18 Thread Dan Shirah
On 9/18/08, Dan Joseph [EMAIL PROTECTED] wrote:

 Hi,

 Anyone else using the odbc_* functions to interact with MS SQL Server 2005?

 I'm having a problem getting odbc_num_rows() to return anything other than
 -1 when querying a stored procedure.  I can get it to work using Top in a
 normal query (non-stored procedure).

 SELECT Top 100 * FROM Table

 if I do an odbc_num_rows( result ) on that, I get the number of rows.
 However...

 EXEC ProcedureName @Var = 'value'

 if I do an odbc_num_rows( result), I get -1.  The same is true if I did a
 straight SELECT * FROM Table.  I've tried putting Top in my query in the
 stored procedure.

 Right now I'm either doing an extra query for @@ROWCOUNT, or I'm doing two
 result sets, a counting query, and then the normal query.  I am concerned
 about performance in doing the two queries, and with @@ROWCOUNT, I feel I'm
 just adding extra things to the code that may be unreliable?

 From what I've read, its something with the ODBC driver, and updating the
 ODBC driver isn't an option.

 Anyone else having this problem?  Any suggestions?

 --
 -Dan Joseph



 Dan,

If you already have your results in an array, try using count($result); That
should count the number of results returned to your result array.

Or you could try uncommenting the mssql extension in your php.ini file and
then try using:

mssql_num_rows() ?

Dan


Re: [PHP] ODBC Functions MS SQL Server 2005

2008-09-18 Thread Dan Joseph
On Thu, Sep 18, 2008 at 3:36 PM, Dan Shirah [EMAIL PROTECTED] wrote:


 If you already have your results in an array, try using count($result);
 That should count the number of results returned to your result array.

 Or you could try uncommenting the mssql extension in your php.ini file and
 then try using:

 mssql_num_rows() ?

 Dan




I don't have them in an array usually, I just cycle thru each row.

I've thought about using the mssql_* functions.  My boss originally pushed
me into odbc posing the question What if we move to a different database
server type?.

I do have a class for handling all the database functions.  Maybe I'll just
go that route.  If he changed to Oracle or something, I could modify my
class easy enough.

I'm assuming mssql_num_rows() works fine when calling a stored procedure?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] ODBC Functions MS SQL Server 2005

2008-09-18 Thread Micah Gersten
If you need abstraction, check this out:
http://us.php.net/pdo

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Dan Joseph wrote:
 On Thu, Sep 18, 2008 at 3:36 PM, Dan Shirah [EMAIL PROTECTED] wrote:

   
 If you already have your results in an array, try using count($result);
 That should count the number of results returned to your result array.

 Or you could try uncommenting the mssql extension in your php.ini file and
 then try using:

 mssql_num_rows() ?

 Dan




 
 I don't have them in an array usually, I just cycle thru each row.

 I've thought about using the mssql_* functions.  My boss originally pushed
 me into odbc posing the question What if we move to a different database
 server type?.

 I do have a class for handling all the database functions.  Maybe I'll just
 go that route.  If he changed to Oracle or something, I could modify my
 class easy enough.

 I'm assuming mssql_num_rows() works fine when calling a stored procedure?

   

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



Re: [PHP] ODBC Functions MS SQL Server 2005

2008-09-18 Thread Dan Joseph
On Thu, Sep 18, 2008 at 4:35 PM, Micah Gersten [EMAIL PROTECTED] wrote:

 If you need abstraction, check this out:
 http://us.php.net/pdo

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com

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


I looked at PDO, and liked it, but it seems really buggy in the version of
php we're running.  I had to stop using it.  We're running 5.1.2.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] ODBC Functions MS SQL Server 2005

2008-09-18 Thread Micah Gersten
You can't upgrade PHP?

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Dan Joseph wrote:
 On Thu, Sep 18, 2008 at 4:35 PM, Micah Gersten [EMAIL PROTECTED] wrote:

   
 If you need abstraction, check this out:
 http://us.php.net/pdo

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com

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


 
 I looked at PDO, and liked it, but it seems really buggy in the version of
 php we're running.  I had to stop using it.  We're running 5.1.2.

   

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



[PHP] Error message

2008-09-18 Thread Terry J Daichendt
I'm pasting this code from the example at php.net and getting these errors. 
Can anyone determine what I'm doing wrong?


?php
// page1.php

session_start();

echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal']   = 'cat';
$_SESSION['time'] = time();

// Works if session cookie was accepted
echo 'br /a href=page2.phppage 2/a';

// Or maybe pass along the session id, if needed
echo 'br /a href=page2.php?' . SID . 'page 2/a';
?


Warning: session_start() [function.session-start]: Cannot send session 
cookie - headers already sent by (output started at 
/home/terryswe/public_html/hisdailybread/session.php:6) in 
/home/terryswe/public_html/hisdailybread/session.php on line 9


Warning: session_start() [function.session-start]: Cannot send session cache 
limiter - headers already sent (output started at 
/home/terryswe/public_html/hisdailybread/session.php:6) in 
/home/terryswe/public_html/hisdailybread/session.php on line 9

Welcome to page #1

Terry


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



Re: [PHP] Error message

2008-09-18 Thread CanihoJR
No puedes tener ningun espacio en blanco delante de session_start();

Sorry for my english:
you cant have any blank spaccing before SESSION_START()


Prueba:
TRY:

?php
session_start();

echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal']   = 'cat';
$_SESSION['time'] = time();

// Works if session cookie was accepted
echo 'br /a href=page2.phppage 2/a';

// Or maybe pass along the session id, if needed
echo 'br /a href=page2.php?' . SID . 'page 2/a';
?


Re: [PHP] Error message

2008-09-18 Thread Andrew Barnett
It sounds like there is a space or output before the ?php line. It
should be the very first line on a PHP page, and have no spaces before
it.

Andrew

2008/9/19 CanihoJR [EMAIL PROTECTED]:
 No puedes tener ningun espacio en blanco delante de session_start();

 Sorry for my english:
 you cant have any blank spaccing before SESSION_START()


 Prueba:
 TRY:

 ?php
 session_start();

 echo 'Welcome to page #1';

 $_SESSION['favcolor'] = 'green';
 $_SESSION['animal']   = 'cat';
 $_SESSION['time'] = time();

 // Works if session cookie was accepted
 echo 'br /a href=page2.phppage 2/a';

 // Or maybe pass along the session id, if needed
 echo 'br /a href=page2.php?' . SID . 'page 2/a';
 ?


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



Re: [PHP] Error message

2008-09-18 Thread Jochem Maas

Terry J Daichendt schreef:
I'm pasting this code from the example at php.net and getting these 


which example might that be, with 1000's of built in functions you
can imagine there is probably more than one.


errors. Can anyone determine what I'm doing wrong?



yes. but can your read? the error message tells you what is wrong.

output started at /home/terryswe/public_html/hisdailybread/session.php:6

basically the body of a http request must come after the http headers,
sessions make use of cookies. the first echo (or print) statement effectively
starts the output of the http request body after which no headers can be sent
anymore.

what is also plainly obvious is that the example code you posted is *NOT*
the code your trying to run:

there is no session_start() called on line 9 in the example you gave.


?php
// page1.php

session_start();

echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal']   = 'cat';
$_SESSION['time'] = time();

// Works if session cookie was accepted
echo 'br /a href=page2.phppage 2/a';

// Or maybe pass along the session id, if needed
echo 'br /a href=page2.php?' . SID . 'page 2/a';


don't bother with the above line, it's shite. which is a
short way of saying that you have no idea as to the security
ramifications so best not to even go there.


?


Warning: session_start() [function.session-start]: Cannot send session 
cookie - headers already sent by (output started at 
/home/terryswe/public_html/hisdailybread/session.php:6) in 
/home/terryswe/public_html/hisdailybread/session.php on line 9


Warning: session_start() [function.session-start]: Cannot send session 
cache limiter - headers already sent (output started at 
/home/terryswe/public_html/hisdailybread/session.php:6) in 
/home/terryswe/public_html/hisdailybread/session.php on line 9

Welcome to page #1

Terry





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



Re: [PHP] Error message

2008-09-18 Thread Jochem Maas

Andrew Barnett schreef:

It sounds like there is a space or output before the ?php line. It
should be the very first line on a PHP page, and have no spaces before
it.


a blank space before the ?php tag ... on LINE 6???


Andrew

2008/9/19 CanihoJR [EMAIL PROTECTED]:

No puedes tener ningun espacio en blanco delante de session_start();

Sorry for my english:
you cant have any blank spaccing before SESSION_START()


Prueba:
TRY:

?php
session_start();

echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal']   = 'cat';
$_SESSION['time'] = time();

// Works if session cookie was accepted
echo 'br /a href=page2.phppage 2/a';

// Or maybe pass along the session id, if needed
echo 'br /a href=page2.php?' . SID . 'page 2/a';
?






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



Re: [PHP] Error message

2008-09-18 Thread Terry J Daichendt

You have a real attitude problem, please don't bother with me again.


Jochem Maas [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Terry J Daichendt schreef:

I'm pasting this code from the example at php.net and getting these


which example might that be, with 1000's of built in functions you
can imagine there is probably more than one.


errors. Can anyone determine what I'm doing wrong?



yes. but can your read? the error message tells you what is wrong.

output started at /home/terryswe/public_html/hisdailybread/session.php:6

basically the body of a http request must come after the http headers,
sessions make use of cookies. the first echo (or print) statement 
effectively
starts the output of the http request body after which no headers can be 
sent

anymore.

what is also plainly obvious is that the example code you posted is *NOT*
the code your trying to run:

there is no session_start() called on line 9 in the example you gave.


?php
// page1.php

session_start();

echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal']   = 'cat';
$_SESSION['time'] = time();

// Works if session cookie was accepted
echo 'br /a href=page2.phppage 2/a';

// Or maybe pass along the session id, if needed
echo 'br /a href=page2.php?' . SID . 'page 2/a';


don't bother with the above line, it's shite. which is a
short way of saying that you have no idea as to the security
ramifications so best not to even go there.


?


Warning: session_start() [function.session-start]: Cannot send session 
cookie - headers already sent by (output started at 
/home/terryswe/public_html/hisdailybread/session.php:6) in 
/home/terryswe/public_html/hisdailybread/session.php on line 9


Warning: session_start() [function.session-start]: Cannot send session 
cache limiter - headers already sent (output started at 
/home/terryswe/public_html/hisdailybread/session.php:6) in 
/home/terryswe/public_html/hisdailybread/session.php on line 9

Welcome to page #1

Terry







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



Re: [PHP] Error message

2008-09-18 Thread Micah Gersten
Si, puedes tener espacio en blanco delante de session_start(), pero no
puedes tener espacio delante de '?php'.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



CanihoJR wrote:
 No puedes tener ningun espacio en blanco delante de session_start();

 Sorry for my english:
 you cant have any blank spaccing before SESSION_START()


 Prueba:
 TRY:

 ?php
 session_start();

 echo 'Welcome to page #1';

 $_SESSION['favcolor'] = 'green';
 $_SESSION['animal']   = 'cat';
 $_SESSION['time'] = time();

 // Works if session cookie was accepted
 echo 'br /a href=page2.phppage 2/a';

 // Or maybe pass along the session id, if needed
 echo 'br /a href=page2.php?' . SID . 'page 2/a';
 ?

   

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



Re: [PHP] Error message

2008-09-18 Thread Jim Lucas
Terry J Daichendt wrote:
 You have a real attitude problem, please don't bother with me again.
 
 
 Jochem Maas [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Terry J Daichendt schreef:
 I'm pasting this code from the example at php.net and getting these

 which example might that be, with 1000's of built in functions you
 can imagine there is probably more than one.

 errors. Can anyone determine what I'm doing wrong?


 yes. but can your read? the error message tells you what is wrong.

 output started at
 /home/terryswe/public_html/hisdailybread/session.php:6

 basically the body of a http request must come after the http headers,
 sessions make use of cookies. the first echo (or print) statement
 effectively
 starts the output of the http request body after which no headers can
 be sent
 anymore.

 what is also plainly obvious is that the example code you posted is *NOT*
 the code your trying to run:

 there is no session_start() called on line 9 in the example you gave.

 ?php
 // page1.php

 session_start();

 echo 'Welcome to page #1';

 $_SESSION['favcolor'] = 'green';
 $_SESSION['animal']   = 'cat';
 $_SESSION['time'] = time();

 // Works if session cookie was accepted
 echo 'br /a href=page2.phppage 2/a';

 // Or maybe pass along the session id, if needed
 echo 'br /a href=page2.php?' . SID . 'page 2/a';

 don't bother with the above line, it's shite. which is a
 short way of saying that you have no idea as to the security
 ramifications so best not to even go there.

 ?


 Warning: session_start() [function.session-start]: Cannot send
 session cookie - headers already sent by (output started at
 /home/terryswe/public_html/hisdailybread/session.php:6) in
 /home/terryswe/public_html/hisdailybread/session.php on line 9

 Warning: session_start() [function.session-start]: Cannot send
 session cache limiter - headers already sent (output started at
 /home/terryswe/public_html/hisdailybread/session.php:6) in
 /home/terryswe/public_html/hisdailybread/session.php on line 9
 Welcome to page #1

 Terry



 
 

He was simply trying to point to the fact that you showing us something that
is different then what you trying to run that IS causing the problems.

And a side note:  the answer to your question,
Can anyone determine what I'm doing wrong?

He told you that the answer to that question was in your own email.

headers already sent

where

in the file /home/terryswe/public_html/hisdailybread/session.php

on line 6

Everything Jochem's said was facts based on the information that you gave us
in your original email.

My suggestion, remove your session_start() in the above example, because it is
causing the problem.

-- 
Jim Lucas

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

Twelfth Night, Act II, Scene V
by William Shakespeare


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



[PHP] XHTML 移动概要 (XHTML MP) / WAP 2.0 教程

2008-09-18 Thread Shelley
各位好.

XHTML 移动概要 (XHTML MP) / WAP 2.0 教程:
http://www.phparch.cn/index.php/web/66-mobile/188

正在编写中,已完成部分已加链接。
欢迎大家多提意见或建议并留下你的想法供大家交流。

谢谢。

-- 
With best regards,
Shelley Shyan
http://phparch.cn


Re: [PHP] ODBC Functions MS SQL Server 2005

2008-09-18 Thread Dan Joseph
On Thu, Sep 18, 2008 at 5:35 PM, Micah Gersten [EMAIL PROTECTED] wrote:

 You can't upgrade PHP?

 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com



 Dan Joseph wrote:
  On Thu, Sep 18, 2008 at 4:35 PM, Micah Gersten [EMAIL PROTECTED]
 wrote:
 
 
  If you need abstraction, check this out:
  http://us.php.net/pdo
 
  Thank you,
  Micah Gersten
  onShore Networks
  Internal Developer
  http://www.onshore.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
  I looked at PDO, and liked it, but it seems really buggy in the version
 of
  php we're running.  I had to stop using it.  We're running 5.1.2.
 
 

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


No, unfortunately not.  My boss is opposed to it (or atleast was a while
back).  He wasn't sure how some of his stuff would react to the upgarde.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life.


Re: [PHP] Error message

2008-09-18 Thread Eric Gorr

On Sep 18, 2008, at 5:52 PM, Terry J Daichendt wrote:

I'm pasting this code from the example at php.net and getting these  
errors. Can anyone determine what I'm doing wrong?


?php
// page1.php

session_start();

echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal']   = 'cat';
$_SESSION['time'] = time();

// Works if session cookie was accepted
echo 'br /a href=page2.phppage 2/a';

// Or maybe pass along the session id, if needed
echo 'br /a href=page2.php?' . SID . 'page 2/a';
?


Well, this is weird. When I copied your text and tried it myself, the  
error I got was:


Parse error: syntax error, unexpected T_STRING in /Users/ericgorr/ 
Sites/page1.php on line 9


Now, of course, there is nothing visibly wrong with line 9  
($_SESSION['animal'] = 'cat';). But, when I had my text editor show  
invisible characters, there were some on that line and line 10.


Do you have a text editor that can show invisible characters?

On the Mac, the one I really like (and is free) is TextWrangler (http://www.barebones.com/products/textwrangler/ 
) and has this capability. This may be part of your problem. Once I  
got rid of the invisible characters, the example worked without any  
problems.


Also, are you certain there are no spaces or anything (even invisible  
characters) before ?php?


Whenever I've gotten a similar error in the past, that was nearly  
always the problem. You are welcome to compress the text file and send  
it to me directly so I can see exactly what it contains.



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