[PHP] create word files

2005-04-04 Thread Roman Duriancik
I have problem with creating word file in PHP script. I create table in 
word document but sometimes php send me error message : "*Warning*: 
(null)(): Invoke() failed: Exception occurred. *Source*: Microsoft Word 
*Description*: There is insufficient memory" and then php script 
generate only word document without table.
What can I do ?

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


[PHP] How to compile PHP5 with VC++ 6.0

2005-04-04 Thread kioto
Hi all i have a question. There si an how-to that explain step by step 
all necessary to create
a myself compiled php distribution ?
I have read about: http://docs.php.net/en/install.windows.building.html
Can you send a new link about this issue.
Thanks so much again and good work to all.

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


RE: [PHP] Session in two servers

2005-04-04 Thread Kim Madsen
> -Original Message-
> From: Philip Hallstrom [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 01, 2005 7:43 PM


> You could modify your app so that upon the first request (randomly
picked)
> the client will then continue to use that server until they quit their
> browser.

That would break the whole idea of load balancing!
 
> Might not work for your situation, but it would get around the
> file/session issue...

The solution is to have a common share that all servers in the LB scheme
use for storing session variables.

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper

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



[PHP] Re: How to compile PHP5 with VC++ 6.0

2005-04-04 Thread M. Sokolewicz
Kioto wrote:
Hi all i have a question. There si an how-to that explain step by step 
all necessary to create a myself compiled php distribution ?
yes, there is.
I have read about: http://docs.php.net/en/install.windows.building.html
which is exactly that resource.
Can you send a new link about this issue.
why? that resource shows you what to do just fine, simply read php5 
instead of php4 everywhere that it's mentioned.

Personally though, I use the SDK, so that means I compile it using 
nmake. It's not really that hard.
I'll explain my way of compiling (bit more flexible):
1. follow the instructions (on the page you posted the link to) up till 
you get to "Compiling". What comes after this is different from what it 
says there.
2. Start up the command-line with the environment variables registered 
(if you have Vistual Studio, there'll be a link to such a thing from the 
start menu. Alternatively, you can use Start>Run, type in "cmd" (no 
quotes). navigate to whereever vcvars.bat is located, and run it. Once 
done) go (back) to the c:\work directory (or wherever you put the 
source-files in).
3. run "buildconf.bat:
4. run "cscript /nologo configure.js --help" (no quotes), and you'll get 
a list of configure options you can set. This way you can also compile 
in certain extensions, which makes loading them faster, but also makes 
your php install (a lot) bigger.
5. Once you've configured it, simply type "nmake"
6. you'll get a couple of files in the Release_TS or Debug_TS directory, 
depending on if you built a Debug build or not, php5ts.dll (or 
php5ts_debug.dll) is the most important one. You'll also need another 
library to connect to your server, but which one that is really depends 
on which server you have, and what you configured PHP to work with (eg. 
apache2 support is given via php5apache2.dll).
6. Once you have those, simply follow the instructions given in 
c:\work\whatever_path_you_put_php_in\win32\install.txt, and it should 
all work just fine

Thanks so much again and good work to all.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Connection to Two databases simultaneously

2005-04-04 Thread Kim Madsen
> -Original Message-
> From: HarryG [mailto:[EMAIL PROTECTED]
> Sent: Saturday, April 02, 2005 6:29 AM

> I am connecting to two database in my index.php.

If the 2 databases are on the same mysql server and the MySQL user has access 
to both databases, You can easily use join:

Select name FROM db1.members, db2.addresses WHERE db1.members.id = 
db2.addresses.member_id

It´s been a while(years!) since I´ve used this, so I´m sorry if the syntax 
ain´t correct.

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper

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



Re: [PHP] How to call a static class and method dynamically

2005-04-04 Thread Josip Dzolonga
Dan Rossi wrote:
I was wonderiing how I would go about something like this
$class = 'classname';
return $class::staticMethod(); , not happy isnt working. Any ideas 
lemme know.

class MyClass {
   function static_method() {
  echo 'I'm in static_method !';
   }
}
You can call the function statically using the double colon ( :: ) 
operator :

MyClass::static_method();
I suggest you to take a good look here 
http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php

--
Josip Dzolonga
http://josip.dotgeek.org
jdzolonga[at]gmail.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Re: eregi problem

2005-04-04 Thread Kim Madsen

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Sunday, April 03, 2005 6:03 PM
> To: php-general@lists.php.net
> Subject: [PHP] Re: eregi problem
> 
> i'm not familliar with regular expresions but i think that  ^a-z - means
> that variable must start witx a-z characters
> you can chek it  here:
> 
> http://www.php.net/manual/en/reference.pcre.pattern.syntax.php

True, but look careful at what HE did:

> > if((eregi("[^a-zA-Z0-9]",$GP[sifre])

Putting the ^ _inside_ [] means NOT, so if any of the chars a-z0-9 is in the 
string it´s NOT matched.

Also there´s no idea in having a-zA-Z in the pattern since eregi() is case 
insensitive.

-- 
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen 
Systemudvikler/systemdeveloper

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



[PHP] Exchanging Data among processes

2005-04-04 Thread Matheus Degiovani
Hello,
How can I exchange data among processes (i.e. two or more users 
accessing a php webpage)? The two "usual" ways would be using either a 
database or file, so I was wondering if there is another, more "fast" 
(with reduced latency) for different pages being processed to exchange 
information.

In other words: how (if) can I make a chat program that doesn't use 
files or databases to exchange information between users.

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


Re: [PHP] Exchanging Data among processes

2005-04-04 Thread Chris Ramsay
Matheus,
 As a start I would check out using sockets:
 http://uk.php.net/sockets
 rgds
 Chris Ramsay


[PHP] Test

2005-04-04 Thread maillists
Test

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

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



Re: [PHP] pass variable from vbscript to php

2005-04-04 Thread Ashley
Ok, apparently I wasn't clear enough with my explanation due to the 
responses I have received.

I have a webserver (not on the same computer as the users) that is 
hosting an Intranet app.  I want to obtain the username of the current 
person logged into the workstation that is connecting to the Intranet.

From what I have read this is impossible to accomplish from the server 
without prompting for a username/password.  I found an activeX control 
(called NWSess from Novell) that will provide the currently logged in user.

The problem is that I need to take this variable (provided by the 
activeX control to a vbscript) and pass it to PHP so that it can be 
used.  I don't typically use vbscript so I would really like to put the 
variable in PHP so that I can use it for other things.

I hope this explains what I am trying to accomplish a little better and 
thank you for the responses thus far.

Ashley
Burhan Khalid wrote:
Ashley wrote:
I have a unique problem that may be able to be solved another way, but 
I don't know how.

What I need to do is pass a variable from a vbscript into php for use.
I am using vbscript to access an activeX control on the computer that 
grabs the currently logged in user.  This works fine, but I cannot 
determine how I can get that value into php so that I can use it.

If PHP is running on the same computer that the user is logged into, 
then you can use $_SERVER['REMOTE_USER'] to get the current logged in user.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: eregi problem

2005-04-04 Thread M. Sokolewicz
Kim Madsen wrote:
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Sunday, April 03, 2005 6:03 PM
To: php-general@lists.php.net
Subject: [PHP] Re: eregi problem
i'm not familliar with regular expresions but i think that  ^a-z - means
that variable must start witx a-z characters
you can chek it  here:
http://www.php.net/manual/en/reference.pcre.pattern.syntax.php

True, but look careful at what HE did:

if((eregi("[^a-zA-Z0-9]",$GP[sifre])

Putting the ^ _inside_ [] means NOT, so if any of the chars a-z0-9 is in the string it´s NOT matched.
actually, that's not entirely correct. The regexp basically means that 
if there is any character in the string which is NOT alphanumeric, then 
it is matched. So basically it returns true if there is a 
non-alphanumeric char, and false otherwise. However, AFAIK the regexp 
should be delimited, since if it isn't it behaves "differently"... I 
just can't remember how differently it is exactly =/
Also there´s no idea in having a-zA-Z in the pattern since eregi() is case 
insensitive.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Test

2005-04-04 Thread Ryan A
Good test!


On 4/4/2005 2:46:14 PM, [EMAIL PROTECTED] wrote:
> Test
> 
> 
> 
> --
> 
> This message has been scanned for viruses and
> 
> dangerous content by MailScanner, and is
> 
> believed to be clean.
> 
> MailScanner thanks transtec Computers for their support.
> 


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.1 - Release Date: 4/1/2005

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



RE: [PHP] Re: eregi problem

2005-04-04 Thread Kim Madsen

> -Original Message-
> From: M. Sokolewicz [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 04, 2005 3:08 PM


> > Putting the ^ _inside_ [] means NOT, so if any of the chars a-z0-9 is in
> the string it´s NOT matched.

> actually, that's not entirely correct. The regexp basically means that
> if there is any character in the string which is NOT alphanumeric, then
> it is matched. So basically it returns true if there is a
> non-alphanumeric char, and false otherwise. However, AFAIK the regexp
> should be delimited, since if it isn't it behaves "differently"... I
> just can't remember how differently it is exactly =/

It _is_ correct. [^] means that whatever is in the [] must not be in the 
checked var to be true! Look in "mastering regular expressions" if You´re in 
doubt. There´s an example [^1-6] meaning if a digit between 1 and 6 is not in 
the value checked, it´s true:

$var1 = "123";
$var2 = "789";

if(ereg("[^1-6]", $var1))
  print "$var1 is true";
else
  print "$var1 is false";

returns false

if(ereg("[^1-6]", $var2))
  print "$var2 is true";
else
  print "$var2 is false";

returns true

It´s untested though :-)

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper

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



Re: [PHP] functions vs classes

2005-04-04 Thread Brent Baisley
At the most basic level a class allows you to group your functions 
together. On small projects, grouping of functions may not seem to buy 
you anything. But the bigger the project gets, the more you would like 
to be able to keep your functions separated into groups.

One simple advantage of classes is that they prevent naming conflicts 
with your functions. This is very important when you are sharing code 
since you don't know what another programmer named their functions. 
What if you both name a function "get_one_record"? If you use classes, 
you only need to keep the names of your classes unique. Which then 
means you can use the same generic function name across all your 
classes, and you interface within your classes in a consistent manner, 
only the context changes.

For instance, you may have a class call "companies" and another called 
"contacts". Within each you may have functions called "get_list", 
"get_one" and "delete_one". Same function names, but in different 
classes so they don't conflict. Now you could create a generic 
interface to view a list, view a record or delete a record. What data 
is displayed depends on which class you load. The function names are 
all the same, so you don't need to change your code when you change the 
context (companies or contacts).

This is hardly a tutorial on OOP. But maybe it will give you an idea of 
the benefits of using classes.

On Apr 4, 2005, at 12:28 AM, DuSTiN KRySaK wrote:
Novice PHPer, and i am wondering why one would use a function instead 
of a class (or object)? They seem to server very similar in use.

The way I see it, is a function if for repeated use in a project 
specific manner, where as a class could be used for many projects.

is this correct?
Although one could just include the function library in multiple 
projects.

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

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: eregi problem

2005-04-04 Thread M. Sokolewicz
Kim Madsen wrote:
-Original Message-
From: M. Sokolewicz [mailto:[EMAIL PROTECTED]
Sent: Monday, April 04, 2005 3:08 PM


Putting the ^ _inside_ [] means NOT, so if any of the chars a-z0-9 is in
the string it´s NOT matched.

actually, that's not entirely correct. The regexp basically means that
if there is any character in the string which is NOT alphanumeric, then
it is matched. So basically it returns true if there is a
non-alphanumeric char, and false otherwise. However, AFAIK the regexp
should be delimited, since if it isn't it behaves "differently"... I
just can't remember how differently it is exactly =/

It _is_ correct. [^] means that whatever is in the [] must not be in the checked var to be true! Look in "mastering regular expressions" if You´re in doubt. There´s an example [^1-6] meaning if a digit between 1 and 6 is not in the value checked, it´s true:
which is exactly what I said...
$var1 = "123";
$var2 = "789";
if(ereg("[^1-6]", $var1))
  print "$var1 is true";
else
  print "$var1 is false";
returns false
if(ereg("[^1-6]", $var2))
  print "$var2 is true";
else
  print "$var2 is false";
returns true
It´s untested though :-)
I just wasn't too sure about absence of the regexp-delimiter...
--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] file upload

2005-04-04 Thread William Stokes
Hello,
I might have asked this already but I am still ignorent ;-)

How to check if a same name file already exists in a upload directory when 
uploading new file?

Thanks
-Will 

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



Re: [PHP] pass variable from vbscript to php

2005-04-04 Thread Jason Barnett
Ashley wrote:
> Ok, apparently I wasn't clear enough with my explanation due to the
> responses I have received.
>
> I have a webserver (not on the same computer as the users) that is
> hosting an Intranet app.  I want to obtain the username of the current
> person logged into the workstation that is connecting to the Intranet.
>

OK.

> From what I have read this is impossible to accomplish from the server
> without prompting for a username/password.  I found an activeX control
> (called NWSess from Novell) that will provide the currently logged in user.
>

Apparently it's not impossible to do this without prompting for
the username / password then eh?

ActiveX controls are in the COM family.  If you don't know about COM
then you can start by looking here:
http://www.microsoft.com/com/default.mspx

Now... when you find the list of commands / variables that you will need
from the ActiveX container then you can make those calls with PHP.  The
relevant part of the PHP manual is:
http://php.net/manual/en/ref.com.php

P.S. this sounds pretty interesting.  I (and probably others) would
appreciate it if you would post back to the list with a [SOLVED]
response that shows PHP code you used to get this working.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] pass variable from vbscript to php

2005-04-04 Thread Ashley
Just so that I don't start working in the wrong direction, do you mean 
that I can get the same information from the activeX control directly 
from PHP rather than having to do it with vbscript?

I am not much of a coder so any help porting the vbscript to PHP would 
be great.  The code that I am using to get the information from the 
activeX control is:
<--

for each tree in NWSess1.ConnectedTrees
anyTree=tree.FullName
anyUser=NWSess1.LoginName(anyTree)
output=output+"Tree:"+anyTree+", userID:"+anyUser+vbcrlf
next
//msgbox output
--> I found this code on Novell's site so I didn't make this myself. In the mean time, I will look at the information that you gave me and see if I can figure it out. Thanks, Ashley Jason Barnett wrote: Ashley wrote: Ok, apparently I wasn't clear enough with my explanation due to the responses I have received. I have a webserver (not on the same computer as the users) that is hosting an Intranet app. I want to obtain the username of the current person logged into the workstation that is connecting to the Intranet. OK. From what I have read this is impossible to accomplish from the server without prompting for a username/password. I found an activeX control (called NWSess from Novell) that will provide the currently logged in user. Apparently it's not impossible to do this without prompting for the username / password then eh? ActiveX controls are in the COM family. If you don't know about COM then you can start by looking here: http://www.microsoft.com/com/default.mspx Now... when you find the list of commands / variables that you will need from the ActiveX container then you can make those calls with PHP. The relevant part of the PHP manual is: http://php.net/manual/en/ref.com.php P.S. this sounds pretty interesting. I (and probably others) would appreciate it if you would post back to the list with a [SOLVED] response that shows PHP code you used to get this working. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-general&w=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] What's the going rate for making websites ?

2005-04-04 Thread Brent Baisley
That would be between $10 and $150 per hour or more. One can easily 
find and hire a college kid to slap together some open source programs, 
maybe throw a bit of Flash and fancy graphics on a web page and the 
project is done for $10 per hour. Of course, there is no cohesiveness 
or consistency to the "finished" website, and there was no reason to 
use Flash code, except to say the website uses Flash. All the text is 
actually graphics so there is no easy way to update the content. But 
the site works and it was done in 20 hours. So what is some of the site 
doesn't work if you are not using Internet Explorer under Windows, it 
will work for 85% of the people.

For $150+ per hour, you would get security analysis, usability 
analysis, browser testing, performance analysis and testing, adherence 
to standards, project management, scalability and maintainability. 
Perhaps even return on investment (ROI) estimates. The time frame will 
be a lot longer than the $10 hour work, but you won't have any problems 
tracking someone down to fix bugs and it will encompass things the 
client hadn't thought of.

Just a motorcycle club? If it's just some graphics and a discussion 
area, that's not too hard. There is a bunch of open source forum 
software available. Is there going to be a mailing list? Now that's 
including membership and people's personal information. You need to 
take security into account, especially SQL insertion, cross-site 
scripting, the hosted OS, etc.

Prices charged can be all over the place based on the talent of the 
person(s) doing the work. You may choke if someone said they would come 
up with a tag line for your company for only $20,000. That's not even a 
website, but a one line sentence. But that's about what HBO paid for 
"It's not TV, it's HBO.". In hindsight, $20k was pretty cheap.

So, what you charge depends on your talent and what needs to be done. 
$20-$50 per hour is probably the most common range for someone who 
doesn't really do this professionally, but knows they can do a decent 
job. You can come up a project price based on your hourly rate.

Bottom line, there really is no answer. I used to charge $75 per hour 
when I did consulting during the dot com era and my clients were 
telling me I was charging them too little. Some even saying I should 
double my rate.

On Apr 3, 2005, at 6:51 PM, -{ Rene Brehmer }- wrote:
Hi gang
Sorry for asking this question here, but I don't know where else to 
ask. And Goole'ing didn't help me much.

My father-in-law has a friend in Alaska (and I'm in Canada) that needs 
a website done. Not sure what kinda site he wants done yet, or how 
much he needs me to do for him (like webspace, domain hosting, domain 
registration, and such) but for now I've been asked what it'd cost to 
get it done.

I'm assuming it's something pretty simple, since it's just for a 
motorcycle club, but he wants a price first ...

What do y'all charge when you do sites for people ??? ... In the past 
I've only done pro-bono work (because they usually don't require much 
work, so it's not a problem getting it done while working on other 
projects), but I've never actually done paid work before... It's more 
that I just recently moved to Canada (from Denmark) so I have no 
feeling with what the prices and rates are overhere ...

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

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] functions vs classes

2005-04-04 Thread Martin . C . Austin
I know I sure appreciate reading any discussions on OOP issues, as they 
are something I just cannot seem to grasp.

Thanks!

Martin Austin





Brent Baisley <[EMAIL PROTECTED]>
04/04/2005 08:44 AM
 
To: DuSTiN KRySaK <[EMAIL PROTECTED]>
cc: PHP 
Subject:Re: [PHP] functions vs classes


At the most basic level a class allows you to group your functions 
together. On small projects, grouping of functions may not seem to buy 
you anything. But the bigger the project gets, the more you would like 
to be able to keep your functions separated into groups.

One simple advantage of classes is that they prevent naming conflicts 
with your functions. This is very important when you are sharing code 
since you don't know what another programmer named their functions. 
What if you both name a function "get_one_record"? If you use classes, 
you only need to keep the names of your classes unique. Which then 
means you can use the same generic function name across all your 
classes, and you interface within your classes in a consistent manner, 
only the context changes.

For instance, you may have a class call "companies" and another called 
"contacts". Within each you may have functions called "get_list", 
"get_one" and "delete_one". Same function names, but in different 
classes so they don't conflict. Now you could create a generic 
interface to view a list, view a record or delete a record. What data 
is displayed depends on which class you load. The function names are 
all the same, so you don't need to change your code when you change the 
context (companies or contacts).

This is hardly a tutorial on OOP. But maybe it will give you an idea of 
the benefits of using classes.


On Apr 4, 2005, at 12:28 AM, DuSTiN KRySaK wrote:

> Novice PHPer, and i am wondering why one would use a function instead 
> of a class (or object)? They seem to server very similar in use.
>
> The way I see it, is a function if for repeated use in a project 
> specific manner, where as a class could be used for many projects.
>
> is this correct?
>
> Although one could just include the function library in multiple 
> projects.
>
> Thanks!
>
> Dustin
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
-- 
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

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




[PHP] Re: file upload

2005-04-04 Thread Jason Barnett
Search the list archives for "(noob) file"

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] pass variable from vbscript to php

2005-04-04 Thread Ashley
Ok, I did a quick scan of the COM section on PHP's site (linked below) 
and found this requirement:
"COM functions are only available for the Windows version of PHP."

In my first post, I mentioned that I am running my webserver on a 
Netware 6.5 server.

In light of this I am guessing that this suggestion will not work.  Is 
this in fact the case or is there another way around this?

Ashley
Jason Barnett wrote:
Ashley wrote:
Ok, apparently I wasn't clear enough with my explanation due to the
responses I have received.
I have a webserver (not on the same computer as the users) that is
hosting an Intranet app.  I want to obtain the username of the current
person logged into the workstation that is connecting to the Intranet.

OK.

From what I have read this is impossible to accomplish from the server
without prompting for a username/password.  I found an activeX control
(called NWSess from Novell) that will provide the currently logged in user.

Apparently it's not impossible to do this without prompting for
the username / password then eh?
ActiveX controls are in the COM family.  If you don't know about COM
then you can start by looking here:
http://www.microsoft.com/com/default.mspx
Now... when you find the list of commands / variables that you will need
from the ActiveX container then you can make those calls with PHP.  The
relevant part of the PHP manual is:
http://php.net/manual/en/ref.com.php
P.S. this sounds pretty interesting.  I (and probably others) would
appreciate it if you would post back to the list with a [SOLVED]
response that shows PHP code you used to get this working.
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] file upload

