RE: [PHP] How New Is <<

2003-12-27 Thread Grant Walters
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Saturday, 27 December 2003 20:56
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] How New Is << 
> 
> By "comment[ing] out line 11", I take it you mean making a comment of line
> 11. I just did--as this problem woke me from a night's sleep at just past
> 2:30 AM--and the error message is now:
> 
> Parse error: parse error, unexpected $ in [path to file] on line 19
> 
> Where will this end?
> 
> Steve
> 
> Original Message:
> -
> From: Olwen Williams [EMAIL PROTECTED]
> Date: Sat, 27 Dec 2003 18:25:00 +1300
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] How New Is << 
> 
> Comment out line 11 to checkj it's the cause of the proble.  If the 
> error goes away then retype the line.  I just tested this code and got 
> no errors.  It could be a character that is not what it seems.
> 
> [EMAIL PROTECTED] wrote:
> 
> > Cesar,
> > 
> > Sorry to have taken so long to answer. My day got complicated. Anyway,
> > here's  the code all over again, with the last changes I was advised to
> > make. I took out the line spaces and added line numbers. But first, the
> > latest error message:
> > 
> >Parse error: parse error, unexpected T_VARIABLE in [path to file] on
> > line 11
> > 
> > The code:
> > 
> > 1 
> > 2 
> > 3 
> > 4 persistence demo
> > 5 
> > 6 
> > 7 
> > 8 Persistence Demo
> > 9 
> > 10  > 11 $txtBoxCounter = $_POST['txtBoxCounter'];
> 
> -- 

For what it is worth,  I cut and pasted your full html into a file.

Under PHP version 4.3.1

It runs from the command line without fault.

Apache 1.3.22

It runs without fault (increments properly).

What text editor are you using?  I saved the code as both Unix and DOS format and it 
works for both.

I've attached my file for you to try.  Hope it helps as I can't fault the code.

Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175 OR 4762661, CellPhone 025488265, ICQ# 23511989 

"Never argue with an idiot. They drag you down to their level, then beat you with 
experience."


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

[PHP] Setting Up Openlink ODBC to Work With PHP

2001-01-16 Thread Grant Walters

Hi,

Can anyone point me to a step by step setup including which files to
download for using PHP/OpenLink?

I want to make PHP talk to a Progress 8.3C database on a remote server.

Regards

Grant Walters
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989

 smime.p7s


[PHP] PHP4 Compile As Per Bug id #2933

2001-03-20 Thread Grant Walters

Hi,

>From a search of the PHP Site.
--
Status: Closed User Modify   Dev Modify
From: [EMAIL PROTECTED]
Date: 1999-12-07 16:51:27
Type: Compile Failure
OS: AIX 4.2.1
PHP Version: 4.0 Latest CVS (07/12/1999)
Assigned To:
Short Desc.: SQLCHAR undeclared
--

I have the same error compiling php4.0.1p2 on SCO Openserver 5.0.5 (with gcc
2.95).

I'm not sure about the CVS thing, but I downloaded a php-latest tar file
from the snapshots site, which I can't get to compile at all.

I even tried taking the etc/odbc directory from the snapshot and putting it
into the pl2 directory I have (as you can see I'm not a C programmer :-) ).
But this didn't work.

Is it possible to get detail on the patch that was applied, or another
solution.

Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




FW: [PHP] PHP4 Compile As Per Bug id #2933 AMMENDED - FIXED!

2001-03-20 Thread Grant Walters

> Actually my error is
> php_odbc.c: In function `odbc_column_lengths':
> php_odbc.c:606: `SQLINTEGER' undeclared (first use in this function)
> php_odbc.c:606: (Each undeclared identifier is reported only once
> php_odbc.c:606: for each function it appears in.)
> php_odbc.c:606: parse error before `len'
> php_odbc.c:634: `len' undeclared (first use in this function)

I went back to the latest source relaaes and found the following which I
have included in my pl2 version.


---
#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_OPENLINK)
/* this seems to be necessary for Solid2.3 ( tested by
 * [EMAIL PROTECTED]) and Solid 3.0 (tested by
[EMAIL PROTECTED])
 * Solid does not seem to declare a SQLINTEGER, but it does declare a
 * SQL_INTEGER which does not work (despite being the same type as a
SDWORD.
 * Solid 3.5 does not have this issue.
 */
SDWORD len;
#else
SQLINTEGER len;
#endif

---

php_odbc.c now compiles, the rest is still compiling :-)

Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Easy Object Reading

