Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Red Wingate
trim will not work, try something like:

$id = preg_replace(/^0+(.*)$/,//1,$id);

instead

Monty wrote:

I tried removing the zeros, but, I get the same result:

$id = 11;
$id = ltrim($id, '0');
echo $id;   // Displays: 9 instead of 11 ???
This didn't work either:

$id = 11;
settype($id, 'string');
$id = ltrim($id, '0');
echo $id;   // Displays: 9 instead of 11 ???
No matter what I do, $id=11 is seen as 9. Only way is to pass the
number without the zeros ($id=11), but, because this data is being read from
a database, I can't change the format because PHP seems to be converting it
immediately to a 9 instead of reading it as 11 or even 11.
If PHP sees this as an octal, then why does gettype(11) = INTEGER? This
makes no sense.
Monty.


From: [EMAIL PROTECTED] (Jay Blanchard)
Newsgroups: php.general
Date: Fri, 2 Apr 2004 15:38:03 -0600
To: Monty [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: [PHP] Strange Numeric Conversion...
[snip]
Why is this happening???
$id = 11;
echo $id;   // Displays: 9
$id = 11;
echo $id;   // Displays: 11
How do I make the first number (00011) display as 11? Why is it showing
9?
[/snip]
First of all you have naked numbers. The first one, 11, looks like
a binary number (which actually should be 3). You are going to have to
trim the leading zero's from the number to have it display as 11.


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


Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Red Wingate
sry... it's \\1 instead of //1 ... guess i had one to many beers :)

Red Wingate wrote:

trim will not work, try something like:

$id = preg_replace(/^0+(.*)$/,//1,$id);

instead

Monty wrote:

I tried removing the zeros, but, I get the same result:

$id = 11;
$id = ltrim($id, '0');
echo $id;   // Displays: 9 instead of 11 ???
This didn't work either:

$id = 11;
settype($id, 'string');
$id = ltrim($id, '0');
echo $id;   // Displays: 9 instead of 11 ???
No matter what I do, $id=11 is seen as 9. Only way is to pass the
number without the zeros ($id=11), but, because this data is being 
read from
a database, I can't change the format because PHP seems to be 
converting it
immediately to a 9 instead of reading it as 11 or even 11.

If PHP sees this as an octal, then why does gettype(11) = INTEGER? 
This
makes no sense.

Monty.


From: [EMAIL PROTECTED] (Jay Blanchard)
Newsgroups: php.general
Date: Fri, 2 Apr 2004 15:38:03 -0600
To: Monty [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: [PHP] Strange Numeric Conversion...
[snip]
Why is this happening???
$id = 11;
echo $id;   // Displays: 9
$id = 11;
echo $id;   // Displays: 11
How do I make the first number (00011) display as 11? Why is it showing
9?
[/snip]
First of all you have naked numbers. The first one, 11, looks like
a binary number (which actually should be 3). You are going to have to
trim the leading zero's from the number to have it display as 11.




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


RE: [PHP] Image output (Newb question)

2004-04-02 Thread Matt Matijevich
you should have script, call it image.php or something like that, the
only thing that should be in that script is this:
?php
$link = mysql_connect(localhost, root, );
if ($link){
header(Content-type: image/png);
$im = imagecreatefrompng(images/map/map-15x9.png);
imagepng($im); //,images/.session_id()..png
imagedestroy($im);
mysql_close($link);
}
else{
//probably want to have another way to handle this error
echo(Not connected.);
}
?


no html tags in there, no whitespace.

to see the image you could call the page like this
http://www.yourdomain.whatever/image.php . you could call it in a
iumage tag like this 

img src=http://www.yourdomain.whatever/image.php; /

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



RE: [PHP] Image output (Newb question)

2004-04-02 Thread Fidencio Monroy
This way works fine!!

Thank you very much.



-Original Message-
From: Matt Matijevich [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 02, 2004 2:10 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Image output (Newb question)

you should have script, call it image.php or something like that, the
only thing that should be in that script is this:
?php
$link = mysql_connect(localhost, root, );
if ($link){
header(Content-type: image/png);
$im = imagecreatefrompng(images/map/map-15x9.png);
imagepng($im); //,images/.session_id()..png
imagedestroy($im);
mysql_close($link);
}
else{
//probably want to have another way to handle this error
echo(Not connected.);
}
?


no html tags in there, no whitespace.

to see the image you could call the page like this
http://www.yourdomain.whatever/image.php . you could call it in a
iumage tag like this 

img src=http://www.yourdomain.whatever/image.php; /

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



[PHP] Session hell: register_globals off

2004-04-02 Thread Randall Perry
Had a previous thread on this issue. Started working on it again and am
running into new bugs, so thought I'd start a new thread.

Read thoroughly through session examples in docs and here's how I tried to
pass an object from one page to another:


page 1
__

// include class definition file
include_once order_classes.php;
// start session
session_start();
// create instance of class Order
$order = New Order();
// assign class instance to $SESSION[]
$_SESSION['order'] = $order;

page 2
__

// include class definition file
include_once order_classes.php;
// start session
session_start();
// assign $_SESSION['order'] object to variable
$order = $_SESSION['order'];


I'm getting the following error when page 2 loads:
 [error] PHP Notice:  Undefined variable:  _SESSION

Any ideas?





Pertinent PHP vars:
___

Darwin systame.cniweb.net 7.2.0 Darwin Kernel Version 7.2.0: Thu Dec 11
16:20:23 PST 2003; root:xnu/xnu-517.3.7.obj~1/RELEASE_PPC Power Macintosh

Build Date Apr 2 2004 12:58:17

Configure Command  './configure' '--with-apxs=/usr/sbin/apxs' '--with-pgsql'
'--with-xml' '--with-openssl=/usr/local/ssl' '--with-pear'
'--with-curl=/usr/lib'

Apache/1.3.29 (Darwin) DAV/1.0.3 mod_perl/1.29 PHP/4.3.5 mod_jk/1.2.4
mod_ssl/2.8.16 OpenSSL/0.9.7c

register_globalsOff Off


-- 
Randall Perry
sysTame

Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales

http://www.systame.com/

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



Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Monty
Thanks Red, but, still the same problem:

$id = 11;
$id2 = preg_replace(/^0+(.*)$/,\\1,$id);

echo $id2;  // Displays 9
echo $id;   // Displays 9 as well.

If the number begins with a zero, there seems to be no way to tell PHP this
is an integer, not an octal. The conversion happens as soon as the number is
stored in the variable, it appears, which is why everything done afterwards
makes no difference, because $id=11; seems to be stored as $id=9 by
PHP. 


 From: [EMAIL PROTECTED] (Red Wingate)
 Organization: ErisX Development
 Reply-To: [EMAIL PROTECTED]
 Newsgroups: php.general
 Date: Sat, 03 Apr 2004 00:01:43 +0200
 To: [EMAIL PROTECTED]
 Cc: Monty [EMAIL PROTECTED],  [EMAIL PROTECTED]
 Subject: Re: [PHP] Strange Numeric Conversion...
 
 sry... it's \\1 instead of //1 ... guess i had one to many beers :)
 
 Red Wingate wrote:
 
 trim will not work, try something like:
 
 $id = preg_replace(/^0+(.*)$/,//1,$id);
 
 instead
 
 

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



Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Daniel Clark
Doesn't putting and x11 tell PHP it's a decimal format?

 $id = 11;
 $id2 = preg_replace(/^0+(.*)$/,\\1,$id);

 echo $id2;  // Displays 9
 echo $id;   // Displays 9 as well.

 If the number begins with a zero, there seems to be no way to tell PHP
 this
 is an integer, not an octal. The conversion happens as soon as the number
 is
 stored in the variable, it appears, which is why everything done
 afterwards
 makes no difference, because $id=11; seems to be stored as $id=9 by
 PHP.

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



Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Red Wingate
hm

ever tryed telling PHP to display the variable as an integer?

echo (integer) $id ;

 -- red

Daniel Clark wrote:

Doesn't putting and x11 tell PHP it's a decimal format?


   $id = 11;
   $id2 = preg_replace(/^0+(.*)$/,\\1,$id);
   echo $id2;  // Displays 9
   echo $id;   // Displays 9 as well.
If the number begins with a zero, there seems to be no way to tell PHP
this
is an integer, not an octal. The conversion happens as soon as the number
is
stored in the variable, it appears, which is why everything done
afterwards
makes no difference, because $id=11; seems to be stored as $id=9 by
PHP.


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


Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Daniel Clark
Found this:

$a = 1234; # decimal number
$a = -123; # a negative number
$a = 0123; # octal number (equivalent to 83 decimal)
$a = 0x1A; # hexadecimal number (equivalent to 26 decimal)

http://www.phpbuilder.com/manual/language.types.integer.php#language.types.integer.casting


 hm

 ever tryed telling PHP to display the variable as an integer?

 echo (integer) $id ;

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



Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Curt Zirzow
* Thus wrote Daniel Clark ([EMAIL PROTECTED]):
 Found this:
 
 $a = 1234; # decimal number
 $a = -123; # a negative number
 $a = 0123; # octal number (equivalent to 83 decimal)
 $a = 0x1A; # hexadecimal number (equivalent to 26 decimal)

$a is integer in all these cases, the only difference is the last 
two are set using different base notation.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread Curt Zirzow
* Thus wrote Monty ([EMAIL PROTECTED]):
 I tried removing the zeros, but, I get the same result:
 
 $id = 11;
 $id = ltrim($id, '0');
 echo $id;   // Displays: 9 instead of 11 ???
 
 This didn't work either:
 
 $id = 11;
 settype($id, 'string');
 $id = ltrim($id, '0');
 echo $id;   // Displays: 9 instead of 11 ???

This is expected, $id becomes 9 as soon as you assign it. the
ltrim() function's dont see any 0.

this will work however:
  $id = 011;
  echo (int)$id;

  - or

  $id = 011;
  echo ltrim($id, '0');

 No matter what I do, $id=11 is seen as 9. Only way is to pass the
 number without the zeros ($id=11), but, because this data is being read from
 a database, I can't change the format because PHP seems to be converting it
 immediately to a 9 instead of reading it as 11 or even 11.

  This shouldn't be happening. A variable that contains a value of
  '11' will not be seen as on octal value.

 
 If PHP sees this as an octal, then why does gettype(11) = INTEGER? This
 makes no sense.

 Thats because 11 is an integer in octal notation.

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread John Holmes
Red Wingate wrote:

ever tryed telling PHP to display the variable as an integer?

echo (integer) $id ;
Ever tryed realizing 0x09, 011, and 9 are all integers (just different 
bases)?

;)

---John Holmes...

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


Re: [PHP] Strange Numeric Conversion...

2004-04-02 Thread John Holmes
Monty wrote:

Thanks Red, but, still the same problem:

$id = 11;
$id2 = preg_replace(/^0+(.*)$/,\\1,$id);
echo $id2;  // Displays 9
echo $id;   // Displays 9 as well.
If the number begins with a zero, there seems to be no way to tell PHP this
is an integer, not an octal. The conversion happens as soon as the number is
stored in the variable, it appears, which is why everything done afterwards
makes no difference, because $id=11; seems to be stored as $id=9 by
PHP. 
011 and 9 are the exact same number, but represented in different bases! 
Maybe this is the concept you're not grasping. When you say $id = 
11, then you're telling PHP to assign the value of 9 to $id, plain 
and simple.

Can we take a step back here and ask where you're getting 11 from?

---John Holmes...

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


[PHP] $this variable reference question

2004-04-02 Thread Adam Reiswig
I was trying to bend my mind around the concept of the reference 
operator () today and came across an article at 
http://www.onlamp.com/pub/a/php/2002/09/12/php_foundations.html where 
the author gave the following example:

?php
class test {
function test($val) {
global $myref;
$myref = $this;
$this-value = $val;
}
function printval() {
echo The value of this class is '{$this-value}' br;
}
function setval($val) {
$this-value = $val;
}
}
?
My question is actually regarding the line $myref = $this;.  The 
author states that this is a reference to the class/object itself. 
Isn't this like saying outside the class $myref = new test;?  What 
would be the point of referring to itself inside the class in this 
manner?  Thanks for your help in advance!

-Adam Reiswig

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


[PHP] Directories function opendir() - how to open an URL

2004-04-02 Thread Dave
The Directories function opendir(string path)
As of PHP 4.3.0 path can also be any URL which supports directory listing

This returns false eventhough the URL supports directory listing?

opendir (http://www.fu.bar/images/);

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



Re: [PHP] Directories function opendir() - how to open an URL

2004-04-02 Thread Curt Zirzow
* Thus wrote Dave ([EMAIL PROTECTED]):
 The Directories function opendir(string path)
 As of PHP 4.3.0 path can also be any URL which supports directory listing

, however only the file:// URL wrapper supports this in PHP 4.3. As
of PHP 5.0.0, support for the ftp:// URL wrapper is included as
well.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] Re: problem about php

2004-04-02 Thread Jason Barnett
the browser always shows like this: brbFatal error/b:  Call to 
undefined function:  domxml_open_mem() in 
bc:\apache\htdocs\svg_dom_xml_php_bsp.php/b on line b76/bbr. What is wrong here?
In php 4 the dom xml extension is NOT loaded by default.  So you can't 
just call these functions until you load the extension.
http://us2.php.net/domxml

 
 I also looked through the web site www.php.net.  But I was 
confused with so much information.Should I download GNOME XML library? Should 
domxml run only under linux, not windows?Should domxml run above 
the version php4.0.x?
 If possible under windows, how can I get the GNOME XML library and 
then how to install it? At last,how can I configurate php again after 
installing it?
Windows users don't need the GNOME library for domxml, and I wouldn't 
recommend building it yourself.  However, depending on your version of 
php you need to have a file in your include path.  Directly from the manual:

Note to Win32 Users:  In order to enable this module on a Windows 
environment, you must copy one additional file from the DLL folder of 
the PHP/Win32 binary package to the SYSTEM32 folder of your Windows 
machine (Ex: C:\WINNT\SYSTEM32 or C:\WINDOWS\SYSTEM32). For PHP = 4.2.0 
copy libxml2.dll, for PHP = 4.3.0 copy iconv.dll from the DLL folder to 
your SYSTEM32 folder.

For windows 98, I think you can put the relevant file into C:\WINDOWS\SYSTEM

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


Re: [PHP] Directories function opendir() - how to open an URL

2004-04-02 Thread Dave

Is http:// URL wrapper support included in PHP 4.3.4 ?
or is this included in PHP 5.0.0?

Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 * Thus wrote Dave ([EMAIL PROTECTED]):
  The Directories function opendir(string path)
  As of PHP 4.3.0 path can also be any URL which supports directory
listing

 , however only the file:// URL wrapper supports this in PHP 4.3. As
 of PHP 5.0.0, support for the ftp:// URL wrapper is included as
 well.


 Curt
 -- 
 I used to think I was indecisive, but now I'm not so sure.

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



[PHP] opening cash register drawer

2004-04-02 Thread Leonard B Burton
Greetings,

I am working on a Point of Sale Program for PHP.  I need to find out how to open a 
cash register drawer.  Could anyone give me any info?  Do I need to do this with a 
javascript section?

Thanks,



Leonard Burton

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



Re: [PHP] Directories function opendir() - how to open an URL

2004-04-02 Thread Curt Zirzow
* Thus wrote Dave ([EMAIL PROTECTED]):
 
 Is http:// URL wrapper support included in PHP 4.3.4 ?
 or is this included in PHP 5.0.0?

I wouldn't expect the http wrapper to ever support opendir
functionality. Its virtually impossilble to read directoy listings
from a web server.


 
 Curt Zirzow [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  * Thus wrote Dave ([EMAIL PROTECTED]):
   The Directories function opendir(string path)
   As of PHP 4.3.0 path can also be any URL which supports directory
 listing
 
  , however only the file:// URL wrapper supports this in PHP 4.3. As
  of PHP 5.0.0, support for the ftp:// URL wrapper is included as
  well.
 
 
  Curt
  -- 
  I used to think I was indecisive, but now I'm not so sure.
 

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] Re: $this variable reference question

2004-04-02 Thread Jason Barnett
It's not the same thing.  When an variable references an object then you 
can change either the original object or the new variable and you will 
be changing the *same* object, not a new one.  Maybe this example helps?

?php

class test {
function test($val) {
global $myref;
$myref = $this;
$this-value = $val;
}
function printval() {
echo The value of this class is '{$this-value}' br;
}
function setval($val) {
$this-value = $val;
}
}
$a = new test();
$b = $a;
$c = new test();
$a-setval(22);
$b-setval(321);
$c-setval('A weird comment');
$a-printval(); // should see 321
$b-printval(); // should see 321
$c-printval(); // should see A weird comment
?

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


[PHP] Re: $this variable reference question

2004-04-02 Thread Jason Barnett
My question is actually regarding the line $myref = $this;.  The 
author states that this is a reference to the class/object itself. Isn't 
this like saying outside the class $myref = new test;?  What would be 
the point of referring to itself inside the class in this manner?  
Thanks for your help in advance!

-Adam Reiswig
The exact class that the author wrote isn't too useful, although it 
makes its point well.  However, a reference to $this inside a class can 
be useful, for example, if you were using the observer pattern.
http://www.phppatterns.com/index.php/article/articleview/27/1/1/

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


[PHP] Re: Session hell: register_globals off

2004-04-02 Thread Jason Barnett
page 1
__
// include class definition file
include_once order_classes.php;
// start session
session_start();
// create instance of class Order
$order = New Order();
// assign class instance to $SESSION[]
$_SESSION['order'] = $order;
page 2
__
// include class definition file
include_once order_classes.php;
// start session
session_start();
// assign $_SESSION['order'] object to variable
$order = $_SESSION['order'];
I'm getting the following error when page 2 loads:
 [error] PHP Notice:  Undefined variable:  _SESSION
Any ideas?

Are you passing the session id between the pages?  E.g. are you setting 
session cookies, or passing the session id as part of the url?

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


[PHP] Re: Why does session ID sometimes show appeneded to url and sometimes not?

2004-04-02 Thread Jason Barnett
Boot wrote:

Thanks to those who helped with my last post on session vars.

My question now is why does my server seem to randomly choose whether or not
to show the session ID appended to the browser URL? Sometimes it is there,
sometimes not. All pages session_start();.
Thanks!
Check your browser's cookies... do you have the session id there?  If so 
then you don't need to append the id as part of the url.

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


[PHP] Re: opening cash register drawer

2004-04-02 Thread Jason Barnett
You probably need to check out OPOS, but I haven't looked at it in a 
while and can't really tell you what to do.

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


Re: [PHP] opening cash register drawer

2004-04-02 Thread Raditha Dissanayake
Leonard B Burton wrote:

Greetings,

I am working on a Point of Sale Program for PHP.  I need to find out how to open a cash register drawer.  Could anyone give me any info?  Do I need to do this with a javascript section?
 

You will be hard pressed to do anything like this with php. the reason 
is that php is designed primarily as a language for building web 
applications. Not at all suitable for desktop applications or smart 
devices. Hardware control certainly is not recommended.

Having said all that if you have a C library that handles the 
functionality you can invoke it's methods via php.


Thanks,



Leonard Burton

 



--
Raditha Dissanayake.
-
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions 

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


Re: [PHP] Re: Session hell: register_globals off

2004-04-02 Thread Randall Perry
on 4/2/04 8:24 PM, Jason Barnett at [EMAIL PROTECTED] wrote:
 
 Are you passing the session id between the pages?  E.g. are you setting
 session cookies, or passing the session id as part of the url?

Doesn't php default to using cookies? I'm not doing anything other than
using the code I showed.

 page 1
 __
 
 // include class definition file
 include_once order_classes.php;
 // start session
 session_start();
 // create instance of class Order
 $order = New Order();
 // assign class instance to $SESSION[]
 $_SESSION['order'] = $order;
 
 page 2
 __
 
 // include class definition file
 include_once order_classes.php;
 // start session
 session_start();
 // assign $_SESSION['order'] object to variable
 $order = $_SESSION['order'];


-- 
Randall Perry
sysTame

Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales

http://www.systame.com/

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



Re: [PHP] opening cash register drawer

2004-04-02 Thread John Holmes
Leonard B Burton wrote:
I am working on a Point of Sale Program for PHP.  I need to find out 
how to open a cash register drawer.  Could anyone give me any info?  
Do I need to do this with a javascript section?
Uhmm... I to am interested in PHP scripts that open cash register 
drawers. Yeah... can you, ah, let me know what you find out??

John Holmes...

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


Re: [PHP] opening cash register drawer

2004-04-02 Thread Robert Cummings
On Fri, 2004-04-02 at 20:40, Raditha Dissanayake wrote:
 Leonard B Burton wrote:
 
 Greetings,
 
 I am working on a Point of Sale Program for PHP.  I need to find out how to open a 
 cash register drawer.  Could anyone give me any info?  Do I need to do this with a 
 javascript section?
   
 
 You will be hard pressed to do anything like this with php. the reason 
 is that php is designed primarily as a language for building web 
 applications. Not at all suitable for desktop applications or smart 
 devices. Hardware control certainly is not recommended.
 
 Having said all that if you have a C library that handles the 
 functionality you can invoke it's methods via php.

Or a command line interface that can be invoked with exec, or system, or
backticks :)

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

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



[PHP] Re: How to retrieve dir file list from an internet server folder?

2004-04-02 Thread Aidan Lister
Yes, you'll need to parse the output of the page.


Dave [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Is it possible to retrieve dir file list from an internet server folder
from
 within a php program?

 In the browser, the http:// page displays Index of and a list of files.

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



Re: [PHP] Re: Session hell: register_globals off

2004-04-02 Thread Jason Barnett
Randall Perry wrote:

on 4/2/04 8:24 PM, Jason Barnett at [EMAIL PROTECTED] wrote:

Are you passing the session id between the pages?  E.g. are you setting
session cookies, or passing the session id as part of the url?


Doesn't php default to using cookies? I'm not doing anything other than
using the code I showed.

Hmmm, I misunderstood the problem... OK, just try this and see if the 
session is starting and any errors starting it:

?php

error_reporting(E_ALL);
if (session_start()) {
echo Session started;
} else {
echo No session;
}
?

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


Re: [PHP] Re: $this variable reference question

2004-04-02 Thread Adam Reiswig
Jason, thanks.  Yes, I understand your example here very well.  My 
question actually had more to do with understanding what value was added 
to the class by $myref = $this;.  Perhaps it is some misunderstanding 
I have of classes but, since a class is just a pattern and not an 
actual, usable object in and of itself, what is the value in equating a 
member variable with the class.  Almost seems recursive. Even though 
$myref is set to global it is still a member variable, right?  Does 
$this refer to the class pattern or is it creating an object of itself 
inside the class, sort of an object inside an object?  I guess my 
problem in understanding this is not so much where this sort of coding 
should be used but rather what is really going on here.  Thanks again!

-Adam Reiswig

Jason Barnett wrote:

It's not the same thing.  When an variable references an object then you 
can change either the original object or the new variable and you will 
be changing the *same* object, not a new one.  Maybe this example helps?

?php

class test {
function test($val) {
global $myref;
$myref = $this;
$this-value = $val;
}
function printval() {
echo The value of this class is '{$this-value}' br;
}
function setval($val) {
$this-value = $val;
}
}
$a = new test();
$b = $a;
$c = new test();
$a-setval(22);
$b-setval(321);
$c-setval('A weird comment');
$a-printval(); // should see 321
$b-printval(); // should see 321
$c-printval(); // should see A weird comment
?

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


Re: [PHP] Global $_FILEs

2004-04-02 Thread Jason Wong
On Saturday 03 April 2004 05:50, Bruno Santos wrote:

 i've tried to pass the global array $_FILES to a function

$_FILES is a superglobal and hence available everywhere (including the inside 
of functions) without any work on your part.

 but still no sucess...

Please elaborate.

 can someone help me ??

Only if you can provide some details:

1) State what you're trying to do
2) Show the code that you're using
3) State what you expect the code to do
4) State what the code is actually doing

If (3) and (4) are different then:
 
 i) Enable full error reporting and study any error messages you get