2005-04-04 Thread Larry E . Ullman
I might have asked this already but I am still ignorent ;-)
How to check if a same name file already exists in a upload directory 
when
uploading new file?
Use the appropriately named file_exists() function.
L.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Exchanging Data among processes

2005-04-04 Thread Matheus Degiovani
Hello Chris,
Matheus,
 As a start I would check out using sockets:
 http://uk.php.net/sockets
Did some experiments, and it seems this would work great. Thanks a lot! :)
The only problem is that not all (if not almost all) hosting services 
disable sockets...

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


Re: [PHP] pass variable from vbscript to php

2005-04-04 Thread Jason Barnett
Ashley wrote:
> Just so that I don't start working in the wrong direction, do you mean
> that I can get the same information from the activeX control directly
> from PHP rather than having to do it with vbscript?

Yes, that is exactly what I mean.

>
> I am not much of a coder so any help porting the vbscript to PHP would
> be great.  The code that I am using to get the information from the
> activeX control is:
> <--
> 
> for each tree in NWSess1.ConnectedTrees
> anyTree=tree.FullName
> anyUser=NWSess1.LoginName(anyTree)
> output=output+"Tree:"+anyTree+", userID:"+anyUser+vbcrlf
> next
> //msgbox output
> 
> -->
>

You should be able to translate all of the above code into PHP.  Send us
another message if you have trouble with some part of it.  Exact process
will depend on PHP4/PHP5 though.  Again, refer to this link:
http://php.net/manual/en/ref.com.php