2001-03-20 Thread Grant Walters

> -Original Message-
> From: Thorsten Viel [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 21 March 2001 00:59
> To: [EMAIL PROTECTED]
> Subject: [PHP] Easy Object Reading
>
>
> Hi,
>
> does somebody know a function where I can read all variables of an object
> independent of there name?
>
> I have to test with large classes, more than 30 vars per class, and dont
> want to implement a function just for testing.
> I want to echo all values of vars of a class without specifyieng
> explicitly
> every single varname.
>

var_dump(PHP3 >= 3.0.5, PHP4 )
Dumps information about a variable
void var_dump (mixed expression)
This function returns structured information about an expression that
includes its type and value.
Arrays are explored recursively with values indented to show structure.
Compare var_dump() to print_r().

1
2 
3 
7 
8


Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Attachment problem with web based mail - CODE SAMPLE

2001-03-21 Thread Grant Walters

> We hired a developer about a year ago to develop a
> web based email system for us in php. The developer
> is no longer around, so I am having to pick up
> the development on the project...When clicking
> on the attachment link of an email in Internet
> Explorer 5.5 in Windows 98, I get the save as dialog
> and when I select ok, it tries to save the html
> page. If I right click and do save target as, it
> gets the correct file. This all works correctly in
> IE 5.0 and Netscape 4.76, and what's weird is that
> it even works as expected in IE 5.5 running on Win2k.
> Can anyone offer any suggestions? I'll be glad to send
> any code snipplets, or info if anyone can clue me in...
>
> Jack Davis
> Network Admin
> Bootheel Internet Services

I built this a few months ago to handle mail merges with a fixed defied
attachment and it seems to work for most email readers I have tried.  It is
supposed to handle text email clients and MIME clients as well as per the
RFC's (It was templated from an outgoing email attachment from Microsoft
Outlook so it will probably screw something up somewhere).

The site variable is a class variable from an included file that contains
all sorts of default stuff.
class SITE {
  var $mail_from = "[EMAIL PROTECTED]";
  var $mail_reply_to = "[EMAIL PROTECTED]";
} // END SITE CLASS

The get page function
  function get_page($page_name="") {
$return="";
if (file_exists($page_name))

  $fp = fopen("$page_name","r");
  $return .= fread($fp, filesize($page_name));
  fclose($fp);
}
return $return;
  }

The logger function is just a thing thats adds a record to a mysql table to
record the event for later use by my contact management/list procesing
system.

  function
mail_it($subject,$mail_message,$mail_to="[EMAIL PROTECTED]",$mail_
attachment="",$from="",$reply_to="") {
global $site;
if ($from) { $mail_from="From:$from"; } else
 $mail_from="From:".$site->mail_from; }
if ($reply_to) { $mail_reply_to="Reply-To:$reply_to"; } else
 $mail_reply_to="Reply-To:".$site->mail_reply_to; }

$rand=md5(rand());
$boundary="=_NextPart_000_$rand";
$boundary2="=_NextPart_001_$rand";
$mail_headers = "$mail_from\n$mail_reply_to\n";
$mail_headers .= "Content-Type: multipart/mixed;\n
boundary=\"$boundary\"";
$mail_headers .= "\nX-Priority: 3 (Normal)\nX-Mailer: Walters And
Associates WCDS, Build 1.01\nImportance: Normal";
$mail_body = "";
$mail_body .= "  This message is in MIME format.  The first part
should";
$mail_body .= "be readable text,\n  while the remaining parts are";
$mail_body .= "likely unreadable without MIME-aware tools.\n  Send
mail";
$mail_body .= "to [EMAIL PROTECTED] for more information.\n";
$mail_body .= "\n";
$mail_body .= "--".$boundary;
$mail_body .= "\n";
$mail_body .= "Content-Type: multipart/alternative;\n
boundary=\"$boundary2\"\n";
$mail_body .= "\n";
$mail_body .= "\n";
$mail_body .= "--".$boundary2."\n";
$mail_body .= "Content-Type: text/plain;\n
charset=\"iso-8859-1\"\n";
$mail_body .= "Content-Transfer-Encoding: 7bit\n";
$mail_body .= "\n";
$mail_body .= strip_tags($mail_message)."\n";
$mail_body .= "\n";
$mail_body .= "\n";
$mail_body .= "--".$boundary2."\n";
$mail_body .= "Content-Type: text/html;\n
charset=\"iso-8859-1\"\n";
$mail_body .= "Content-Transfer-Encoding: quoted-printable\n";
$mail_body .= "\n";
$mail_body .= "$mail_message\n";
$mail_body .= "\n";
$mail_body .= "--".$boundary2."--\n";
$mail_body .= "\n";