ii) Use print_r() and var_dump() to examine all your variables.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
A king's castle is his home.
*/

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



Re: [PHP] Problem sending with mail()

2004-04-02 Thread Jason Wong
On Saturday 03 April 2004 03:35, Matt MacLeod wrote:

 I'm stumped. I have a script to send a simple email using the mail()
 function in PHP.

 For some reason I can only receive the email if I send it to my hotmail
 account. If I send to my regular email ([EMAIL PROTECTED]) I can't get
 it. I've also tried sending to other non-hotmail addresses with no
 luck.

What does the php error logs say?
And your mail logs?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
If the human brain were so simple that we could understand it,
we would be so simple we couldn't.
*/

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



Re: [PHP] php email functionality

2004-04-02 Thread Jason Wong
On Saturday 03 April 2004 00:59, Shawn Beard wrote:
 I just tried downgrading to version 4.3.4 and it still does not work.

And presumably it had worked before you did the upgrade? The tone of your 
original post suggested that the upgrade broke the mail functionality?

Again:

 Are you positive you have made no other changes to your setup whilst
 upgrading php?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Murphy's Law is recursive.  Washing your car to make it rain doesn't work.
*/

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



Re: [PHP] I can't view files uploaded with PHP

2004-04-02 Thread Jason Wong
On Saturday 03 April 2004 03:04, Linux Zero wrote:

 I write some PHP scripts for a system's module that allows the user to
 upload a file from his computer to the host. It works fine in a server with
 Linux   Apache   MySQL   PHP (LAMP) environment. I based on the examples of
 this page:

 http://www.php.net/manual/en/features.file-upload.php

 Las week we transfer the whole system to another server with the same
 environment, but now the uploaded files can't be viewed in the browser.
 That's because the file is uploaded with 640 permissions and can't be
 opened by the browser with a wwwrun user.

 We check in the old server and find that these uploaded files with 644
 permissions. I check the httpd.conf and php.ini files looking for something
 like a umask option, but I find nothing like that.