Personally, I'd code this for use in a PHP5 parser.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


RE: [PHP] file upload

2005-04-04 Thread Mike
> How to check if a same name file already exists in a upload 
> directory when uploading new file?
> 

Use the file_exists() function (oddly named, I know).

http://us4.php.net/manual/en/function.file-exists.php

-M 

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



Re: [PHP] file upload

2005-04-04 Thread Robby Russell
On Mon, 2005-04-04 at 17:07 +0300, William Stokes wrote:
> Hello,
> I might have asked this already but I am still ignorent ;-)
> 
> How to check if a same name file already exists in a upload directory when 
> uploading new file?
> 
> Thanks
> -Will 
> 

http://www.php.net/file_exists

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP, Ruby, and PostgreSQL Development
* http://www.robbyonrails.com/
/

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



Re: [PHP] pass variable from vbscript to php

2005-04-04 Thread Satyam
One way you can do it is to put an invisible  on the same page as 
the  which provides you the user information.  When you get, via 
vbscript or javascript, the userid, then you set the src property of the 
 to that of a page where you will process that info, appended with 
the information taken from the .




Asiming the property of the ActiveX object you want to send to the PHP 
server is called UserId, whenever you are sure you can read it (perhaps an 
event or whatever) you do:

document.getElementById('iframename').src = 'ValidateUser.php?UserId=' + 
document.getElementById('objectname').UserId


The page ValidateUser.php would receive the UserId as an argument in the URL 
(and you can add as many as you want) and may reply with whatever response 
is apropriate.  That answer will go into the body of the iframe document.

Thus, assuming that you reply with a 0 or 1, you will get that by having an 
function attached to the onLoad event of the .  The onLoad will be 
triggered when a response is finally received.

The reply you will get as

document.getElementById('iframename').document.body.innerHTML

which you could check by doing a:




Satyam


"Ashley" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Ok, apparently I wasn't clear enough with my explanation due to the 
> responses I have received.
>
> I have a webserver (not on the same computer as the users) that is hosting 
> an Intranet app.  I want to obtain the username of the current person 
> logged into the workstation that is connecting to the Intranet.
>
> From what I have read this is impossible to accomplish from the server 
> without prompting for a username/password.  I found an activeX control 
> (called NWSess from Novell) that will provide the currently logged in 
> user.
>
> The problem is that I need to take this variable (provided by the activeX 
> control to a vbscript) and pass it to PHP so that it can be used.  I don't 
> typically use vbscript so I would really like to put the variable in PHP 
> so that I can use it for other things.
>
> I hope this explains what I am trying to accomplish a little better and 
> thank you for the responses thus far.
>
> Ashley
>
>
> Burhan Khalid wrote:
>> Ashley wrote:
>>
>>> I have a unique problem that may be able to be solved another way, but I 
>>> don't know how.
>>>
>>> What I need to do is pass a variable from a vbscript into php for use.
>>>
>>> I am using vbscript to access an activeX control on the computer that 
>>> grabs the currently logged in user.  This works fine, but I cannot 
>>> determine how I can get that value into php so that I can use it.
>>
>>
>> If PHP is running on the same computer that the user is logged into, then 
>> you can use $_SERVER['REMOTE_USER'] to get the current logged in user. 

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



[PHP] Compact, human-editable serialization

2005-04-04 Thread GamblerZG
Somewhere around here I asked about human-readable serialization and 
there was no solution that fitted my needs. So I wrote my own 
serialize/deserialize pair. The decode function is different from the 
one I posted here before. This function, in my opinion, is written very 
efficiently, but it's still about 10-50 times slower than serialize. I 
guess it's not too bad, because I compete with pure C++ code, but I 
would still appreciate any suggestion for performance tune-up.

PS: If someone would write the same functions in C, they wold probably 
be faster than PHP's de/serialize. And they provide output that is much 
more compact. And it's human-editable. PHP developers, if you read this, 
think about it.

---
function encode($var) {
   if (is_array($var)) {
   $code = '(';
   foreach ($var as $key => $value) {
   $code .= encode($key).'='.encode($value).',';
   }
   $code = chop($code, ','); //remove unnecessary coma
   $code .= ')';
   return $code;
   } else {
   if (is_string($var)) { //this also catches string with numbers 
inside
   if (strpos($var, "'") !== FALSE) {
   $var = str_replace("'", "''", $var);
   }
   return "'".$var."'";
   } elseif (is_numeric($var)) {
   return $var;
   } elseif (is_bool($var)) {
   return ($var ? 'T' : 'F');
   } else {
   return 'N';
   }
   }
}