if ($mail_attachment<>"") {
  $content = get_page($mail_attachment);
  if ($content) {
$mail_body .= "--".$boundary."\n";
$mail_body .= "Content-Type: application/octet-stream\n";
$mail_body .= "name=\"".basename($mail_attachment)."\"\n";
    $mail_body .= "Content-Transfer-Encoding: base64\n";
$mail_body .= "Content-Description: \"Mail Attachment\"\n";
$mail_body .= "Content-Disposition: attachment;\n";
$mail_body .= "
filename=\"".basename($mail_attachment)."\"\n";
$mail_body .= "\n";
$mail_body .= base64_encode($content)."\n\n";
  }
}
$mail_body .= "--".$boundary."--\n";

if (mail($mail_to,"$subject",$mail_body,$mail_headers)) {
  logger(1,"Mail Success","$subject To $mail_to",$mail_message);
  return TRUE;
} else {
  logger(9,"Mail Failure",$mail_to,$mail_body);
  return FALSE;
}
  }


Hope this Helps.

Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Attachment problem with web based mail

2001-03-21 Thread Grant Walters


> We hired a developer about a year ago to develop a
> web based email system for us in php. The developer
> is no longer around, so I am having to pick up
> the development on the project...When clicking
> on the attachment link of an email in Internet
> Explorer 5.5 in Windows 98, I get the save as dialog
> and when I select ok, it tries to save the html
> page. If I right click and do save target as, it
> gets the correct file. This all works correctly in
> IE 5.0 and Netscape 4.76, and what's weird is that
> it even works as expected in IE 5.5 running on Win2k.
> Can anyone offer any suggestions? I'll be glad to send
> any code snipplets, or info if anyone can clue me in...
>
> Jack Davis
> Network Admin
> Bootheel Internet Services

I built this a few months ago and it seems to work for most things I have
tried.  It is supposed to handle text email clients and MIME clients as
well.

The site variable is a class variable that contains all sorts of stuff.
  var $mail_from = "[EMAIL PROTECTED]";
  var $mail_reply_to = "[EMAIL PROTECTED]";


  function
mail_it($subject,$mail_message,$mail_to="[EMAIL PROTECTED]",$mail_
attachment="",$from="",$reply_to="") {
global $site;
if ($from) { $mail_from="From:$from"; } else
 $mail_from="From:".$site->mail_from; }
if ($reply_to) { $mail_reply_to="Reply-To:$reply_to"; } else
 $mail_reply_to="Reply-To:".$site->mail_reply_to; }