umask() and/or chmod()

However it is odd, files uploaded via HTTP should be owned by the webserver, 
which in your case ought to be 'wwwrun'? What is the user that the webserver 
is running under and who is the owner of the uploaded files?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Your temporary financial embarrassment will be relieved in a surprising 
manner.
*/

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



Re: [PHP] Apache version... 1.3.29 vs 2.0.

2004-04-02 Thread Jason Wong
On Saturday 03 April 2004 01:28, Chris Shiflett wrote:
 --- Frano ILICIC [EMAIL PROTECTED] wrote:
  I just wonder what is the best apache version to run PHP 4.35?
  Just wondering if there is an obvious choice?

 Maybe not obvious, but I think the best choice is the latest Apache 1.3.x.

But presumably one still has to wait for PHP 4.35 to be released ;-)

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Nothing is as simple as it seems at first
Or as hopeless as it seems in the middle
Or as finished as it seems in the end.
*/

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



[PHP] Re: Relative Url

2004-04-02 Thread K.Bogac Bokeer
I'm using this on Apache. You need to include 'inc/globals.php' in your 
script.

inc/globals.php
?
require_once('functions.php');
define('RELPATH', GetRelativePath());
?
inc/functions.php

function GetRelativePath() {

$RELPATH = str_replace(UpDirectory(__FILE__), '', 
dir_name($_SERVER['SCRIPT_NAME]));
$RELPATH = substr_count($RELPATH, '/');

if ( $RELPATH0 )
$RELPATH = str_repeat('../', $RELPATH);
else
$RELPATH = '/';
return ConvertSlashes($RELPATH);
}
function UpDirectory($directory, $level=1) {

while ( $level--  0 )
$directory = dirname(dirname($directory));
return ConvertSlashes($directory);
}
function ConvertSlashes($st) {

$st = str_replace('', '/', $st);
$st = str_replace('\\', '/', $st);
return $st;
}
function dir_name($directory) {

return ConvertSlashes(dirname($directory));
}
Chris Thomas wrote:
Is there anyway that i can get a url relative to my server for a script that
is being run??
The script is being included in mulitple files and $_SERVER['SCRIPT_NAME']
just gives me the name of the file that is including the other scripts.
Also $_SERVER['SCRIPT_FILENAME'] is returning nothing.
Thanks

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


Re: [PHP] Configuration Variable user_agent

2004-04-02 Thread Burhan Khalid
Bernhard Kraft wrote:
Hallo !

I run PHP 4.1.2.

I want to set the user_agent which gets sent
along when fetching file via the fopen(...) call.
Normally this is PHP/VERISON in my case PHP/4.1.2

I want to set a different user_agent.
I *believe* you can set this via header(), but its still early here.  A 
sure-fire way to find out is to see how snoopy (snoopy.sf.net) does it.

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


Re: [PHP] php email functionality

2004-04-02 Thread Burhan Khalid
Shawn Beard wrote:
I just upgraded to PHP 4.3.5 and now my email functionality does not work.  I do have the SMTP setting in the php.ini set up and did restart Apache. We are running a Windows 2000 server and Apache 2.0.49.   Any ideas?
A few ideas/suggestions :

Does your smtp server require authentication before sending? If so, the 
default mail() function in PHP can't handle SMTP authentication.  Could 
be that it changed since your upgrade.

Does turning up the error_reporting level (E_ALL) print any 
warnings/notices?

Can you ping the smtp server from your web server?

Do other (non-PHP) mail applications work?

Can you send mail using the same smtp server from a mail client running 
from the webserver?

Is it possible to scan the logs of the smtp server to see what is going on?

Hopefully these can lead you in the right direction.

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


<    1   2