function decode($str) {
preg_match_all('/"(.*?)"/s', $str, $matches, PREG_PATTERN_ORDER);
$dStack = $matches[1];
$str = preg_replace('/".*?"/s', 'D', $str);
preg_match_all("/'(.*?)'/s", $str, $matches, PREG_PATTERN_ORDER);
$sStack = $matches[1];
$str = preg_replace("/'.*?'/s", "S", $str);
if (preg_match('/[\'"]/', $string)) {
user_error("Unpaired quotes", E_USER_WARNING);
return;
}
$str = preg_replace('/\s/', '', $str);
$str = preg_replace('/,\)/', ')', $str);
preg_match_all('/([^TFNDS=,\(\)]+)/i', $str, $matches, 
PREG_PATTERN_ORDER);
$xStack = $matches[1];
$str = preg_replace('/[^TFNDS=,\(\)]+/i', 'X', $str);

$heap = array();
$ptr = strlen($str) - 1;
while ($ptr != 0) {
switch ($str{$ptr}) {
case 'D':
$string = array_pop($sStack);
while ($str{$ptr - 1} == 'D') {
$string = array_pop($dStack).'"'.$string;
$str{$ptr} = '_';
--$ptr;
}
$str{$ptr} = '$';
$heap[$subPtr] = $string;
break;
case 'S':
$string = array_pop($sStack);
while ($str{$ptr - 1} == 'S') {
$string = array_pop($sStack)."'".$string;
$str{$ptr} = '_';
--$ptr;
}
$str{$ptr} = '$';
$heap[$ptr] = $string;
break;
case 'T':
$heap[$ptr] = TRUE;
$str{$ptr} = '$';
break;
case 'F':
$heap[$ptr] = FALSE;
$str{$ptr} = '$';
break;
case 'N':
$heap[$ptr] = NULL;
$str{$ptr} = '$';
break;
case 'X':
$number = array_pop($xStack);
$str{$ptr} = '$';
if (is_numeric($number)) {
$heap[$ptr] = $number + 0;
} else {
user_error('Invalid character sequence in array 
['.($ptr - 1).']', E_USER_WARNING);
return;
}
break;
} //braces, commas and equal signs are ignored
--$ptr;
}

while (($aStart = strrpos($str, '(')) !== FALSE) {
$aEnd = strpos($str, ')', $aStart);
if ($aEnd === FALSE) {
user_error("Array beginning at [$aStart] is not closed", 
E_USER_WARNING);
return;
}

$ptr = $aStart + 1;
if ($str{$ptr} == ',' || $str{$ptr} == '=') {
user_error("Invalid array entry [$ptr]", E_USER_WARNING);
return;
}
$str{$aEnd} = ','; //comma serves as a trigger, so array should 
end with one

$aStack = array();
while ($ptr < $aEnd) {
switch ($str{$ptr}) {
case '=':
$str{$ptr} = '_';
$keyPtr = $ptr - 1;
while ($str{$keyPtr} != '$') {
if ($str{$keyPtr} != '_') {
user_error("Invalid character sequence in array 
[$keyPtr]", E_USER_WARNING);
return;
}
$str{$keyPtr} = '_';
--$keyPtr;
}
$str{$keyPtr} = '_';
$valPtr = $ptr + 1;
if ($str{$valPtr} != '$') {
user_error("Invalid character sequence in array 
[$keyPtr]", E_USER_WARNING);
return;
}
$str{$valPtr} = '_';
$aStack[$heap[$keyPtr]]= $heap[$val

[PHP] MySQL empty row

2005-04-04 Thread Neo Theone
Until some time I could make a new empty line in mysql with this query:
INSERT INTO `".$_SESSION['type']."`() VALUES ()
where $_SESSION['type'] was the table I wanted to use but now I get an 
error and since I use DB I just get this error

INSERT INTO `authors`() VALUES ()
*Warning*: Cannot modify header information - headers already sent by 
(output started at 
/usr/local/ftp/faps/public_html/pubDB/edit/newline.php:9) in 
*/usr/local/ftp/faps/public_html/pubDB/edit/newline.php* on line *19

*This is the file

   include "../modules/connect.php";
  
   array_pop($_REQUEST);
   $query = "INSERT INTO `".$_SESSION['type']."`() VALUES ()";
  
   $res =& $db->query($query);
   //Always check that result is not an error
   if (DB::isError($res)) {
   die($res->getMessage());
   }

   include "../modules/disconnect.php";
  
   header ("Location: ./edit.php?".$_SESSION['stayurl']);

?>
Howcome does line nine: $res =& $db->query($query); write anything??
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: MySQL empty row

2005-04-04 Thread GamblerZG
Please replace die($res->getMessage()) with 
user_error($res->getMessage(), E_USER_ERROR) and then post the output.

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


Re: [PHP] How to call a static class and method dynamically

2005-04-04 Thread GamblerZG
class MyClass {
   function static_method() {
  echo 'I'm in static_method !';
   }
}
You can call the function statically using the double colon ( :: ) 
operator :
Ahem. Double colon does now works with dynamic names. If I'm not 
mistaken, call_user_func(array('class', 'function')) is the only way.

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


Re: [PHP] Re: MySQL empty row

2005-04-04 Thread Neo Theone
GamblerZG wrote:
Please replace die($res->getMessage()) with 
user_error($res->getMessage(), E_USER_ERROR) and then post the output.

If I uncomment this it seems to work. Not error or anything in the code.
Truely don't know what the error is.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to call a static class and method dynamically

2005-04-04 Thread GamblerZG
I ment: Double colon does no_t_ works with dynamic names.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] pass variable from vbscript to php

2005-04-04 Thread Mikey
> > From what I have read this is impossible to accomplish from 
> the server 
> > without prompting for a username/password.  I found an 
> activeX control 
> > (called NWSess from Novell) that will provide the currently 
> logged in user.
> >

You have not mentioned what network you are running. IF it is a Windows
network, AND you run PHP on IIS, the server variable NT_AUTH_USER is defined
for you.  However, I suspect from the fact that you are looking at COM
objects from Novell that you are running a Novell network.

> Apparently it's not impossible to do this without 
> prompting for the username / password then eh?
> 
> ActiveX controls are in the COM family.  If you don't know 
> about COM then you can start by looking here:
> http://www.microsoft.com/com/default.mspx
> 
> Now... when you find the list of commands / variables that 
> you will need from the ActiveX container then you can make 
> those calls with PHP.  The relevant part of the PHP manual is:
> http://php.net/manual/en/ref.com.php
> 
> P.S. this sounds pretty interesting.  I (and probably others) 
> would appreciate it if you would post back to the list with a 
> [SOLVED] response that shows PHP code you used to get this working.

However, I believe this response was a little hasty as I do not believe that
the question involves running an ActiveX Control on a server, but on a
client.  In this case, the variables that are passed into your VBScript need
to be then added to an HTML form (via hidden input tags) and the form needs
to be submitted.

Thing is though, this means transmitting user network login details via POST
and this means that it would be possible for anyone on your network to watch
this traffic and get logins for anybody that uses your system.

Maybe a better solution in this case would be to associate a user account
with a network login when the account is created and store this information
in your user database.

HTH,

Mikey

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



[PHP] Re: MySQL empty row

2005-04-04 Thread Satyam
You might have changed inadvertently one of the include files.  It might 
have trailing blanks after the final ?>, which obviously you don't see, 
being blank, but they are echoed to the browser, and the header('location 
... then gives an error.  Might have nothing to do with the SQl instructions

Satyam

"Neo Theone" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Until some time I could make a new empty line in mysql with this query:
> INSERT INTO `".$_SESSION['type']."`() VALUES ()
> where $_SESSION['type'] was the table I wanted to use but now I get an 
> error and since I use DB I just get this error
>
> INSERT INTO `authors`() VALUES ()
> *Warning*: Cannot modify header information - headers already sent by 
> (output started at 
> /usr/local/ftp/faps/public_html/pubDB/edit/newline.php:9) in 
> */usr/local/ftp/faps/public_html/pubDB/edit/newline.php* on line *19
>
> *This is the file
> include "./checkuser.php";
>
>include "../modules/connect.php";
>   array_pop($_REQUEST);
>$query = "INSERT INTO `".$_SESSION['type']."`() VALUES ()";
>   $res =& $db->query($query);
>//Always check that result is not an error
>if (DB::isError($res)) {
>die($res->getMessage());
>}
>
>include "../modules/disconnect.php";
>   header ("Location: ./edit.php?".$_SESSION['stayurl']);
>
> ?>
> Howcome does line nine: $res =& $db->query($query); write anything?? 

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



Re: [PHP] Exchanging Data among processes

2005-04-04 Thread Satyam
Perhaps a memory based database?

http://dev.mysql.com/doc/mysql/en/memory-storage-engine.html

Might not be supported by all ISPs, though.


"Matheus Degiovani" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello Chris,
>
>> Matheus,
>>  As a start I would check out using sockets:
>>  http://uk.php.net/sockets
>
> Did some experiments, and it seems this would work great. Thanks a lot! :)
>
> The only problem is that not all (if not almost all) hosting services 
> disable sockets...
>
> Thanks. 

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



Re: [PHP] Re: MySQL empty row

2005-04-04 Thread Neo Theone
GamblerZG wrote:
Please replace die($res->getMessage()) with 
user_error($res->getMessage(), E_USER_ERROR) and then post the output.

on one table it still does not work:
this is the error:
DB Error: constraint violation
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP 5.0.4 not generating /usr/local/bin/pear ?

2005-04-04 Thread mbneto
Hi,

I've downloaded the 5.0.4 targz and installed on a new server using
the same ./configure settings I use in a nother server that runs php
5.0.3.

I did a make/make install and everything runs fine excepth the fact
that I can no longer pear install  because there is no pear in
/usr/local/bin.

'./configure' '--with-kerberos' '--with-gd' '--with-apxs2'
'--with-xml' '--with-ftp' '--enable-session' '--enable-trans-sid'
'--with-zlib' '--enable-inline-optimization'
'--with-mcrypt=/usr/local' '--enable-sigchild' '--with-gettext'
'--with-freetype' '--with-ttf' '--with-ftp' '--enable-ftp'
'--with-jpeg-dir=/usr' '--with-mysql=/usr/include/mysql'
'--enable-soap' '--with-pear'

Any ideas?

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



Re: [PHP] PHP 5.0.4 not generating /usr/local/bin/pear ?

2005-04-04 Thread Chris
That could be caused by http://bugs.php.net/bug.php?id=32525 .
Though I don't know much about PEAR.
mbneto wrote:
Hi,
I've downloaded the 5.0.4 targz and installed on a new server using
the same ./configure settings I use in a nother server that runs php
5.0.3.
I did a make/make install and everything runs fine excepth the fact
that I can no longer pear install  because there is no pear in
/usr/local/bin.
'./configure' '--with-kerberos' '--with-gd' '--with-apxs2'
'--with-xml' '--with-ftp' '--enable-session' '--enable-trans-sid'
'--with-zlib' '--enable-inline-optimization'
'--with-mcrypt=/usr/local' '--enable-sigchild' '--with-gettext'
'--with-freetype' '--with-ttf' '--with-ftp' '--enable-ftp'
'--with-jpeg-dir=/usr' '--with-mysql=/usr/include/mysql'
'--enable-soap' '--with-pear'
Any ideas?
 

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


Re: [PHP] MySQL empty row

2005-04-04 Thread Andy Pieters
Hi Neo

Just some observations and hints.

I see you use the contents of a user variable ($_POST,$_GET,$_REQUEST,
$_SESSION) without check.  Possibly you checked them on another page but you 
shouldn't rely on that. You should take NOTHING for granted.  You should 
escape the input by using a function like mysql_escape_string

Google for mysql injection will give you ample information on the why of this 
precaution.

2ndly you include a line die($res->getMessage()) which would expose security 
sensitive information about your server, and database.  You do not want this!  
Instead you can redirect to a page that explains to the user that an error 
ocured.  For yourself, you can write the error to a file on the server that 
you can peruse to debug.

Just scream if you want an example of this.

How about trying this:

unset($res);
$res=@&$db->query($query);
if($res)
 if(DB::isError($res))
...rest of your code

The HTTP specification is also that a Location header should provide the 
absolute address, not the relative.  

You might also consider rewriting your logic a bit:

Instead of depending on a connect and a disconnect file, make one include file 
like this:

function connect()
{#details of your connect
 if(connection_ok)
register_shutdown_function(disconnect);
 }
function disconnect()
{#your stuff here
}

Including (or require ing) the file at the start of the page will provide you 
with all functionality and will automatically close the database connection 
when the script finishes. (Don't use this with persistent connections though)

Also when you use functions that rewrite the header, you can either use 
ob_start, ob_end and stuff to buffer the output, or make sure you send 
nothing to the browser until after the headers are sent.
One common pitfall is having characters before the 

After the ?> must be NO character, not even a CR or LF
Best way to check this is to put your cursor right next to the > and press the 
left key.  If you r cursor moves then press left followed by del.  Keep 
pressing the del key until all the charcters after the > are gone.

With kind regards


Andy Pieters
Straight-A-Software

On Monday 04 April 2005 16:57, Neo Theone wrote:
> Until some time I could make a new empty line in mysql with this query:
> INSERT INTO `".$_SESSION['type']."`() VALUES ()
> where $_SESSION['type'] was the table I wanted to use but now I get an
> error and since I use DB I just get this error
>
> INSERT INTO `authors`() VALUES ()
> *Warning*: Cannot modify header information - headers already sent by
> (output started at
> /usr/local/ftp/faps/public_html/pubDB/edit/newline.php:9) in
> */usr/local/ftp/faps/public_html/pubDB/edit/newline.php* on line *19
>
> *This is the file
>  include "./checkuser.php";
>
> include "../modules/connect.php";
>
> array_pop($_REQUEST);
> $query = "INSERT INTO `".$_SESSION['type']."`() VALUES ()";
>
> $res =& $db->query($query);
> //Always check that result is not an error
> if (DB::isError($res)) {
> die($res->getMessage());
> }
>
> include "../modules/disconnect.php";
>
> header ("Location: ./edit.php?".$_SESSION['stayurl']);
>
> ?>
> Howcome does line nine: $res =& $db->query($query); write anything??

-- 
Registered Linux User Number 379093
--
Feel free to check out these few
php utilities that I released under the GPL2 and 
that are meant for use with a php cli binary:
http://www.vlaamse-kern.com/sas/
--

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



Re: [PHP] MySQL empty row

2005-04-04 Thread Andy Pieters
On Monday 04 April 2005 18:45, Andy Pieters wrote:
> After the ?> must be NO character, not even a CR or LF
> Best way to check this is to put your cursor right next to the > and press
> the left key.  If you r cursor moves then press left followed by del.  Keep
> pressing the del key until all the charcters after the > are gone.

Should be "and press the right key" off course.

-- 
Registered Linux User Number 379093
--
Feel free to check out these few
php utilities that I released under the GPL2 and 
that are meant for use with a php cli binary:
http://www.vlaamse-kern.com/sas/
--

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



[PHP] Almost OT - urlencode and IE

2005-04-04 Thread Chris
I'm writing a web app that passes values in the URL separated by a / . 
I'm passing these values by supplying links to them.

The writing and reading of these values is fine, I'm just stuck at the 
differing ways IE handles urlencoding the data..

IE will not work unless I double urlencode it 
`urlencode(urlencode($sData))` while Firefox and Opera (and, I imagine, 
every other non-microsoft browser out there) only needs to be encoded once.

I could gripe about IE or whatnot, but I just want to know if there have 
been 'solutions' to this problem in the past?

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


[PHP] Anyone working with UPS Online Tools?

2005-04-04 Thread Chris W. Parker
Hello,

I am in the process of integrating my site with UPS' Online Tools.
Specifically Address Validation, and Rates and Service.

The problem I'm seeing is that it's quite slow. I'm doing all my tests
on the test server and thought that querying the test server would be
the reason for the slowness, but when I tried the live server (once) it
seemed to be the same.

The test page takes about 4-6 seconds to complete.

Is this a normal time for such a process?


Thanks,
Chris.

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



Re: [PHP] Almost OT - urlencode and IE

2005-04-04 Thread Philip Hallstrom
You could base64_encode it... you'll run into url length issues at some 
point, but I believe that's around 4kbytes or so...

I've done this before... something like:
base64_encode(serialize($my_object));
then undo it on the other end.
On Mon, 4 Apr 2005, Chris wrote:
I'm writing a web app that passes values in the URL separated by a / . I'm 
passing these values by supplying links to them.

The writing and reading of these values is fine, I'm just stuck at the 
differing ways IE handles urlencoding the data..

IE will not work unless I double urlencode it `urlencode(urlencode($sData))` 
while Firefox and Opera (and, I imagine, every other non-microsoft browser 
out there) only needs to be encoded once.

I could gripe about IE or whatnot, but I just want to know if there have been 
'solutions' to this problem in the past?

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


[PHP] Piping email into a php script

2005-04-04 Thread Jeff McKeon
Running PHP 4.3.9, apache, mysql, qmail

I know it's possible to pipe an incoming mail message to a script in
qmial by creating a .qmail file for the user like:

|script

What I'd like to do is pipe incoming mail for a specific user into a php
script that parses it out (using mailparse I imagine) and puts the
pieces into a database table.  

On PHP.net I see an example like this on the function page for
Mailparse:

[SNIP]

[SNIP]

This looks like it will work so long as I put the required database
interface code in the "foreach" section.  However I'm a little stuck on
how to actually pipe the file into the script so that it winds up in the
$buffer variable.

Can anyone give me a clue as to how I can do this?

Thanks,

Jeff

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



[PHP] Re: A strange problem..

2005-04-04 Thread chris
what is the structure of your table?


"JoShQuNe" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi, i have a strange problem. In my site i have to counters for file
> downloads. One is general, other is weekly. On the main page i
> display a list sorted according to weekly hits. The problem is there:
> i give this prompt mysql_query("SELECT * FROM table ORDER BY
> weekly_hits DESC LIMIT 15") to display top 15 but if the hit is
> greater than 9 itz not displayed. What maybe the reason? Is it
> possible to be because of the place of the weekly_hits column in the
> table? When i try to sort by general hit, it does, but general hits
> are started with 600s so i couldn't get what happens.. Thanx for
> help..
>
>
>
> __
> Do you Yahoo!?
> Yahoo! Personals - Better first dates. More second dates.
> http://personals.yahoo.com 

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



[PHP] Adding Fonts to JpGraph

2005-04-04 Thread Stephen Johnson
I am using JPGraph for a project that I am working on right now and I have
hit a small snag -

My client wants to have the user be able to select from a list of about 20
­30 standard fonts.  JPGraph only has about six built into it and the
support in the docs is not very helpful since it wants you to register it to
get font support.  I am willing to do that, BUT, their website says they are
no longer accepting support clients.

So ‹ anyone out there have any advice our a tutorial that I can look at for
some assistance ?

Thanks 

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>



Re: [PHP] Exchanging Data among processes

2005-04-04 Thread Matheus Degiovani
Hello Satyam,
Perhaps a memory based database?
http://dev.mysql.com/doc/mysql/en/memory-storage-engine.html
Might not be supported by all ISPs, though.
Nice tip! Thanks! :)
Cya.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Piping email into a php script

2005-04-04 Thread Philip Hallstrom
$buffer = file_get_contents("php://stdin");
will read the contents of standard input into the string $buffer.
-philip
On Mon, 4 Apr 2005, Jeff McKeon wrote:
Running PHP 4.3.9, apache, mysql, qmail
I know it's possible to pipe an incoming mail message to a script in
qmial by creating a .qmail file for the user like:
|script
What I'd like to do is pipe incoming mail for a specific user into a php
script that parses it out (using mailparse I imagine) and puts the
pieces into a database table.
On PHP.net I see an example like this on the function page for
Mailparse:
[SNIP]

$buffer = [...] // Mail Content from pipe or whatever
$mail = mailparse_msg_create();
mailparse_msg_parse($mail,$buffer);
$struct = mailparse_msg_get_structure($mail);
foreach($struct as $st) {
  $section = mailparse_msg_get_part($mail, $st);
  $info = mailparse_msg_get_part_data($section);
  print_r($info);
}
?>
[SNIP]
This looks like it will work so long as I put the required database
interface code in the "foreach" section.  However I'm a little stuck on
how to actually pipe the file into the script so that it winds up in the
$buffer variable.
Can anyone give me a clue as to how I can do this?


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


[PHP] Re: What's the going rate for making websites ?

2005-04-04 Thread chris
Get it in writing...
--
Find out what they want and have them sign the design targets.

Price depends on the complexity
---
I break a job done by functional areas and how much time I expect to spend 
developing each section (i.e. - message board, general page layout and 
graphics, e-commerce store, etc.). Be realistic with your time estimates. If 
you will be using a new language then be generous with your time, but as you 
gain experience reduce that time too.

and the per Hour
-
Look at your cost of living. A person in New York City can not afford to 
charge the same rate as a person in Toledo, Ohio
I charge more for onsite (to cover gas, parking, lunch and other issues) 
than I do for offsite (working from home, I'll give then a price break).
Leave extra time for revisions to the site, I'll add between 25% - 50% to my 
time for each area depending on how the contract negotions go, if the client 
is a pain in the arse with the contract, then expect issues and difficulty 
while you work the project (a.k.a. - scope/deadline creep).

Web developers can be had for a very cheap price if one wants to search for 
them.You are the local expert and this is why you were hired (or possibly 
your reputation is very good). If a client is real persistent about adding a 
new "feature" then I will say something to the effect of, OK - Mr. 
InsertClientNameHere, I can make those changes but I will have to increase 
the development time to X and that will add Z to the cost of the project. 
Don't be afraid to slap a good price on that Z, specially if you are far 
into the project. The client will do one of two things. He will either 
backdown and stick to the original design, or he will say OK(more money for 
you)! If he says OK then make an addendum to the contract and have him sign 
it. So the new time and price is agreed upon.

is it a one time deal or continued business...

I charge more for just building a website, but if I am going to maintain the 
site I then adjust for any hosting cost, then charge a 10-20% fee (of the 
total project build) for monthly maintenance/year (this will cover my time). 
I then will give a price break, usually of 10-20% off the total project 
price for maintenance as an added motivation to get it.

make sure you deliver
--
You reputation is of the utmost importance, do everything you can to meet 
your deadline.. If you can not complete part of a contract yourself then, 
outsource it. The client does not need to know and in most cases they don't 
care.

CJ

"-{ Rene Brehmer }-" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi gang
>
> Sorry for asking this question here, but I don't know where else to ask. 
> And Goole'ing didn't help me much.
>
> My father-in-law has a friend in Alaska (and I'm in Canada) that needs a 
> website done. Not sure what kinda site he wants done yet, or how much he 
> needs me to do for him (like webspace, domain hosting, domain 
> registration, and such) but for now I've been asked what it'd cost to get 
> it done.
>
> I'm assuming it's something pretty simple, since it's just for a 
> motorcycle club, but he wants a price first ...
>
> What do y'all charge when you do sites for people ??? ... In the past I've 
> only done pro-bono work (because they usually don't require much work, so 
> it's not a problem getting it done while working on other projects), but 
> I've never actually done paid work before... It's more that I just 
> recently moved to Canada (from Denmark) so I have no feeling with what the 
> prices and rates are overhere ...
>
>
> TIA
>
> Rene 

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



[PHP] Creating INSERT INTO statement from dbf file

2005-04-04 Thread Rahul S. Johari

Ave,

I¹ve written a code that is able to extract the Column names and Records
from a simple dbf (foxpro) file and create an INSERT INTO sql statement
which can be used to insert all those records with their corresponding field
names in an existing mySQL table. (A CREATE TABLE code I wrote is able to
create the table from the dbf file information).

Following is the code I wrote for creating the INSERT INTO sql:

";
   
}
}
dbase_close($dbh);
?> 

It works fine, except for one problem. It¹s able to create the INSERT INTO
sql statement, with all the fields and corresponding values, but as I¹m
running a loop for both the fields names, and the values corresponding to
fields names, it leaves a comma after the records are over.

So instead of having this : INSERT INTO tblname (c1,c2,c3) VALUES
(Œv1¹,¹v2¹,¹v3¹);
I achieve this : INSERT INTO tblname (c1,c2,c3,) VALUES (Œv1¹,¹v2¹,¹v3¹,¹);

Notice an additional Comma after column names, and an additional ,¹ after
the values. I¹m not quite sure what to do to get rid of those. I¹ve tried
some different combinations using different kind of logic with the echo
statements, but it¹s not working out. Would love some help.

Thanks,

Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180

Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: [EMAIL PROTECTED]
http://www.informed-sources.com



[PHP] [Q] mail() & security

2005-04-04 Thread Eric Gorr
I wanted to setup a good 'contact me' page on my website. I do not want 
to reveal my e-mail address, so I was going to use a form.

The PHP script with the actual mail() function would define the To and 
Subject parameters, so these could not be faked.

I also plan to use a captcha.
The only concern I had was how to process the body text. Any 
recommendations?

One useful function would appear to be strip_tags, so no one could embed 
annoying or destructive HTML, etc. which I may accidentally cause my 
e-mail application to render.

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


Re: [PHP] Re: A strange problem..

2005-04-04 Thread Joe Harman
Hey Josh... make sure your mysql table column is a integer... not a
varchar.. i've done that by mistake a few times!

On Apr 4, 2005 3:22 PM, chris <[EMAIL PROTECTED]> wrote:
> what is the structure of your table?
> 
> "JoShQuNe" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi, i have a strange problem. In my site i have to counters for file
> > downloads. One is general, other is weekly. On the main page i
> > display a list sorted according to weekly hits. The problem is there:
> > i give this prompt mysql_query("SELECT * FROM table ORDER BY
> > weekly_hits DESC LIMIT 15") to display top 15 but if the hit is
> > greater than 9 itz not displayed. What maybe the reason? Is it
> > possible to be because of the place of the weekly_hits column in the
> > table? When i try to sort by general hit, it does, but general hits
> > are started with 600s so i couldn't get what happens.. Thanx for
> > help..
> >
> >
> >
> > __
> > Do you Yahoo!?
> > Yahoo! Personals - Better first dates. More second dates.
> > http://personals.yahoo.com
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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



RE: [PHP] [Q] mail() & security

2005-04-04 Thread Chris W. Parker
Eric Gorr 
on Monday, April 04, 2005 2:01 PM said:

> The only concern I had was how to process the body text. Any
> recommendations?
> 
> One useful function would appear to be strip_tags, so no one could
> embed annoying or destructive HTML, etc. which I may accidentally
> cause my e-mail application to render.
> 
> Any other suggestions?

Maybe:

www.php.net/addslashes
www.php.net/htmlentities

Whatever you do don't strip out line breaks. I find it really annoying
when I neatly format (read "use paragraphs") a message in a contact form
just to find out that all those pretty line breaks are removed, turning
my nice message into a difficult to read blob.



Chris.

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



[PHP] strtotime() bug?

2005-04-04 Thread Al
Suddenly my strtotime() are goofy, anyone have any ideas?
echo date('Y/m/d/H', time()). "";   //2005/04/04/18
echo date('Y/m/d/H', strtotime("-1 day")). "";
//2005/04/03/18
echo date('Y/m/d/H', strtotime("last Sunday")). "";   
//2005/04/02/23
Sunday shows as Saturday.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [Q] mail() & security

2005-04-04 Thread Eric Gorr
Chris W. Parker wrote:
www.php.net/addslashes
I am uncertain what dangerous/annoying things might happen if I did not 
call this function. Can you come up with any?

Remember, the text being processed goes straight from $_POST[ 'body' ] 
through strip_tags (+ more?) into mail().

It would seem that addslashes would just make the body text look messy 
for no reason.

www.php.net/htmlentities
It seems as if strip_tags strip out everything that htmlentities would 
change and would therefore be unnecessary.

--
== Eric Gorr === http://www.ericgorr.net ===
"The more you study, the more you know. The more you know, the more you
forget. The more you forget, the less you know. So, why study?" - ???
== Insults, like violence, are the last refuge of the incompetent... ===
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [Q] mail() & security

2005-04-04 Thread Josip Dzolonga
Eric Gorr wrote:
Any other suggestions?
Well see this example :
function clean_body($body_text) {
   if(ini_get('magic_quotes_gpc')) $body_text = 
stripslashes($body_text); // If magic_quotes are on, strip the 
extra-added slashes
   return htmlentities($body_text); // Return the value
}

This is a good way to start, I think. Filtering the input first would be 
a nice idea too, especeally if there're more input fields ;-)

--
Josip Dzolonga
http://josip.dotgeek.org
jdzolonga[at]gmail.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] [Q] mail() & security

2005-04-04 Thread Chris W. Parker
Eric Gorr 
on Monday, April 04, 2005 3:13 PM said:

> Remember, the text being processed goes straight from $_POST[ 'body' ]
> through strip_tags (+ more?) into mail().

Remember? You didn't mention this is your original email so how could I
be told to recall this information? In your specific case addslashes()
is probably not necessary.

> It seems as if strip_tags strip out everything that htmlentities would
> change and would therefore be unnecessary.

strip_tags() and htmlentities() both perform seperate functions (hence
they have different names). htmlentities() encodes special characters,
strip_tags() strips HTML from a string. One example is the following:

Original: &

With strip_tags applied: &

With htmlentities applied: &

It may or may not be necessary for you.


Chris.

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



[PHP] Help. Floats turning into really small numbers? x.xxxxxxxxxxxxxxxxxxxxxxE-xx

2005-04-04 Thread Anthony Tippett
I'm having trouble figuring out why subtraction of two floats are giving
me a very small number.  I'm thinking it has something to do with the
internals of type casting, but i'm not sure.  If anyone has seen this or
can give me some suggestions, please.

I have 2 variables that go through a while loop and are
added/subtracted/ multipled. InvAmt and InvPay are shown as
floats but when they are subtracted, they give me a really small
number

// code
var_dump($InvAmt);
var_dump($InvPay);
var_dump($InvAmt-$InvPay);

// output
float(18.49)
float(18.49)
float(2.1316282072803E-14)

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



Re: [PHP] [Q] mail() & security

2005-04-04 Thread Eric Gorr
Chris W. Parker wrote:
It seems as if strip_tags strip out everything that htmlentities would
change and would therefore be unnecessary.

strip_tags() and htmlentities() both perform seperate functions (hence
they have different names). htmlentities() encodes special characters,
strip_tags() strips HTML from a string. One example is the following:
Original: &
With strip_tags applied: &
With htmlentities applied: &
It may or may not be necessary for you.
What dangerous/annoying things might happen if I did not pass the text 
intended for the body parameter of the mail function through 
htmlentities? (But, did pass it through strip_tags)

I cannot come up with anything.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [Q] mail() & security

2005-04-04 Thread Eric Gorr
Josip Dzolonga wrote:
Eric Gorr wrote:
Any other suggestions?

Well see this example :
function clean_body($body_text) {
   if(ini_get('magic_quotes_gpc')) $body_text = 
stripslashes($body_text); // If magic_quotes are on, strip the 
extra-added slashes
   return htmlentities($body_text); // Return the value
}

This is a good way to start, I think. Filtering the input first would be 
a nice idea too, especeally if there're more input fields ;-)
htmlentities would potentially make the body text messier then seems 
necessary.

Shouldn't strip_tags be enough? What dangerous/annoying things might 
happen if I replaced htmlentities with strip_tags in the above function 
and then passed the body text to the mail() function?

I do not mind over doing it and potentially getting rid useful text in 
the body (strip_tags could do this). People, in general, will not be 
using this form to contact me often enough for it to matter.

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


[PHP] PHP Tool to answer emails

2005-04-04 Thread Daniel Baughman
Hi all,

 

I am looking for a php tool that will provide email tracking and a web
interface to an email box.  Pretty much, we get lots of emails directed to
an administrative email account (most of the valid emails) that need
response. To the point that one person is getting over whelmed.

 

It would be nice if someone had a tool already made that would check the
box, download the email, mark the receipt time, then present them to be
answered on a web site for employees, document the answer, etc. etc.. 

 

Anyone know of anything?

 

 

Dan Baughman

IT Technician

Professional Bull Riders, Inc.

719-471-3008 x 3161

 



Re: [PHP] [Q] mail() & security

2005-04-04 Thread Josip Dzolonga
Eric Gorr wrote:
Shouldn't strip_tags be enough? What dangerous/annoying things might 
happen if I replaced htmlentities with strip_tags in the above 
function and then passed the body text to the mail() function?
Nothing, but with htmlentities() you can be sure if the user has tried 
to inject something malicious :-).

--
Josip Dzolonga
http://josip.dotgeek.org
jdzolonga[at]gmail.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] [Q] mail() & security

2005-04-04 Thread Chris W. Parker
Eric Gorr 
on Monday, April 04, 2005 3:48 PM said:

> htmlentities would potentially make the body text messier then seems
> necessary.

Then just use strip_tags() and be done with it.

It's not like nuclear missiles are going to be launched via your email
form if you use the wrong function. Or in a less extreme case, your
computer get hijacked and used to send spam because you used
htmlentities() instead of strip_tags().

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



Re: [PHP] [Q] mail() & security

2005-04-04 Thread Eric Gorr
Chris W. Parker wrote:
> Or in a less extreme case, your
computer get hijacked and used to send spam because you used
htmlentities() instead of strip_tags().
Well, this is why I asked the question to begin with. I am concerned (as 
everyone _should_ be) about such things and desire to do my best to 
prevent them.

Now, as near as I can tell, strip_tags is the only thing one really 
needs to do to be safe.

But, one can use htmlentities to potentially preserve useful text, if it 
is important to do so and still remain safe - with the downside being 
having a messier body then may be necessary.

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


Re: [PHP] [Q] mail() & security

2005-04-04 Thread Anthony Tippett
Eric,

It sounds like you just need to do some reading on "best practices" of
security when writing php code.  It's pretty vast what one can do when
trying to hack a php application and depending on what php server
settings are set, you may need to do certain things.  I'd suggesting
reading / google php security and viewing pages like the following to
answer your question.  It may only answer your question in the long run,
but there are many more things to know about besides htmlentities to
make sure your application is secure.  I actually need to do some
reading about them.  Once in a while

http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/


Also events like the following are good to go to expecially if you can
get your company to pay for them.
http://www.osevents.com/page5.html?

Eric Gorr wrote:
> Chris W. Parker wrote:
>> Or in a less extreme case, your
> 
>> computer get hijacked and used to send spam because you used
>> htmlentities() instead of strip_tags().
> 
> 
> Well, this is why I asked the question to begin with. I am concerned (as
> everyone _should_ be) about such things and desire to do my best to
> prevent them.
> 
> Now, as near as I can tell, strip_tags is the only thing one really
> needs to do to be safe.
> 
> But, one can use htmlentities to potentially preserve useful text, if it
> is important to do so and still remain safe - with the downside being
> having a messier body then may be necessary.
> 

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



Re: [PHP] Help. Floats turning into really small numbers? x.xxxxxxxxxxxxxxxxxxxxxxE-xx - Narrowed it down!

2005-04-04 Thread Anthony Tippett
Ok i've narrowed it down a little bit but still can't figure it out..

Here's the code and what I get for the output.  Does anyone know what's
going on?  Can someone else run it on their computer and see if they get
the same results?
"; // 18.49

var_dump($a);  // float(18.49)
var_dump($a-18.49); // float(3.5527136788005E-15)
?>


Anthony Tippett wrote:
> I'm having trouble figuring out why subtraction of two floats are giving
> me a very small number.  I'm thinking it has something to do with the
> internals of type casting, but i'm not sure.  If anyone has seen this or
> can give me some suggestions, please.
> 
> I have 2 variables that go through a while loop and are
> added/subtracted/ multipled. InvAmt and InvPay are shown as
> floats but when they are subtracted, they give me a really small
> number
> 
> // code
> var_dump($InvAmt);
> var_dump($InvPay);
> var_dump($InvAmt-$InvPay);
> 
> // output
> float(18.49)
> float(18.49)
> float(2.1316282072803E-14)
> 

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



Re: [PHP] Help. Floats turning into really small numbers? x.xxxxxxxxxxxxxxxxxxxxxxE-xx - Narrowed it down!

2005-04-04 Thread Richard Lynch
Floats are NEVER going to be coming out "even" reliably.

You'll have to check if the difference is less than X for whatever number
X you like.

Or you can look at something like BC_MATH where precision can be carried
out as far as you like...

But what you are seeing is to be expected.

That's just the way computers work, basically.

On Mon, April 4, 2005 5:07 pm, Anthony Tippett said:
> Ok i've narrowed it down a little bit but still can't figure it out..
>
> Here's the code and what I get for the output.  Does anyone know what's
> going on?  Can someone else run it on their computer and see if they get
> the same results?
> 
> $a = "17.00" * "1";
> $a+= "1.10" * "1";
> $a+= "0.32" * "1";
> $a+= "0.07" * "1";
>
> print $a.""; // 18.49
>
> var_dump($a);  // float(18.49)
> var_dump($a-18.49); // float(3.5527136788005E-15)
> ?>
>
>
> Anthony Tippett wrote:
>> I'm having trouble figuring out why subtraction of two floats are giving
>> me a very small number.  I'm thinking it has something to do with the
>> internals of type casting, but i'm not sure.  If anyone has seen this or
>> can give me some suggestions, please.
>>
>> I have 2 variables that go through a while loop and are
>> added/subtracted/ multipled. InvAmt and InvPay are shown as
>> floats but when they are subtracted, they give me a really small
>> number
>>
>> // code
>> var_dump($InvAmt);
>> var_dump($InvPay);
>> var_dump($InvAmt-$InvPay);
>>
>> // output
>> float(18.49)
>> float(18.49)
>> float(2.1316282072803E-14)
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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

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



Re: [PHP] PHP Tool to answer emails

2005-04-04 Thread Anthony Tippett
I think what you are looking for is a combination of programs.  A
mailing list that customers can view answers of emails try mailman or
smartlist.  Perhaps just a mailint list would give you want you want.

If you are looking for more of a trouble ticket program, or FAQ program
there are serveral at freshmeat.net but haven't used many of them.


Daniel Baughman wrote:
> Hi all,
> 
>  
> 
> I am looking for a php tool that will provide email tracking and a web
> interface to an email box.  Pretty much, we get lots of emails directed to
> an administrative email account (most of the valid emails) that need
> response. To the point that one person is getting over whelmed.
> 
>  
> 
> It would be nice if someone had a tool already made that would check the
> box, download the email, mark the receipt time, then present them to be
> answered on a web site for employees, document the answer, etc. etc.. 
> 
>  
> 
> Anyone know of anything?
> 
>  
> 
>  
> 
> Dan Baughman
> 
> IT Technician
> 
> Professional Bull Riders, Inc.
> 
> 719-471-3008 x 3161
> 
>  
> 
> 

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



Re: [PHP] Help. Floats turning into really small numbers? x.xxxxxxxxxxxxxxxxxxxxxxE-xx - Narrowed it down!

2005-04-04 Thread Anthony Tippett
btw, thanks for your response.

I'm not sure as if I understand why.  It's not like I'm using a very
precise number when dealing with the hundreths place.

Even without the multiplication the number gets messed up.

eg.

$a = 17.00;
$a+= 1.10;
$a+= 0.32;
$a+= 0.07;


print $a.""; // 18.49

var_dump($a);  // float(18.49)
var_dump($a-18.49); // float(3.5527136788005E-15)

I'm just trying to add money amounts?  Can I not rely on floats to do this?



Richard Lynch wrote:
> Floats are NEVER going to be coming out "even" reliably.
> 
> You'll have to check if the difference is less than X for whatever number
> X you like.
> 
> Or you can look at something like BC_MATH where precision can be carried
> out as far as you like...
> 
> But what you are seeing is to be expected.
> 
> That's just the way computers work, basically.
> 
> On Mon, April 4, 2005 5:07 pm, Anthony Tippett said:
> 
>>Ok i've narrowed it down a little bit but still can't figure it out..
>>
>>Here's the code and what I get for the output.  Does anyone know what's
>>going on?  Can someone else run it on their computer and see if they get
>>the same results?
>>>
>>$a = "17.00" * "1";
>>$a+= "1.10" * "1";
>>$a+= "0.32" * "1";
>>$a+= "0.07" * "1";
>>
>>print $a.""; // 18.49
>>
>>var_dump($a);  // float(18.49)
>>var_dump($a-18.49); // float(3.5527136788005E-15)
>>?>
>>
>>
>>Anthony Tippett wrote:
>>
>>>I'm having trouble figuring out why subtraction of two floats are giving
>>>me a very small number.  I'm thinking it has something to do with the
>>>internals of type casting, but i'm not sure.  If anyone has seen this or
>>>can give me some suggestions, please.
>>>
>>>I have 2 variables that go through a while loop and are
>>>added/subtracted/ multipled. InvAmt and InvPay are shown as
>>>floats but when they are subtracted, they give me a really small
>>>number
>>>
>>>// code
>>>var_dump($InvAmt);
>>>var_dump($InvPay);
>>>var_dump($InvAmt-$InvPay);
>>>
>>>// output
>>>float(18.49)
>>>float(18.49)
>>>float(2.1316282072803E-14)
>>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 
> 
> 

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



[PHP] Why do I have to declare __set if I declare __get for read-only properties?

2005-04-04 Thread C Drozdowski
Howdy,
I'd like to access some of the private members of my classes as 
read-only properties without resorting to function calls to access 
them. (e.g. $testClass->privateMember instead of 
$testClass->privateMember(), etc)

Based on my research and testing, using the __get and __set overloading 
methods appears to be the only way to do so. It also, based on testing, 
appears that these private members must be in an array.

What I do not understand is that if I declare a __get method I MUST 
also declare a "do nothing" __set method to prevent the read-only 
properties from being modified in code that uses the class.

For example, the code below allows me to have read-only properties. 
However, if I remove the "do nothing" __set method completely, then the 
properties are no longer read-only.

I'm curious as to why I HAVE to implement the __set method?
Example:

class testClass
{
   private $varArray = array('one'=>'ONE', 'two'=>'TWO');
   public function __get($name)
   {
   if (array_key_exists($name, $this->varArray)) {
   return $this->varArray[$name];
   }
   }
   public function __set($name, $value)
   {
   }
}
$test = new testClass();
$test->one = 'TWO';   // doesn't work
echo $test->one;  // echo s 'ONE'
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [Q] mail() & security

2005-04-04 Thread Eric Gorr
Anthony Tippett wrote:
http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/
thank you for the suggestion.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Set session variable if link is clicked, do not want to use GET

2005-04-04 Thread Kent
Hi!
I am writing a simple shopping cart system which uses sessions and PHP.
I would like a normal link that says "Add to cart" which the user can 
click and the item is added to the cart.

However, i do not want to use GET for this as it could introduce 
unwanted features if the user bookmarks the page just after clicking 
"Add to cart". So i don't want an URL like: 
http://thisistheurl.com?buy=10 and therefore prefer if this could be 
done using POST.

It would have been easy if i would have used a normal FORM and would 
have had a button called "Add to cart". But i would like it to be in 
url-style or using some  which i understand that the BUTTON item 
does not support (or am i wrong?).

Any advice would be greatly appreciated.
Best regards, Kent
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [Q] mail() & security

2005-04-04 Thread Eric Gorr
Anthony Tippett wrote:
http://www.devshed.com/c/a/PHP/PHP-Security-Mistakes/
Actually, I am familiar with everything this document mentions.
Unfortunately, this document does not discuss what one might need to be 
concerned about when passing text to the body parameter of the mail() 
function.

If you have any comments with respect to this (which was my only concern 
in the original message), please let me know.

I haven't found any articles which addresses this particular issue, 
which is why I posted the question.

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


[PHP] Accented character 'echo'ed randomly

2005-04-04 Thread John Coppens
Hi people.

I submitted the issue below to the bug site, but the people there
suggested I present it here. I've tried some more, but until now, I
couldn't find any cause for the problem. 

Any suggestion would be appreciated!

John


Description:

I have a very simple web-page script with mainly 'echo' commands.
Randomly the accented characters are replaced
by question-marks. If or not the question mark appears
seems to be depending on the page contents, though at least
in one of the cases, the only thing that changes in the
page is a GIF image. 

All this happens in the same html-session, using the same
script.

I've seen other -similar- reports, though none about 'echo'.
I can't be sure if this is an apache problem or php-related.

Sorry if was already solved... Please indicate.

Reproduce code:
---
echo "Página Índice";

Expected result:

Página Índice

Actual result:
--
Randomly 
Página Índice
P?gina ?ndice

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



[PHP] test

2005-04-04 Thread shimuqiheb
Shi MuQi 
  LangFang ABC (China)  °v° 
  Tel:(86)-316-68382!^ /(_)\ 
  E-mail:[EMAIL PROTECTED] ^ ^ 



Re: [PHP] test

2005-04-04 Thread Stephen Johnson
你好- 測試被接受。歡迎到小組。


http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?>

> From: [EMAIL PROTECTED]
> Date: Tue, 5 Apr 2005 09:40:55 +0800
> To: php-general@lists.php.net
> Subject: [PHP] test
> 
>   Shi MuQi
> LangFang ABC (China)  °v°
> Tel:(86)-316-68382!^ /(_)\
> E-mail:[EMAIL PROTECTED] ^ ^
> 

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



[PHP] Re: strtotime() bug?

2005-04-04 Thread Al
Al wrote:
Suddenly my strtotime() are goofy, anyone have any ideas?
echo date('Y/m/d/H', time()). "";//2005/04/04/18
echo date('Y/m/d/H', strtotime("-1 day")). "";
//2005/04/03/18
echo date('Y/m/d/H', strtotime("last Sunday")). "";
//2005/04/02/23

Sunday shows as Saturday.

Additional info
Problem seems to be daylight saving time problem
echo date('Y/m/d/H:i:s', strtotime("last sunday"));   //2005/04/02/23:00:00
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Help. Floats turning into really small numbers? x.xxxxxxxxxxxxxxxxxxxxxxE-xx - Narrowed it down!

2005-04-04 Thread Anthony Tippett
Thanks to everyone that helped.  After further googling, bug 9288 had a
good explanation of what was going on ( which is not a bug)

http://bugs.php.net/bug.php?id=9288&edit=3

I'll just include the answer for anyone that comes upon this tread on a
search engine.


[15 Feb 2001 2:55pm CET] hholzgra at php rot dot fot net

short answer:
never use floats or doubles for financial data!

longer answer:
the internal number format in modern computers
is binary (base 2) and not decimal (base 10) for performance
and complexity reasons
while it is possible to convert decimal numbers into binaries
and back this does not hold true for fractions
something like 0.3 (decimal) would be a periodic binary
fraction like 10/3 is 0....
in decimal
this leads to loss of precision when calculation with
decimal fractions as you have when storing currency values

solution:
if you just summ up values then you should store values in
the smalest unit your currency has (pennies?) instead of
what you are used to (Pounds?) to totally avoid fractions

if you cannot avoid fractions (like when dealing with
percentage calculations or currency conversions) you
should just be aware of the (usually very small) internal
conversion differences
(0.27755575615629 in your example)
or use the bcmath extension, although for monetary
values you should go perfectly fine with using round(...,2)
on your final results




Anthony Tippett wrote:
> btw, thanks for your response.
> 
> I'm not sure as if I understand why.  It's not like I'm using a very
> precise number when dealing with the hundreths place.
> 
> Even without the multiplication the number gets messed up.
> 
> eg.
> 
> $a = 17.00;
> $a+= 1.10;
> $a+= 0.32;
> $a+= 0.07;
> 
> 
> print $a.""; // 18.49
> 
> var_dump($a);  // float(18.49)
> var_dump($a-18.49); // float(3.5527136788005E-15)
> 
> I'm just trying to add money amounts?  Can I not rely on floats to do this?
> 
> 
> 
> Richard Lynch wrote:
> 
>>Floats are NEVER going to be coming out "even" reliably.
>>
>>You'll have to check if the difference is less than X for whatever number
>>X you like.
>>
>>Or you can look at something like BC_MATH where precision can be carried
>>out as far as you like...
>>
>>But what you are seeing is to be expected.
>>
>>That's just the way computers work, basically.
>>
>>On Mon, April 4, 2005 5:07 pm, Anthony Tippett said:
>>
>>
>>>Ok i've narrowed it down a little bit but still can't figure it out..
>>>
>>>Here's the code and what I get for the output.  Does anyone know what's
>>>going on?  Can someone else run it on their computer and see if they get
>>>the same results?
>
>>>$a = "17.00" * "1";
>>>$a+= "1.10" * "1";
>>>$a+= "0.32" * "1";
>>>$a+= "0.07" * "1";
>>>
>>>print $a.""; // 18.49
>>>
>>>var_dump($a);  // float(18.49)
>>>var_dump($a-18.49); // float(3.5527136788005E-15)
>>>?>
>>>
>>>
>>>Anthony Tippett wrote:
>>>
>>>
I'm having trouble figuring out why subtraction of two floats are giving
me a very small number.  I'm thinking it has something to do with the
internals of type casting, but i'm not sure.  If anyone has seen this or
can give me some suggestions, please.

I have 2 variables that go through a while loop and are
added/subtracted/ multipled. InvAmt and InvPay are shown as
floats but when they are subtracted, they give me a really small
number

// code
var_dump($InvAmt);
var_dump($InvPay);
var_dump($InvAmt-$InvPay);

// output
float(18.49)
float(18.49)
float(2.1316282072803E-14)

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

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



[PHP] Re: PHP Tool to answer emails

2005-04-04 Thread Manuel Lemos
Hello,
on 04/04/2005 08:56 PM Daniel Baughman said the following:
I am looking for a php tool that will provide email tracking and a web
interface to an email box.  Pretty much, we get lots of emails directed to
an administrative email account (most of the valid emails) that need
response. To the point that one person is getting over whelmed.
 

It would be nice if someone had a tool already made that would check the
box, download the email, mark the receipt time, then present them to be
answered on a web site for employees, document the answer, etc. etc.. 

 

Anyone know of anything?
Probably the simplest way to get you started is to make those messages 
drop in a mailbox accessible by POP3 . Then you can use a POP3 client 
class like this to fetch the messages that you for your own processing:

http://www.phpclasses.org/pop3class
If you want to generate automatic responses, you may want to take a look 
at this other class too:

http://www.phpclasses.org/autoresponse
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Set session variable if link is clicked, do not want to use GET

2005-04-04 Thread Leif Gregory
Hello Kent,

Monday, April 4, 2005, 6:21:41 PM, you wrote:
K> It would have been easy if i would have used a normal FORM and
K> would have had a button called "Add to cart". But i would like it
K> to be in url-style or using some  which i understand that
K> the BUTTON item does not support (or am i wrong?).

Button images are fine:
http://www.mompswebdesign.com/html/button_tag.html (just picked that
one at random).

Another option is to set a unique SESSION variable each time they
visit, and that unique variable is only good during that session. You
pass that variable in the GET request and then match it on the
following page. If they don't match then you know they bookmarked it
or fudged the GET request.


Cheers,
Leif Gregory 

-- 
TB Lists Moderator (and fellow registered end-user)
PCWize Editor  /  ICQ 216395  /  PGP Key ID 0x7CD4926F
Web Site 

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



Re: [PHP] Set session variable if link is clicked, do not want to use GET

2005-04-04 Thread emre
you can use POST with some javascript tricks.

lets assume that you are going to you an image file to submit, then just add
a function andd call that function to handle submitting data.

here is an example:




To: 
Sent: Tuesday, April 05, 2005 3:21 AM
Subject: [PHP] Set session variable if link is clicked, do not want to use
GET


> Hi!
>
> I am writing a simple shopping cart system which uses sessions and PHP.
>
> I would like a normal link that says "Add to cart" which the user can
> click and the item is added to the cart.
>
> However, i do not want to use GET for this as it could introduce
> unwanted features if the user bookmarks the page just after clicking
> "Add to cart". So i don't want an URL like:
> http://thisistheurl.com?buy=10 and therefore prefer if this could be
> done using POST.
>
> It would have been easy if i would have used a normal FORM and would
> have had a button called "Add to cart". But i would like it to be in
> url-style or using some  which i understand that the BUTTON item
> does not support (or am i wrong?).
>
> Any advice would be greatly appreciated.
>
> Best regards, Kent
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

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



Re: [PHP] Set session variable if link is clicked, do not want to use GET

2005-04-04 Thread emre
lol, sorry for mess,  I was in a bit hurry. 

here is the right one: 



http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php