$rand=md5(rand());
$boundary="=_NextPart_000_$rand";
$boundary2="=_NextPart_001_$rand";
$mail_headers = "$mail_from\n$mail_reply_to\n";
$mail_headers .= "Content-Type: multipart/mixed;\n
boundary=\"$boundary\"";
$mail_headers .= "\nX-Priority: 3 (Normal)\nX-Mailer: Walters And
Associates WCDS, Build 1.01\nImportance: Normal";
$mail_body = "";
$mail_body .= "  This message is in MIME format.  The first part
should";
$mail_body .= "be readable text,\n  while the remaining parts are";
$mail_body .= "likely unreadable without MIME-aware tools.\n  Send
mail";
$mail_body .= "to [EMAIL PROTECTED] for more information.\n";
$mail_body .= "\n";
$mail_body .= "--".$boundary;
$mail_body .= "\n";
$mail_body .= "Content-Type: multipart/alternative;\n
boundary=\"$boundary2\"\n";
$mail_body .= "\n";
$mail_body .= "\n";
$mail_body .= "--".$boundary2."\n";
$mail_body .= "Content-Type: text/plain;\n
charset=\"iso-8859-1\"\n";
$mail_body .= "Content-Transfer-Encoding: 7bit\n";
$mail_body .= "\n";
$mail_body .= strip_tags($mail_message)."\n";
$mail_body .= "\n";
$mail_body .= "\n";
$mail_body .= "--".$boundary2."\n";
$mail_body .= "Content-Type: text/html;\n
charset=\"iso-8859-1\"\n";
$mail_body .= "Content-Transfer-Encoding: quoted-printable\n";
$mail_body .= "\n";
$mail_body .= "$mail_message\n";
$mail_body .= "\n";
$mail_body .= "--".$boundary2."--\n";
$mail_body .= "\n";

if ($mail_attachment<>"") {
  $content = get_page($mail_attachment);
  if ($content) {
$mail_body .= "--".$boundary."\n";
$mail_body .= "Content-Type: application/octet-stream\n";
$mail_body .= "name=\"".basename($mail_attachment)."\"\n";
$mail_body .= "Content-Transfer-Encoding: base64\n";
$mail_body .= "Content-Description: \"Mail Attachment\"\n";
$mail_body .= "Content-Disposition: attachment;\n";
$mail_body .= "
filename=\"".basename($mail_attachment)."\"\n";
$mail_body .= "\n";
$mail_body .= base64_encode($content)."\n\n";
  }
}
$mail_body .= "--".$boundary."--\n";

if (mail($mail_to,"$subject",$mail_body,$mail_headers)) {
  logger(1,"Mail Success","$subject To $mail_to",$mail_message);
  return TRUE;
} else {
  logger(9,"Mail Failure",$mail_to,$mail_body);
  return FALSE;
}
  }




Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] MySQL data

2001-04-17 Thread Grant Walters

> Can I get the data from a table in MySQL and copy/transfer all data to
> other database to a table with the same name?
> 

Assuming that both databases are on the same server and that you have created the 
empty table in the second database:

mysql

> INSERT INTO DATABASE2.TABLENAME SELECT * FROM DATABASE1.TABLENAME

I don't know what the implications are for large tables, possibly use mysqldump 
utility instead.

Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP4 4.04pl1 ODBC/Openlink/Progress8.3 COUNT Problem

2001-04-19 Thread Grant Walters

Hi,

Using the above combination I issue the statement

SELECT COUNT(*) FROM mytable

I have tried using either odbc_prepare or odbc_do with each of the cursor types

SQL_CUR_USE_ODBC
SQL_CUR_IF_NEEDED
SQL_CUR_USE_DRIVER
SQL_CUR_DEFAULT

Instead of geting a resultset set with 1 row containing the count I am getting a 
resultset as follows:

executing 'SELECT COUNT(*) FROM mytable'
NUM_ROWS:9
COUNT
1
1
1
1
1
1
1
1
1

I have issued the same SQL statemnt with the Progress tools and with the openlink 
odbctest program and they both return 1 row with
the result

COUNT
9

Any help appreciated.

Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] preg_replace on array with "E (PCRE_DOLLAR_ENDONLY)" modifier

2001-04-23 Thread Grant Walters

Hi,

I'm having problems stopping preg_replace from losing $ signs and following text when 
replacing with array variables.  I am trying
to use the E modifier and keep getting:

"Warning: Unknown modifier 'E' in script.WEB.php3 on line 413"

$template=array(
  "/({PAGETOP})/E",
  "/({PAGEMIDDLE})/E",
  "/({PAGEBOTTOM})/E"
);

$pagevars=array(
  "PAGETOP" => $pagetop,
  "PAGEMIDLE" => $pagetop,
  "PAGEBOTTOM" => $pagenavbar,
);

Text from assorted sources such as database records or external files are placed into 
the variables $pagetop ...

$page = "{PAGETOP}{PAGEMIDDLE}{PAGEBOTTOM}";
$page = preg_replace($template,$pagevars,$page);

Other modifiers seem to be accepted.  Any help appreciated.

Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP Openlink/Progress Problems

2001-10-22 Thread Grant Walters

I'm going nuts trying to work out how to handle errors from data statement with single 
quotes.  PHP 4.0.6 appears to be mangling
something somewhere.
All statements work with the Openlink odbctest program
Any help appreciated

SQL: $sql";
$results = odbc_do($conn,$sql);
if ($results) {
  while (odbc_fetch_into($results,$row)) {
echo $row[0]." ".$row[1]." ".$row[2]."\n";
  }
}
$sql="SELECT ID,Category,description FROM card_type WHERE description LIKE '%PEP%'";
echo "SQL: $sql";
$results = odbc_do($conn,$sql);
if ($results) {
  while (odbc_fetch_into($results,$row)) {
echo $row[0]." ".$row[1]." ".$row[2]."\n";
  }
}
$sql='SELECT ID,Category,description FROM card_type WHERE description LIKE "%PEP%"';
echo "SQL: $sql";
$results = odbc_do($conn,$sql);
if ($results) {
  while (odbc_fetch_into($results,$row)) {
echo $row[0]." ".$row[1]." ".$row[2]."\n";
  }
}
$sql='SELECT ID,Category,description FROM card_type WHERE description="PEPPERELL\'S"';
echo "SQL: $sql";
$results = odbc_do($conn,$sql);
if ($results) {
  while (odbc_fetch_into($results,$row)) {
echo $row[0]." ".$row[1]." ".$row[2]."\n";
  }
}
$sql="SELECT ID,Category,description FROM card_type WHERE description=\"PEPPERELL'S\"";
echo "SQL: $sql";
$results = odbc_do($conn,$sql);
if ($results) {
  while (odbc_fetch_into($results,$row)) {
echo $row[0]." ".$row[1]." ".$row[2]."\n";
  }
}
?>

OUTPUT
--
SQL: SELECT ID,Category,description FROM card_type WHERE description='IMPEYS'
355 Other Item IMPEYS

SQL: SELECT ID,Category,description FROM card_type WHERE description LIKE '%PEP%'
177 Other Item PEPPERELL'S

SQL: SELECT ID,Category,description FROM card_type WHERE description LIKE "%PEP%"
Warning: SQL error: [OpenLink][ODBC][Driver]Syntax error or access, SQL state 37000 in 
SQLExecDirect in
/usr/local/.WWW/WEBS/_odbc/test.php3 on line 42

SQL: SELECT ID,Category,description FROM card_type WHERE description="PEPPERELL'S"
Warning: SQL error: [OpenLink][ODBC][Driver]Syntax error or access, SQL state 37000 in 
SQLExecDirect in
/usr/local/.WWW/WEBS/_odbc/test.php3 on line 50

SQL: SELECT ID,Category,description FROM card_type WHERE description="PEPPERELL'S"
Warning: SQL error: [OpenLink][ODBC][Driver]Syntax error or access, SQL state 37000 in 
SQLExecDirect in
/usr/local/.WWW/WEBS/_odbc/test.php3 on line 58


Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP Openlink/Progress Problems

2001-10-24 Thread Grant Walters

> On Tue, 23 Oct 2001 16:35, Grant Walters wrote:
> > I'm going nuts trying to work out how to handle errors from data
> > statement with single quotes.  PHP 4.0.6 appears to be mangling
> > something somewhere.
> > All statements work with the Openlink odbctest program
> > Any help appreciated
> >
> >  > $conn = odbc_connect("$dsn","","","$cursor");
> > $sql="SELECT ID,Category,description FROM card_type WHERE
> > description='IMPEYS'"; echo "SQL: $sql";
> > $results = odbc_do($conn,$sql);
> > if ($results) {
> >   while (odbc_fetch_into($results,$row)) {
> > echo $row[0]." ".$row[1]." ".$row[2]."\n";
> >   }
> > }
> > $sql="SELECT ID,Category,description FROM card_type WHERE description
> > LIKE '%PEP%'"; echo "SQL: $sql";
> > $results = odbc_do($conn,$sql);
> > if ($results) {
> >   while (odbc_fetch_into($results,$row)) {
> > echo $row[0]." ".$row[1]." ".$row[2]."\n";
> >   }
> > }
> > $sql='SELECT ID,Category,description FROM card_type WHERE description
> > LIKE "%PEP%"'; echo "SQL: $sql";
> > $results = odbc_do($conn,$sql);
> > if ($results) {
> >   while (odbc_fetch_into($results,$row)) {
> > echo $row[0]." ".$row[1]." ".$row[2]."\n";
> >   }
> > }
> > $sql='SELECT ID,Category,description FROM card_type WHERE
> > description="PEPPERELL\'S"'; echo "SQL: $sql";
> > $results = odbc_do($conn,$sql);
> > if ($results) {
> >   while (odbc_fetch_into($results,$row)) {
> > echo $row[0]." ".$row[1]." ".$row[2]."\n";
> >   }
> > }
> > $sql="SELECT ID,Category,description FROM card_type WHERE
> > description=\"PEPPERELL'S\""; echo "SQL: $sql";
> > $results = odbc_do($conn,$sql);
> > if ($results) {
> >   while (odbc_fetch_into($results,$row)) {
> > echo $row[0]." ".$row[1]." ".$row[2]."\n";
> >   }
> > }
> > ?>
>
> If I were doing that with mysql, I would use
>  $sql="SELECT ID,Category,description FROM card_type WHERE
>  description='PEPPERELL\'S'; echo "SQL: $sql";

I do the same for MySQL.  Appears there is a bug somewher in the PHP odbc code.  The 
Openlink team suggested using odbc_prepare
instead, and that works fine, so I'll be converting all of my classes to use 
odbc_prepare statements instead of odbc_do.  I've just
logged this as a bug on the php bug site, so we'll see if they can shed any further 
light on it.

> Given that you are probably getting the description value passed in, you
> might want to check your magic_quotes settings, and also perhaps echo the
> incoming value for description to see whether it is as you expect.
>
> You might have to play around with addslashes to get the right result.

Seems, that addslashes and magic_quotes have no impact at all.  I've downloaded and 
checked the M$ ODBC SDK and the error 37000 is
now error 42000 under ODBC 3.5?  It means that there is a syntax error in the SQL 
command being passed.  considering that everything
works fine from the odbctest program provided by Openlink and also works with 
odbc_prepare using ? and parameters, it must be in the
PHP stuff somewhere.

>
> > OUTPUT
>
> >
> > SQL: SELECT ID,Category,description FROM card_type WHERE
> > description="PEPPERELL'S" Warning: SQL error:
> > [OpenLink][ODBC][Driver]Syntax error or access, SQL state 37000 in
> > SQLExecDirect in /usr/local/.WWW/WEBS/_odbc/test.php3 on line 58
> >
> Ah, how's the wind today? :-)

Ever present.  I live right on the coast facing West, so it gets a wee bit 
rambunctious sometimes :-)


Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] email an ms-word attachment (please)

2001-03-21 Thread Grant Walters

> [EMAIL PROTECTED] wrote:
>
> > Addressed to: Jen Hall <[EMAIL PROTECTED]>
> >   [EMAIL PROTECTED]
> >
> > ** Reply to note from Jen Hall <[EMAIL PROTECTED]> Tue,
> 20 Mar 2001 19:59:26 -0500
> > >
> > > Hi there
> > > I am trying to build an application where a user can use an
> > > HTML form, fill out some fields, select a file from their
> > > hard drive, and have it emailed as an attachment with the
> > > contents of the form.  (essentially, fill in your name and
> > > address, use my module to attach ms-word file of your
> > > resume, send email of all).
> >
> >
> > > I am able to make it work with an image as the attachment,
> > > but when I select an MS-WORD document, which is the goal of
> > > this application, it still thinks it's an image, and doesn't
> > > work properly.
> >
> > Emailing a .doc file is a VERY BAD idea.  VB for applications which is
> > embedded in word is very powerful.  What happens when some hacker
> > decides to use your page to send a vba script like the naked wife virus
> > thru your program?
> >
> >Oh, here is a resume...  lets take a look.
> >
> >Open the attachemnt.
> >
> >A burst of network activity while the vb script sends a
> >copy of itself to everyone in the victim's address book.
> >
> >Then the hard drive light comes on as the program deletes
> >a bunch of important files from the \windows\system directory.
> >
> >Finally the computer crashes because windows can't run
> >without the missing files.  Even though the machine won't
> >boot, the computer forensics people recover the email, and
> >trace it back to you.
> >
> >The victim's lawyers come knocking on your door asking for
> >damages because you let some hacker release a virus thru
> >your program that wiped out several computers at the victim's
> >company, some of their customers, as well as several of
> >his friends.
> >
> >You are forced out of business because the damages are more
> >than the value of your entire company.
> >
> > Not good.
> >
> > Don't believe me?  How about one of them:
> >
> >http://www.gcn.com/state/vol5_no11/enterprise/491-1.html
> >
> >http://members.door.net/kls/virusinfo.htm
> >
> >http://venus.soci.niu.edu/~cudigest/CUDS11/cud1120.html
> >
> >http://www.jwolsen.com/wtip035.htm
> >
> > Want more? - search for 'macro virus' on your favorite search engine.
> >
> > NEVER send .doc, .exe, .com, .bat or .vbs files as attachments, and
> > never - ever open them if one is sent to you.  Not even from someone you
> > trust. Melissa, Anna and Naked Wife all depend on the fact that the
> > virus often comes from a trusted individual as part of their tactics,
> > and it works!  Are you sure your anti-virus software is up to date?
> >
> > Rick Widmer
> > Internet Marketing Specialists
> > http://www.developersdesk.com
>
> Hi Rick
> I have advised my client of all of the risk you mention.
> They still want to go ahead.  They feel that the bulk of their
> website visitors are
> trustworthy (huge assumption on their part), and they tell me
> they will assume all
> responsibility for virus checking, etc.
>
> I still need to know how to do it - technically - to allow an
> attachment of the kind they
> desire
>

If you check my post on RE: [PHP] Attachment problem with web based mail -
CODE SAMPLE from earlier today you will find the code that will send the
file.  You can always virus scanners the document before you send it (even
on a Unix box).

Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] FYI: compile php4 compress uncompress libmysqlclient issue

2001-03-25 Thread Grant Walters
-enable-discard-path=yes \
  --enable-magic-quotes=yes \
  --enable-track-vars=yes \
  --enable-memory-limit \
  --enable-trans-sid \
  --enable-versioning \
  --enable-shared=yes \
  --enable-static=no \
  --disable-pear \
  --disable-xml \
  --disable-bcmath \
  --disable-calendar \
  --without-gd \
  --without-cybercash \
  --without-mod-dav \
  --without-gdbm \
  --without-ndbm \
  --without-db2 \
  --without-db3 \
  --without-cdb \
  --without-dom \
  --without-gettext \
  --without-hyperwave \
  --without-icap \
  --without-imap \
  --without-ldap \
  --without-mcal \
  --without-mcrypt \
  --without-mhash \
  --without-custom-odbc \
  --without-pdflib


The php binary when installed (in mycase) in /usr/local/bin works and
preforms all of the SELECT, UPDATE, DELETE stuff I have thrown at it so far.

It you run the ldd command on it you get this.

# ldd /usr/local/bin/php

dynamic linker: /usr/local/bin/php: file loaded: /usr/lib/libiodbc.so
dynamic linker: /usr/local/bin/php: file loaded:
/usr/local/lib/mysql/libmysqlclient.so10
dynamic linker: /usr/local/bin/php: file loaded: /usr/local/lib/libz.so.1
dynamic linker: /usr/local/bin/php: file loaded: /usr/lib/libsocket.so.1
dynamic linker: /usr/local/bin/php: file loaded: /usr/lib/libc.so.1

NOTES:
There is probably a whole lot of stuff that is a bit wrong with what I have
done above, but a functioning binary was all I was after.  I would
appreciate any feedback on this.

Regards

Grant Walters
Brainbench 'Most Valuable Professional' for Unix Admin
Walters & Associates, P O Box 13-043 Johnsonville, Wellington, NEW ZEALAND
Telephone: +64 4 4765175, CellPhone 025488265, ICQ# 23511989


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]